From 0a4bae2cfc7205e625bcddb020c4bdf2fa342605 Mon Sep 17 00:00:00 2001 From: "Joe Atzberger (siptest" Date: Wed, 10 Sep 2008 22:30:04 -0500 Subject: [PATCH] Bugs 2541 and 2587 - AddIssue must return date object as intended. SIP actually relied on the AddIssue return that was not reliable. AddRenew also updated to return C4::Dates object for datedue. Please note, any running SIPServer will have to be restarted *immediately* after applying this patch, because although Koha C4 behaves as normal, the SIP server runs as a Net::Server with components cached. Changes will not be applied until SIPServer restarts, and so checkout actions may fail until then. Signed-off-by: Galen Charlton Signed-off-by: Chris Cormack --- C4/Circulation.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index d460957f33..0694c40b38 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -982,7 +982,12 @@ sub AddIssue { unless ($datedue) { my $itype = ( C4::Context->preference('item-level_itypes') ) ? $biblio->{'itype'} : $biblio->{'itemtype'}; my $loanlength = GetLoanLength( $borrower->{'categorycode'}, $itype, $branch ); - $datedue = CalcDateDue( C4::Dates->new( $issuedate, 'iso' ), $loanlength, $branch, $borrower ); + $datedue = CalcDateDue( C4::Dates->new( $issuedate, 'iso' ), $loanlength, $branch ); + + # if ReturnBeforeExpiry ON the datedue can't be after borrower expirydate + if ( C4::Context->preference('ReturnBeforeExpiry') && $datedue->output('iso') gt $borrower->{dateexpiry} ) { + $datedue = C4::Dates->new( $borrower->{dateexpiry}, 'iso' ); + } } $sth->execute( $borrower->{'borrowernumber'}, # borrowernumber -- 2.39.5