foreach ($line, $column) {
$filter{$_} = [];
$field{$_} = $_;
- given ($_) {
- when (/closedate/) {
- $filter{$_}->[0] = @$filters[0];
- $filter{$_}->[1] = @$filters[1];
- my $a = $_;
- given ($podsp) {
- when (1) { $field{$a} = "concat(hex(weekday($a)+1),'-',dayname($a))" }
- when (2) { $field{$a} = "concat(hex(month($a)),'-',monthname($a))" }
- when (3) { $field{$a} = "Year($a)" }
- default { $field{$a} = $a }
- }
- }
- when (/received/) {
- $filter{$_}->[0] = @$filters[2];
- $filter{$_}->[1] = @$filters[3];
- my $a = $_;
- given ($rodsp) {
- when (1) { $field{$a} = "concat(hex(weekday($a)+1),'-',dayname($a))" }
- when (2) { $field{$a} = "concat(hex(month($a)),'-',monthname($a))" }
- when (3) { $field{$a} = "Year($a)" }
- default { $field{$a} = $a }
- }
- }
- when (/bookseller/) {
- $filter{$_}->[0] = @$filters[4];
- }
- when (/homebranch/) {
- $filter{$_}->[0] = @$filters[5];
- }
- when (/ccode/) {
- $filter{$_}->[0] = @$filters[6];
- }
- when (/itemtype/) {
- $filter{$_}->[0] = @$filters[7];
- }
- when (/budget/) {
- $filter{$_}->[0] = @$filters[8];
- }
- when (/sort1/) {
- $filter{$_}->[0] = @$filters[9];
+ if ( $_ =~ /closedate/ ) {
+ $filter{$_}->[0] = @$filters[0];
+ $filter{$_}->[1] = @$filters[1];
+ my $a = $_;
+ if ( $podsp == 1 ) {
+ $field{$a} = "concat(hex(weekday($a)+1),'-',dayname($a))";
+ } elsif ( $podsp == 2 ) {
+ $field{$a} = "concat(hex(month($a)),'-',monthname($a))";
+ } elsif ( $podsp == 3 ) {
+ $field{$a} = "Year($a)";
+ } else {
+ $field{$a} = $a;
}
- when (/sort2/) {
- $filter{$_}->[0] = @$filters[10];
+ }
+ elsif ( $_ =~ /received/ ) {
+ $filter{$_}->[0] = @$filters[2];
+ $filter{$_}->[1] = @$filters[3];
+ my $a = $_;
+ if ( $rodsp == 1 ) {
+ $field{$a} = "concat(hex(weekday($a)+1),'-',dayname($a))";
+ } elsif ( $rodsp == 2 ) {
+ $field{$a} = "concat(hex(month($a)),'-',monthname($a))";
+ } elsif ( $rodsp == 3 ) {
+ $field{$a} = "Year($a)";
+ } else {
+ field{$a} = $a;
}
}
+ elsif ( $_ =~ /bookseller/ ) {
+ $filter{$_}->[0] = @$filters[4];
+ }
+ elsif ( $_ =~ /homebranch/ ) {
+ $filter{$_}->[0] = @$filters[5];
+ }
+ elsif ( $_ =~ /ccode/ ) {
+ $filter{$_}->[0] = @$filters[6];
+ }
+ elsif ( $_ =~ /itemtype/ ) {
+ $filter{$_}->[0] = @$filters[7];
+ }
+ elsif ( $_ =~ /budget/ ) {
+ $filter{$_}->[0] = @$filters[8];
+ }
+ elsif ( $_ =~ /sort1/ ) {
+ $filter{$_}->[0] = @$filters[9];
+ }
+ elsif ( $_ =~ /sort2/ ) {
+ $filter{$_}->[0] = @$filters[10];
+ }
}
my @linefilter = @{ $filter{$line} };
# preparing calculation
my $strcalc;
$strcalc .= "SELECT $linefield, $colfield, ";
- given ($process) {
- when (1) { $strcalc .= "COUNT(*) " }
- when (2) { $strcalc .= "COUNT(DISTINCT(aqorders.biblionumber)) " }
- when ([3,4,5]) { $strcalc .= "SUM(aqorders.listprice) " }
- default { $strcalc .= "NULL " }
+ if ( $process == 1 ) {
+ $strcalc .= "COUNT(*) ";
+ } elsif ( $process == 2 ) {
+ $strcalc .= "COUNT(DISTINCT(aqorders.biblionumber)) ";
+ } elsif ( $process == 3 || $process == 4 || $process == 5 ) {
+ $strcalc .= "SUM(aqorders.listprice) ";
+ } else {
+ $strcalc .= "NULL ";
}
$strcalc .= "
FROM aqorders
}
output_html_with_http_headers $input, $cookie, $template->output;
-sub catcode_aref() {
+sub catcode_aref {
my $req = C4::Context->dbh->prepare("SELECT categorycode, description FROM categories ORDER BY description");
$req->execute;
return $req->fetchall_arrayref({});
}
-sub catcodes_hash() {
+sub catcodes_hash {
my %cathash;
my $catcodes = &catcode_aref;
foreach (@$catcodes) {
# Filters
my $linefilter;
- given ($line) {
- when (/categorycode/) { $linefilter = @$filters[0] }
- when (/zipcode/) { $linefilter = @$filters[1] }
- when (/branchcode/) { $linefilter = @$filters[2] }
- when (/sex/) { $linefilter = @$filters[5] }
- when (/sort1/) { $linefilter = @$filters[6] }
- when (/sort2/) { $linefilter = @$filters[7] }
- when (/^patron_attr\.(.*)$/) { $linefilter = $attr_filters->{$1} }
- default { $linefilter = '' }
- }
+ if ( $line =~ /categorycode/ ) { $linefilter = @$filters[0]; }
+ elsif ( $line =~ /zipcode/ ) { $linefilter = @$filters[1]; }
+ elsif ( $line =~ /branchcode/ ) { $linefilter = @$filters[2]; }
+ elsif ( $line =~ /sex/ ) { $linefilter = @$filters[5]; }
+ elsif ( $line =~ /sort1/ ) { $linefilter = @$filters[6]; }
+ elsif ( $line =~ /sort2/ ) { $linefilter = @$filters[7]; }
+ elsif ( $line =~ /^patron_attr\.(.*)$/ ) { $linefilter = $attr_filters->{$1}; }
+ else { $linefilter = ''; }
my $colfilter;
- given ($column) {
- when (/categorycode/) { $colfilter = @$filters[0] }
- when (/zipcode/) { $colfilter = @$filters[1] }
- when (/branchcode/) { $colfilter = @$filters[2] }
- when (/sex/) { $colfilter = @$filters[5] }
- when (/sort1/) { $colfilter = @$filters[6] }
- when (/sort2/) { $colfilter = @$filters[7] }
- when (/^patron_attr\.(.*)$/) { $colfilter = $attr_filters->{$1} }
- default { $colfilter = '' }
- }
+ if ( $column =~ /categorycode/ ) { $colfilter = @$filters[0]; }
+ elsif ( $column =~ /zipcode/ ) { $colfilter = @$filters[1]; }
+ elsif ( $column =~ /branchcode/) { $colfilter = @$filters[2]; }
+ elsif ( $column =~ /sex/) { $colfilter = @$filters[5]; }
+ elsif ( $column =~ /sort1/) { $colfilter = @$filters[6]; }
+ elsif ( $column =~ /sort2/) { $colfilter = @$filters[7]; }
+ elsif ( $column =~ /^patron_attr\.(.*)$/) { $colfilter = $attr_filters->{$1}; }
+ else { $colfilter = ''; }
my @loopfilter;
foreach my $i (0 .. scalar @$filters) {
$cell{filter} = @$filters[$i];
}
- given ($i) {
- when (0) { $cell{crit} = "Cat code" }
- when (1) { $cell{crit} = "Zip code" }
- when (2) { $cell{crit} = "Branch code" }
- when ([3,4]) { $cell{crit} = "Date of birth" }
- when (5) { $cell{crit} = "Sex" }
- when (6) { $cell{crit} = "Sort1" }
- when (7) { $cell{crit} = "Sort2" }
- default { $cell{crit} = "Unknown" }
- }
+ if ( $i == 0) { $cell{crit} = "Cat code"; }
+ elsif ( $i == 1 ) { $cell{crit} = "Zip code"; }
+ elsif ( $i == 2 ) { $cell{crit} = "Branch code"; }
+ elsif ( $i == 3 ||
+ $i == 4 ) { $cell{crit} = "Date of birth"; }
+ elsif ( $i == 5 ) { $cell{crit} = "Sex"; }
+ elsif ( $i == 6 ) { $cell{crit} = "Sort1"; }
+ elsif ( $i == 7 ) { $cell{crit} = "Sort2"; }
+ else { $cell{crit} = "Unknown"; }
+
push @loopfilter, \%cell;
}
}