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 <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2018-04-23 12:07:58 -03:00
parent 564809473d
commit fc082c26a1
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}