Bugzilla – Attachment 70232 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.patch (text/plain), 5.11 KB, created by
Kyle M Hall (khall)
on 2018-01-02 18:30:12 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:
2018-01-02 18:30:12 UTC
Size:
5.11 KB
patch
obsolete
>From 30e5264272a1109e348eb34bc6558ea20cdefc26 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 | 15 +++++++++++++-- > 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 ++-- > 6 files changed, 19 insertions(+), 8 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 03d9a60..cc8db76 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2713,9 +2713,20 @@ sub _adjust_pubyear { > =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/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl >index a3cb1a9..53e66c5 100755 >--- a/opac/opac-ISBDdetail.pl >+++ b/opac/opac-ISBDdetail.pl >@@ -79,7 +79,7 @@ if(my $cart_list = $query->cookie("bib_list")){ > } > } > >-$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); >+$template->param( 'ItemsIssued' => CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) ); > > my $marcflavour = C4::Context->preference("marcflavour"); > >diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl >index 9605cdd..52238d9 100755 >--- a/opac/opac-MARCdetail.pl >+++ b/opac/opac-MARCdetail.pl >@@ -137,7 +137,7 @@ for my $itm (@all_items) { > } > > $template->param( 'AllowOnShelfHolds' => $allow_onshelf_holds ); >-$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); >+$template->param( 'ItemsIssued' => CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) ); > > # adding the $RequestOnOpac param > my $RequestOnOpac; >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 9ace469..7a86891 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -459,7 +459,7 @@ if ($session->param('busc')) { > } > > >-$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); >+$template->param( 'ItemsIssued' => CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) ); > $template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); > > # adding items linked via host biblios >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index ccde617..3c1314d 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -674,7 +674,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 8804e62..888bf58 100755 >--- a/tools/batch_delete_records.pl >+++ b/tools/batch_delete_records.pl >@@ -85,7 +85,7 @@ if ( $op eq 'form' ) { > $biblio->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $record_id ) ); > $biblio->{itemnumbers} = C4::Items::GetItemnumbersForBiblio( $record_id ); > $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 >@@ -134,7 +134,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.10.2
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