From 414ab9b166a0f4d18138f6129ccb73a7806976cf Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 24 Jun 2019 18:48:29 +0000 Subject: [PATCH] Bug 23197: Add more batch operation options to SQL report results This patch extends the feature which allows the user to send item numbers from a page of report results to batch item modification. For biblionumbers: Batch record modification, batch record deletion, and add to list are now available. For item numbers: batch item deletion is added. A new menu button is added for these options at the top of report results, removing the button from the item number column header. Corresponding CSS has been removed. To test, apply the patch and create a report which includes both biblionumber and itemnumber columns in the results. - Run the report and confirm that a new "Batch operations" button appears at the top of the results. Test each option: - Batch record modification - Batch record deletion - Add to list - Batch item modification - Batch item deletion In each case the correct set of parameters should be passed to the batch operations. Test with reports which return only biblionumbers, only itemnumbers, and neither. Signed-off-by: Maryse Simard Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- koha-tmpl/intranet-tmpl/prog/css/reports.css | 11 -- .../modules/reports/guided_reports_start.tt | 159 +++++++++++++++--- 2 files changed, 134 insertions(+), 36 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/reports.css b/koha-tmpl/intranet-tmpl/prog/css/reports.css index fa8e13e5da..ef60a95adc 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/reports.css +++ b/koha-tmpl/intranet-tmpl/prog/css/reports.css @@ -36,17 +36,6 @@ del { font-family: monospace; } -.send_to_item_mod { - background-color: #EBF3FF; - border: 1px solid #88b0e8; - border-radius: 5px; - display: inline-block; - font-size: 75%; - margin: 3px 5px; - padding: 3px 5px; - white-space: nowrap; -} - .filter { background-color: #EBF3FF; border-radius: 5px; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index 58ff9e3acd..ba2dc6dbe9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -731,6 +731,104 @@ canned reports and writing custom SQL reports.

+[% IF ( execute ) %] + [% UNLESS ( errors ) %] +
+ + + [% # Preserve the whitespace of the following textarea in order to format the values correctly %] + +
+ +
+ + + [% # Preserve the whitespace of the following textarea in order to format the values correctly %] + +
+ +
+ + [% FOREACH result IN results %] + [% FOREACH cells IN result.cells %] + [% place = loop.index %] + [% IF header_row.$place.cell == 'itemnumber' %] + [% SET batch_itemnumbers = 1 %] + + [% END %] + [% END %] + [% END %] +
+ +
+ + + [% FOREACH result IN results %] + [% FOREACH cells IN result.cells %] + [% place = loop.index %] + [% IF header_row.$place.cell == 'itemnumber' %] + [% SET batch_itemnumbers = 1 %] + + [% END %] + [% END %] + [% END %] +
+ +
+ [% FOREACH result IN results %] + [% FOREACH cells IN result.cells %] + [% place = loop.index %] + [% IF header_row.$place.cell == 'biblionumber' %] + [% SET batch_biblionumbers = 1 %] + + [% END %] + [% END %] + [% END %] +
+ + [% IF ( batch_biblionumbers || batch_itemnumbers ) %] +

+

+

+ [% END %] + [% END # UNLESS ( errors ) %] +[% END # IF ( execute ) %] +
@@ -757,34 +855,20 @@ canned reports and writing custom SQL reports.

[% pagination_bar | $raw %]
[% UNLESS ( errors ) %] - - - +
+ + [% FOREACH header_ro IN header_row %] + + [% END %] + + [% FOREACH result IN results %] - [% FOREACH header_ro IN header_row %] - [% IF header_ro.cell == 'itemnumber' %] - - [% ELSE %] - - [% END %] + [% FOREACH cells IN result.cells %] + [% END %] - [% FOREACH result IN results %] - - [% FOREACH cells IN result.cells %] - [% place = loop.index %] - [% IF header_row.$place.cell == 'itemnumber' %] - - [% END %] - - [% END %] - - [% END %] -
[% header_ro.cell | html %]
- [% header_ro.cell | html %] - [% header_ro.cell | html %][% cells.cell | $raw %]
[% cells.cell | $raw %]
-
- + [% END %] + [% END %] [% INCLUDE 'chart.inc' %] @@ -1426,6 +1510,17 @@ canned reports and writing custom SQL reports.

$("#mana_result_content").html(""); $("#mana_search_field").val(""); }); + + $(".batch_op").on("click", function(e){ + e.preventDefault(); + var target_form = $(this).data("submit"); + $("#" + target_form ).submit(); + }); + + $("#batch_add_to_list").on("submit", function(e){ + e.preventDefault(); + addToList(); + }); }); function addColumn() { @@ -1502,6 +1597,20 @@ canned reports and writing custom SQL reports.

} }); } + + function addToList() { + var biblionumbers = []; + $(".bib_to_list").each(function() { + var biblionumber = Number( $(this).val() ); + if( biblionumbers.indexOf( biblionumber ) < 0 ){ + biblionumbers.push( biblionumber ); + } + }); + bibs = biblionumbers.join("/"); + var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs; + window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes'); + return false; + } [% END %] -- 2.39.5