From 34e37dca5b101567adbbb3b2fbd4b66eb49b48ba Mon Sep 17 00:00:00 2001 From: Sophie Meynieux Date: Wed, 31 Jul 2013 08:04:25 +0200 Subject: [PATCH] Bug 10664: fix error in overdue_notices.pl if there is no active currency If there is no active currency, when running overdue_notices.pl you get a sofware error "Can't use an undefined value as a HASH reference" on GetCurrency() function call. With this patch, if there is no active currency, fines are formated by default 0.00 and notices are correctly generated. Test plan : - have at least one borrower with overdue that should trigger a notice - verify that there is no active currency (Adminitration > Currency & Exchange rates) - run misc/cronjobs/overdue_notices.pl -v -n (to get the notice directly on output) => without the patch you get the software error => with the patch, notices are correctly generated If an active currency is defined, the script overdue_notices.pl runs the same with or without patch Signed-off-by: Srdjan Signed-off-by: Kyle M Hall Signed-off-by: Galen Charlton (cherry picked from commit a9a3bb7b3d7e8e862cf0f772246667258a20b786) Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 5e12ca5684ee19c54685a4dc935fb242eaf0c3bc) Signed-off-by: Bernardo Gonzalez Kriegel (cherry picked from commit 5e12ca5684ee19c54685a4dc935fb242eaf0c3bc) --- misc/cronjobs/overdue_notices.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 828a5ccfe2..93332a6064 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -671,7 +671,8 @@ sub parse_letter { $tables{'branches'} = $p; } - my $currency_format = GetCurrency()->{currency}; + my $currencies = GetCurrency(); + my $currency_format = $currencies->{currency} if defined($currencies); my @item_tables; if ( my $i = $params->{'items'} ) { -- 2.39.5