Bug 9457: [ENH] Ordering branches should be case independent (2)
authorBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Wed, 23 Jan 2013 14:44:41 +0000 (11:44 -0300)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Wed, 20 Mar 2013 19:35:58 +0000 (15:35 -0400)
This patch replace use of CGI::scroll_list() to show list of branches.

In two files, marc21_linking_section.pl and unimarc_field_4XX.pl,
the scrolling list is created but not used in the template file,
so the code is removed.

Also minor renaming/normalizing of variables.

To test:
1) Install with some branches, records and patrons

2.1) Select a record, click 'Place hold', select user,
     there is a library pull-down next to 'Pickup at:',
     list is ordered case sensitive
2.2) Go to Reports > Average loan time,
     next to Library is a pull-down,
     list without order
2.3) Go to Reports > Catalog by item type,
     next to 'Select a library' is a pull-down,
     list is ordered case sensitive
2.4) This is tricky, go to Reports home,
     change last part of URL 'reports-home.pl' with
     'manager.pl?report_name=issues_by_borrower_category'
     (can't find a direct link), next to 'Select a library'
     is a library pull-down,
     list without order
2.5) Edit/Add a patron, on section 'Library management'
     there is a library pull-down, case sensitive
2.6) OPAC, as logged user, make a suggestion or hold,
     there is library pull-down, correct order

3) Apply the patch

4.1) Repeat 2.1), correctly ordered list
4.2) Repeat 2.2), correctly ordered list
4.3) Repeat 2.3), correctly ordered list
4.4) Repeat 2.4), correctly ordered list
4.5) This is a bit more work
     There are 3 possible situations to test:
     A) No branches, must show a message that are no
        libraries defined
     B) New patron, must show a correctly ordered
        list of branches, current branch selected
     C) Edit patron, must show a correctly ordered
        list of branches, patron branch selected
4.6) Small changes on variable names, so retest 2.6)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
16 files changed:
cataloguing/value_builder/marc21_linking_section.pl
cataloguing/value_builder/unimarc_field_4XX.pl
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_by_borrower_category.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt
members/memberentry.pl
opac/opac-reserve.pl
opac/opac-suggestions.pl
reports/issues_avg_stats.pl
reports/issues_by_borrower_category.plugin
reports/itemtypes.plugin
reserve/request.pl

index f30086e..ac7cfce 100644 (file)
@@ -356,25 +356,7 @@ sub plugin {
          );
              $sth->finish;
 
