Bugzilla – Attachment 130298 Details for
Bug 29706
When placing a request on the opac, the user is shown titles they cannot place a hold on
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29706: Hide items that cannot be held by default when placing hold on OPAC
Bug-29706-Hide-items-that-cannot-be-held-by-defaul.patch (text/plain), 8.87 KB, created by
Jonathan Druart
on 2022-02-08 15:50:19 UTC
(
hide
)
Description:
Bug 29706: Hide items that cannot be held by default when placing hold on OPAC
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-02-08 15:50:19 UTC
Size:
8.87 KB
patch
obsolete
>From e7e296e6a8f2ee235bf626290d006cf57ea03ae1 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 16 Dec 2021 01:59:50 +0000 >Subject: [PATCH] Bug 29706: Hide items that cannot be held by default when > placing hold on OPAC > >This patch adds a 'holdable' and 'unholdable' class to the rows of the table > >Additionally I rename the 'backgroundcolor' field to 'onloan' as that is what it contains. >Note: Out of the box, there is no css associated with this class > >I add a div around the table to allow hiding the new buttons as well when optiuons are hidden > >It would be nice in the future to utilise a Koha table here, however, it is complicated by multi-holds > >To test: > 1 - Add a number of items to a record, ensuring they belong to different libraries > 2 - Set 'Default checkout, hold and return policy'->'Hold policy' to 'From home library' > 3 - Sign in to opac and attempt to placehold on the record > 4 - Click 'show more options' and 'a specificitem' > 5 - Note holds table includes items that cannot be held > 6 - Apply patch > 7 - Reload holds page > 8 - Note items that cannot be heldare hidden > 9 - Click 'Show unholdable items' and note they appear >10 - Click 'Hide unholdable items' and veriofy they hide >11 - Test with multi holds > >Signed-off-by: The Minh Luong <the-minh.luong@inlibro.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../bootstrap/en/modules/opac-reserve.tt | 47 ++++++++++++++----- > opac/opac-reserve.pl | 2 +- > 2 files changed, 36 insertions(+), 13 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >index 85eb71e4da0..b85c17ba9d2 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -343,7 +343,8 @@ > </ul> > > [% IF bibitemloo.itemholdable %] >- <table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber | html %]"> >+ <div id="copiesrow_[% bibitemloo.biblionumber | html %]" class="copiesrow"> >+ <table class="table table-bordered table-striped"> > <caption>Select a specific item:</caption> > <thead> > <tr> >@@ -369,21 +370,32 @@ > </thead> > <tbody> > >+ [% SET unholdable_items = 0 %] > [% FOREACH itemLoo IN bibitemloo.itemLoop %] >- <tr class="[% itemLoo.backgroundcolor | html %]"> >- <td class="copynumber"> >- [% IF ( itemLoo.available ) %] >- <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber | html %]" name="checkitem_[% bibitemloo.biblionumber | html %]" value="[% itemLoo.itemnumber | html %]" /> >- [% ELSE %] >- <input disabled="disabled" type="radio" aria-label="Cannot be put on hold" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber | html %]" >+ [% IF ( itemLoo.available ) %] >+ [% IF ( itemLoo.onloan ) %] >+ <tr class="holdable onloan"> >+ [% ELSE %] >+ <tr class="holdable"> >+ [% END %] >+ <td class="copynumber"> >+ <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber | html %]" name="checkitem_[% bibitemloo.biblionumber | html %]" value="[% itemLoo.itemnumber | html %]" /> >+ [% ELSE %] >+ [% SET unholdable_items = 1 %] >+ [% IF ( itemLoo.onloan ) %] >+ <tr class="unholdable onloan" style="display:none;"> >+ [% ELSE %] >+ <tr class="unholdable" style="display:none;"> >+ [% END %] >+ <td class="copynumber"> >+ <input disabled="disabled" type="radio" aria-label="Cannot be put on hold" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber | html %]" > style="display:none;" /> > <i class="fa fa-remove danger" aria-hidden="true" title="Cannot be put on hold"></i> >- [% END %] >- >+ [% END %] > [% IF ( itemLoo.copynumber ) %] > [% itemLoo.copynumber | html %] > [% END %] >- </td> >+ </td> [%# copynumber %] > > [% IF ( item_level_itypes ) %] > <td class="itype"> >@@ -456,6 +468,11 @@ > [% END # / FOREACH itemLoo IN bibitemloo.itemLoop%] > </tbody> > </table> <!-- / #copiesrow_[% bibitemloo.biblionumber | html %] --> >+ [% IF unholdable_items %] >+ <button id="show_unholdable" class="btn btn-primary toggle_unholdable unholdable">Show unholdable items</button> >+ <button id="hide_unholdable" class="btn btn-primary toggle_unholdable unholdable" style="display:none;">Hide unholdable items</button> >+ [% END %] >+ </div> > [% END # / IF ( bibitemloo.itemholdable )%] > </div> <!-- / #hold-options-[% bibitemloo.biblionumber | html %] --> > </fieldset> >@@ -492,6 +509,12 @@ > } > > $(document).ready(function() { >+ >+ $(".toggle_unholdable").click(function(e){ >+ e.preventDefault(); >+ $(".unholdable").toggle(); >+ }); >+ > $("#hold-request-form").preventDoubleFormSubmit(); > var copiesRowId = null; > var wasSpecific = false; >@@ -579,8 +602,8 @@ > > // If the user is *allowed* to choose a specific item > // The first one is preselected >- $("table.copiesrow").each(function(){ >- var id = suffixOf($(this).attr("id"), "_"); >+ $(".copiesrow table").each(function(){ >+ var id = suffixOf($(this).closest('div').attr("id"), "_"); > select_first_available(id); > }); > >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index e8810650f75..7be38e25680 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -508,7 +508,7 @@ foreach my $biblioNum (@biblionumbers) { > my $issue = Koha::Checkouts->find( { itemnumber => $itemNum } ); > if ( $issue ) { > $itemLoopIter->{dateDue} = output_pref({ dt => dt_from_string($issue->date_due, 'sql'), as_due_date => 1 }); >- $itemLoopIter->{backgroundcolor} = 'onloan'; >+ $itemLoopIter->{onloan} = 'onloan'; > } > > # checking reserve >-- >2.25.1
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 29706
:
128580
|
128581
|
129196
|
130262
|
130263
|
130281
|
130297
| 130298 |
130299