From 8966b300ebecd00bb0e799b7539d60da72e69aea Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 10 Oct 2012 10:27:47 -0400 Subject: [PATCH] Bug 8292 - Clicking ignore on hold cancels transfer Clicking 'ignore' in the hold confirmation box does nothing but make the confirmation box disappear. No further actions are taken. The code to do the transfer is never executed, and the item sits at the holdingbranch library. If you're ignoring the hold, you want the checkin to proceed as if the hold had never popped up in the first place, and that means doing a return home if appropriate. To test, place a hold on an item for delivery to Library A. Check that item in at Library B. Click "Ignore" in the hold confirmation message. Before the patch, doing so would simply trigger JavaScript to hide the dialog. After the patch the form will be sumitted and the item will be transfered without fulfilling the hold. Signed-off-by: Owen Leonard Added description and test plan to the best of my understanding of what this patch is trying to accomplish based on the bug report. The patch works if I'm correct in my test plan. Signed-off-by: Katrin Fischer All tests and QA script pass. Tests done: 1) Add an item hold on an item from library B for a patron from library A, pickup location is library A 2) Check in item at library A 3) Click 'ignore' a) AutomaticItemReturn is ON = Koha provides a link to print the transfer slip. b) AutomaticItemReturn is OFF = Koha provides 3 options: Confirm transfer and print slip, confirm transfer, don't confirm transfer. Without the patch the item was returned, but the transfer wasn't triggered. Signed-off-by: Liz Rea --- C4/Circulation.pm | 19 +++++++++------ circ/returns.pl | 6 +++-- .../intranet-tmpl/prog/en/modules/circ/returns.tt | 25 ++++++++++++++++---- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 063a409..dd2969d 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1612,7 +1612,7 @@ sub GetBranchItemRule { =head2 AddReturn ($doreturn, $messages, $iteminformation, $borrower) = - &AddReturn($barcode, $branch, $exemptfine, $dropbox); + &AddReturn($barcode, $branch, $exemptfine, $dropbox, $ignore_reserves); Returns a book. @@ -1631,6 +1631,9 @@ 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<$ignore_reserves> indicates that the check-in should not +attempt to find reserves to full using this item. + =back C<&AddReturn> returns a list of four items: @@ -1684,7 +1687,7 @@ patron who last borrowed the book. =cut sub AddReturn { - my ( $barcode, $branch, $exemptfine, $dropbox ) = @_; + my ( $barcode, $branch, $exemptfine, $dropbox, $ignore_reserves ) = @_; if ($branch and not GetBranchDetail($branch)) { warn "AddReturn error: branch '$branch' not found. Reverting to " . C4::Context->userenv->{'branch'}; @@ -1843,11 +1846,13 @@ sub AddReturn { # find reserves..... # if we don't have a reserve with the status W, we launch the Checkreserves routine - my ($resfound, $resrec); - ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ) unless ( $item->{'wthdrawn'} ); - if ($resfound) { - $resrec->{'ResFound'} = $resfound; - $messages->{'ResFound'} = $resrec; + my ( $resfound, $resrec ); + unless ( $ignore_reserves ) { + ( $resfound, $resrec ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ) unless ( $item->{'wthdrawn'} ); + if ($resfound) { + $resrec->{'ResFound'} = $resfound; + $messages->{'ResFound'} = $resrec; + } } # update stats? diff --git a/circ/returns.pl b/circ/returns.pl index 9472797..b2d0260 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -171,6 +171,7 @@ my $messages; my $issueinformation; my $itemnumber; my $barcode = $query->param('barcode'); +my $ignore_reserves = $query->param('ignore_reserves'); my $exemptfine = $query->param('exemptfine'); my $dropboxmode = $query->param('dropboxmode'); my $dotransfer = $query->param('dotransfer'); @@ -216,7 +217,7 @@ if ($barcode) { # save the return # ( $returned, $messages, $issueinformation, $borrower ) = - AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode); # do the return + AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $ignore_reserves ); # do the return my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn'); $homeorholdingbranchreturn ||= 'homebranch'; @@ -390,7 +391,6 @@ if ( $messages->{'ResFound'}) { borcnum => $borr->{'cardnumber'}, debarred => $borr->{'debarred'}, gonenoaddress => $borr->{'gonenoaddress'}, - barcode => $barcode, destbranch => $reserve->{'branchcode'}, borrowernumber => $reserve->{'borrowernumber'}, itemnumber => $reserve->{'itemnumber'}, @@ -556,5 +556,7 @@ $template->param( # } #} +$template->param( barcode => $barcode ); + # actually print the page! output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 7fd8d1d..9a4ff22 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -299,11 +299,12 @@ $(document).ready(function () { [% END %] - + [% FOREACH inputloo IN inputloop %] - - - [% END %] + + + + [% END %] @@ -311,6 +312,22 @@ $(document).ready(function () { + +
+ [% FOREACH inputloo IN inputloop %] + + + + [% END %] + + + + + + + + +
[% END %] [% ELSE %] -- 1.7.9.5