Bugzilla – Attachment 12275 Details for
Bug 8559
conflicting item statuses
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8559 - conflicting item statuses - Force cancel or revert
Bug-8559---conflicting-item-statuses---Force-cance.patch (text/plain), 4.80 KB, created by
Kyle M Hall (khall)
on 2012-09-17 13:10:57 UTC
(
hide
)
Description:
Bug 8559 - conflicting item statuses - Force cancel or revert
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-09-17 13:10:57 UTC
Size:
4.80 KB
patch
obsolete
>From 631ef323caeb33dda8a7b249b12e50b131e76b79 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 17 Sep 2012 09:06:38 -0400 >Subject: [PATCH] Bug 8559 - conflicting item statuses - Force cancel or revert >Content-Type: text/plain; charset="utf-8" > >If a librarian checks out a waiting hold to a different patron >it gives the item conflicting statuses. The item will show as both >checked out to the different patron, and waiting for the original >patron. > >This patch fixes this by not allowing this situation to occurr. If >a librarian attempts to issue an item that is waiting for a different >patron, the system will force the librarian to choose to >a) not issue the item >b) issue the item, and cancel the waiting hold >c) issue the item, and revert the waiting hold > >In this scenario, reverting the waiting hold means to push it back >on the reserves queue as a hold with a priority of 1, which will push >the priorities of any existing holds back by 1 as well. It will become >an item level hold for the given item, as we cannot know if the hold >was item-level or bib-level given the data we have about the hold. >--- > C4/Reserves.pm | 66 +++++++++++++++++++- > .../prog/en/modules/circ/circulation.tt | 6 +- > 2 files changed, 69 insertions(+), 3 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 585d1e5..3182007 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -2007,7 +2007,10 @@ sub MoveReserve { > ModReserveFill($borr_res); > } > >- if ($cancelreserve) { # cancel reserves on this item >+ if ( $cancelreserve eq 'revert' ) { ## Revert waiting reserve to priority 1 >+ RevertWaitingStatus( itemnumber => $itemnumber ); >+ } >+ elsif ( $cancelreserve eq 'cancel' || $cancelreserve ) { # cancel reserves on this item > CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'}); > CancelReserve($res->{'biblionumber'}, 0, $res->{'borrowernumber'}); > } >@@ -2058,6 +2061,67 @@ sub MergeHolds { > } > } > >+=head2 RevertWaitingStatus >+ >+ $success = RevertWaitingStatus( itemnumber => $itemnumber ); >+ >+ Reverts a 'waiting' hold back to a regular hold with a priority of 1. >+ >+ Caveat: Any waiting hold fixed with RevertWaitingStatus will be an >+ item level hold, even if it was only a bibliolevel hold to >+ begin with. This is because we can no longer know if a hold >+ was item-level or bib-level after a hold has been set to >+ waiting status. >+ >+=cut >+ >+sub RevertWaitingStatus { >+ my ( %params ) = @_; >+ warn "RevertWaitingStatus( " . Data::Dumper::Dumper( \%params ) . " ) "; >+ my $itemnumber = $params{'itemnumber'}; >+ >+ return unless ( $itemnumber ); >+ >+ my $dbh = C4::Context->dbh; >+ >+ ## Get the waiting reserve we want to revert >+ my $query = " >+ SELECT * FROM reserves >+ WHERE itemnumber = ? >+ AND found IS NOT NULL >+ "; >+ my $sth = $dbh->prepare( $query ); >+ $sth->execute( $itemnumber ); >+ my $reserve = $sth->fetchrow_hashref(); >+ >+ ## Increment the priority of all other non-waiting >+ ## reserves for this bib record >+ $query = " >+ UPDATE reserves >+ SET >+ priority = priority + 1 >+ WHERE >+ biblionumber = ? >+ AND >+ priority > 0 >+ "; >+ $sth = $dbh->prepare( $query ); >+ $sth->execute( $reserve->{'biblionumber'} ); >+ >+ ## Fix up the currently waiting reserve >+ $query = " >+ UPDATE reserves >+ SET >+ priority = 1, >+ found = NULL, >+ waitingdate = NULL >+ WHERE >+ reserve_id = ? >+ "; >+ $sth = $dbh->prepare( $query ); >+ return $sth->execute( $reserve->{'reserve_id'} ); >+} >+ > =head2 ReserveSlip > > ReserveSlip($branchcode, $borrowernumber, $biblionumber) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index c95002d..940eabd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -370,15 +370,17 @@ function validate1(date) { > > [% IF ( RESERVED ) %] > <p> >- <input type="checkbox" id="cancelreserve" name="cancelreserve" value="1" /> >+ <input type="checkbox" id="cancelreserve" name="cancelreserve" value="cancel" /> > <label for="cancelreserve">Cancel hold</label> > </p> > [% END %] > > [% IF ( RESERVE_WAITING ) %] > <p> >- <input type="checkbox" id="cancelreserve" name="cancelreserve" value="1" /> > <label for="cancelreserve">Cancel hold</label> >+ <input type="radio" name="cancelreserve" value="cancel" checked="checked"><br/> >+ <label for="cancelreserve">Revert waiting status</label> >+ <input type="radio" name="cancelreserve" value="revert"> > </p> > [% END %] > >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8559
:
11293
|
12249
|
12250
|
12252
|
12275
|
12276
|
12279
|
12281
|
12679
|
13668
|
13669