Bugzilla – Attachment 170068 Details for
Bug 34486
Hide more OPAC holdings table columns when they are empty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34486: Show OPAC Column Due Date only if items on loan exist
Bug-34486-Show-OPAC-Column-Due-Date-only-if-items-.patch (text/plain), 11.36 KB, created by
Owen Leonard
on 2024-08-05 14:51:17 UTC
(
hide
)
Description:
Bug 34486: Show OPAC Column Due Date only if items on loan exist
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2024-08-05 14:51:17 UTC
Size:
11.36 KB
patch
obsolete
>From 22a2d0573a1bb7e6af938f1cc3f1481fa4a14273 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 5 Aug 2024 13:43:19 +0000 >Subject: [PATCH] Bug 34486: Show OPAC Column Due Date only if items on loan > exist > >This patch updates the OPAC bibliographic detail page so that in the >holdings table, the following columns are hidden if they contain no >data: Call number, date due, materials, checkouts, barcode, >and item-level holds. > >To test, apply the patch and restart services. > >- In the staff interface, go to Administration -> System preferences. >- Search for OPACShowHoldQueueDetails and set it to "Show holds and > their priority level." >- Search for OPACShowHoldQueueDetails and set it to "Show holds and > their priority level." >- In the OPAC, locate a bibliographic record with multiple items. >- View the detail page and confirm that the holdings table doesn't show > these columns if there is no data in any of the rows: Call number, > date due, materials, barcode, and item-level holds >- For each of the affected fields, update the record the record so that > there is data to be shown for at least one of the items: > - Edit an item to add: call number, materials specified, barcode > - Check out an item to someone in order to show the date due column > - Place an item-level hold on one of the items to show the item holds > column. >- Go to Administration -> Table settings -> OPAC -> biblio-detail and > configure some columns to be hidden by default. Confirm that your > changes are correctly shown in the OPAC holdings table. > >Sponsored-by: Athens County Public Libraries >--- > .../bootstrap/en/modules/opac-detail.tt | 44 ++++++++++++------- > opac/opac-detail.pl | 36 +++++++++------ > 2 files changed, 49 insertions(+), 31 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index 7dd44416f5..c788478692 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -1191,8 +1191,10 @@ > [% IF ( Koha.Preference('OpacLocationOnDetail') == 'column' && itemdata_location ) %] > <th id="item_shelving_location" data-colname="item_shelving_location" class="shelving_location">Shelving location</th> > [% END %] >+ [% IF ( itemdata_itemcallnumber ) %] > <th id="item_callnumber" data-colname="item_callnumber" class="call_no">Call number</th> >- [% UNLESS TablesSettings.is_hidden( 'opac', 'biblio-detail', 'holdingst', 'item_materials') %] >+ [% END %] >+ [% IF ( itemdata_materials ) %] > <th id="item_materials" data-colname="item_materials" class="materials">Materials specified</th> > [% END %] > [% IF ( itemdata_enumchron ) %] >@@ -1208,9 +1210,13 @@ > [% IF ( itemdata_itemnotes ) %] > <th id="item_notes" data-colname="item_notes" class="notes">Notes</th> > [% END %] >+ [% IF ( item_checkouts ) %] > <th id="item_datedue" data-colname="item_datedue" class="date_due">Date due</th> >+ [% END %] >+ [% IF ( itemdata_barcode ) %] > <th id="item_barcode" data-colname="item_barcode" class="barcode">Barcode</th> >- [% IF holds_count.defined %] >+ [% END %] >+ [% IF item_level_holds > 0 %] > <th id="item_holds" data-colname="item_holds">Item holds</th> > [% ELSIF show_priority %] > <th id="item_priority" data-colname="item_priority">Item hold queue priority</th> >@@ -1313,20 +1319,22 @@ > <td class="shelving_location"><span class="shelvingloc">[% ITEM_RESULT.location_description | html %]</span></td> > [% END %] > >- <td class="call_no" property="sku"> >- [% IF ( ITEM_RESULT.itemcallnumber ) %] >- [% ITEM_RESULT.itemcallnumber | html %] >- [% IF ( OPACShelfBrowser ) %] >- [% IF ( ITEM_RESULT.itemnumber == starting_itemnumber ) %] >- (<a class="close_shelf" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber | html %]&shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber | html %]#[% tab | html %]">Browse shelf<span class="sr-only">(Opens below)</span></a>) >- [% ELSE %] >- (<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber | uri %]&shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber | uri %]#[% tab | uri %]">Browse shelf<span class="sr-only">(Opens below)</span></a>) >+ [% IF ( itemdata_itemcallnumber ) %] >+ <td class="call_no" property="sku"> >+ [% IF ( ITEM_RESULT.itemcallnumber ) %] >+ [% ITEM_RESULT.itemcallnumber | html %] >+ [% IF ( OPACShelfBrowser ) %] >+ [% IF ( ITEM_RESULT.itemnumber == starting_itemnumber ) %] >+ (<a class="close_shelf" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber | html %]&shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber | html %]#[% tab | html %]">Browse shelf<span class="sr-only">(Opens below)</span></a>) >+ [% ELSE %] >+ (<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber | uri %]&shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber | uri %]#[% tab | uri %]">Browse shelf<span class="sr-only">(Opens below)</span></a>) >+ [% END %] > [% END %] > [% END %] >- [% END %] >- </td> >+ </td> >+ [% END %] > >- [% UNLESS TablesSettings.is_hidden( 'opac', 'biblio-detail', 'holdingst', 'item_materials') %] >+ [% IF ( itemdata_materials ) %] > <td class="materials">[% ITEM_RESULT.materials | html %]</td> > [% END %] > >@@ -1380,14 +1388,15 @@ > [% IF ( itemdata_copynumber ) %]<td class="copynumber">[% ITEM_RESULT.copynumber | html %]</td>[% END %] > <td class="status">[% INCLUDE 'item-status.inc' item = ITEM_RESULT.object include_schema_org = 1 %]</td> > [% IF ( itemdata_itemnotes ) %]<td class="notes" property="description">[% ITEM_RESULT.itemnotes | $raw %]</td>[% END %] >- [% IF ITEM_RESULT.checkout %] >+ [% IF item_checkouts %] > <td class="date_due" data-order="[% ITEM_RESULT.checkout.date_due | html %]">[% ITEM_RESULT.checkout.date_due | $KohaDates as_due_date => 1 %]</td> >- [% ELSE %] >- <td class="date_due"></td> > [% END %] > >+ [% IF ( itemdata_barcode ) %] > <td class="barcode" property="serialNumber">[% ITEM_RESULT.barcode | html %]</td> >- [% IF holds_count.defined || show_priority %] >+ [% END %] >+ >+ [% IF item_level_holds > 0 %] > <td class="holds_count"> > [% IF holds_count.defined %] [% ITEM_RESULT.holds_count | html %] [% END %] > [% IF ITEM_RESULT.priority %] >@@ -1399,6 +1408,7 @@ > [% END %] > </td> > [% END %] >+ > [% IF ShowCourseReservesHeader %] > <td> > [% IF ITEM_RESULT.course_reserves %] >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 96c73dd1fc..3d2da21763 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -670,6 +670,8 @@ my $holdable_items = $biblio->items->filter_by_for_hold->count; > my $can_holds_be_placed = $patron ? 0 : $holdable_items; > > my ( $itemloop_has_images, $otheritemloop_has_images ); >+my $item_level_holds; >+my $item_checkouts; > if ( not $viewallitems and $items->count > $max_items_to_display ) { > $template->param( > too_many_items => 1, >@@ -681,6 +683,7 @@ else { > while ( my $item = $items->next ) { > my $item_info = $item->unblessed; > $item_info->{holds_count} = $item_reserves{ $item->itemnumber }; >+ if( $item_info->{holds_count} && $item_info->{holds_count} > 0 ){ $item_level_holds = 1; } > $item_info->{priority} = $priority{ $item->itemnumber }; > > # Get opac_info from Additional contents for home and holding library >@@ -721,9 +724,11 @@ else { > $item_info->{'description'} = > $itemtypes->{ $itemtype->itemtype }->{translated_description}; > >+ $item_info->{checkout} = $item->checkout; >+ if( $item_info->{checkout} && $item_info->{checkout} > 0 ){ $item_checkouts = 1; } >+ > foreach my $field ( >- qw(ccode materials enumchron copynumber itemnotes location_description uri) >- ) >+ qw(ccode materials enumchron copynumber itemnotes location_description uri barcode itemcallnumber)) > { > $itemfields{$field} = 1 if $item_info->{$field}; > } >@@ -735,7 +740,6 @@ else { > $item_info->{serial} = $serial if $serial; > } > >- $item_info->{checkout} = $item->checkout; > $item_info->{object} = $item; > > >@@ -772,6 +776,8 @@ else { > } > > $template->param( >+ item_checkouts => $item_checkouts, >+ item_level_holds => $item_level_holds, > ReservableItems => $can_holds_be_placed, > itemloop_has_images => $itemloop_has_images, > otheritemloop_has_images => $otheritemloop_has_images, >@@ -798,17 +804,19 @@ if( C4::Context->preference('ArticleRequests') ) { > $template->param( artreqpossible => $artreqpossible ); > } > >- $template->param( >- MARCNOTES => $marcnotesarray, >- itemdata_ccode => $itemfields{ccode}, >- itemdata_materials => $itemfields{materials}, >- itemdata_enumchron => $itemfields{enumchron}, >- itemdata_uri => $itemfields{uri}, >- itemdata_copynumber => $itemfields{copynumber}, >- itemdata_itemnotes => $itemfields{itemnotes}, >- itemdata_location => $itemfields{location_description}, >- OpacStarRatings => C4::Context->preference("OpacStarRatings"), >- ); >+$template->param( >+ MARCNOTES => $marcnotesarray, >+ itemdata_ccode => $itemfields{ccode}, >+ itemdata_materials => $itemfields{materials}, >+ itemdata_enumchron => $itemfields{enumchron}, >+ itemdata_uri => $itemfields{uri}, >+ itemdata_copynumber => $itemfields{copynumber}, >+ itemdata_itemnotes => $itemfields{itemnotes}, >+ itemdata_location => $itemfields{location_description}, >+ itemdata_barcode => $itemfields{barcode}, >+ itemdata_itemcallnumber => $itemfields{itemcallnumber}, >+ OpacStarRatings => C4::Context->preference("OpacStarRatings"), >+); > > if (C4::Context->preference("AlternateHoldingsField") && $items->count == 0) { > my $fieldspec = C4::Context->preference("AlternateHoldingsField"); >-- >2.39.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 34486
:
170068
|
170073
|
170587
|
170588