From 5bd9482550cee62fde36c5a74d73714ec000dc0b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 12 Nov 2014 12:23:38 +0100 Subject: [PATCH] Bug 13240: Remove some code obfuscation my $bar; my $foo = $bar->{borrowernumber} ||= {}; $foo->{one} ||= 'something'; $foo->{two}++; What does $bar contain? $VAR1 = { 'borrowernumber' => { 'two' => 1, 'bar' => 'something' } }; Not really obvious. Maybe something I did not see is hidden. Test plan: Verify the digest for DUE and PREDUE work as before. Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- misc/cronjobs/advance_notices.pl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl index 26f87ae22f..edcaee7f79 100755 --- a/misc/cronjobs/advance_notices.pl +++ b/misc/cronjobs/advance_notices.pl @@ -242,9 +242,8 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { if ( $borrower_preferences->{'wants_digest'} ) { # cache this one to process after we've run through all of the items. - my $digest = $due_digest->{$upcoming->{'borrowernumber'}} ||= {}; - $digest->{email} ||= $from_address; - $digest->{count}++; + $due_digest->{$upcoming->{borrowernumber}}{email} = $from_address; + $due_digest->{$upcoming->{borrowernumber}}{count}++; } else { my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} ); my $letter_type = 'DUE'; @@ -278,9 +277,8 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { if ( $borrower_preferences->{'wants_digest'} ) { # cache this one to process after we've run through all of the items. - my $digest = $upcoming_digest->{$upcoming->{'borrowernumber'}} ||= {}; - $digest->{email} ||= $from_address; - $digest->{count}++; + $upcoming_digest->{$upcoming->{borrowernumber}}{email} = $from_address; + $upcoming_digest->{$upcoming->{borrowernumber}}{count}++; } else { my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} ); my $letter_type = 'PREDUE'; -- 2.39.5