From 4144bf56d1527e41070d95ff1f3127fc98006283 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 16 Dec 2013 17:02:25 +0100 Subject: [PATCH] Bug 11395: The modification template should be changed on the list view This patch fixes the following issue: If the user comes from a basket, the list view is displayed but there is no way to select the modification template. Now the template can be chosen on the list view. This way, the user is able to change the modifications to apply and see the previewed records. Signed-off-by: Brendan Gallagher Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- .../tools/batch_record_modification.tt | 61 +++++++++++++------ tools/batch_record_modification.pl | 4 +- 2 files changed, 45 insertions(+), 20 deletions(-) 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 2ce3481a68..b9433e7a56 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 @@ -41,7 +41,24 @@ $(document).ready(function() { })); $("#mainformsubmit").click(function(){ - return submitBackgroundJob(document.getElementById("process")); + if ( $("#marc_modification_template_id").val() > 0 ) { + return submitBackgroundJob(document.getElementById("process")); + } + alert(_("Please select a modification template.")); + return false; + }); + + $("#marc_modification_template_id").change(function(){ + var url = "/cgi-bin/koha/svc/records/preview?" + var mmtid = $(this).val(); + $("a.preview").each(function(){ + $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid); + }); + }); + + $("a.preview").click(function(){ + // Equivalent to rel="gb_page_center[600,500]" + return GB_showCenter(_("Preview MARC"), this.href , 600, 500); }); }); @@ -138,12 +155,23 @@ $(document).ready(function() { [% ELSIF view == 'list' %] [% IF records %] - [% IF recordtype == 'biblio' %] - -
+ + + + [% IF recordtype == 'biblio' %] + @@ -159,19 +187,17 @@ $(document).ready(function() { - [% END %]
[% biblio.biblionumber %] [% biblio.title %]Preview MARC - + Preview MARC
Reminder: this action will modify all selected biblios!
- [% ELSE %] - - + [% ELSE %] + @@ -187,20 +213,19 @@ $(document).ready(function() { - [% END %]
[% authority.authid %] [% PROCESS authresult summary=authority.summary %]Preview MARC + Preview MARC
Reminder: this action will modify all selected authorities!
- [% END %] + [% END %]
- Cancel
diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl index bec2f9e0cd..d16b5476a6 100755 --- a/tools/batch_record_modification.pl +++ b/tools/batch_record_modification.pl @@ -65,7 +65,7 @@ if ( $completedJobID ) { exit; } -my @templates = GetModificationTemplates(); +my @templates = GetModificationTemplates( $mmtid ); unless ( @templates ) { $op = 'error'; $template->param( @@ -91,7 +91,6 @@ if ( $op eq 'form' ) { # Display the form $template->param( view => 'form', - MarcModificationTemplatesLoop => \@templates, ); } elsif ( $op eq 'list' ) { # List all records to process @@ -256,6 +255,7 @@ if ( $op eq 'form' ) { $template->param( messages => \@messages, recordtype => $recordtype, + MarcModificationTemplatesLoop => \@templates, ); output_html_with_http_headers $input, $cookie, $template->output; -- 2.39.5