From a831f95929df23e9a4a24a57c89819b113ff98fe Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 13 Apr 2023 13:15:55 +0200 Subject: [PATCH] Bug 33568: can_be_edited MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Not sure if this is ideal but at least the algorithm complexity is way better than before! Signed-off-by: Owen Leonard Signed-off-by: Laurence Rault Signed-off-by: Emily Lamancusa Signed-off-by: Tomás Cohen Arazi Signed-off-by: Katrin Fischer --- catalogue/detail.pl | 6 ++++++ .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 9edaf3f3bb..f6c65eefc2 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -634,6 +634,12 @@ if ( C4::Context->preference('UseCourseReserves') ) { $template->param( course_reserves => $course_reserves ); } +my @libraries = $biblio->items({ host_items => 1 })->get_column('homebranch'); +my %can_edit_items_from = map { + $_ => $patron->can_edit_items_from($_) +} @libraries; +$template->param(can_edit_items_from => \%can_edit_items_from); + $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 0f2ed85b7b..6beee2e5d4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -1,5 +1,6 @@ [% USE raw %] [% USE Asset %] +[% USE To %] [% USE Koha %] [% USE KohaDates %] [% USE KohaPlugins %] @@ -2504,8 +2505,11 @@ searchable: false, orderable: false, render: function (data, type, row, meta) { - // FIXME if item.can_be_edited - return (''.format(row.item_id)); + if ( can_edit_items_from[row.holding_library_id] ){ + return ''.format(row.item_id); + } else { + return '' + } } }, [% END %] -- 2.39.5