From a2ef93c7e54d45254f79d62e389aa04f089f817f Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 13 Jun 2024 10:59:54 +0000 Subject: [PATCH] Bug 37116: Redirect to batch serial modification when batch modifying items --- .../en/includes/modals/edit_serial_issues.inc | 18 ++++++++++--- .../prog/en/modules/tools/batchMod-edit.tt | 11 +++++++- .../intranet-tmpl/prog/js/pages/batchMod.js | 16 +++++++++++ tools/batchMod.pl | 27 ++++++++++++++++--- 4 files changed, 64 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/edit_serial_issues.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/edit_serial_issues.inc index 53a1c03e1a..7b227e5d18 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/edit_serial_issues.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/edit_serial_issues.inc @@ -9,11 +9,23 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt index 1b442b5fcf..77e91a8684 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -162,6 +162,9 @@ + [% FOREACH linked_serial_id IN linked_serial_ids %] + + [% END %] [% IF biblionumber %] [% END %] @@ -237,7 +240,12 @@
- + [% IF linked_serials %] + + + [% ELSE %] + + [% END %] Cancel
@@ -260,6 +268,7 @@ [% END %] + [% INCLUDE 'modals/edit_serial_issues.inc' batch=1 %] [% MACRO jsinclude BLOCK %] [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js b/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js index 128c37909f..5366155034 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js @@ -116,6 +116,11 @@ function hideAllColumns() { Cookies.set("showColumns", cookieString, { expires: date, path: '/', sameSite: 'Lax' }); } +function ShowSerialEditingConfirmation(form) { + $('#edit-serial-issues-modal').modal(); + return false; +} + $(document).ready(function () { var items_table = KohaTable("itemst", { "columnDefs": [ @@ -165,4 +170,15 @@ $(document).ready(function () { } } }); + $(document).on('click', '#edit-serial-issues-modal-btn-submit', function (e) { + e.preventDefault(); + $('#edit-serial-issues-modal').modal('hide'); + $('#edit-serial-issues').val('1'); + return $("form[name='f'").submit(); + }); + $(document).on('click', '#no-edit-serial-issues-modal-btn-submit', function (e) { + e.preventDefault(); + $('#edit-serial-issues-modal').modal('hide'); + return $("form[name='f'").submit(); + }); }); diff --git a/tools/batchMod.pl b/tools/batchMod.pl index e6dc6ded99..5890ca8cfa 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -182,10 +182,20 @@ if ( $op eq "cud-action" ) { }; try { - my $job_id = - Koha::BackgroundJob::BatchUpdateItem->new->enqueue($params); - $nextop = 'enqueued'; - $template->param( job_id => $job_id, ); + # my $job_id = + # Koha::BackgroundJob::BatchUpdateItem->new->enqueue($params); + # $nextop = 'enqueued'; + # $template->param( job_id => $job_id, ); + + if ( $input->param('edit-serial-issues') ) { + my @linked_serial_ids = $input->multi_param('linked_serial_id'); + my $redirect_url = "/cgi-bin/koha/serials/serials-edit.pl?"; + for my $serial_id (@linked_serial_ids) { + $redirect_url .= "serialid=$serial_id&"; + } + print $input->redirect($redirect_url); + exit; + } } catch { push @messages, @@ -269,6 +279,15 @@ if ($op eq "cud-show" || $op eq "show"){ $template->param(itemnumbers_array => \@itemnumbers); } + my @linked_serial_ids; + foreach my $itemnumber (@itemnumbers) { + my $item = Koha::Items->find($itemnumber); + my $serialid = $item->serial_item->serialid; + push( @linked_serial_ids, $serialid ) if $serialid; + } + $template->param( linked_serial_ids => \@linked_serial_ids ); + $template->param( linked_serials => 1 ) if scalar(@linked_serial_ids) > 0; + # now, build the item form for entering a new item # Getting list of subfields to keep when restricted batchmod edit is enabled -- 2.39.3 (Apple Git-146)