Bug 30551: Make cash register report take branchcode from cash register
[srvgit] / reports / issues_stats.pl
index 3eb27fb..ca0b8ec 100755 (executable)
@@ -82,7 +82,7 @@ $template->param(do_it => $do_it,
 
 our $itemtypes = Koha::ItemTypes->search_with_localization->unblessed;
 
-our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']});
+our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
 
 our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
 our $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
@@ -312,7 +312,8 @@ sub calculate {
           ( $linesource eq 'items' )
           ? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
           : " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
-        $strsth .= " WHERE $line is not null AND $line != '' ";
+        $strsth .= " WHERE $line IS NOT NULL ";
+        $strsth .= " AND $line != '' " if $line ne "datetime";
     }
 
     if ( $line =~ /datetime/ ) {
@@ -400,7 +401,8 @@ sub calculate {
           ( $colsource eq 'items' )
           ? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) "
           : "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) ";
-        $strsth2 .= " WHERE $column IS NOT NULL AND $column != '' ";
+        $strsth2 .= " WHERE $column IS NOT NULL";
+        $strsth2 .= " AND $column != '' " if $column ne "datetime";
     }
 
     if ( $column =~ /datetime/ ) {