Bugzilla – Attachment 31183 Details for
Bug 10226
suspended holds still show not available
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10226 - suspended holds still show not available
Bug-10226---suspended-holds-still-show-not-availab.patch (text/plain), 2.70 KB, created by
Kyle M Hall (khall)
on 2014-08-27 12:54:53 UTC
(
hide
)
Description:
Bug 10226 - suspended holds still show not available
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-08-27 12:54:53 UTC
Size:
2.70 KB
patch
obsolete
>From 8a8ec84e01ac8769625d9045290f33b8f073a6a2 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 27 Aug 2014 08:29:05 -0400 >Subject: [PATCH] Bug 10226 - suspended holds still show not available > >If you suspend a hold, the item does not show Available. It still shows >the person next in line, who isn't eligible for the hold yet because of >the suspension. This is not the case for a delayed hold, where you >originally place the hold and tell it not to start until a future date. >If you do that, it shows as Available. This is confusing and >inconsistent. > >Test Plan: >1) Create an item level suspended hold for a record with no other holds >2) Note in the record details that the hold shows an item level hold >3) Apply this patch >4) Refresh the record details page, note the item is "Available" >5) Optional: prove t/db_dependent/Holds.t t/db_dependent/Reserves.t >--- > C4/Reserves.pm | 41 ++++++++++++++++++++++++++++------------- > 1 files changed, 28 insertions(+), 13 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index a98eed4..23cd714 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -38,6 +38,7 @@ use C4::Branch qw( GetBranchDetail ); > use C4::Dates qw( format_date_in_iso ); > > use Koha::DateUtils; >+use Koha::Database; > > use List::MoreUtils qw( firstidx ); > >@@ -380,19 +381,33 @@ The routine does not look at future reserves (read: item level holds), but DOES > =cut > > sub GetReservesFromItemnumber { >- my ( $itemnumber ) = @_; >- my $dbh = C4::Context->dbh; >- my $query = " >- SELECT reservedate,borrowernumber,branchcode,reserve_id,waitingdate >- FROM reserves >- WHERE itemnumber=? AND ( reservedate <= CAST(now() AS date) OR >- waitingdate IS NOT NULL ) >- ORDER BY priority >- "; >- my $sth_res = $dbh->prepare($query); >- $sth_res->execute($itemnumber); >- my ( $reservedate, $borrowernumber,$branchcode, $reserve_id, $wait ) = $sth_res->fetchrow_array; >- return ( $reservedate, $borrowernumber, $branchcode, $reserve_id, $wait ); >+ my ($itemnumber) = @_; >+ >+ my $schema = Koha::Database->new()->schema(); >+ >+ my $r = $schema->resultset('Reserve')->search( >+ { >+ itemnumber => $itemnumber, >+ suspend => 0, >+ -or => [ >+ reservedate => \'<= CAST( NOW( ) AS DATE )', >+ waitingdate => { '!=', undef } >+ ] >+ }, >+ { >+ order_by => 'priority', >+ } >+ )->first(); >+ >+ return unless $r; >+ >+ return ( >+ $r->reservedate(), >+ $r->get_column('borrowernumber'), >+ $r->get_column('branchcode'), >+ $r->reserve_id(), >+ $r->waitingdate(), >+ ); > } > > =head2 GetReservesFromBorrowernumber >-- >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 10226
:
31183
|
31185
|
31217
|
31475
|
31504
|
31505