Bugzilla – Attachment 83643 Details for
Bug 15505
Mark Hold Items 'On hold' instead of 'Available'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15505 - Mark Hold Items 'On hold' instead of 'Available'
Bug-15505---Mark-Hold-Items-On-hold-instead-of-Ava.patch (text/plain), 7.99 KB, created by
Nick Clemens (kidclamp)
on 2019-01-04 17:44:43 UTC
(
hide
)
Description:
Bug 15505 - Mark Hold Items 'On hold' instead of 'Available'
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-01-04 17:44:43 UTC
Size:
7.99 KB
patch
obsolete
>From 351335978224b4b40a326640f9e44a66f97130b6 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 27 Dec 2016 17:07:20 +0000 >Subject: [PATCH] Bug 15505 - Mark Hold Items 'On hold' instead of 'Available' > >This patch adds a 'pending hold' column to C4::Items:GetItemsInfo to >allow for displaying status of an item when it has been selected for a >hold by the holdsqueue and AllowItemsOnHoldCheckout is set to 'Don't >allow' > >To test: >00 - Set AllowItemsOnHoldCheckout to 'Allow' >01 - Place a hold on an item >02 - Build the holdsqueue (kohadevbox example below) > sudo koha-shell kohadev > perl misc/cronjobs/holds/build_holds_queue.pl >03 - Search for the item on the OPAC >04 - Note item shows as 'Available' in results and details >05 - Toggle AllowItemsOnHOldCheckout to 'Don't allow' >06 - Repeat search, note there is no change >06 - Apply Patch >07 - Search for the item on the OPAC >08 - Note that item now shows as 'Pending hold' >09 - Toggle AllowItemsOnHoldCheckout to Allow >10 - Note item shows as available >11 - prove -v t/db_dependent/Items.t >--- > C4/Items.pm | 3 +++ > C4/XSLT.pm | 6 +++++- > .../prog/en/modules/admin/preferences/circulation.pref | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc | 5 +++++ > .../bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 6 ++++++ > t/db_dependent/Items.t | 15 ++++++++++++++- > 6 files changed, 34 insertions(+), 3 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 3b006c686e..47aeabcfbd 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1005,6 +1005,7 @@ sub GetItemsInfo { > holding.opac_info as holding_branch_opac_info, > home.opac_info as home_branch_opac_info > "; >+ $query .= ",IF(tmp_holdsqueue.itemnumber,1,0) AS pending_hold" if !C4::Context->preference('AllowItemsOnHoldCheckout'); > $query .= " > FROM items > LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode >@@ -1017,6 +1018,8 @@ sub GetItemsInfo { > LEFT JOIN serial USING (serialid) > LEFT JOIN itemtypes ON itemtypes.itemtype = " > . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype'); >+ $query .= " >+ LEFT JOIN tmp_holdsqueue USING (itemnumber)" if !C4::Context->preference('AllowItemsOnHoldCheckout'); > $query .= q| > LEFT JOIN localization ON itemtypes.itemtype = localization.code > AND localization.entity = 'itemtypes' >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index bf2647ab74..f2b4385c7f 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -27,6 +27,7 @@ use C4::Context; > use C4::Items; > use C4::Koha; > use C4::Biblio; >+use C4::HoldsQueue; > use C4::Circulation; > use C4::Reserves; > use Koha::AuthorisedValues; >@@ -293,7 +294,7 @@ sub buildKohaItemsNamespace { > my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} ); > > if ( ( $item->{itype} && $itemtypes->{ $item->{itype} }->{notforloan} ) || $item->{notforloan} || $item->{onloan} || $item->{withdrawn} || $item->{itemlost} || $item->{damaged} || >- (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") ){ >+ (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") || $item->{pending_hold} ){ > if ( $item->{notforloan} < 0) { > $status = "On order"; > } >@@ -318,6 +319,9 @@ sub buildKohaItemsNamespace { > if (defined $reservestatus && $reservestatus eq "Waiting") { > $status = 'Waiting'; > } >+ if ($item->{pending_hold}) { >+ $status = 'Pending hold'; >+ } > } else { > $status = "available"; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index e67fc81d7b..63280f1195 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -188,7 +188,7 @@ Circulation: > choices: > yes: Allow > no: "Don't allow" >- - checkouts of items reserved to someone else. If allowed do not generate RESERVE_WAITING and RESERVED warning. This allows self checkouts for those items. >+ - checkouts of items reserved to someone else. If allowed do not generate RESERVE_WAITING and RESERVED warning. This allows self checkouts for those items. If using the holds queue items with pending holds will be marked as "unavailable" if this set to "Don't Allow". > - > - pref: AllowItemsOnHoldCheckoutSCO > choices: >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc >index 99bdeed344..d21cbc86aa 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc >@@ -89,6 +89,11 @@ > <span class="item-status onorder">On order</span> > [% END %] > >+[% IF item.pending_hold %] >+ [% SET itemavailable = 0 %] >+ <span class="item-status pendinghold">Pending hold</span> >+[% END %] >+ > [% IF ( itemavailable ) %] > [% IF NOT item.isa('Koha::Item') %][% SET restrictedopac = item.restrictedopac %][% END %] > <span class="item-status available">Available [% IF restrictedopac %]<span class="restricted">([% restrictedopac | html %])</span>[% END %]</span> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >index b6c9ee7747..d4a5b48a2e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >@@ -1297,6 +1297,12 @@ > <xsl:value-of select="count(key('item-by-status', 'On order'))"/> > <xsl:text>). </xsl:text> </span> > </xsl:if> >+ <xsl:if test="count(key('item-by-status', 'Pending hold'))>0"> >+ <span class="unavailable"> >+ <xsl:text>Pending hold (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status', 'Pending hold'))"/> >+ <xsl:text>). </xsl:text> </span> >+ </xsl:if> > <xsl:if test="count(key('item-by-status', 'In transit'))>0"> > <span class="unavailable"> > <xsl:text>In transit (</xsl:text> >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index bc7aaa9feb..2b4957ff6c 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -250,7 +250,7 @@ subtest 'GetHiddenItemnumbers tests' => sub { > > subtest 'GetItemsInfo tests' => sub { > >- plan tests => 4; >+ plan tests => 6; > > $schema->storage->txn_begin; > >@@ -294,6 +294,19 @@ subtest 'GetItemsInfo tests' => sub { > is( exists( $results[0]->{ onsite_checkout } ), 1, > 'GetItemsInfo returns a onsite_checkout key' ); > >+ t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 ); >+ #place item into holds queue >+ my $dbh = C4::Context->dbh; >+ $dbh->do(q{INSERT INTO tmp_holdsqueue (biblionumber, itemnumber, surname, borrowernumber ) VALUES (?, ?, "Zorro", 42)}, undef, $item_bibnum, $itemnumber); >+ @results = GetItemsInfo( $biblionumber ); >+ is( $results[0]->{ pending_hold }, "1", >+ 'Hold marked as pending/unavailable if not AllowItemsOnHoldCheckout' ); >+ t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 ); >+ @results = GetItemsInfo( $biblionumber ); >+ is( $results[0]->{ pending_hold }, undef, >+ 'Hold not marked as pending/unavailable if AllowItemsOnHoldCheckout' ); >+ >+ > $schema->storage->txn_rollback; > }; > >-- >2.11.0
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 15505
:
58459
|
58549
|
83643
|
85349
|
86817
|
86821
|
88158