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 <gmc@esilibrary.com>
This commit is contained in:
parent
ef25c3665b
commit
f4efda5bc5
1 changed files with 7 additions and 5 deletions
|
@ -2698,9 +2698,11 @@ has the item on loan.
|
||||||
|
|
||||||
C<$itemnumber> is the number of the item to renew.
|
C<$itemnumber> is the number of the item to renew.
|
||||||
|
|
||||||
C<$GetSoonestRenewDate> returns the DateTime of the soonest possible renew date,
|
C<$GetSoonestRenewDate> returns the DateTime of the soonest possible
|
||||||
based on the value "No renewal before" of the applicable issuing rule. Returns the
|
renew date, based on the value "No renewal before" of the applicable
|
||||||
current date if the item can already be renewed.
|
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
|
=cut
|
||||||
|
|
||||||
|
@ -2709,8 +2711,8 @@ sub GetSoonestRenewDate {
|
||||||
|
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
|
|
||||||
my $item = GetItem($itemnumber) or return ( 0, 'no_item' );
|
my $item = GetItem($itemnumber) or return;
|
||||||
my $itemissue = GetItemIssue($itemnumber) or return ( 0, 'no_checkout' );
|
my $itemissue = GetItemIssue($itemnumber) or return;
|
||||||
|
|
||||||
$borrowernumber ||= $itemissue->{borrowernumber};
|
$borrowernumber ||= $itemissue->{borrowernumber};
|
||||||
my $borrower = C4::Members::GetMemberDetails($borrowernumber)
|
my $borrower = C4::Members::GetMemberDetails($borrowernumber)
|
||||||
|
|
Loading…
Reference in a new issue