Bug 14279: Remove CGI::scrolling_list from issues_avg_stats.pl
authorBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tue, 26 May 2015 17:45:22 +0000 (14:45 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 1 Jun 2015 17:21:58 +0000 (14:21 -0300)
This patch removes scrolling_lists from this file

To test
1) Go to Reports > Average loan time
2) Check dropdowns Patron category, Item type, Sort1/2 and Into application
will be changed
3) Apply the patch
4) Reload and check for regression

Followed test plan. Works as expected.
Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt
reports/issues_avg_stats.pl

index ce4bf86..67d0a13 100644 (file)
                                <td>Patron category</td>
                                <td><input type="radio" name="Line" value="borrowers.categorycode" /></td>
                                <td><input type="radio" name="Column" value="borrowers.categorycode" /></td>
-                               <td>[% CGIBorCat %]</td>
+                <td>
+                    <select name="Filter" size="1" id="borcat">
+                        <option value=""></option>
+                        [% FOREACH value IN BorCat.values %]
+                        <option value="[%- value -%]">[%- BorCat.labels.$value -%]</option>
+                        [% END %]
+                    </select>
+                </td>
                        </tr>
                        <tr>
                                <td>Item type</td>
                                <td><input type="radio" name="Line" value="itemtype" /></td>
                                <td><input type="radio" name="Column" value="itemtype" /></td>
-                               <td >[% CGIItemType %]</td>
+                <td>
+                    <select name="Filter" size="1" id="itemtypes">
+                        <option value=""></option>
+                        [% FOREACH value IN ItemType.values %]
+                        <option value="[%- value -%]">[%- ItemType.labels.$value -%]</option>
+                        [% END %]
+                    </select>
+                </td>
                        </tr>
                        <tr class="hilighted">
                                <td>Library</td>
                                <td><input type="radio" name="Line" value="branchcode" /></td>
                                <td><input type="radio" name="Column" value="branchcode" /></td>
-                           <td><select name="Filter" size="1" id="branch">
-                                    <option value=""></option>
-                                [%- FOREACH branchloo IN branchloop %]
-                                    <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
-                                [%- END %]
-                                    </select>
-                                </td>
+                <td>
+                    <select name="Filter" size="1" id="branch">
+                        <option value=""></option>
+                        [%- FOREACH branchloo IN branchloop %]
+                        <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
+                        [%- END %]
+                    </select>
+                </td>
                        </tr>
                        [% IF ( hassort1 ) %]
                                <tr class="hilighted"> 
                                        <td>Sort1</td>
                                        <td><input type="radio" name="Line" value="borrowers.sort1" /></td>
                                        <td><input type="radio" name="Column" value="borrowers.sort1" /></td>
-                                       <td>[% CGISort1 %] </td>
+                    <td>
+                        <select name="Filter" size="1" id="sort1">
+                            <option value=""></option>
+                            [%- FOREACH value IN Sort1.values %]
+                            <option value="[%- value -%]">[%- value -%]</option>
+                            [%- END %]
+                        </select>
+                    </td>
                                </tr>
                        [% END %]
                        [% IF ( hassort2 ) %]
                                        <td>Sort2</td>
                                        <td><input type="radio" name="Line" value="borrowers.sort2" /></td>
                                        <td><input type="radio" name="Column" value="borrowers.sort2" /></td>
-                                       <td>[% CGISort2 %] </td>
+                    <td>
+                        <select name="Filter" size="1" id="sort2">
+                            <option value=""></option>
+                            [%- FOREACH value IN Sort2.values %]
+                            <option value="[%- value -%]">[%- value -%]</option>
+                            [%- END %]
+                        </select>
+                    </td>
                                </tr>
                        [% END %]
                </tbody>
             <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="MIME"  size="1" id="MIME">
+                <option value="CSV">CSV</option>
+            </select>
             <select name="sep" id="sep" size="1">
             [% FOREACH value IN CGIsepChoice.values.sort() %]
               [% IF ( value == CGIsepChoice.default ) %]
