From 5712662f7ed6e6eb3515abe531a447569b8b9ecc Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 24 Mar 2015 15:54:37 +0100 Subject: [PATCH] Bug 4502: Catch software error if no active budget defined To reproduce: 0/ On a fresh install (so no budget defined), create a budget and don't mark it as active. 1/ Go on the budget detail page > Plannin > By months 2/ Click on the 'Select' button (on the left) Without this patch, you get a software error: Usage: Date::Calc::Delta_YMD(year1, month1, day1, year2, month2, day2) With this patch, you get a sweet alert message inviting you to create an active budget. Note: This script is a mess... --- admin/aqplan.pl | 4 ++++ koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt | 2 ++ 2 files changed, 6 insertions(+) diff --git a/admin/aqplan.pl b/admin/aqplan.pl index dda1d21..e792ca2 100755 --- a/admin/aqplan.pl +++ b/admin/aqplan.pl @@ -106,6 +106,10 @@ 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"); 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 b465f8c..2cfb912 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt @@ -224,6 +224,8 @@ + [% ELSIF not budget_period_id %] +
No active budget defined. You should define one before continuing.
[% ELSE %]
No funds to display for this search criteria
[% END %] -- 2.1.0