Bugzilla – Attachment 121504 Details for
Bug 28353
Regression: Batch item deletion no longer shows which items were not removed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28353: Display a list of items that cannot be deleted
Bug-28353-Display-a-list-of-items-that-cannot-be-d.patch (text/plain), 5.34 KB, created by
David Nind
on 2021-05-29 00:51:45 UTC
(
hide
)
Description:
Bug 28353: Display a list of items that cannot be deleted
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-05-29 00:51:45 UTC
Size:
5.34 KB
patch
obsolete
>From d5d205034a73362e3ad3d331cba604db3f023462 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 18 May 2021 09:41:40 +0200 >Subject: [PATCH] Bug 28353: Display a list of items that cannot be deleted > >We used to display a list of items that cannot be deleted (checked out >or on hold) on the Batch item deletion tool. >With bug 8132 we improve the error handling, but the info is spread in >the table. > >This patch adds, at the top of the page, the list of items (barcode) >that cannot be removed. > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/en/modules/tools/batchMod-del.tt | 35 +++++++++++++--------- > tools/batchMod.pl | 10 ++++++- > 2 files changed, 30 insertions(+), 15 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 d13d849b38..5269cf003e 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 >@@ -51,11 +51,6 @@ > [% END %] > </tbody> > </table> >- [% UNLESS ( too_many_items_display ) %] >- [% IF ( item_loop ) %] >- <h4>The following barcodes were found: </h4> >- [% END %] >- [% END %] > [% END %] <!-- /notfoundbarcodes --> > [% IF ( notfounditemnumbers.size ) %] > <div class="dialog alert"> >@@ -71,14 +66,27 @@ > [% END %] > </tbody> > </table> >- [% UNLESS ( too_many_items_display ) %] >- [% IF ( item_loop ) %] >- <h4>The following itemnumbers were found: </h4> >- [% END %] >- [% END %] > [% END %] <!-- /notfounditemnumbers --> > >+ [% IF cannot_be_deleted.size %] >+ <div class="dialog alert"> >+ <p>Warning, the following items cannot be deleted: </p> >+ </div> >+ <table style="margin:auto;"> >+ <thead> >+ <tr><th>Cannot be deleted</th></tr> >+ </thead> >+ <tbody> >+ [% FOREACH barcode IN cannot_be_deleted %] >+ <tr><td>[% barcode | html %]</td></td> >+ [% END %] >+ </tbody> >+ </table> >+ [% END %] > >+ [% IF ( notfoundbarcodes.size || notfounditemnumbers.size || cannot_be_deleted.size ) && !too_many_items_display && item_loop %] >+ <h4>The following barcodes were found: </h4> >+ [% END %] > > > <form name="f" action="batchMod.pl" method="post"> >@@ -120,17 +128,16 @@ > [% IF item_loo.nomod %] > <td class="error">Cannot delete</td> > [% ELSE %] >- [% SET can_be_deleted = item_loo.item.safe_to_delete %] >- [% IF can_be_deleted == 1 %] >+ [% IF item_loo.safe_to_delete == 1 %] > <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" checked="checked" /></td> > [% ELSE %] >- [% SWITCH can_be_deleted %] >+ [% SWITCH item_loo.safe_to_delete%] > [% 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 belong 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 "last_item_for_hold" %][% SET cannot_delete_reason = t("Last item for bibliographic record with biblio-level hold on it") %] >- [% CASE %][% SET cannot_delete_reason = t("Unknown reason") _ '(' _ can_be_deleted _ ')' %] >+ [% CASE %][% SET cannot_delete_reason = t("Unknown reason") _ '(' _ item_loo.safe_to_delete _ ')' %] > [% END %] > > <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" disabled="disabled" title="[% cannot_delete_reason | html %]"/></td> >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index fa4a86ec96..4c8edebe87 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -711,13 +711,21 @@ sub BuildItemsData{ > $row_data{holds} = $row->{holds}; > $row_data{item_holds} = $row->{item_holds}; > $row_data{item} = $row->{item}; >+ $row_data{safe_to_delete} = $row->{item}->safe_to_delete; > my $is_on_loan = C4::Circulation::IsItemIssued( $row->{itemnumber} ); > $row_data{onloan} = $is_on_loan ? 1 : 0; > push(@item_value_loop,\%row_data); > } > my @header_loop=map { { header_value=> $witness{$_}} } @witnesscodessorted; > >- return { item_loop => \@item_value_loop, item_header_loop => \@header_loop }; >+ my @cannot_be_deleted = map { >+ $_->{safe_to_delete} == 1 ? () : $_->{item}->barcode >+ } @item_value_loop; >+ return { >+ item_loop => \@item_value_loop, >+ cannot_be_deleted => \@cannot_be_deleted, >+ item_header_loop => \@header_loop >+ }; > } > > #BE WARN : it is not the general case >-- >2.11.0
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 28353
:
121089
|
121504
|
121577