Bug 2553 [Serials report] alphabetize dropdown menus
authorOwen Leonard <oleonard@myacpl.org>
Thu, 23 Aug 2012 14:08:27 +0000 (10:08 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 4 Sep 2012 16:28:59 +0000 (18:28 +0200)
Rebase of a patch originally submitted by gcollum@gmail.com
Original commit message:

Improvement on the previous patch through the use of GetBranchesLoop.
Added code so that the logged in location will be the location that
is selected by default.

Fixed a couple of minor xhtml errors.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt
reports/serials_stats.pl

index c42bc45..af51a4c 100644 (file)
                                        [% END %]
                            </select>
                        </li><li>
-                       <label for="branch">
+                <label for="branchcode">
                                        Library:
                        </label>
                        <select name="branchcode"  id="branchcode">
                                <option value="">Any library</option>
-                               [% FOREACH branche IN branches %]
-                                               <option value="[% branche.branchcode %]">[% branche.branchname %]</option>
+                    [% FOREACH branche IN branches %]
+                        [% IF ( branche.selected ) %]
+                            <option value="[% branche.value %]" selected="selected">[% branche.branchname %]</option>
+                        [% ELSE %]
+                            <option value="[% branche.value %]">[% branche.branchname %]</option>
+                        [% END %]
                                        [% END %]
                        </select>
 
                    </li>
                    <li>
                        <label for="expired">Include expired subscriptions: </label>
-                       <input type="checkbox" name="expired" />
+                <input type="checkbox" name="expired" id="expired" />
                    </li>
                </ol>
        </fieldset>
index ff80b2f..9aff54b 100755 (executable)
@@ -140,19 +140,7 @@ if($do_it){
     while(my $row = $sth->fetchrow_hashref){
         push(@booksellers,$row)
     }
-   
-    ## We generate branchlist
-    my $branches=GetBranches();
-       my @branchloop;
-       foreach (sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches) {
-               my $thisbranch = ''; # FIXME: populate $thisbranch to preselect one
-               my %row = (branchcode => $_,
-                       selected => ($thisbranch eq $_ ? 1 : 0),
-                       branchname => $branches->{$_}->{'branchname'},
-               );
-               push @branchloop, \%row;
-       } 
-    
+
        my $CGIextChoice=CGI::scrolling_list(
                                -name => 'MIME',
                                -id => 'MIME',
@@ -164,7 +152,7 @@ if($do_it){
                CGIextChoice => $CGIextChoice,
                CGIsepChoice => $CGIsepChoice,
         booksellers  => \@booksellers,
-        branches     => \@branchloop);
+        branches     => GetBranchesLoop(C4::Context->userenv->{'branch'}));
 }
 
 output_html_with_http_headers $input, $cookie, $template->output;