From 5c9534a6ad5d0109b8876dda08c07294814c54ad Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 6 Apr 2015 19:50:30 -0400 Subject: [PATCH] Bug 4502: An attempt to make things more sensible. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The reason the budget_period_id was not defined was because in two cases it was not passed! This patch adds those missing parameters. And as a result, cuts out the attempt to default the authcat to '' unless the budget_period_id is defined. Additionally, the start and end months don't seem to be passed, so rather than have it blow up, checking them forces the else case logic. budget_period_id is the budget id. If you have two budgets, you can craft a URL to work with budget_period_id matching those two ids. Anything else should trigger the new error which was modified to reflect more of what the problem is. Follow the test plan in comment #6. Feel free to also to attempt crafting URLs and triggering errors. Signed-off-by: Bernardo Gonzalez Kriegel Well, works and does not explode any more No errors To trigger the new message simply put /cgi-bin/koha/admin/aqplan.pl on your staff page, an intriguing 'Planning for by Asort1' appears :) Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit fea7b9b4d444a6bdf3f1326c54eddd68670be7f7) Signed-off-by: Frédéric Demians (cherry picked from commit 4ca1bac3106728450cef9feb9df942e78a1256a9) Signed-off-by: Liz Rea --- admin/aqplan.pl | 6 +----- koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt | 4 +++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/admin/aqplan.pl b/admin/aqplan.pl index e1604f9173..0fdbf1910e 100755 --- a/admin/aqplan.pl +++ b/admin/aqplan.pl @@ -106,10 +106,6 @@ if ( $budget_period_locked == 1 && not defined $show_actual ) { $authcat = 'Asort1' if not defined $authcat; # defaults to Asort if no authcat given -# If no active budget is defined, budget_period_id is undef -# This is the behavior of GetBudgetPeriod -$authcat = '' unless $budget_period_id; - my $budget_id = $input->param('budget_id'); my $op = $input->param("op"); @@ -215,7 +211,7 @@ if ( $authcat =~ m/^Asort/ ) { $sth->finish; @authvals = sort { $a <=> $b } @authvals; } -elsif ( $authcat eq 'MONTHS' ) { +elsif ( $authcat eq 'MONTHS' && $budget_period_startdate && $budget_period_enddate ) { # build months my @start_date = UnixDate( $budget_period_startdate, ( '%Y', '%m', '%d' ) ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt index fdf84b66c5..fa18fd36ec 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt @@ -226,7 +226,7 @@ [% ELSIF not budget_period_id %] -
No active budget defined. You should define one before continuing.
+
That budget is not defined. You should select a defined budget to continue.
[% ELSE %]
No funds to display for this search criteria
[% END %] @@ -237,6 +237,7 @@
+

Filter

[% BLOCK planning_types %] @@ -311,6 +312,7 @@
+
-- 2.11.4.GIT