Bugzilla – Attachment 152236 Details for
Bug 13870
Add warnings about subscriptions and orders when deleting items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13870: Add columns in batch delete mode
Bug-13870-Add-columns-in-batch-delete-mode.patch (text/plain), 5.63 KB, created by
Thibaud Guillot (thibaud_g)
on 2023-06-09 10:35:00 UTC
(
hide
)
Description:
Bug 13870: Add columns in batch delete mode
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2023-06-09 10:35:00 UTC
Size:
5.63 KB
patch
obsolete
>From 8b460f65ec2567d443893b5cd3a4875f6b188cac Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Fri, 9 Jun 2023 12:31:23 +0200 >Subject: [PATCH] Bug 13870: Add columns in batch delete mode > >--- > .../prog/en/includes/html_helpers.inc | 19 +++++++++++++++ > tools/batchMod.pl | 24 ++++++++++++++++--- > 2 files changed, 40 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >index f0d695bc9c..e0aa25408c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >@@ -258,6 +258,8 @@ > [% END %] > <th class="anti-the">Title</th> > <th class="holds_count" title="Item holds / Total holds">Holds</th> >+ <th class="linked_order" title="Linked order">Linked order</th> >+ <th class="linked_subscription" title="Linked subscription">Linked subscription</th> > [% FOREACH item_header IN headers %] > [% IF item_header.column_name %] > <th data-colname="[% item_header.column_name | html %]"> >@@ -272,6 +274,9 @@ > <tbody> > [% FOREACH item IN items %] > [% SET can_be_edited = !item.nomod && !( Koha.Preference('IndependentBranches') && ! logged_in_user && item.homebranch != Branches.GetLoggedInBranchname() ) %] >+ [% SET current_itemnumber = item.itemnumber %] >+ [% SET linked_order = linked_orders_subscriptions.$current_itemnumber %] >+ [% SET linked_subscription = linked_orders_subscriptions.$current_itemnumber.subscription %] > > <tr> > <td>[% item.index + 1 | html %]</td> >@@ -342,6 +347,20 @@ > [% END %] > </a> > </td> >+ <td class="linked_order"> >+ [% IF linked_order.ordernumber %] >+ <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% linked_order.basket | uri %]" title="See basket details">[% linked_order.ordernumber | html %]<a> >+ [% ELSE %] >+ None >+ [% END %] >+ </td> >+ <td class="linked_subscription"> >+ [% IF linked_subscription %] >+ <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% linked_subscription | uri %]" title="Subscription id [% linked_subscription | html %]">Subscription details<a> >+ [% ELSE %] >+ None >+ [% END %] >+ </td> > [% FOREACH header IN headers %] > [% SET attribute = header.attribute %] > [% IF header.attribute AND date_fields.grep('^' _ attribute _ '$').size %] >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index 6c252ff849..e0bd493cf9 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -26,6 +26,7 @@ use C4::Auth qw( get_template_and_user haspermission ); > use C4::Output qw( output_html_with_http_headers ); > use C4::Circulation qw( barcodedecode ); > use C4::Context; >+use C4::Acquisition qw( GetOrderFromItemnumber ); > use MARC::File::XML; > use List::MoreUtils qw( uniq ); > use Encode qw( encode_utf8 ); >@@ -40,6 +41,8 @@ use Koha::BackgroundJob::BatchDeleteItem; > use Koha::BackgroundJob::BatchUpdateItem; > use Koha::UI::Form::Builder::Item; > use Koha::UI::Table::Builder::Items; >+use Koha::Serial::Items; >+use Koha::Serials; > > my $input = CGI->new; > my $dbh = C4::Context->dbh; >@@ -85,6 +88,7 @@ my $nextop=""; > my $display_items; > > my @messages; >+my %linked_orders_subscriptions; > > if ( $op eq "action" ) { > >@@ -238,6 +242,19 @@ if ($op eq "show"){ > if (defined $biblionumber && !@itemnumbers){ > my $biblio = Koha::Biblios->find($biblionumber); > @itemnumbers = $biblio ? $biblio->items->get_column('itemnumber') : (); >+ foreach my $itemnumber (@itemnumbers) { >+ $linked_orders_subscriptions{$itemnumber} = []; >+ my $order = GetOrderFromItemnumber($itemnumber); >+ my $serial_id = Koha::Serial::Items->search( { itemnumber => $itemnumber } )->get_column('serialid'); >+ if ($order) { >+ $linked_orders_subscriptions{$itemnumber} = >+ { ordernumber => $order->{ordernumber}, basket => $order->{basketno} }; >+ } >+ if ($serial_id) { >+ my $subscription_id = Koha::Serials->search( { serialid => $serial_id } )->get_column('subscriptionid'); >+ $linked_orders_subscriptions{$itemnumber} = { subscription => $subscription_id }; >+ } >+ } > } > if ( my $list = $input->param('barcodelist') ) { > my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list ); >@@ -289,9 +306,10 @@ if ($op eq "show"){ > > # what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. > $template->param( >- subfields => $subfields, >- notfoundbarcodes => \@notfoundbarcodes, >- notfounditemnumbers => \@notfounditemnumbers >+ subfields => $subfields, >+ notfoundbarcodes => \@notfoundbarcodes, >+ notfounditemnumbers => \@notfounditemnumbers, >+ linked_orders_subscriptions => \%linked_orders_subscriptions, > ); > $nextop="action" > } # -- End action="show" >-- >2.25.1
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 13870
:
147641
|
152235
|
152236
|
155576
|
175440
|
176858
|
179579
|
179580
|
179581
|
179834
|
180952