C4/Search.pm followup auto_truncation
[koha.git] / reports / issues_stats.pl
index a497564..add5ad4 100755 (executable)
@@ -137,19 +137,6 @@ for my $itype ( sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{des
        push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{description} } ;
 }
 
-my $branches=GetBranches();
-my @branchloop;
-foreach (sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches) {
-       my $thisbranch = ''; # FIXME 
-       my %row = (
-               branchcode => $_,
-               selected => ($thisbranch eq $_ ? 1 : 0),
-               code => $branches->{$_}->{'branchcode'},
-               description => $branches->{$_}->{'branchname'},
-       );
-       push @branchloop, \%row;
-}
-
     # location list
 my @locations;
 foreach (sort keys %$locations) {
@@ -178,7 +165,7 @@ $template->param(
        itemtypeloop => \@itemtypeloop,
        locationloop => \@locations,
           ccodeloop => \@ccodes,
-         branchloop => \@branchloop,
+         branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}),
        hassort1=> $hassort1,
        hassort2=> $hassort2,
        Bsort1 => $Bsort1,
@@ -350,8 +337,8 @@ sub calculate {
        } else {
                $colfield = $column;
        }
-       $colorder = ($colfield =~ /dayname/) ? "weekday($line)" :
-                               ($colfield =~ /^month/ ) ? "  month($line)" : $colfield;
+       $colorder = ($colfield =~ /dayname/) ? "weekday($column)" :
+                               ($colfield =~ /^month/ ) ? "  month($column)" : $colfield;
        my $strsth2 = "SELECT distinctrow $colfield FROM statistics, ";
        # get stats on items if ccode or location, otherwise borrowers.
        $strsth2 .= ($colsource eq 'items' ) ?