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 <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2015-11-11 12:07:05 +00:00 committed by Tomas Cohen Arazi
parent 2e74c8f15b
commit 7aabe91749
1 changed files with 4 additions and 10 deletions

View File

@ -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.