From 7aabe91749936aa5cffacbf2da385ac2762f80fc Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 11 Nov 2015 12:07:05 +0000 Subject: [PATCH] Bug 14985: Simplify the date management in AddReserve The code is much more readable using the str param of output_pref Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- C4/Reserves.pm | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 29a0aa5fb3..fc76fc1344 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -165,16 +165,10 @@ sub AddReserve { my $dbh = C4::Context->dbh; - $resdate = eval { output_pref( { dt => dt_from_string( $resdate ), dateonly => 1, dateformat => 'iso' }); } - if ( $resdate ); - $resdate = eval { output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' }); } - unless ( $resdate ); + $resdate = output_pref( { str => dt_from_string( $resdate ), dateonly => 1, dateformat => 'iso' }) + or output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' }); - if ($expdate) { - $expdate = eval { output_pref( { dt => dt_from_string( $expdate), dateonly => 1, dateformat => 'iso' } ); }; - } else { - undef $expdate; # make reserves.expirationdate default to null rather than '0000-00-00' - } + $expdate = output_pref({ str => $expdate, dateonly => 1, dateformat => 'iso' }); if ( C4::Context->preference('AllowHoldDateInFuture') ) { @@ -1978,7 +1972,7 @@ sub _koha_notify_reserve { 'reserves' => $reserve, 'items', $reserve->{'itemnumber'}, }, - substitute => { today => eval { output_pref( { dt => dt_from_string, dateonly => 1 } ); } }, + substitute => { today => output_pref( { dt => dt_from_string, dateonly => 1 } ) }, ); my $notification_sent = 0; #Keeping track if a Hold_filled message is sent. If no message can be sent, then default to a print message. -- 2.39.5