#!/usr/bin/perl
-# $Id$
-
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
use C4::Context;
use C4::Branch; # GetBranches
use C4::Koha;
+use C4::Dates;
use C4::Acquisition;
use C4::Output;
use C4::Circulation;
+use Date::Calc qw(
+ Today
+ Add_Delta_YM
+ );
=head1 NAME
my $column = $input->param("Column");
my @filters = $input->param("Filter");
my $digits = $input->param("digits");
+my $period = $input->param("period");
my $borstat = $input->param("status");
my $borstat1 = $input->param("activity");
my $output = $input->param("output");
$select_catcode{$catcode} = $description;
}
my $CGICatCode=CGI::scrolling_list( -name => 'Filter',
- -id => 'Filter',
+ -id => 'catcode',
-values => \@select_catcode,
-labels => \%select_catcode,
-size => 1,
#my %select_branches;
push @select_branch,"";
#$select_branches{""}="";
-foreach my $thisbranch (keys %$branches) {
+foreach my $thisbranch (sort keys %$branches) {
push @select_branch,$thisbranch;
# my $selected = 1 if $thisbranch eq $branch;
my %row =(value => $thisbranch,
push @branchloop, \%row;
}
my $CGIBranch=CGI::scrolling_list( -name => 'Filter',
- -id => 'Filter',
+ -id => 'branch',
-values => \@select_branch,
# -labels => \%select_branches,
-size => 1,
}
#
my $CGIZipCode=CGI::scrolling_list( -name => 'Filter',
- -id => 'Filter',
+ -id => 'zipcode',
-values => \@select_zipcode,
-size => 1,
-multiple => 0 );
}
#
my $CGIsort1=CGI::scrolling_list( -name => 'Filter',
- -id => 'Filter',
+ -id => 'sort1',
-values => \@select_sort1,
-labels =>\%select_sort1,
-size => 1,
}
}
my $CGIsort2=CGI::scrolling_list( -name => 'Filter',
- -id => 'Filter',
+ -id => 'sort2',
-values => \@select_sort2,
-size => 1,
-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',
$template->param( CGICatCode => $CGICatCode,
CGIZipCode => $CGIZipCode,
-# CGIBranch => $CGIBranch,
CGISort1 => $CGIsort1,
hassort1 => $hassort1,
CGISort2 => $CGIsort2,
hassort2 => $hassort2,
CGIextChoice => $CGIextChoice,
CGIsepChoice => $CGIsepChoice,
- CGIBranch => $CGIBranch
-# CGIBranch => \@branchloop
- );
+ CGIBranch => $CGIBranch,
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
+ );
}
output_html_with_http_headers $input, $cookie, $template->output;
if ($activity) {
push @loopfilter,{crit=>"Activity",filter=>$activity};
}
+# year of activity
+ my ( $period_year, $period_month, $period_day )=Add_Delta_YM( Today(),-$period, 0);
+ my $newperioddate=$period_year."-".$period_month."-".$period_day;
+# warn "PERIOD".$period;
# 1st, loop rows.
my $linefield;
if (($line =~/zipcode/) and ($digits)) {
$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 timestamp > ' 2007-01-01')" if ($activity eq 'active');
- $strcalc .= " AND borrowernumber not in (select distinct(borrowernumber) from issues where timestamp > ' 2007-01-01')" 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;
+# warn "". $strcalc;
my $dbcalc = $dbh->prepare($strcalc);
$dbcalc->execute;
# warn "filling table";