Lines 2007-2013
sub MoveReserve {
Link Here
|
2007 |
ModReserveFill($borr_res); |
2007 |
ModReserveFill($borr_res); |
2008 |
} |
2008 |
} |
2009 |
|
2009 |
|
2010 |
if ($cancelreserve) { # cancel reserves on this item |
2010 |
if ( $cancelreserve eq 'revert' ) { ## Revert waiting reserve to priority 1 |
|
|
2011 |
RevertWaitingStatus( itemnumber => $itemnumber ); |
2012 |
} |
2013 |
elsif ( $cancelreserve eq 'cancel' || $cancelreserve ) { # cancel reserves on this item |
2011 |
CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'}); |
2014 |
CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'}); |
2012 |
CancelReserve($res->{'biblionumber'}, 0, $res->{'borrowernumber'}); |
2015 |
CancelReserve($res->{'biblionumber'}, 0, $res->{'borrowernumber'}); |
2013 |
} |
2016 |
} |
Lines 2058-2063
sub MergeHolds {
Link Here
|
2058 |
} |
2061 |
} |
2059 |
} |
2062 |
} |
2060 |
|
2063 |
|
|
|
2064 |
=head2 RevertWaitingStatus |
2065 |
|
2066 |
$success = RevertWaitingStatus( itemnumber => $itemnumber ); |
2067 |
|
2068 |
Reverts a 'waiting' hold back to a regular hold with a priority of 1. |
2069 |
|
2070 |
Caveat: Any waiting hold fixed with RevertWaitingStatus will be an |
2071 |
item level hold, even if it was only a bibliolevel hold to |
2072 |
begin with. This is because we can no longer know if a hold |
2073 |
was item-level or bib-level after a hold has been set to |
2074 |
waiting status. |
2075 |
|
2076 |
=cut |
2077 |
|
2078 |
sub RevertWaitingStatus { |
2079 |
my ( %params ) = @_; |
2080 |
my $itemnumber = $params{'itemnumber'}; |
2081 |
|
2082 |
return unless ( $itemnumber ); |
2083 |
|
2084 |
my $dbh = C4::Context->dbh; |
2085 |
|
2086 |
## Get the waiting reserve we want to revert |
2087 |
my $query = " |
2088 |
SELECT * FROM reserves |
2089 |
WHERE itemnumber = ? |
2090 |
AND found IS NOT NULL |
2091 |
"; |
2092 |
my $sth = $dbh->prepare( $query ); |
2093 |
$sth->execute( $itemnumber ); |
2094 |
my $reserve = $sth->fetchrow_hashref(); |
2095 |
|
2096 |
## Increment the priority of all other non-waiting |
2097 |
## reserves for this bib record |
2098 |
$query = " |
2099 |
UPDATE reserves |
2100 |
SET |
2101 |
priority = priority + 1 |
2102 |
WHERE |
2103 |
biblionumber = ? |
2104 |
AND |
2105 |
priority > 0 |
2106 |
"; |
2107 |
$sth = $dbh->prepare( $query ); |
2108 |
$sth->execute( $reserve->{'biblionumber'} ); |
2109 |
|
2110 |
## Fix up the currently waiting reserve |
2111 |
$query = " |
2112 |
UPDATE reserves |
2113 |
SET |
2114 |
priority = 1, |
2115 |
found = NULL, |
2116 |
waitingdate = NULL |
2117 |
WHERE |
2118 |
reserve_id = ? |
2119 |
"; |
2120 |
$sth = $dbh->prepare( $query ); |
2121 |
return $sth->execute( $reserve->{'reserve_id'} ); |
2122 |
} |
2123 |
|
2061 |
=head2 ReserveSlip |
2124 |
=head2 ReserveSlip |
2062 |
|
2125 |
|
2063 |
ReserveSlip($branchcode, $borrowernumber, $biblionumber) |
2126 |
ReserveSlip($branchcode, $borrowernumber, $biblionumber) |