Bugzilla – Attachment 23721 Details for
Bug 11336
Priority is not updated on deleting holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11336: WIP add GetOldReserve
Bug-11336-WIP-add-GetOldReserve.patch (text/plain), 2.59 KB, created by
Jonathan Druart
on 2013-12-20 16:09:48 UTC
(
hide
)
Description:
Bug 11336: WIP add GetOldReserve
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-12-20 16:09:48 UTC
Size:
2.59 KB
patch
obsolete
>From 6e4cc41e90adcb440a005c3ff582a4cb84c7ecd5 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 20 Dec 2013 17:09:22 +0100 >Subject: [PATCH] Bug 11336: WIP add GetOldReserve > >--- > C4/Reserves.pm | 28 ++++++++++++++++++++-------- > t/db_dependent/Holds.t | 5 ++++- > 2 files changed, 24 insertions(+), 9 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 5a91d27..9532a74 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -95,6 +95,7 @@ BEGIN { > &AddReserve > > &GetReserve >+ &GetOldReserve > &GetReservesFromItemnumber > &GetReservesFromBiblionumber > &GetReservesFromBorrowernumber >@@ -252,7 +253,7 @@ sub AddReserve { > > $res = GetReserve( $reserve_id ); > >- Return the current reserve or the old reserve. >+ Return the current reserve. > > =cut > >@@ -263,15 +264,24 @@ sub GetReserve { > my $query = "SELECT * FROM reserves WHERE reserve_id = ?"; > my $sth = $dbh->prepare( $query ); > $sth->execute( $reserve_id ); >- my $res = $sth->fetchrow_hashref(); >+ return $sth->fetchrow_hashref(); >+} > >- unless ( $res ) { >- $res = $dbh->selectrow_hashref(q| >- SELECT * FROM old_reserves WHERE reserve_id = ? >- |, {}, $reserve_id); >- } >+=head2 GetOldReserve >+ >+ $res = GetOldReserve( $reserve_id ); >+ >+ Return a old reserve. >+ >+=cut >+ >+sub GetOldReserve { >+ my ($reserve_id) = @_; > >- return $res; >+ my $dbh = C4::Context->dbh; >+ return $dbh->selectrow_hashref(q| >+ SELECT * FROM old_reserves WHERE reserve_id = ? >+ |, {}, $reserve_id); > } > > =head2 GetReservesFromBiblionumber >@@ -1618,6 +1628,8 @@ sub _FixPriority { > > my $res = GetReserve( $reserve_id ); > >+ $res = GetOldReserve( $reserve_id ) unless $res; >+ > if ( $rank eq "del" ) { > CancelReserve({ reserve_id => $reserve_id }); > } >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 2c28c07..bae31cb 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -6,7 +6,7 @@ use t::lib::Mocks; > use C4::Context; > use C4::Branch; > >-use Test::More tests => 25; >+use Test::More tests => 26; > use MARC::Record; > use C4::Biblio; > use C4::Items; >@@ -278,6 +278,9 @@ ModReserve({ reserve_id => $reserveid2, rank => 'del' }); > $reserve3 = GetReserve( $reserveid3 ); > is( $reserve3->{priority}, 1, "After ModReserve, the 3rd reserve becomes the first on the waiting list" ); > >+my $oldreserve2 = GetOldReserve( $reserveid2 ); >+is_deeply( $oldreserve2->{reserve_id}, $reserve2->{reserve_id} ); >+ > > # Helper method to set up a Biblio. > sub create_helper_biblio { >-- >1.7.10.4
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 11336
:
23286
|
23384
|
23522
|
23531
|
23532
|
23567
|
23629
|
23706
|
23707
|
23721
|
23787
|
23831
|
23862
|
23863