From fc082c26a18392a029d60ef76db6d358c073d17c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 23 Apr 2018 12:07:58 -0300 Subject: [PATCH] Bug 20625: Handle non existing of active currency This patch avoid the explosion in the air when creating a new patron category and no active currency is defined. Test plan: Remove the currencies, create a new patron category Without this patch applied you will get Can't call method "p_sep_by_space" on an undefined value With this patch the form will be displayed correctly and you will be able to create the patron category Signed-off-by: Mark Tompsett Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- Koha/Number/Price.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/Number/Price.pm b/Koha/Number/Price.pm index 899044f800..f549d8a243 100644 --- a/Koha/Number/Price.pm +++ b/Koha/Number/Price.pm @@ -89,7 +89,7 @@ sub _format_params { my $currency = Koha::Acquisition::Currencies->get_active; my $currency_format = C4::Context->preference("CurrencyFormat"); - my $int_curr_symbol = $with_symbol ? $currency->symbol : q||; + my $int_curr_symbol = ( $with_symbol and $currency ) ? $currency->symbol : q||; my %format_params = ( decimal_fill => '2', decimal_point => '.', @@ -123,7 +123,7 @@ sub _format_params { $format_params{p_cs_precedes} = $p_cs_precedes if defined $p_cs_precedes; - $format_params{p_sep_by_space} = $currency->p_sep_by_space ? 1 : 0; + $format_params{p_sep_by_space} = ( $currency and $currency->p_sep_by_space ) ? 1 : 0; return \%format_params; } -- 2.39.5