Bugzilla – Attachment 35580 Details for
Bug 13636
Search results item status incorrect for holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13636 - Search results item status incorrect for holds
Bug-13636---Search-results-item-status-incorrect-f.patch (text/plain), 3.60 KB, created by
Kyle M Hall (khall)
on 2015-01-28 13:35:15 UTC
(
hide
)
Description:
Bug 13636 - Search results item status incorrect for holds
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-01-28 13:35:15 UTC
Size:
3.60 KB
patch
obsolete
>From 87271d4c9014a4bdac53098b4d617f209fd617b9 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 28 Jan 2015 08:31:30 -0500 >Subject: [PATCH] Bug 13636 - Search results item status incorrect for holds > >Imagine this scenario: we have one record with four items. Two of those >items are checked out, one of those items is a waiting hold, and one of >those items is available. We would expect to see this on the search >results page. Instead, we will see both non-checked out items as >unavailable due to waiting holds. > >This is due to a semantic issue GetReserveStatus. >C4::Search::searchResults uses GetReserveStatus to get the reserve >status of each item, but unlike all other calls to the sub, this one >passes in not only itemnumber, but biblionumber. > >When no reserve is found for the available item, the subroutine uses the >biblionumber to grab what is essentially an arbitrary reserve to use for >the status. This makes no sense and this functionality should be >entirely removed from the subroutine so regressions like this will be >prevented in the future. > >Test Plan: >1) Create one record with 4 items > a) check two of the items out to patrons > b) set one of the items as a waiting hold > c) leave the fourth item as available >2) Run a search where this record will be in the results list >3) Note that the results list 2 items on loan, two unavailable >4) Apply this patch, reload the search results >5) Note that the results list 1 available, 2 on loan, 1 unavailable >--- > C4/Reserves.pm | 10 ++-------- > C4/Search.pm | 2 +- > 2 files changed, 3 insertions(+), 9 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index a188f96..1f78753 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -852,7 +852,7 @@ sub GetReservesForBranch { > > =head2 GetReserveStatus > >- $reservestatus = GetReserveStatus($itemnumber, $biblionumber); >+ $reservestatus = GetReserveStatus($itemnumber); > > Take an itemnumber or a biblionumber and return the status of the reserve places on it. > If several reserves exist, the reserve with the lower priority is given. >@@ -864,7 +864,7 @@ If several reserves exist, the reserve with the lower priority is given. > ## multiple reserves for that bib can have the itemnumber set > ## the sub is only used once in the codebase. > sub GetReserveStatus { >- my ($itemnumber, $biblionumber) = @_; >+ my ($itemnumber) = @_; > > my $dbh = C4::Context->dbh; > >@@ -875,12 +875,6 @@ sub GetReserveStatus { > ($found, $priority) = $sth->fetchrow_array; > } > >- if ( $biblionumber and not defined $found and not defined $priority ) { >- $sth = $dbh->prepare("SELECT found, priority FROM reserves WHERE biblionumber = ? order by priority LIMIT 1"); >- $sth->execute($biblionumber); >- ($found, $priority) = $sth->fetchrow_array; >- } >- > if(defined $found) { > return 'Waiting' if $found eq 'W' and $priority == 0; > return 'Finished' if $found eq 'F'; >diff --git a/C4/Search.pm b/C4/Search.pm >index 5216a12..f93dd15 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -2147,7 +2147,7 @@ sub searchResults { > # should map transit status to record indexed in Zebra. > # > ($transfertwhen, $transfertfrom, $transfertto) = C4::Circulation::GetTransfers($item->{itemnumber}); >- $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber}, $oldbiblio->{biblionumber} ); >+ $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} ); > } > > # item is withdrawn, lost, damaged, not for loan, reserved or in transit >-- >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 13636
:
35580
|
35581
|
35608
|
35730