Bug 14653

Summary: Acq planning filter and export always use default active period
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: AcquisitionsAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: chris, hector.hecaxmmx, jonathan.druart, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14649
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 14653 - Acq planning filter always use default active period
Bug 14653 - Acq planning export always use default active period
[SIGNED-OFF]Bug 14653 - Acq planning export always use default active period
[SIGNED-OFF]Bug 14653 - Acq planning filter always use default active period
[SIGNED-OFF]Bug 14653 - Acq planning export always use default active period
Bug 14653 - Acq planning filter always use default active period
Bug 14653 - Acq planning export always use default active period

Description Fridolin Somers 2015-08-06 08:27:59 UTC
In Acq planning /cgi-bin/koha/admin/aqplan.pl, left side filter and export forms have no parameter budget_period_id nor authcat, so the use the default active period.
As said in code :
# IF PERIOD_ID IS DEFINED,  GET THE PERIOD - ELSE GET THE ACTIVE PERIOD BY DEFAULT
my $period = GetBudgetPeriod($budget_period_id);
Comment 1 Fridolin Somers 2015-08-06 09:09:55 UTC Comment hidden (obsolete)
Comment 2 Fridolin Somers 2015-08-06 09:10:05 UTC Comment hidden (obsolete)
Comment 3 Héctor Eduardo Castro Avalos 2015-10-09 19:57:40 UTC Comment hidden (obsolete)
Comment 4 Héctor Eduardo Castro Avalos 2015-10-09 20:03:38 UTC Comment hidden (obsolete)
Comment 5 Héctor Eduardo Castro Avalos 2015-10-09 20:03:52 UTC Comment hidden (obsolete)
Comment 6 Jonathan Druart 2015-10-13 11:30:33 UTC
Created attachment 43378 [details] [review]
Bug 14653 - Acq planning filter always use default active period

In Acq planning /cgi-bin/koha/admin/aqplan.pl, left side filter and export forms have no parameter budget_period_id nor authcat, so the use the default active period.
As said in code :
- IF PERIOD_ID IS DEFINED,  GET THE PERIOD - ELSE GET THE ACTIVE PERIOD BY DEFAULT
my $period = GetBudgetPeriod($budget_period_id);

This patch corrects the filter form.

Test plan :
- Create an active budget "B_ACTIVE" with 1 fund
- Create an inactive budget "B_OLD" with 3 funds
- Go to "B_OLD" planning by libraries
- You see 3 funds
- In filter form, select "by months" in "Select planning type"
=> Without patch, you see planning of "B_ACTIVE" with 1 fund
=> Without patch, you see planning of "B_OLD" with 3 funds

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2015-10-13 11:30:36 UTC
Created attachment 43379 [details] [review]
Bug 14653 - Acq planning export always use default active period

In Acq planning /cgi-bin/koha/admin/aqplan.pl, left side filter and export forms have no parameter budget_period_id nor authcat, so the use the default active period.
As said in code
- IF PERIOD_ID IS DEFINED,  GET THE PERIOD - ELSE GET THE ACTIVE PERIOD BY DEFAULT
my $period = GetBudgetPeriod($budget_period_id);

This patch corrects the export form.

Test plan :
- Create an active budget "B_ACTIVE" with 1 fund
- Create an inactive budget "B_OLD" with 3 funds
- Go to "B_OLD" planning by libraries
- You see 3 funds
- Click on "Submit" in export form
=> Without patch, you get the planning of "B_ACTIVE" with 1 fund
=> Without patch, you get the planning of "B_OLD" with 3 funds by libraries

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2015-10-13 11:31:28 UTC
So it seems that only 1 library uses this feature :)
Comment 9 Tomás Cohen Arazi (tcohen) 2015-10-13 15:22:19 UTC
Patches pushed to master.

Thanks Frido!
Comment 10 Fridolin Somers 2015-10-14 12:19:25 UTC
(In reply to Jonathan Druart from comment #8)
> So it seems that only 1 library uses this feature :)

Indeed :D
Comment 11 Chris Cormack 2015-10-24 07:38:16 UTC
Pushed to 3.20.x will be in 3.20.5