From 7211fd22bad5b3a3939cca6fe766ee65a7c62b13 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Sun, 17 Sep 2017 11:53:34 +0200 Subject: [PATCH] Bug 19328: Internal server error because of missing currency This patch fixes internal server errors because of missing active currency in files aqbudgetperiods.pl, aqbudgets.pl and aqplan.pl. To reproduce: - Make sure that no active currency is defined. You can undefine the active currency in Administration->Currencies and exchange rates - Try to go to Administration->Budgets and Admistration->Funds Result: Internal server error To test: - Apply patch - Restart plack - Try to reproduce issue, it should no longer occur. There should be a yellow message box "No active currency is defined" - From Administration-> Budgets administration try to edit a fund and go to "Planning". Verify that the message box appears here as well. Signed-off-by: David Bourgault Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- admin/aqbudgetperiods.pl | 8 +++++--- admin/aqbudgets.pl | 8 +++++--- admin/aqplan.pl | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/admin/aqbudgetperiods.pl b/admin/aqbudgetperiods.pl index fbe193843b..0a05a5539b 100755 --- a/admin/aqbudgetperiods.pl +++ b/admin/aqbudgetperiods.pl @@ -91,9 +91,11 @@ my ($template, $borrowernumber, $cookie, $staff_flags ) = get_template_and_user( # This is used in incbudgets-active-currency.inc my $active_currency = Koha::Acquisition::Currencies->get_active; -$template->param( symbol => $active_currency->symbol, - currency => $active_currency->currency - ); +if ( $active_currency ) { + $template->param( symbol => $active_currency->symbol, + currency => $active_currency->currency + ); +} # ADD OR MODIFY A BUDGET PERIOD - BUILD SCREEN if ( $op eq 'add_form' ) { diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl index 7e85254f14..f106a86415 100755 --- a/admin/aqbudgets.pl +++ b/admin/aqbudgets.pl @@ -50,9 +50,11 @@ my ($template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user( ); my $active_currency = Koha::Acquisition::Currencies->get_active; -$template->param( symbol => $active_currency->symbol, - currency => $active_currency->currency - ); +if ( $active_currency ) { + $template->param( symbol => $active_currency->symbol, + currency => $active_currency->currency + ); +} my $op = $input->param('op') || 'list'; diff --git a/admin/aqplan.pl b/admin/aqplan.pl index a27fb0a4ca..f96086e013 100755 --- a/admin/aqplan.pl +++ b/admin/aqplan.pl @@ -58,9 +58,11 @@ my $budget_period_id = $input->param('budget_period_id'); my $period = GetBudgetPeriod($budget_period_id); my $count = GetPeriodsCount(); my $active_currency = Koha::Acquisition::Currencies->get_active; -$template->param( symbol => $active_currency->symbol, - currency => $active_currency->currency, - ); +if ( $active_currency ) { + $template->param( symbol => $active_currency->symbol, + currency => $active_currency->currency, + ); +} $template->param( period_button_only => 1 ) if $count == 0; -- 2.39.5