use C4::Output;
use C4::Koha;
use C4::Circulation;
-use C4::Date;
+use C4::Dates;
=head1 NAME
debug => 1,
});
$template->param(do_it => $do_it,
- DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
);
if ($do_it) {
-
- #warn
-"line=$line, col=$column, pod=$podsp, rod=$rodsp, aod=$aodsp, calc=$calc, filters=@filters\n";
-
+ # warn "line=$line, col=$column, pod=$podsp, rod=$rodsp, aod=$aodsp, calc=$calc, filters=@filters\n";
my $results =
calculate( $line, $column, $podsp, $rodsp, $aodsp, $calc, \@filters );
if ( $output eq "screen" ) {
$template->param( mainloop => $results );
output_html_with_http_headers $input, $cookie, $template->output;
- exit(1);
}
else {
print $input->header(
print $sep. $col->{totalcol};
}
print $sep. @$results[0]->{total};
- exit(1);
}
+ exit(1);
}
else {
my $dbh = C4::Context->dbh;
my %labels;
my %select;
my $req;
- $req =
- $dbh->prepare(
- "SELECT distinctrow id,name FROM aqbooksellers ORDER BY name");
+ $req = $dbh->prepare("SELECT distinctrow id,name FROM aqbooksellers ORDER BY name");
$req->execute;
my @select;
push @select, "";
my @mime = ( C4::Context->preference("MIME") );
foreach my $mime (@mime) {
-
# warn "".$mime;
}
use C4::Koha;
use C4::Circulation;
use C4::Members;
-use C4::Date;
+use C4::Dates qw(format_date_in_iso);
=head1 NAME
=cut
my $input = new CGI;
-my $do_it=$input->param('do_it');
my $fullreportname = "reports/bor_issues_top.tmpl";
-my $limit = $input->param("Limit");
-my $column = $input->param("Criteria");
+my $do_it = $input->param('do_it');
+my $limit = $input->param("Limit");
+my $column = $input->param("Criteria");
my @filters = $input->param("Filter");
-$filters[0]=format_date_in_iso($filters[0]);
-$filters[1]=format_date_in_iso($filters[1]);
-$filters[2]=format_date_in_iso($filters[2]);
-$filters[3]=format_date_in_iso($filters[3]);
-my $output = $input->param("output");
+for (0..3) {
+ $filters[$_]=format_date_in_iso($filters[$_]);
+}
+my $output = $input->param("output");
my $basename = $input->param("basename");
-my $mime = $input->param("MIME");
-my $del = $input->param("sep");
+my $mime = $input->param("MIME");
+my $del = $input->param("sep");
#warn "calcul : ".$calc;
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => $fullreportname,
debug => 1,
});
$template->param(do_it => $do_it,
- DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
);
if ($do_it) {
# Displaying results
# Checking filters
#
my @loopfilter;
+ my @cellmap = (
+ "Issue From",
+ "Issue To",
+ "Return From",
+ "Return To",
+ "Branch",
+ "Doc Type",
+ "Bor Cat",
+ "Day",
+ "Month",
+ "Year"
+ );
for (my $i=0;$i<=6;$i++) {
my %cell;
if ( @$filters[$i] ) {
} else {
$cell{filter} .= format_date(@$filters[$i]);
}
- $cell{crit} .="Issue From" if ($i==0);
- $cell{crit} .="Issue To" if ($i==1);
- $cell{crit} .="Return From" if ($i==2);
- $cell{crit} .="Return To" if ($i==3);
- $cell{crit} .="Branch" if ($i==4);
- $cell{crit} .="Doc Type" if ($i==5);
- $cell{crit} .="Bor Cat" if ($i==6);
- $cell{crit} .="Day" if ($i==7);
- $cell{crit} .="Month" if ($i==8);
- $cell{crit} .="Year" if ($i==9);
+ defined ($cellmap[$i]) and
+ $cell{crit} .= $cellmap[$i];
push @loopfilter, \%cell;
}
}
my $value;
my $count=0;
my $link;
- if (@loopcol){
- $value =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}}->{'name'};
- $count =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}}->{'count'};
- $link =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}}->{'link'};
- } else {
- $value =$table[$i]->{"zzEMPTY"}->{'name'};
- $count =$table[$i]->{"zzEMPTY"}->{'count'};
- $link =$table[$i]->{"zzEMPTY"}->{'link'};
- }
+ my $key = ((!(@loopcol)) or ($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))
+ ? "zzEMPTY" : $col->{coltitle};
+ $value =$table[$i]->{$key}->{'name'};
+ $count =$table[$i]->{$key}->{'count'};
+ $link =$table[$i]->{$key}->{'link'};
# warn " ".$i ." value:$value count:$count reference:$link";
push @loopcell, {value => $value, count =>$count, reference => $link} ;
}
$hilighted = -$hilighted;
}
#
-
# the header of the table
$globalline{loopfilter}=\@loopfilter;
#!/usr/bin/perl
-
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
use C4::Output;
use C4::Circulation;
use C4::Members;
-use C4::Date;
+use C4::Dates;
=head1 NAME
my $basename = $input->param("basename");
my $mime = $input->param("MIME");
my $del = $input->param("sep");
-#warn "calcul : ".$calc;
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => $fullreportname,
query => $input,
debug => 1,
});
$template->param(do_it => $do_it,
- DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
);
if ($do_it) {
# Displaying results
}
-
-
sub calculate {
my ($line, $column, $filters) = @_;
my @mainloop;
my $sth2 = $dbh->prepare( $strsth2 );
$sth2->execute;
-
-
while (my ($celvalue) = $sth2->fetchrow) {
my %cell;
# my %ft;
$dbcalc->execute;
# warn "filling table";
my $previous_col;
- my $i=1;
+ $i=1;
while (my @data = $dbcalc->fetchrow) {
my ($row, $col )=@data;
$col = "zzEMPTY" if ($col eq undef);
$i=1 if (($previous_col) and not($col eq $previous_col));
$table[$i]->{$col}=$row;
-# warn " ".$i." ".$col. " ".$row;
+# warn " $i $col $row";
$i++;
$previous_col=$col;
}
push @loopcol,{coltitle => "Global"} if not($column);
- my $max =(($line)?$line:@table -1);
+ $max =(($line)?$line:@table -1);
for ($i=1; $i<=$max;$i++) {
my @loopcell;
#@loopcol ensures the order for columns is common with column titles
#!/usr/bin/perl
-
# 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;
CGIsepChoice => $CGIsepChoice,
CGIBranch => $CGIBranch,
# CGIBranch => \@branchloop
- DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
);
}
use C4::Output;
use C4::Koha;
use C4::Circulation;
-use C4::Date;
+use C4::Dates;
use C4::Members;
=head1 NAME
debug => 1,
});
$template->param(do_it => $do_it,
- DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
);
if ($do_it) {
# Displaying results
$strcalc .= " AND biblioitems.itemtype like '" . @$filters[1] ."'" if ( @$filters[1] );
$strcalc .= " group by items.itemnumber";
- $strcalc .= ", $colfield" if ($column);
+ $strcalc .= ", $colfield" if ($column);
$strcalc .= " order by $colfield " if ($colfield);
- my $max;
- if (@loopcol) {
- $max = $line*@loopcol;
- } else { $max=$line;}
- $strcalc .= " LIMIT 0,$max" if ($line);
+ my $max = (@loopcol) ? $line*@loopcol : $line ;
+ $strcalc .= " LIMIT 0,$max" if ($line);
warn "SQL :". $strcalc;
my $dbcalc = $dbh->prepare($strcalc);
$dbcalc->execute;
# warn "filling table";
my $previous_col;
- my $i=1;
+ $i=1;
while (my @data = $dbcalc->fetchrow) {
my ($barcode,$title,$bibnum,$author, $col )=@data;
$col = "zzEMPTY" if ($col eq undef);
push @loopcol,{coltitle => "Global"} if not($column);
- my $max =(($line)?$line:@table);
+ $max =(($line)?$line:@table);
for ($i=1; $i<$max;$i++) {
my @loopcell;
#@loopcol ensures the order for columns is common with column titles
$linefilter[0] = @$filters[7] if ($line =~ /publishercode/ ) ;
$linefilter[0] = @$filters[8] if ($line =~ /publicationyear/ ) ;
$linefilter[1] = @$filters[9] if ($line =~ /publicationyear/ ) ;
- @linefilter[0] = @$filters[10] if ($line =~ /items.homebranch/ ) ;
- @linefilter[0] = @$filters[11] if ($line =~ /items.location/ ) ;
+ $linefilter[0] = @$filters[10] if ($line =~ /items.homebranch/ ) ;
+ $linefilter[0] = @$filters[11] if ($line =~ /items.location/ ) ;
#
my @colfilter ;
$colfilter[0] = @$filters[0] if ($column =~ /dewey/ ) ;
$colfilter[0] = @$filters[7] if ($column =~ /publishercode/ ) ;
$colfilter[0] = @$filters[8] if ($column =~ /publicationyear/ ) ;
$colfilter[1] = @$filters[9] if ($column =~ /publicationyear/ ) ;
- @colfilter[0] = @$filters[10] if ($column =~ /items.homebranch/ ) ;
- @colfilter[0] = @$filters[11] if ($column =~ /items.location/ ) ;
+ $colfilter[0] = @$filters[10] if ($column =~ /items.homebranch/ ) ;
+ $colfilter[0] = @$filters[11] if ($column =~ /items.location/ ) ;
# 1st, loop rows.
my $linefield;
use C4::Context;
use C4::Output;
use C4::Biblio;
-use C4::Date;
-
+use C4::Dates;
# Fixed variables
my $linecolor1='#ffffcc';
my $script_name="/cgi-bin/koha/admin/branches.pl";
my $pagepagesize=20;
-
#######################################################################################
# Main loop....
my $input = new CGI;
);
if ($uploadbarcodes && length($uploadbarcodes)>0){
my $dbh=C4::Context->dbh;
- my $date=format_date($input->param('setdate'));
- $date = format_date("today") unless $date;
+ my $date = format_date($input->param('setdate')) || C4::Dates->new()->output();
# warn "$date";
my $strsth="update items set (datelastseen = $date) where items.barcode =?";
my $qupdate = $dbh->prepare($strsth);
- my $strsth="select * from issues, items where items.itemnumber=issues.itemnumber and items.barcode =? and issues.returndate is null";
+ $strsth="select * from issues, items where items.itemnumber=issues.itemnumber and items.barcode =? and issues.returndate is null";
my $qonloan = $dbh->prepare($strsth);
- my $strsth="select * from items where items.barcode =? and issues.wthdrawn=1";
+ $strsth="select * from items where items.barcode =? and issues.wthdrawn=1";
my $qwthdrawn = $dbh->prepare($strsth);
my @errorloop;
my $count=0;
use C4::Output;
use C4::Koha;
use C4::Circulation;
-use C4::Date;
+use C4::Dates;
use Date::Calc qw(Delta_Days);
=head1 NAME
debug => 1,
});
$template->param(do_it => $do_it,
- DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
);
if ($do_it) {
# Displaying results
$row = "zzEMPTY" if ($row eq undef);
# fill returndate to avoid an error with date calc (needed for all non returned issues)
$returndate= join '-',Date::Calc::Today if $returndate eq '0000-00-00';
- my $result =Delta_Days(split(/-/,$issuedate),split (/-/,$returndate)) ;
# DateCalc returns => 0:0:WK:DD:HH:MM:SS the weeks, days, hours, minutes,
# and seconds between the two
- $loanlength = $result;
+ $loanlength = Delta_Days(split(/-/,$issuedate),split (/-/,$returndate)) ;
# warn "512 Same row and col DateCalc returns :$loanlength with return ". $returndate ."issue ". $issuedate ."weight : ". $weight;
# warn "513 row :".$row." column :".$col;
$table{$row}->{$col}+=$weight*$loanlength;
use C4::Koha;
use C4::Output;
use C4::Circulation;
-use C4::Date;
+use C4::Dates;
use Date::Manip;
=head1 NAME
debug => 1,
});
$template->param(do_it => $do_it,
- DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
);
if ($do_it) {
# Displaying results
report_name => $report_name,
);
my $cgidir = C4::Context->config('intranetdir')."/cgi-bin/reports/";
-unless (opendir(DIR, "$cgidir")) {
+unless (-r $cgidir and -d $cgidir) {
$cgidir = C4::Context->intranetdir."/reports/";
}
my $plugin = $cgidir.$report_name.".plugin";
use strict;
use C4::Stats;
-use C4::Date;
+use C4::Dates;
use CGI;
use C4::Output;
use C4::Branch; # GetBranches
$date2 = ParseDate($time2);
}
-my $date = UnixDate( $date, '%Y-%m-%d' );
-my $date2 = UnixDate( $date2, '%Y-%m-%d' );
+$date = UnixDate( $date, '%Y-%m-%d' );
+$date2 = UnixDate( $date2, '%Y-%m-%d' );
# warn "MASON: TIME: $time, $time2";
# warn "MASON: DATE: $date, $date2";
#get credits and append to the bottom of payments
my @credits = getcredits( $date, $date2 );
-my $count = @credits;
-my $i = 0;
+$count = @credits;
+$i = 0;
while ( $i < $count ) {