From f31513ee0f91d85d54d17525ef11226431396354 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 10 Mar 2021 15:25:00 +0100 Subject: [PATCH] Bug 27893: Display the number of orders on the batch record deletion --- .../prog/en/modules/tools/batch_delete_records.tt | 12 ++++++++++++ tools/batch_delete_records.pl | 10 ++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt index 1cd8e0793a..99e50f2e8f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt @@ -1,6 +1,8 @@ [% USE raw %] [% USE Asset %] +[% USE Context %] [% SET footerjs = 1 %] +[% PROCESS 'i18n.inc' %] [% PROCESS 'authorities-search-results.inc' %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Batch record deletion @@ -143,6 +145,7 @@ Items Holds Checkouts + Orders @@ -154,6 +157,15 @@ [% biblio.itemnumbers.size | html %] [% biblio.holds_count | html %] [% biblio.issues_count | html %] + + [% IF biblio.current_orders_count %] + [% tnpx('pluralization', '1 current order', '{count} current orders', biblio.current_orders_count, { count = biblio.current_orders_count }) | $raw %] + [% END %] + [% IF biblio.current_orders_count && biblio.cancelled_orders_count %]
[% END %] + [% IF biblio.cancelled_orders_count %] + [% tnpx('pluralization', '1 cancelled order', '{count} cancelled orders', biblio.cancelled_orders_count, { count = biblio.cancelled_orders_count }) | $raw %] + [% END %] + [% END %] diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl index ea87d8b6c8..ca4c6d5c66 100755 --- a/tools/batch_delete_records.pl +++ b/tools/batch_delete_records.pl @@ -81,8 +81,8 @@ if ( $op eq 'form' ) { for my $record_id ( uniq @record_ids ) { if ( $recordtype eq 'biblio' ) { # Retrieve biblio information - my $biblio = Koha::Biblios->find( $record_id ); - unless ( $biblio ) { + my $biblio_object = Koha::Biblios->find( $record_id ); + unless ( $biblio_object ) { push @messages, { type => 'warning', code => 'biblio_not_exists', @@ -90,12 +90,14 @@ if ( $op eq 'form' ) { }; next; } - my $holds_count = $biblio->holds->count; - $biblio = $biblio->unblessed; + my $holds_count = $biblio_object->holds->count; + my $biblio = $biblio_object->unblessed; my $record = &GetMarcBiblio({ biblionumber => $record_id }); $biblio->{itemnumbers} = [Koha::Items->search({ biblionumber => $record_id })->get_column('itemnumber')]; $biblio->{holds_count} = $holds_count; $biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id ); + $biblio->{current_orders_count} = $biblio_object->orders->filter_by_current->count; + $biblio->{cancelled_orders_count} = $biblio_object->orders->filter_by_cancelled->count; push @records, $biblio; } else { # Retrieve authority information -- 2.20.1