From 3e0e754f565fba34ee859b0ad9666db141ab31be Mon Sep 17 00:00:00 2001
From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Date: Fri, 1 Aug 2014 23:23:48 -0300
Subject: [PATCH] Bug 12696: Remove CGI::scrolling_list from C4/Reports.pm

This patch removes only instance in this file.
Problem is that there are many template files
involved. Most of them have other instances of
scrolling_lists but is a problem for other bugs,
they will depend on this.

What is replaced is a pulldown for delimiter choices.
In all but one case the code is the same (variable name change),
and I did a little tidy of the TT code

To test:
1. Apply the patch

In all the following cases, check delimiters pulldown (Output box, bottom right)

2. Go to Reports > Statistics wizard > Acquisitions
3. Go to Reports > Statistics wizard > Patrons
4. Go to Reports > Statistics wizard > Catalog
5. Go to Reports > Statistics wizard > Circulation
6. Go to Reports > Statistics wizard > Serials
7. Go to Reports > Statistics wizard > Holds
there is a bug here, pulldown next to this must show 'CSV' option,
but shows nothing. Will be fixed

8. Go to Reports > Other > Average loan time

9. Go to Reports > Top lists > Patron checking out the most
Here there is a 'Delimiter' label before delimiters, only case
10. Go to Reports > Top lists > Most-circulated items

11. Go to Reports > Inactive > Patrons who haven't checked out
There is and inconsistency here, name of option on reports page,
and name on this report, 'Patrons with no checkouts'
---
 C4/Reports.pm                                      |   11 ++++-----
 .../prog/en/modules/reports/acquisitions_stats.tt  |   24 ++++++++++++++++----
 .../prog/en/modules/reports/bor_issues_top.tt      |   10 +++++++-
 .../prog/en/modules/reports/borrowers_out.tt       |   24 ++++++++++++++++----
 .../prog/en/modules/reports/borrowers_stats.tt     |   24 ++++++++++++++++----
 .../prog/en/modules/reports/cat_issues_top.tt      |   24 ++++++++++++++++----
 .../prog/en/modules/reports/catalogue_stats.tt     |   10 +++++++-
 .../prog/en/modules/reports/issues_avg_stats.tt    |   24 ++++++++++++++++----
 .../prog/en/modules/reports/issues_stats.tt        |   24 ++++++++++++++++----
 .../prog/en/modules/reports/reserves_stats.tt      |   24 ++++++++++++++++----
 .../prog/en/modules/reports/serials_stats.tt       |   24 ++++++++++++++++----
 11 files changed, 182 insertions(+), 41 deletions(-)

diff --git a/C4/Reports.pm b/C4/Reports.pm
index 104858e..74019c0 100644
--- a/C4/Reports.pm
+++ b/C4/Reports.pm
@@ -67,13 +67,10 @@ sub GetDelimiterChoices {
     my ($choices, $default) = $sth->fetchrow;
     my @dels = split /\|/, $choices;
 
-    return CGI::scrolling_list(
-                -name     => 'sep',
-                -id       => 'sep',
-                -default  => $default,
-                -values   => \@dels,
-                -size     => 1,
-                -multiple => 0 );
+    return {
+        values  => \@dels,
+        default => $default,
+    };
 }
 
 1;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt
index 66f4144..512f8c1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt
@@ -273,10 +273,26 @@
 
 	<fieldset class="rows">
 	<legend>Output</legend>
-<ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /> </li>
-<li><label for="outputfile">To a file:</label> 		<input type="radio" name="output" value="file" id="outputfile" /> <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" /> <label class="inline" for="MIME">Into an application
-		</label>[% CGIextChoice %]
-		[% CGIsepChoice %]</li></ol>
+    <ol>
+        <li>
+            <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
+        </li>
+        <li>
+            <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
+            <label class="inline" for="basename">Named: </label> <input type="text" name="basename" id="basename" value="Export" />
+            <label class="inline" for="MIME">Into an application</label>
+            [% CGIextChoice %]
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
+        </li>
+    </ol>
 	</fieldset>
 
 	<fieldset class="action">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt
