From f4efda5bc58e619e42493ac635cdaab78f53a950 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 8 Apr 2014 22:52:01 +0000 Subject: [PATCH] Bug 7413: (follow-up) improve return of GetSoonestRenewDate() This patch modifies GetSoonestRenewDate() so that it returns undef if the patron, item, or loan cannot be found. This better reflects the usage of this routine GetSoonestRenewDate(), as none of its callers tried to check the second return value containing an error code. This patch also updates the POD to match. Signed-off-by: Galen Charlton --- C4/Circulation.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 39c1fadff3..af5522585e 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2698,9 +2698,11 @@ has the item on loan. C<$itemnumber> is the number of the item to renew. -C<$GetSoonestRenewDate> returns the DateTime of the soonest possible renew date, -based on the value "No renewal before" of the applicable issuing rule. Returns the -current date if the item can already be renewed. +C<$GetSoonestRenewDate> returns the DateTime of the soonest possible +renew date, based on the value "No renewal before" of the applicable +issuing rule. Returns the current date if the item can already be +renewed, and returns undefined if the borrower, loan, or item +cannot be found. =cut @@ -2709,8 +2711,8 @@ sub GetSoonestRenewDate { my $dbh = C4::Context->dbh; - my $item = GetItem($itemnumber) or return ( 0, 'no_item' ); - my $itemissue = GetItemIssue($itemnumber) or return ( 0, 'no_checkout' ); + my $item = GetItem($itemnumber) or return; + my $itemissue = GetItemIssue($itemnumber) or return; $borrowernumber ||= $itemissue->{borrowernumber}; my $borrower = C4::Members::GetMemberDetails($borrowernumber) -- 2.39.2