From 8530cfc9017b82b505318e69f432b3abfb0b312e Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Wed, 26 Jun 2024 12:32:13 +0000 Subject: [PATCH] Bug 36154: Showing LocalCoverImages and CustomCoverImages in the list page in staff interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To test 1. Log in to the staff interface 2. Make sure the system preference LocalCoverImages has «Show» value 3. Create a new list 4.1. Click on «More» menu then click on «List» and click on «New List» 4. Search for a record and add a local image to it 5. Add the record to the list created on step 4.1 6. Check the list ----> The image is not displayed 7. Apply the patch 8. Check the list again ----> the image is now display in a new column named «Cover» 9. Put the system preference LocalCoverImages to «Don't show» and CustomCoverImages to « Show » and add an image url to CustomCoverImagesURL (https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/481px-Cat03.jpg) 10. Check the list again ----> the image in CustomCoverImagesURL is display in the column named «Cover» https://bugs.koha-community.org/show_bug.cgi?id=37916 --- .../prog/en/modules/virtualshelves/shelves.tt | 22 +++++++++++++++++++ virtualshelves/shelves.pl | 1 + 2 files changed, 23 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index c9c06745b1..e3d2489a78 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -5,8 +5,10 @@ [% USE KohaDates %] [% USE AuthorisedValues %] [% USE Branches %] +[% USE KohaPlugins %] [% PROCESS 'i18n.inc' %] [% SET footerjs = 1 %] +[% SET CoverImagePlugins = KohaPlugins.get_plugins_intranet_cover_images %] [% INCLUDE 'doc-head-open.inc' %] [% FILTER collapse %] [% IF op == 'view' %] @@ -287,6 +289,9 @@ [% UNLESS ( item_level_itypes ) %] <th>Item type</th> [% END %] + [% IF ( CoverImagePlugins || LocalCoverImages || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL'))) %] + <th>Cover</th> + [% END %] [% IF sortfield == 'title' %] <th class="sorting_[% direction | html %]"> [% ELSE %] @@ -332,6 +337,22 @@ <span class="itypetext">[% itemsloo.description | html %]</span> </td> [% END %] + [% IF LocalCoverImages && itemsloo.biblio_object.cover_images.count > 0 %] + <td> + <span title="[% img_title | html %]" class="[% itemsloo.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span> + <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=[% itemsloo.biblionumber | uri %]" alt="Local cover image" /> + </td> + [% ELSIF Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL') && (custom_cover_image_url = itemsloo.biblio_object.custom_cover_image_url) %] + <td> + [% IF custom_cover_image_url %] + <a class="custom_cover_image" href="[% PROCESS biblio_a_href biblionumber => itemsloo.biblionumber %]"> + <img alt="Custom cover image" src="[% custom_cover_image_url | url %]" /></a> + [% END %] + </td> + [% ELSE %] + <td> + </td> + [% END %] <td> [% IF ( itemsloo.XSLTBloc ) %] [% itemsloo.XSLTBloc | $raw %] @@ -619,6 +640,7 @@ </script> [% END #/print %] + [% CoverImagePlugins | $raw %] <script> var MSG_NO_ITEM_SELECTED = _("Nothing is selected."); var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these records from the list?"); diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index c60038fddd..6baa7d5b4e 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -344,6 +344,7 @@ if ( $op eq 'view' ) { # Getting items infos for location display my $items = $biblio->items; $this_item->{'ITEM_RESULTS'} = $items; + $this_item->{biblio_object} = $biblio; $this_item->{biblionumber} = $biblionumber; push @items, $this_item; } -- 2.34.1