index 1526283..0a87c6d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt
@@ -168,7 +168,15 @@ function Dopop(link) {
 			[% END %]
 			</select>
 			<label class="inline" for="sep">Delimiter: </label>
-			[% CGIseplist %]
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIseplist.values.sort() %]
+              [% IF ( value == CGIseplist.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
 		</li>
 	</ol>
 	</fieldset>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_out.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_out.tt
index 58b5622..8d76853 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_out.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_out.tt
@@ -94,10 +94,26 @@ $(document).ready(function(){
 	
 <fieldset class="rows">
 	<legend>Output</legend>
-<ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /> </li>
-<li><label for="outputfile">To a file:</label> 		<input type="radio" name="output" value="file" id="outputfile" /> <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" /> <label class="inline" for="MIME">Into an application  
-		</label>[% CGIextChoice %]
-		[% CGIsepChoice %]</li></ol>
+    <ol>
+        <li>
+            <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
+        </li>
+        <li>
+            <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
+            <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
+            <label class="inline" for="MIME">Into an application </label>
+            [% CGIextChoice %]
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
+        </li>
+    </ol>
 	</fieldset>
 
 	<fieldset class="action">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
index 37da198..9e20add 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
@@ -253,10 +253,26 @@
 	
 	<fieldset class="rows">
 	<legend>Output</legend>
-<ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /> </li>
-<li><label for="outputfile">To a file:</label> 		<input type="radio" name="output" value="file" id="outputfile" /> <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" /> <label class="inline" for="MIME">Into an application  
-		</label>[% CGIextChoice %]
-		[% CGIsepChoice %]</li></ol>
+    <ol>
+        <li>
+            <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
+        </li>
+        <li>
+            <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
+            <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
+            <label class="inline" for="MIME">Into an application</label>
+            [% CGIextChoice %]
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
+        </li>
+    </ol>
 	</fieldset>
 
 	<fieldset class="action">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt
index dba83f2..cced46a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt
@@ -164,10 +164,26 @@
 	
 	<fieldset class="rows">
 	<legend>Output</legend>
-<ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /> </li>
-<li><label for="outputfile">To a file:</label> 		<input type="radio" name="output" value="file" id="outputfile" /> <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" /> <label class="inline" for="MIME">Into an application  
-		</label>[% CGIextChoice %]
-		[% CGIsepChoice %]</li></ol>
+    <ol>
+        <li>
+            <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
+        </li>
+        <li>
+            <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
+            <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
+            <label class="inline" for="MIME">Into an application </label>
+            [% CGIextChoice %]
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
+        </li>
+    </ol>
 	</fieldset>
 
 	<fieldset class="action">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt
index 91391e8..9290ea7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt
@@ -246,7 +246,15 @@
 			[% END %]
 			</select>
 			<!-- <label class="inline" for="sep">Delimiter: </label> -->
-			[% CGIsepChoice %]
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
 		</li>
 	</ol>
 	</fieldset>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt
index 8460bf0..ffbbdd1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt
@@ -202,10 +202,26 @@
 	
 	<fieldset class="rows">
 	<legend>Output</legend>
-<ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /> </li>
-<li><label for="outputfile">To a file:</label> 		<input type="radio" name="output" value="file" id="outputfile" /> <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" /> <label class="inline" for="MIME">Into an application:  
-		</label>[% CGIextChoice %]
-		[% CGIsepChoice %]</li></ol>
+    <ol>
+        <li>
+            <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
+        </li>
+        <li>
+            <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
+            <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
+            <label class="inline" for="MIME">Into an application: </label>
+            [% CGIextChoice %]
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
+        </li>
+    </ol>
 	</fieldset>
 
 	<fieldset class="action">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt
index 54708b4..8650b4c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt
@@ -254,10 +254,26 @@
 			
 	<fieldset class="rows">
 	<legend>Output</legend>
-<ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /> </li>
-<li><label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" /> <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" /> <label class="inline" for="MIME">Into an application  
-		</label>[% CGIextChoice %]
-		[% CGIsepChoice %]</li></ol>
+    <ol>
+        <li>
+            <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
+        </li>
+        <li>
+            <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
+            <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
+            <label class="inline" for="MIME">Into an application</label>
+            [% CGIextChoice %]
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
+        </li>
+    </ol>
 	</fieldset>
 
 	<fieldset class="action">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt
index e8b2548..8e7f8b5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt
@@ -332,10 +332,26 @@
 			
 	<fieldset class="rows">
 	<legend>Output</legend>
-<ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /> </li>
-<li><label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" /> <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" /> <label class="inline" for="MIME">Into an application  
-		</label>[% CGIextChoice %]
-		[% CGIsepChoice %]</li></ol>
+    <ol>
+        <li>
+            <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
+        </li>
+        <li>
+            <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
+            <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
+            <label class="inline" for="MIME">Into an application</label>
+            [% CGIextChoice %]
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
+        </li>
+    </ol>
 	</fieldset>
 
 	<fieldset class="action">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt
index cd8bf70..90e96ec 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt
@@ -113,10 +113,26 @@
 
 	<fieldset class="rows">
 	<legend>Output</legend>
-<ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /> </li>
-<li><label for="outputfile">To a file:</label> 		<input type="radio" name="output" value="file" id="outputfile" /> <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
-		<label class="inline" for="MIME">Into an application</label>[% CGIextChoice %]
-		[% CGIsepChoice %]</li></ol>
+    <ol>
+        <li>
+            <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
+        </li>
+        <li>
+            <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
+            <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
+            <label class="inline" for="MIME">Into an application</label>
+            [% CGIextChoice %]
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value %]" selected="selected">[% value %]</option>
+              [% ELSE %]
+                <option value="[% value %]">[% value %]</option>
+              [% END %]
+            [% END %]
+            </select>
+        </li>
+    </ol>
 	</fieldset>
 
 	<fieldset class="action">
-- 
1.7.9.5