From bb31e45c50f8130156660af508506181c60acb06 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 19 Nov 2012 13:38:37 -0500 Subject: [PATCH] Bug 8451 - Confusing and problematic double prompt for processing transfers Content-Type: text/plain; charset="utf-8" This patch will cause changing the priority of a reserve from 'in transit' to a priority number to delete the transfer associated with it, if there is one. --- C4/Reserves.pm | 17 +++++++++++++++-- .../prog/en/modules/reserve/request.tt | 1 + reserve/modrequest.pl | 3 ++- reserve/request.pl | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 1dc6f72..e4db4a9 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -273,7 +273,8 @@ sub GetReservesFromBiblionumber { expirationdate, lowestPriority, suspend, - suspend_until + suspend_until, + reserve_id FROM reserves WHERE biblionumber = ? "; unless ( $all_dates ) { @@ -1056,7 +1057,7 @@ itemnumber and supplying itemnumber. sub ModReserve { #subroutine to update a reserve - my ( $rank, $biblio, $borrower, $branch , $itemnumber, $suspend_until) = @_; + my ( $rank, $biblio, $borrower, $branch , $itemnumber, $suspend_until, $reserve_id ) = @_; return if $rank eq "W"; return if $rank eq "n"; my $dbh = C4::Context->dbh; @@ -1089,6 +1090,13 @@ sub ModReserve { } elsif ($rank =~ /^\d+/ and $rank > 0) { + my $reserve; + if ( $reserve_id ) { + my $sth = $dbh->prepare("SELECT * FROM reserves WHERE reserve_id = ?"); + $sth->execute( $reserve_id ); + $reserve = $sth->fetchrow_hashref(); + } + my $query = " UPDATE reserves SET priority = ? ,branchcode = ?, itemnumber = ?, found = NULL, waitingdate = NULL WHERE biblionumber = ? @@ -1098,6 +1106,11 @@ sub ModReserve { $sth->execute( $rank, $branch,$itemnumber, $biblio, $borrower); $sth->finish; + ## If we are re-prioritizing a previously 'in transit' hold, we need to remove any item transfer that may have been created for it. + if ( $reserve->{'found'} eq 'T' ) { + $dbh->do("DELETE FROM branchtransfers WHERE itemnumber = ? AND tobranch = ? AND datearrived IS NULL", undef, ( $itemnumber, $reserve->{'branchcode'} ) ); + } + if ( defined( $suspend_until ) ) { if ( $suspend_until ) { $suspend_until = C4::Dates->new( $suspend_until )->output("iso"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 0ad5d23..06e3385 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -553,6 +553,7 @@ function checkMultiHold() { [% FOREACH reserveloo IN biblioloo.reserveloop %] [% UNLESS ( loop.odd ) %][% ELSE %][% END %] +