From 2363179198c54cc73c5d314b2367a87b367bcef5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 2 Dec 2019 16:15:59 +0100 Subject: [PATCH] Bug 8132: No changes but disable checkboxes When the list of items is displayed we already know if there will be a problem during the deletion. So let's disable the checkbox to tell the user in advance that items cannot be deleted. Signed-off-by: Kelly McElligott Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- .../prog/en/modules/tools/batchMod-del.tt | 20 ++++++++++++++++--- tools/batchMod.pl | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt index 3d11fafd52..8701d9e2c6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt @@ -1,6 +1,7 @@ [% USE raw %] [% USE Asset %] [% SET footerjs = 1 %] +[% PROCESS 'i18n.inc' %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Batch item deletion [% INCLUDE 'doc-head-close.inc' %] @@ -108,9 +109,22 @@ [% IF show %] [% IF item_loo.nomod %] - Cannot edit - [% ELSE %] - + Cannot delete + [% ELSE %] + [% SET can_be_deleted = item_loo.item.safe_to_delete %] + [% IF can_be_deleted == 1 %] + + [% ELSE %] + [% SWITCH can_be_deleted %] + [% CASE "book_on_loan" %][% SET cannot_delete_reason = t("Item is checked out") %] + [% CASE "not_same_branch" %][% SET cannot_delete_reason = t("Item does not belongs to your library") %] + [% CASE "book_reserved" %][% SET cannot_delete_reason = t("Item has a waiting hold") %] + [% CASE "linked_analytics" %][% SET cannot_delete_reason = t("Item has linked analytics") %] + [% CASE %][% SET cannot_delete_reason = t("Unknown reason") %] + [% END %] + + + [% END %] [% END %] [% ELSE %]   diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 8b13257e5d..a7e3188ef0 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -633,6 +633,7 @@ sub BuildItemsData{ $this_row{biblionumber} = $biblio->biblionumber; $this_row{holds} = $biblio->holds->count; $this_row{item_holds} = Koha::Holds->search( { itemnumber => $itemnumber } )->count; + $this_row{item} = Koha::Items->find($itemnumber); if (%this_row) { push(@big_array, \%this_row); @@ -658,6 +659,7 @@ sub BuildItemsData{ $row_data{biblionumber} = $row->{biblionumber}; $row_data{holds} = $row->{holds}; $row_data{item_holds} = $row->{item_holds}; + $row_data{item} = $row->{item}; my $is_on_loan = C4::Circulation::IsItemIssued( $row->{itemnumber} ); $row_data{onloan} = $is_on_loan ? 1 : 0; push(@item_value_loop,\%row_data); -- 2.39.5