From e77469bd2b0d9147c2b569193a2b965531161a21 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 13 Apr 2023 13:25:50 +0200 Subject: [PATCH] Bug 33568: Display item type image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Owen Leonard Signed-off-by: Laurence Rault Signed-off-by: Emily Lamancusa Signed-off-by: Tomás Cohen Arazi --- catalogue/detail.pl | 7 +++++++ .../prog/en/modules/catalogue/detail.tt | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index f6c65eefc2b..4bed0bc7005 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -640,6 +640,13 @@ my %can_edit_items_from = map { } @libraries; $template->param(can_edit_items_from => \%can_edit_items_from); +my @itemtypes = Koha::ItemTypes->search->as_list; +my %item_type_image_locations = map { + $_->itemtype => $_->image_location('intranet') +} @itemtypes; +$template->param(item_type_image_locations => \%item_type_image_locations); + + $template->param(found1 => scalar $query->param('found1') ); $template->param(biblio => $biblio); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 6beee2e5d4e..d6c9b7ee295 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -2492,6 +2492,8 @@ }); [% END %] + const can_edit_items_from = [% To.json(can_edit_items_from) | $raw %]; + const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %]; let table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; var items_table = $("#table_items").kohaTable({ ajax: { url: table_url }, @@ -2529,7 +2531,16 @@ searchable: true, orderable: true, render: function (data, type, row, meta) { - return row._strings.item_type_id.str; // FIXME Display the image + let node = ''; + [% UNLESS noItemTypeImages %] + let image_location = item_type_image_locations[row.item_type_id]; + let item_type_description = row._strings.item_type_id.str; + node += image_location + ? '%s '.format(image_location, item_type_description, item_type_description) + : ''; + [% END %] + node += '%s'.format(item_type_description); + return node; } }, [% END %] -- 2.34.1