From 041a04282ae1c7e2a187760265ab639e1139cab7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 7 Dec 2016 12:26:53 +0100 Subject: [PATCH] Bug 17736: Remove C4::Reserves::GetReservesFromBiblionumber At this point, there should not be any occurrences of GetReservesFromBiblionumber left in the codebase Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall --- C4/Reserves.pm | 67 -------------------------------------------------- 1 file changed, 67 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 6a1756fe5f..f73cc013d3 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -105,7 +105,6 @@ BEGIN { &GetReserve &GetReservesFromItemnumber - &GetReservesFromBiblionumber &GetReservesFromBorrowernumber &GetReservesForBranch &GetReservesToBranch @@ -278,72 +277,6 @@ sub GetReserve { return $sth->fetchrow_hashref(); } -=head2 GetReservesFromBiblionumber - - my $reserves = GetReservesFromBiblionumber({ - biblionumber => $biblionumber, - [ itemnumber => $itemnumber, ] - [ all_dates => 1|0 ] - }); - -This function gets the list of reservations for one C<$biblionumber>, -returning an arrayref pointing to the reserves for C<$biblionumber>. - -By default, only reserves whose start date falls before the current -time are returned. To return all reserves, including future ones, -the C parameter can be included and set to a true value. - -If the C parameter is supplied, reserves must be targeted -to that item or not targeted to any item at all; otherwise, they -are excluded from the list. - -=cut - -sub GetReservesFromBiblionumber { - my ( $params ) = @_; - my $biblionumber = $params->{biblionumber} or return []; - my $itemnumber = $params->{itemnumber}; - my $all_dates = $params->{all_dates} // 0; - my $dbh = C4::Context->dbh; - - # Find the desired items in the reserves - my @params; - my $query = " - SELECT reserve_id, - branchcode, - timestamp AS rtimestamp, - priority, - biblionumber, - borrowernumber, - reservedate, - found, - itemnumber, - reservenotes, - expirationdate, - lowestPriority, - suspend, - suspend_until, - itemtype - FROM reserves - WHERE biblionumber = ? "; - push( @params, $biblionumber ); - unless ( $all_dates ) { - $query .= " AND reservedate <= CAST(NOW() AS DATE) "; - } - if ( $itemnumber ) { - $query .= " AND ( itemnumber IS NULL OR itemnumber = ? )"; - push( @params, $itemnumber ); - } - $query .= "ORDER BY priority"; - my $sth = $dbh->prepare($query); - $sth->execute( @params ); - my @results; - while ( my $data = $sth->fetchrow_hashref ) { - push @results, $data; - } - return \@results; -} - =head2 GetReservesFromItemnumber ( $reservedate, $borrowernumber, $branchcode, $reserve_id, $waitingdate ) = GetReservesFromItemnumber($itemnumber); -- 2.39.5