index 90c1e4e..772acd6 100755 (executable)
@@ -115,94 +115,70 @@ if ($do_it) {
 } else {
     my $dbh = C4::Context->dbh;
     my @values;
-    my %labels;
-    my %select;
     my $req;
     $req = $dbh->prepare("select distinctrow categorycode,description from categories order by description");
     $req->execute;
-    my @select;
-    push @select,"";
-    $select{""}="";
+    my %labelsc;
+    my @selectc;
     while (my ($value, $desc) =$req->fetchrow) {
-        push @select, $value;
-        $select{$value}=$desc;
+        push @selectc, $value;
+        $labelsc{$value} = $desc;
     }
-    my $CGIBorCat=CGI::scrolling_list( -name     => 'Filter',
-                -id => 'borcat',
-                -values   => \@select,
-                -labels   => \%select,
-                -size     => 1,
-                -multiple => 0 );
+    my $BorCat = {
+        values   => \@selectc,
+        labels   => \%labelsc,
+    };
     
     $req = $dbh->prepare( "select distinctrow itemtype,description from itemtypes order by description");
     $req->execute;
-    undef @select;
-    undef %select;
-    push @select,"";
-    $select{""}="";
+    my @selecti;
+    my %labelsi;
     while (my ($value,$desc) =$req->fetchrow) {
-        push @select, $value;
-        $select{$value}=$desc;
+        push @selecti, $value;
+        $labelsi{$value}=$desc;
     }
-    my $CGIItemTypes=CGI::scrolling_list( -name     => 'Filter',
-                -id => 'itemtypes',
-                -values   => \@select,
-                -labels    => \%select,
-                -size     => 1,
-                -multiple => 0 );
+    my $ItemTypes = {
+        values   => \@selecti,
+        labels    => \%labelsi,
+    };
     
     $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1");
     $req->execute;
-    undef @select;
-    push @select,"";
+    my @selects1;
     my $hassort1;
     while (my ($value) =$req->fetchrow) {
         $hassort1 =1 if ($value);
-        push @select, $value;
+        push @selects1, $value;
     }
-    
-    my $CGISort1=CGI::scrolling_list( -name     => 'Filter',
-                -id => 'sort1',
-                -values   => \@select,
-                -size     => 1,
-                -multiple => 0 );
+    my $Sort1 = {
+        values   => \@selects1,
+    };
     
     $req = $dbh->prepare("select distinctrow sort2 from borrowers where sort2 is not null order by sort2");
     $req->execute;
-    undef @select;
-    push @select,"";
+    my @selects2;
     my $hassort2;
     my $hglghtsort2;
     while (my ($value) =$req->fetchrow) {
         $hassort2 =1 if ($value);
         $hglghtsort2= !($hassort1);
-        push @select, $value;
+        push @selects2, $value;
     }
-    my $CGISort2=CGI::scrolling_list( -name     => 'Filter',
-                -id => 'sort2',
-                -values   => \@select,
-                -size     => 1,
-                -multiple => 0 );
-    
-    my $CGIextChoice=CGI::scrolling_list(
-                -name     => 'MIME',
-                -id       => 'MIME',
-                -values   => ['CSV'], # FIXME translation
-                -size     => 1,
-                -multiple => 0 );
+    my $Sort2 = {
+        values   => \@selects2,
+    };
     
     my $CGIsepChoice=GetDelimiterChoices;
     
     $template->param(
-                    CGIBorCat    => $CGIBorCat,
-                    CGIItemType  => $CGIItemTypes,
+                    BorCat       => $BorCat,
+                    ItemType     => $ItemTypes,
                     branchloop   => GetBranchesLoop(),
                     hassort1     => $hassort1,
                     hassort2     => $hassort2,
                     HlghtSort2   => $hglghtsort2,
-                    CGISort1     => $CGISort1,
-                    CGISort2     => $CGISort2,
-                    CGIextChoice => $CGIextChoice,
+                    Sort1        => $Sort1,
+                    Sort2        => $Sort2,
                     CGIsepChoice => $CGIsepChoice
                     );
 output_html_with_http_headers $input, $cookie, $template->output;