From 6c7647323e1a9b5f09c276214cb8d76e5f3b49a2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 11 Jun 2020 12:40:03 +0200 Subject: [PATCH] Bug 22417: Restore the 'add to list' feature Content-Type: text/plain; charset=utf-8 This feature has been added recently by bug 18127. It highlights the need of a post processing hook. Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Cook Signed-off-by: Marcel de Rooy --- admin/background_jobs.pl | 4 ++- .../prog/en/modules/admin/background_jobs.tt | 41 ++++++++++++++-------- .../en/modules/tools/batch_record_modification.tt | 17 --------- tools/batch_record_modification.pl | 2 -- 4 files changed, 29 insertions(+), 35 deletions(-) diff --git a/admin/background_jobs.pl b/admin/background_jobs.pl index 4eacc8c4d4..85dd740b40 100755 --- a/admin/background_jobs.pl +++ b/admin/background_jobs.pl @@ -24,8 +24,8 @@ use C4::Context; use C4::Auth; use C4::Output; -use Koha::BackgroundJob; use Koha::BackgroundJobs; +use Koha::Virtualshelves; my $input = new CGI; my $op = $input->param('op') || 'list'; @@ -50,6 +50,8 @@ if ( $op eq 'view' ) { $template->param( job => $job, ); + $template->param( lists => scalar Koha::Virtualshelves->search([{ category => 1, owner => $loggedinuser }, { category => 2 }]) ) + if $job->type eq 'batch_biblio_record_modification'; } else { $op = 'list'; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt index 8be94aa65b..e105889606 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt @@ -51,6 +51,16 @@ [% IF report.total_records == report.total_success %]
All records have successfully been modified! New batch record modification + [% IF lists.count %] +
+ Add modified records to the following list: + + [% END %]
[% ELSE %]
@@ -95,21 +105,6 @@ Bibliographic record [% m.biblionumber | html %] has not been modified. An error occurred on modifying it.[% IF m.error %] ([% m.error %])[% END %]. [% CASE 'biblio_modified' %] Bibliographic record [% m.biblionumber | html %] has successfully been modified. -

Next steps

-
    -
  • New batch record modification - [% IF lists.count %] -
  • - - -
  • - [% END %] -
[% END %]
[% END %] @@ -224,6 +219,22 @@ "iDisplayLength": 10, "sPaginationType": "full_numbers" })); + + $("#add_bibs_to_list").change(function(){ + var selected = $("#add_bibs_to_list").find("option:selected"); + if ( selected.attr("class") == "shelf" ){ + var shelfnumber = selected.attr("value"); + var bibs = new Array(); + [% FOREACH message IN job.messages %] + [% IF message.code == 'biblio_modified' %] + bibs.push("biblionumber="+[% message.biblionumber | html %]); + [% END %] + [% END %] + var bibstring = bibs.join("&"); + window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&'+bibstring, 'popup', 'width=500,height=500,toolbar=false,scrollbars=yes,resizeable=yes'); + return false; + } + }); }); [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt index 973ec4185e..140d3885aa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt @@ -363,23 +363,6 @@ $("#marcPreviewLabel").html(""); $("#marcPreview .modal-body").html("
\"\" " + _("Loading") + "
"); }); - - $("#add_bibs_to_list").change(function(){ - var selected = $("#add_bibs_to_list").find("option:selected"); - if ( selected.attr("class") == "shelf" ){ - var shelfnumber = selected.attr("value"); - var bibs = new Array(); - [% FOREACH message IN messages %] - [% IF message.code == 'biblio_modified' %] - bibs.push("biblionumber="+[% message.biblionumber | html %]); - [% END %] - [% END %] - var bibstring = bibs.join("&"); - window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&'+bibstring, 'popup', 'width=500,height=500,toolbar=false,scrollbars=yes,resizeable=yes'); - return false; - } - }); - }); [% END %] diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl index f4794c58e7..b28390d297 100755 --- a/tools/batch_record_modification.pl +++ b/tools/batch_record_modification.pl @@ -53,8 +53,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ flagsrequired => { tools => 'records_batchmod' }, }); -$template->param( lists => scalar Koha::Virtualshelves->search([{ category => 1, owner => $loggedinuser }, { category => 2 }]) ); - my $sessionID = $input->cookie("CGISESSID"); my @templates = GetModificationTemplates( $mmtid ); -- 2.11.0