From fef648e9027162b6cae91a6f75ca612ef9e3cfc2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 11 Mar 2020 13:01:52 +0100 Subject: [PATCH] Bug 24800: Handle inexistent return date on self checking See bug 24800 comment 0 for a description of the problem. We do not want the SIP server to crash if it receives a checkin request with a return date that is not given. The option this patch chose is to parse it only if provided. Signed-off-by: Clemens Elmlinger Signed-off-by: Kyle M Hall Signed-off-by: Marcel de Rooy Signed-off-by: Joy Nelson --- C4/SIP/ILS/Transaction/Checkin.pm | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index f1ed6532b7..01d76da008 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -56,20 +56,23 @@ sub do_checkin { } my $barcode = $self->{item}->id; - $return_date = substr( $return_date, 0, 4 ) - . '-' - . substr( $return_date, 4, 2 ) - . '-' - . substr( $return_date, 6, 2 ) - . q{ } - . substr( $return_date, 12, 2 ) - . ':' - . substr( $return_date, 14, 2 ) - . ':' - . substr( $return_date, 16, 2 ); + if ( $return_date ) { + $return_date = substr( $return_date, 0, 4 ) + . '-' + . substr( $return_date, 4, 2 ) + . '-' + . substr( $return_date, 6, 2 ) + . q{ } + . substr( $return_date, 12, 2 ) + . ':' + . substr( $return_date, 14, 2 ) + . ':' + . substr( $return_date, 16, 2 ); + $return_date = dt_from_string($return_date); + } $debug and warn "do_checkin() calling AddReturn($barcode, $branch)"; - my ($return, $messages, $issue, $borrower) = AddReturn($barcode, $branch, undef, dt_from_string($return_date)); + my ($return, $messages, $issue, $borrower) = AddReturn($barcode, $branch, undef, $return_date); if ( $checked_in_ok ) { delete $messages->{ItemLocationUpdated}; -- 2.39.5