From 3f7a0217af670be6d7c308a6ffa640e220e853e2 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 15 Oct 2012 08:15:13 -0400 Subject: [PATCH] Bug 8769 - Allow SIP2 return backdating --- C4/Circulation.pm | 8 ++++++-- C4/SIP/ILS/Transaction/Checkin.pm | 9 ++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index f1c8662..3ab345b 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1630,6 +1630,10 @@ overdue charges are applied and C<$dropbox> is true, the last charge will be removed. This assumes that the fines accrual script has run for _today_. +=item C<$return_date> indicates that the check-in date is assumed to be +this given date. If overdue charges are applied, the last charges +will be based on this return date. + =back C<&AddReturn> returns a list of four items: @@ -1683,7 +1687,7 @@ patron who last borrowed the book. =cut sub AddReturn { - my ( $barcode, $branch, $exemptfine, $dropbox ) = @_; + my ( $barcode, $branch, $exemptfine, $dropbox, $return_date) = @_; if ($branch and not GetBranchDetail($branch)) { warn "AddReturn error: branch '$branch' not found. Reverting to " . C4::Context->userenv->{'branch'}; @@ -1780,7 +1784,7 @@ sub AddReturn { ); } } - MarkIssueReturned($borrowernumber, $item->{'itemnumber'}, $circControlBranch, '', $borrower->{'privacy'}); + MarkIssueReturned($borrowernumber, $item->{'itemnumber'}, $circControlBranch, $return_date, $borrower->{'privacy'}); $messages->{'WasReturned'} = 1; # FIXME is the "= 1" right? This could be the borrower hash. } diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index 49ce926..c4d43f4 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -46,13 +46,12 @@ sub new { sub do_checkin { my $self = shift; - my $branch = shift; - if (!$branch) { - $branch = 'SIP2'; - } + my $branch = shift || 'SIP2'; + my $return_date = shift; + my $barcode = $self->{item}->id; $debug and warn "do_checkin() calling AddReturn($barcode, $branch)"; - my ($return, $messages, $iteminformation, $borrower) = AddReturn($barcode, $branch); + my ($return, $messages, $iteminformation, $borrower) = AddReturn($barcode, $branch, undef, undef, $return_date); $self->alert(!$return); # ignoring messages: NotIssued, IsPermanent, WasLost, WasTransfered -- 1.7.2.5