DB and syspref update for Tags and BakerTaylor
[koha.git] / reports / borrowers_stats.pl
index 283ed2b..45e6bc7 100755 (executable)
@@ -1,6 +1,5 @@
 #!/usr/bin/perl
 
-
 # Copyright 2000-2002 Katipo Communications
 #
 # This file is part of Koha.
@@ -24,6 +23,7 @@ use C4::Auth;
 use C4::Context;
 use C4::Branch; # GetBranches
 use C4::Koha;
+use C4::Dates;
 use C4::Acquisition;
 use C4::Output;
 use C4::Circulation;
@@ -206,10 +206,7 @@ foreach my $thisbranch (sort keys %$branches) {
                                -multiple => 0 );
        
        my @mime = ( C4::Context->preference("MIME") );
-       foreach my $mime (@mime){
-               warn "".$mime;
-       }
-       
+       # warn 'MIME(s): ' . join ' ', @mime;
        my $CGIextChoice=CGI::scrolling_list(
                                -name => 'MIME',
                                -id => 'MIME',
@@ -227,16 +224,14 @@ foreach my $thisbranch (sort keys %$branches) {
 
        $template->param(               CGICatCode => $CGICatCode,
                                        CGIZipCode => $CGIZipCode,
-#                                      CGIBranch => $CGIBranch,
                                        CGISort1 => $CGIsort1,
                                        hassort1 => $hassort1,
                                        CGISort2 => $CGIsort2,
                                        hassort2 => $hassort2,
                                        CGIextChoice => $CGIextChoice,
                                        CGIsepChoice => $CGIsepChoice,
-                                       CGIBranch => $CGIBranch
-#                                      CGIBranch => \@branchloop
-                        DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+                                       CGIBranch => $CGIBranch,
+                                       DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
                     );
 
 }
@@ -401,8 +396,8 @@ sub calculate {
        $strcalc .= " AND sort1 like '" . @$filters[5] ."'" if ( @$filters[5] );
        @$filters[6]=~ s/\*/%/g if (@$filters[6]);
        $strcalc .= " AND sort2 like '" . @$filters[6] ."'" if ( @$filters[6] );
-       $strcalc .= " AND borrowernumber in (select distinct(borrowernumber) from issues where issuedate > '" . $newperioddate . "')" if ($activity eq 'active');
-       $strcalc .= " AND borrowernumber not in (select distinct(borrowernumber) from issues where issuedate > '" . $newperioddate . "')" if ($activity eq 'nonactive');
+       $strcalc .= " AND borrowernumber in (select distinct(borrowernumber) from old_issues where issuedate > '" . $newperioddate . "')" if ($activity eq 'active');
+       $strcalc .= " AND borrowernumber not in (select distinct(borrowernumber) from old_issues where issuedate > '" . $newperioddate . "')" if ($activity eq 'nonactive');
        $strcalc .= " AND $status='1' " if ($status);
        $strcalc .= " group by $linefield, $colfield";
 #      warn "". $strcalc;