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 <galen.charlton@liblime.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
This commit is contained in:
Joe Atzberger (siptest 2008-09-10 22:30:04 -05:00 committed by Chris Cormack
parent c76a5cc070
commit 0a4bae2cfc
1 changed files with 6 additions and 1 deletions

View File

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