-         my @branchloop;
-                my @select_branch;
-             my %select_branches;
-           my $branches = GetBranches;
-            push @select_branch, "";
-               $select_branches{''} = "";
-             foreach my $thisbranch ( keys %$branches ) {
-                   push @select_branch, $branches->{$thisbranch}->{'branchcode'};
-                 $select_branches{ $branches->{$thisbranch}->{'branchcode'} } =
-                   $branches->{$thisbranch}->{'branchname'};
-            }
-              my $CGIbranch = CGI::scrolling_list(
-                   -name     => 'value',
-                  -values   => \@select_branch,
-                  -labels   => \%select_branches,
-                        -size     => 1,
-                        -multiple => 0
-         );
-             $sth->finish;
+         # To show list of branches please use GetBranchesLoop() and modify template
 
          my $req = $dbh->prepare(
 "select distinctrow left(publishercode,45) from biblioitems order by publishercode"
@@ -404,7 +386,6 @@ sub plugin {
 
             $template->param(    #classlist => $classlist,
                  CGIitemtype  => $CGIitemtype,
-                  CGIbranch    => $CGIbranch,
                     CGIPublisher => $CGIpublisher,
                  itypeloop    => \@itemtypes,
                    index        => $query->param('index'),
index 0202438..e390010 100755 (executable)
@@ -511,25 +511,7 @@ sub plugin {
         );
         $sth->finish;
 
-        my @branchloop;
-        my @select_branch;
-        my %select_branches;
-        my $branches = GetBranches;
-        push @select_branch, "";
-        $select_branches{''} = "";
-        foreach my $thisbranch ( keys %$branches ) {
-            push @select_branch, $branches->{$thisbranch}->{'branchcode'};
-            $select_branches{ $branches->{$thisbranch}->{'branchcode'} } =
-              $branches->{$thisbranch}->{'branchname'};
-        }
-        my $CGIbranch = CGI::scrolling_list(
-            -name     => 'value',
-            -values   => \@select_branch,
-            -labels   => \%select_branches,
-            -size     => 1,
-            -multiple => 0
-        );
-        $sth->finish;
+        # To show list of branches please use GetBranchesLoop() and modify template
 
         my $req =
           $dbh->prepare(
@@ -560,7 +542,6 @@ sub plugin {
 
         $template->param(    #classlist => $classlist,
             CGIitemtype  => $CGIitemtype,
-            CGIbranch    => $CGIbranch,
             CGIPublisher => $CGIpublisher,
             itypeloop    => \@itemtypes,
             index        => $query->param('index'),
index 68d6a30..2fdb387 100644 (file)
         [% END %]
         [% UNLESS nobranchcode %]
     <li>
-      [% IF ( mandatorybranchcode ) %]
+      [%- IF ( mandatorybranchcode ) -%]
         <label for="branchcode" class="required">
-      [% ELSE %]
+      [%- ELSE -%]
         <label for="branchcode">
-      [% END %]
-      Library: </label>
-      [% CGIbranch %]
-         [% IF ( mandatorybranchcode ) %]<span class="required">Required</span>[% END %]
+      [%- END -%]
+      Library:</label>
+      <select name="branchcode" size="1" id="branchcode">
+        <option value=""></option>
+        [%- FOREACH branchloo IN branchloop %]
+          [% IF ( branchloo.selected ) -%]
+            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
+          [%- ELSE -%]
+            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
+          [%- END -%]
+        [%- END %]
+      </select>
+      [% IF ( mandatorybranchcode ) -%]
+      <span class="required">Required</span>
+      [%- END %]
     </li>
         [% END %]
     <li>
index eef1fd1..9010092 100644 (file)
                                <td>Library</td>
                                <td><input type="radio" name="Line" value="branchcode" /></td>
                                <td><input type="radio" name="Column" value="branchcode" /></td>
-                               <td>[% CGIBranch %]</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>
 <!-- Modified according to statistics table
                        <tr>
index d0a315f..4af5165 100644 (file)
        </table>
 [% END %]
 [% ELSE %]
-       <form method="post" action="/cgi-bin/koha/reports/manager.pl">
-               <fieldset class="rows">
-               <legend>Checkouts by patron category</legend>
-               <ol><li><label for="borrowercategory">Select a borrower category</label><select name="value" id="borrowercategory"><option value="" > Any Category code</option>
-    [% FOREACH loopcategorie IN loopcategories %]
-        <option value="[% loopcategorie.value %]" >[% loopcategorie.description %] </option>  
-     [% END %] 
-    </select></li>
-               <li><label for="branch">Select a library:</label> [% CGIbranch %]</li></ol></fieldset>
-               <fieldset class="action"><input type="submit" value="Submit" />
-               <input type="hidden" name="report_name" value="[% report_name %]" />
-               <input type="hidden" name="do_it" value="1" /></fieldset>
-       </form>
+        <form method="post" action="/cgi-bin/koha/reports/manager.pl">
+          <fieldset class="rows">
+            <legend>Checkouts by patron category</legend>
+            <ol>
+              <li>
+                <label for="borrowercategory">Select a borrower category</label>
+                <select name="value" id="borrowercategory">
+                  <option value="">Any Category code</option>
+                [%- FOREACH loopcategorie IN loopcategories %]
+                  <option value="[% loopcategorie.value %]" >[% loopcategorie.description %]</option>
+                [%- END %]
+                </select>
+              </li>
+              <li>
+                <label for="branch">Select a library:</label>
+                <select name="value" size="1" id="branch">
+                  <option value=""></option>
+                [%- FOREACH branchloo IN branchloop %]
+                  <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
+                [%- END %]
+               </select>
+              </li>
+            </ol>
+          </fieldset>
+          <fieldset class="action"><input type="submit" value="Submit" />
+            <input type="hidden" name="report_name" value="[% report_name %]" />
+            <input type="hidden" name="do_it" value="1" />
+          </fieldset>
+        </form>
 [% END %]
 
 </div>
index e18ad3e..4f5c07c 100644 (file)
@@ -57,14 +57,31 @@ $(document).ready(function(){
        </table>
 [% END %]
 [% ELSE %]
-       <h3>View a count of items held at your library grouped by item type</h3>
-       <form method="post" action="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">
-               <fieldset class="rows"><ol><li><label for="value">Select a library</label> [% CGIbranch %]
-               <span class="tip">Select none to see all libraries</span></li></ol></fieldset>
-               <fieldset class="action"><input type="submit" value="Submit" />
-               <input type="hidden" name="report_name" value="[% report_name %]" />
-               <input type="hidden" name="do_it" value="1" /></fieldset>
-       </form>
+        <h3>View a count of items held at your library grouped by item type</h3>
+        <form method="post" action="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">
+          <fieldset class="rows">
+            <ol>
+              <li>
+                <label for="value">Select a library</label>
+                <select name="value" size="1" id="value">
+                  <option value=""></option>
+                [%- FOREACH branchloo IN branchloop %]
+                 [% IF ( branchloo.selected ) -%]
+                  <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
+                 [%- ELSE -%]
+                  <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
+                 [%- END -%]
+                [%- END %]
+                </select>
+                <span class="tip">Select none to see all libraries</span>
+              </li>
+            </ol>
+          </fieldset>
+          <fieldset class="action"><input type="submit" value="Submit" />
+            <input type="hidden" name="report_name" value="[% report_name %]" />
+            <input type="hidden" name="do_it" value="1" />
+          </fieldset>
+        </form>
 [% END %]
 
 </div>
index e9a5914..122b2d0 100644 (file)
@@ -286,7 +286,15 @@ function checkMultiHold() {
         </li>
         <li>
             <label for="pickup">Pickup at:</label>
-            [% CGIbranch %]
+            <select name="pickup" size="1" id="pickup">
+            [%- FOREACH branchloo IN branchloop %]
+              [% IF ( branchloo.selected ) -%]
+                <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
+              [%- ELSE -%]
+                <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
+              [%- END -%]
+            [%- END %]
+            </select>
         </li>
 
        [% IF ( reserve_in_future ) %]
@@ -620,9 +628,9 @@ function checkMultiHold() {
           <select name="pickup">
       [% FOREACH branchloo IN reserveloo.branchloop %]
         [% IF ( branchloo.selected ) %]
-            <option value="[% branchloo.value %]" selected="selected">
+            <option value="[% branchloo.branchcode %]" selected="selected">
         [% ELSE %]
-            <option value="[% branchloo.value %]">
+            <option value="[% branchloo.branchcode %]">
         [% END %]
               [% branchloo.branchname %]
             </option>
index 5788b38..1dbddbf 100644 (file)
                                           <td class="branch">
                          [% UNLESS ( bibitemloo.holdable ) %]
                             <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
-                              [% FOREACH branchChoicesLoo IN bibitemloo.branchChoicesLoop %]
-                                [% IF ( branchChoicesLoo.selected ) %]
-                                  <option value="[% branchChoicesLoo.value %]" selected="selected">[% branchChoicesLoo.branchname %]</option>
+                              [% FOREACH branchloo IN bibitemloo.branchloop %]
+                                [% IF ( branchloo.selected ) %]
+                                  <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
                                 [% ELSE %]
-                                  <option value="[% branchChoicesLoo.value %]">[% branchChoicesLoo.branchname %]</option>
+                                  <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
                                 [% END %]
                               [% END %]
                           </select>
                           [% ELSE %]
                             <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
-                              [% FOREACH branchChoicesLoo IN bibitemloo.branchChoicesLoop %]
-                                [% IF ( branchChoicesLoo.selected ) %]
-                                  <option value="[% branchChoicesLoo.value %]" selected="selected">[% branchChoicesLoo.branchname %]</option>
+                              [% FOREACH branchloo IN bibitemloo.branchloop %]
+                                [% IF ( branchloo.selected ) %]
+                                  <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
                                 [% ELSE %]
-                                  <option value="[% branchChoicesLoo.value %]">[% branchChoicesLoo.branchname %]</option>
+                                  <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
                                 [% END %]
                               [% END %]
                             </select>
index 3f1b288..65cb297 100644 (file)
@@ -116,14 +116,14 @@ $.tablesorter.addParser({
                        [% IF ( itemtypeloo.selected ) %]<option value="[% itemtypeloo.itemtype %]" selected="selected"> [% ELSE %]<option value="[% itemtypeloo.itemtype %]"> [% END %] [% itemtypeloo.description %]</option>
         [% END %]
         </select> </li>
-    [% IF ( branch_loop ) %]
+    [% IF ( branchloop ) %]
     <li><label for="branch">Library:</label>
         <select name="branch" id="branch">
-        [% FOREACH branch_loo IN branch_loop %]
-            [% IF ( branch_loo.selected ) %]
-            <option value="[% branch_loo.value %]" selected="selected">[% branch_loo.branchname %]</option>
+        [% FOREACH branchloo IN branchloop %]
+            [% IF ( branchloo.selected ) %]
+            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
             [% ELSE %]
-            <option value="[% branch_loo.value %]">[% branch_loo.branchname %]</option>
+            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
             [% END %]
         [% END %]
         </select>
index 7fc27c0..79f1f93 100755 (executable)
@@ -568,43 +568,18 @@ foreach (keys(%flags)) {
        push @flagdata,\%row;
 }
 
-#get Branches
-my @branches;
-my @select_branch;
-my %select_branches;
-
-my $onlymine=(C4::Context->preference('IndependantBranches') && 
-              C4::Context->userenv && 
-              C4::Context->userenv->{flags} % 2 !=1  && 
-              C4::Context->userenv->{branch}?1:0);
-              
-my $branches=GetBranches($onlymine);
-my $default;
-my $CGIbranch;
-for my $branch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
-    push @select_branch,$branch;
-    $select_branches{$branch} = $branches->{$branch}->{'branchname'};
-    $default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'});
-}
-if(scalar(@select_branch) > 0){
-# --------------------------------------------------------------------------------------------------------
-  #in modify mod :default value from $CGIbranch comes from borrowers table
-  #in add mod: default value come from branches table (ip correspendence)
+# get Branch Loop
+# in modify mod: userbranch value for GetBranchesLoop() comes from borrowers table
+# in add    mod: userbranch value come from branches table (ip correspondence)
+
+my $userbranch = C4::Context->userenv->{'branch'};
 if (defined ($data{'branchcode'}) and ( $op eq 'modify' || ( $op eq 'add' && $category_type eq 'C' ) )) {
-    $default = $data{'branchcode'};
-}
-$CGIbranch = CGI::scrolling_list(-id    => 'branchcode',
-            -name   => 'branchcode',
-            -values => \@select_branch,
-            -labels => \%select_branches,
-            -size   => 1,
-            -override => 1,  
-            -multiple =>0,
-            -default => $default,
-        );
+    $userbranch = $data{'branchcode'};
 }
 
-if(!$CGIbranch){
+my $branchloop = GetBranchesLoop( $userbranch );
+
+if( !$branchloop ){
     $no_add = 1;
     $template->param(no_branches => 1);
 }
@@ -709,7 +684,7 @@ $template->param(
   check_member    => $check_member,#to know if the borrower already exist(=>1) or not (=>0) 
   "op$op"   => 1);
 
-$template->param(CGIbranch=>$CGIbranch) if ($CGIbranch);
+$template->param( branchloop => $branchloop ) if ( $branchloop );
 $template->param(
   nodouble  => $nodouble,
   borrowernumber  => $borrowernumber, #register number
index 07b4f76..e725d30 100755 (executable)
@@ -108,8 +108,7 @@ my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->us
 $template->param( branch => $branch );
 
 # make branch selection options...
-my $CGIbranchloop = GetBranchesLoop($branch);
-$template->param( CGIbranch => $CGIbranchloop );
+my $branchloop = GetBranchesLoop($branch);
 
 # Is the person allowed to choose their branch
 my $OPACChooseBranch = (C4::Context->preference("OPACAllowUserToChooseBranch")) ? 1 : 0;
@@ -358,7 +357,7 @@ foreach my $biblioNum (@biblionumbers) {
 
     my $record = GetMarcBiblio($biblioNum);
     # Init the bib item with the choices for branch pickup
-    my %biblioLoopIter = ( branchChoicesLoop => $CGIbranchloop );
+    my %biblioLoopIter = ( branchloop => $branchloop );
 
     # Get relevant biblio data.
     my $biblioData = $biblioDataHash{$biblioNum};
index eddcd26..1b353fd 100755 (executable)
@@ -131,8 +131,8 @@ if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) {
     my $branch = $input->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ;
 
 # make branch selection options...
-    my $CGIbranchloop = GetBranchesLoop($branch);
-    $template->param( branch_loop => $CGIbranchloop );
+    my $branchloop = GetBranchesLoop($branch);
+    $template->param( branchloop => $branchloop );
 }
 
 $template->param(
index bbd6f52..b601a44 100755 (executable)
@@ -160,21 +160,6 @@ if ($do_it) {
         $hassort1 =1 if ($value);
         push @select, $value;
     }
-    my $branches=GetBranches();
-    my @select_branch;
-    my %select_branches;
-    push @select_branch,"";
-    $select_branches{""} = "";
-    foreach my $branch (keys %$branches) {
-        push @select_branch, $branch;
-        $select_branches{$branch} = $branches->{$branch}->{'branchname'};
-    }
-    my $CGIBranch=CGI::scrolling_list( -name     => 'Filter',
-                -id => 'branch',
-                -values   => \@select_branch,
-                -labels   => \%select_branches,
-                -size     => 1,
-                -multiple => 0 );
     
     my $CGISort1=CGI::scrolling_list( -name     => 'Filter',
                 -id => 'sort1',
@@ -209,14 +194,14 @@ if ($do_it) {
     my $CGIsepChoice=GetDelimiterChoices;
     
     $template->param(
-                    CGIBorCat => $CGIBorCat,
-                    CGIItemType => $CGIItemTypes,
-                    CGIBranch => $CGIBranch,
-                    hassort1=> $hassort1,
-                    hassort2=> $hassort2,
-                    HlghtSort2 => $hglghtsort2,
-                    CGISort1 => $CGISort1,
-                    CGISort2 => $CGISort2,
+                    CGIBorCat    => $CGIBorCat,
+                    CGIItemType  => $CGIItemTypes,
+                    branchloop   => GetBranchesLoop(),
+                    hassort1     => $hassort1,
+                    hassort2     => $hassort2,
+                    HlghtSort2   => $hglghtsort2,
+                    CGISort1     => $CGISort1,
+                    CGISort2     => $CGISort2,
                     CGIextChoice => $CGIextChoice,
                     CGIsepChoice => $CGIsepChoice
                     );
index 825a492..806ff7c 100755 (executable)
@@ -62,36 +62,22 @@ the hashes are then translated to hash / arrays to be returned to manager.pl & s
 =cut
 
 sub set_parameters {
-       my ($template) = @_;
-       my $dbh = C4::Context->dbh;
-       my $branches=GetBranches();
-       my @branches;
-       my @select_branch;
-       my %select_branches;
-       push @select_branch,"";
-       $select_branches{""} = "";
-       foreach my $branch (keys %$branches) {
-               push @select_branch, $branch;
-               $select_branches{$branch} = $branches->{$branch}->{'branchname'};
-       }
-       my $CGIbranch=CGI::scrolling_list( -name     => 'value',
-                               -id => 'branch',
-                               -values   => \@select_branch,
-                               -labels   => \%select_branches,
-                               -size     => 1,
-                               -multiple => 0 );
-       $template->param(CGIbranch => $CGIbranch);
+    my ($template) = @_;
+
+    $template->param( branchloop => GetBranchesLoop() );
   
-  my ($codes,$labels)=GetborCatFromCatType(undef,undef);
-  my @borcatloop;
-  foreach my $thisborcat (sort keys %$labels) {
-            push @borcatloop, {value => $thisborcat,
-                               description => $labels->{$thisborcat},
-                            };
-  }
-  $template->param(loopcategories => \@borcatloop);
-       return $template;
+    my ($codes,$labels)=GetborCatFromCatType(undef,undef);
+    my @borcatloop;
+    foreach my $thisborcat (sort keys %$labels) {
+        push @borcatloop, {
+                          value       => $thisborcat,
+                          description => $labels->{$thisborcat},
+                          };
+    }
+    $template->param(loopcategories => \@borcatloop);
+    return $template;
 }
+
 sub calculate {
        my ($parameters) = @_;
        my @results =();
index 8134354..388649f 100755 (executable)
@@ -32,29 +32,11 @@ use C4::Branch; # GetBranches
 
 sub set_parameters {
        my ($template) = @_;
-       my $dbh = C4::Context->dbh;
-       my $branches=GetBranches();
-       my @branches;
-       my $default;
-       my @select_branch;
-       my %select_branches;
-       push @select_branch,"";
-       $select_branches{""} = "";
-       for my $branch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
-               push @select_branch, $branch;
-               $select_branches{$branch} = $branches->{$branch}->{'branchname'};
-               $default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'});
-       }
-       my $CGIbranch=CGI::scrolling_list( -name     => 'value',
-                               -id => 'value',
-                               -values   => \@select_branch,
-                               -labels   => \%select_branches,
-                               -size     => 1,
-                               -multiple => 0,
-                               -default => $default, );
-       $template->param(CGIbranch => $CGIbranch);
+    my $userbranch = C4::Context->userenv->{'branch'};
+     $template->param( branchloop => GetBranchesLoop($userbranch) );
        return $template;
 }
+
 sub calculate {
        my ($parameters) = @_;
        my @results =();
index 506d5fa..f8e26a2 100755 (executable)
@@ -65,23 +65,7 @@ my $showallitems = $input->param('showallitems');
 my $branches = GetBranches();
 my $itemtypes = GetItemTypes();
 
-my $default = C4::Context->userenv->{branch};
-my @values;
-my %label_of;
-
-foreach my $branchcode ( sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches ) {
-    push @values, $branchcode;
-    $label_of{$branchcode} = $branches->{$branchcode}->{branchname};
-}
-my $CGIbranch = CGI::scrolling_list(
-                                    -name     => 'pickup',
-                                    -id          => 'pickup',
-                                    -values   => \@values,
-                                    -default  => $default,
-                                    -labels   => \%label_of,
-                                    -size     => 1,
-                                    -multiple => 0,
-                                   );
+my $userbranch = C4::Context->userenv->{branch};
 
 # Select borrowers infos
 my $findborrower = $input->param('findborrower');
@@ -590,8 +574,7 @@ foreach my $biblionumber (@biblionumbers) {
     my $time = time();
 
     $template->param(
-                     CGIbranch   => $CGIbranch,
-
+                     branchloop  => GetBranchesLoop($userbranch),
                      time        => $time,
                      fixedRank   => $fixedRank,
                     );