From 33b0a6e2db8d0fbfbb57831727c569af8cd88086 Mon Sep 17 00:00:00 2001
From: Aleisha <aleishaamohia@hotmail.com>
Date: Fri, 29 Apr 2016 03:00:28 +0000
Subject: [PATCH] Bug 16389: Reports row limit should change upon option
 selection

To test:
1) Run a report
2) Confirm there is no 'Update' button next to the 'Rows per page:' dropdown
3) Change the limit (i.e. to 10)
4) Confirm the page updates itself

Sponsored-by: Catalyst IT
---
 .../prog/en/modules/reports/guided_reports_start.tt           |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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 dee52ed..81e844f 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
@@ -67,6 +67,9 @@ function load_group_subgroups () {
 }
 
 $(document).ready(function(){
+    $('#limit').change(function() {
+        $('#limitselect').submit();
+    });
 
 [% IF (saved1) %]
     var rtable = $("#table_reports").dataTable($.extend(true, {}, dataTablesDefaults, {
@@ -794,7 +797,7 @@ canned reports and writing custom SQL reports.</p>
 [% IF ( unlimited_total ) %]<p>Total number of rows matching the (unlimited) query is [% unlimited_total %].</p>[% END %]
 <pre id="sql_output">[% sql |html %]</pre>
 
-<form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
+<form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
     <input type="hidden" name="phase" value="Run this report"/>
     <input type="hidden" name="reports" value="[% report_id %]"/>
 
@@ -803,7 +806,7 @@ canned reports and writing custom SQL reports.</p>
     [% END %]
 
     <label for="limit">Rows per page: </label>
-    <select name="limit">
+    <select name="limit" id="limit">
         [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
         [% FOREACH l IN limits %]
                 [% IF l == limit %]
@@ -813,8 +816,6 @@ canned reports and writing custom SQL reports.</p>
                 [% END %]
         [% END %]
     </select>
-
-    <input type="submit" value="Update" />
 </form>
 
 <div class="pages">[% pagination_bar %]</div>
-- 
1.7.10.4