Bugzilla – Attachment 103020 Details for
Bug 6918
Can't place holds on 'on order' items with AllowOnShelfHolds off
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6918: Can't place holds on 'on order' items with AllowOnShelfHolds off
Bug-6918-Cant-place-holds-on-on-order-items-with-A.patch (text/plain), 6.57 KB, created by
Kyle M Hall (khall)
on 2020-04-15 16:26:16 UTC
(
hide
)
Description:
Bug 6918: Can't place holds on 'on order' items with AllowOnShelfHolds off
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-04-15 16:26:16 UTC
Size:
6.57 KB
patch
obsolete
>From 77b58284482a0fa5c558ce48d13d3df85fec1da5 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 7 Jan 2013 09:34:24 -0500 >Subject: [PATCH] Bug 6918: Can't place holds on 'on order' items with > AllowOnShelfHolds off > >Test Plan: >1) Apply patch >2) Turn off AllowOnShelfHolds >3) Create a bib with one item, mark the item as 'on order' >4) Attempt to place a hold on the item, you should now be able to do so >--- > C4/Biblio.pm | 17 ++++++++++++++--- > C4/Reserves.pm | 8 +++----- > opac/opac-ISBDdetail.pl | 2 +- > opac/opac-MARCdetail.pl | 2 +- > opac/opac-detail.pl | 2 +- > opac/opac-search.pl | 2 +- > tools/batch_delete_records.pl | 4 ++-- > 7 files changed, 23 insertions(+), 14 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index d8a96a6062..03d0d4395e 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2524,14 +2524,25 @@ sub _adjust_pubyear { > > =head2 CountItemsIssued > >- my $count = CountItemsIssued( $biblionumber ); >+ my $count = CountItemsIssued( { biblionumber => $biblionumber, count_on_order => 0 || 1 ); > > =cut > > sub CountItemsIssued { >- my ($biblionumber) = @_; >+ my ($params) = @_; >+ my $biblionumber = $params->{'biblionumber'}; >+ my $count_on_order = $params->{'count_on_order'}; >+ >+ my $sql = 'SELECT COUNT(*) AS issuedCount FROM items LEFT JOIN issues ON items.itemnumber = issues.itemnumber WHERE items.biblionumber = ?'; >+ >+ if ( $count_on_order ) { >+ $sql .= ' AND ( issues.itemnumber IS NOT NULL OR items.notforloan < 0 )'; >+ } else { >+ $sql .= ' AND issues.itemnumber IS NOT NULL'; >+ } >+ > my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare('SELECT COUNT(*) as issuedCount FROM items, issues WHERE items.itemnumber = issues.itemnumber AND items.biblionumber = ?'); >+ my $sth = $dbh->prepare( $sql ); > $sth->execute($biblionumber); > my $row = $sth->fetchrow_hashref(); > return $row->{'issuedCount'}; >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 9c040bdc12..efdfdd0969 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1283,13 +1283,11 @@ sub IsAvailableForItemLevelRequest { > > # if we have this param predefined from outer caller sub, we just need > # to return it, so we saving from having loop inside other loop: >- return $items_any_available ? 0 : 1 >- if defined $items_any_available; >+ $items_any_available //= ItemsAnyAvailableForHold( { biblionumber => $item->biblionumber, patron => $patron }); > >- my $any_available = ItemsAnyAvailableForHold( { biblionumber => $item->biblionumber, patron => $patron }); >- return $any_available ? 0 : 1; >+ return $item->notforloan < 0 || !$items_any_available; > } else { # on_shelf_holds == 0 "If any unavailable" (the description is rather cryptic and could still be improved) >- return $item->onloan || IsItemOnHoldAndFound( $item->itemnumber ); >+ return $item->notforloan < 0 || $item->onloan || IsItemOnHoldAndFound( $item->itemnumber ); > } > } > >diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl >index cc4b5b8d1a..dac22e0732 100755 >--- a/opac/opac-ISBDdetail.pl >+++ b/opac/opac-ISBDdetail.pl >@@ -182,7 +182,7 @@ while ( my $item = $items->next ) { > unless $allow_onshelf_holds; > } > >-if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >+if( $allow_onshelf_holds || CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) || $biblio->has_items_waiting_or_intransit ) { > $template->param( ReservableItems => 1 ); > } > >diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl >index b835f1bdea..b934a9c009 100755 >--- a/opac/opac-MARCdetail.pl >+++ b/opac/opac-MARCdetail.pl >@@ -143,7 +143,7 @@ for my $itm (@all_items) { > last if $allow_onshelf_holds; > } > >-if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >+if ( $allow_onshelf_holds || CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) || $biblio->has_items_waiting_or_intransit ) { > $template->param( ReservableItems => 1 ); > } > >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index f1100878bd..422a9de151 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -731,7 +731,7 @@ if ( not $viewallitems and @items > $max_items_to_display ) { > } > } > >-if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >+if ( $allow_onshelf_holds || CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) || $biblio->has_items_waiting_or_intransit ) { > $template->param( ReservableItems => 1 ); > } > >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 01887f283a..b6bea2858c 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -710,7 +710,7 @@ for (my $i=0;$i<@servers;$i++) { > if (C4::Context->preference('TagsEnabled') and > C4::Context->preference('TagsShowOnList')) { > if ( my $bibnum = $res->{biblionumber} ) { >- $res->{itemsissued} = CountItemsIssued( $bibnum ); >+ $res->{itemsissued} = CountItemsIssued( { biblionumber => $bibnum } ); > $res->{'TagLoop'} = get_tags({ > biblionumber => $bibnum, > approved => 1, >diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl >index 1dccbae99f..18cf20b023 100755 >--- a/tools/batch_delete_records.pl >+++ b/tools/batch_delete_records.pl >@@ -96,7 +96,7 @@ if ( $op eq 'form' ) { > my $record = &GetMarcBiblio({ biblionumber => $record_id }); > $biblio->{itemnumbers} = [Koha::Items->search({ biblionumber => $record_id })->get_column('itemnumber')]; > $biblio->{holds_count} = $holds_count; >- $biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id ); >+ $biblio->{issues_count} = C4::Biblio::CountItemsIssued({ biblionumber => $record_id, count_on_order => 1 }); > push @records, $biblio; > } else { > # Retrieve authority information >@@ -145,7 +145,7 @@ if ( $op eq 'form' ) { > my $biblio = Koha::Biblios->find( $biblionumber ); > > # TODO Replace with $biblio->get_issues->count >- if ( C4::Biblio::CountItemsIssued( $biblionumber ) ) { >+ if ( C4::Biblio::CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) ) { > push @messages, { > type => 'warning', > code => 'item_issued', >-- >2.24.1 (Apple Git-126)
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 6918
:
14004
|
14152
|
14158
|
14390
|
14451
|
15077
|
19087
|
68898
|
68934
|
70232
|
102998
|
103016
|
103020
|
103021
|
103175
|
103179
|
105390
|
105473
|
105474