|
Lines 129-135
if ($do_it) {
Link Here
|
| 129 |
); |
129 |
); |
| 130 |
push @itemtypeloop, \%row; |
130 |
push @itemtypeloop, \%row; |
| 131 |
} |
131 |
} |
| 132 |
|
132 |
|
|
|
133 |
#ccode |
| 134 |
my $ccodes = GetAuthorisedValues('CCODE'); |
| 135 |
my @ccodeloop; |
| 136 |
for my $thisccode (@$ccodes) { |
| 137 |
my %row = (value => $thisccode->{authorised_value}, |
| 138 |
description => $thisccode->{lib}, |
| 139 |
); |
| 140 |
push @ccodeloop, \%row; |
| 141 |
} |
| 142 |
|
| 143 |
@ccodeloop = sort {$a->{value} cmp $b->{value}} @ccodeloop; |
| 144 |
|
| 145 |
#shelvingloc |
| 146 |
my $shelvinglocs = GetAuthorisedValues('LOC'); |
| 147 |
my @shelvinglocloop; |
| 148 |
for my $thisloc (@$shelvinglocs) { |
| 149 |
my %row = (value => $thisloc->{authorised_value}, |
| 150 |
description => $thisloc->{lib}, |
| 151 |
); |
| 152 |
push @shelvinglocloop, \%row; |
| 153 |
} |
| 154 |
|
| 155 |
@shelvinglocloop = sort {$a->{value} cmp $b->{value}} @shelvinglocloop; |
| 156 |
|
| 133 |
#borcat |
157 |
#borcat |
| 134 |
my ($codes,$labels) = GetborCatFromCatType(undef,undef); |
158 |
my ($codes,$labels) = GetborCatFromCatType(undef,undef); |
| 135 |
my @borcatloop; |
159 |
my @borcatloop; |
|
Lines 147-152
if ($do_it) {
Link Here
|
| 147 |
CGIsepChoice => $CGIsepChoice, |
171 |
CGIsepChoice => $CGIsepChoice, |
| 148 |
branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}), |
172 |
branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}), |
| 149 |
itemtypeloop =>\@itemtypeloop, |
173 |
itemtypeloop =>\@itemtypeloop, |
|
|
174 |
ccodeloop =>\@ccodeloop, |
| 175 |
shelvinglocloop =>\@shelvinglocloop, |
| 150 |
borcatloop =>\@borcatloop, |
176 |
borcatloop =>\@borcatloop, |
| 151 |
); |
177 |
); |
| 152 |
output_html_with_http_headers $input, $cookie, $template->output; |
178 |
output_html_with_http_headers $input, $cookie, $template->output; |
|
Lines 171-177
sub calculate {
Link Here
|
| 171 |
# Checking filters |
197 |
# Checking filters |
| 172 |
# |
198 |
# |
| 173 |
my @loopfilter; |
199 |
my @loopfilter; |
| 174 |
for (my $i=0;$i<=6;$i++) { |
200 |
for (my $i=0;$i<=11;$i++) { |
| 175 |
my %cell; |
201 |
my %cell; |
| 176 |
if ( @$filters[$i] ) { |
202 |
if ( @$filters[$i] ) { |
| 177 |
if (($i==1) and (@$filters[$i-1])) { |
203 |
if (($i==1) and (@$filters[$i-1])) { |
|
Lines 188-197
sub calculate {
Link Here
|
| 188 |
$cell{crit} .="Return To" if ($i==3); |
214 |
$cell{crit} .="Return To" if ($i==3); |
| 189 |
$cell{crit} .="Branch" if ($i==4); |
215 |
$cell{crit} .="Branch" if ($i==4); |
| 190 |
$cell{crit} .="Doc Type" if ($i==5); |
216 |
$cell{crit} .="Doc Type" if ($i==5); |
| 191 |
$cell{crit} .="Bor Cat" if ($i==6); |
217 |
$cell{crit} .="Collection code" if ($i==6); |
| 192 |
$cell{crit} .="Day" if ($i==7); |
218 |
$cell{crit} .="Shelving location" if ($i==7); |
| 193 |
$cell{crit} .="Month" if ($i==8); |
219 |
$cell{crit} .="Bor Cat" if ($i==8); |
| 194 |
$cell{crit} .="Year" if ($i==9); |
220 |
$cell{crit} .="Day" if ($i==9); |
|
|
221 |
$cell{crit} .="Month" if ($i==10); |
| 222 |
$cell{crit} .="Year" if ($i==11); |
| 195 |
push @loopfilter, \%cell; |
223 |
push @loopfilter, \%cell; |
| 196 |
} |
224 |
} |
| 197 |
} |
225 |
} |
|
Lines 210-220
sub calculate {
Link Here
|
| 210 |
$colfilter[1] = @$filters[3] if ($column =~ /returndate/ ) ; |
238 |
$colfilter[1] = @$filters[3] if ($column =~ /returndate/ ) ; |
| 211 |
$colfilter[0] = @$filters[4] if ($column =~ /branch/ ) ; |
239 |
$colfilter[0] = @$filters[4] if ($column =~ /branch/ ) ; |
| 212 |
$colfilter[0] = @$filters[5] if ($column =~ /itemtype/ ) ; |
240 |
$colfilter[0] = @$filters[5] if ($column =~ /itemtype/ ) ; |
| 213 |
$colfilter[0] = @$filters[6] if ($column =~ /category/ ) ; |
241 |
$colfilter[0] = @$filters[6] if ($column =~ /ccode/ ) ; |
| 214 |
# $colfilter[0] = @$filters[11] if ($column =~ /sort2/ ) ; |
242 |
$colfilter[0] = @$filters[7] if ($column =~ /loc/ ) ; |
| 215 |
$colfilter[0] = @$filters[7] if ($column =~ /timestamp/ ) ; |
243 |
$colfilter[0] = @$filters[8] if ($column =~ /category/ ) ; |
| 216 |
$colfilter[0] = @$filters[8] if ($column =~ /timestamp/ ) ; |
244 |
# This commented out row (sort2) was not removed when adding new filters for ccode, shelving location and call number |
|
|
245 |
# $colfilter[0] = @$filters[11] if ($column =~ /sort2/ ) ; |
| 217 |
$colfilter[0] = @$filters[9] if ($column =~ /timestamp/ ) ; |
246 |
$colfilter[0] = @$filters[9] if ($column =~ /timestamp/ ) ; |
|
|
247 |
$colfilter[0] = @$filters[10] if ($column =~ /timestamp/ ) ; |
| 248 |
$colfilter[0] = @$filters[11] if ($column =~ /timestamp/ ) ; |
| 218 |
#warn "filtre col ".$colfilter[0]." ".$colfilter[1]; |
249 |
#warn "filtre col ".$colfilter[0]." ".$colfilter[1]; |
| 219 |
|
250 |
|
| 220 |
# loop cols. |
251 |
# loop cols. |
|
Lines 299-304
sub calculate {
Link Here
|
| 299 |
|
330 |
|
| 300 |
# Processing average loanperiods |
331 |
# Processing average loanperiods |
| 301 |
$strcalc .= "SELECT DISTINCT biblio.title, COUNT(biblio.biblionumber) AS RANK, biblio.biblionumber AS ID"; |
332 |
$strcalc .= "SELECT DISTINCT biblio.title, COUNT(biblio.biblionumber) AS RANK, biblio.biblionumber AS ID"; |
|
|
333 |
if (@$filters[6] || @$filters[7]) { |
| 334 |
$strcalc .= ", ccode as CCODE, location as LOC" |
| 335 |
} |
| 302 |
$strcalc .= " , $colfield " if ($colfield); |
336 |
$strcalc .= " , $colfield " if ($colfield); |
| 303 |
$strcalc .= " FROM `old_issues` |
337 |
$strcalc .= " FROM `old_issues` |
| 304 |
LEFT JOIN items USING(itemnumber) |
338 |
LEFT JOIN items USING(itemnumber) |
|
Lines 327-339
sub calculate {
Link Here
|
| 327 |
$strcalc .= "'" . @$filters[5] ."'" ; |
361 |
$strcalc .= "'" . @$filters[5] ."'" ; |
| 328 |
} |
362 |
} |
| 329 |
@$filters[6]=~ s/\*/%/g if (@$filters[6]); |
363 |
@$filters[6]=~ s/\*/%/g if (@$filters[6]); |
| 330 |
$strcalc .= " AND borrowers.categorycode like '" . @$filters[6] ."'" if ( @$filters[6] ); |
364 |
$strcalc .= " AND ccode like '" . @$filters[6] ."'" if ( @$filters[6] ); |
| 331 |
@$filters[7]=~ s/\*/%/g if (@$filters[7]); |
365 |
@$filters[7]=~ s/\*/%/g if (@$filters[7]); |
| 332 |
$strcalc .= " AND dayname(old_issues.timestamp) like '" . @$filters[7]."'" if (@$filters[7]); |
366 |
$strcalc .= " AND location like '" . @$filters[7] ."'" if ( @$filters[7] ); |
| 333 |
@$filters[8]=~ s/\*/%/g if (@$filters[8]); |
367 |
@$filters[8]=~ s/\*/%/g if (@$filters[8]); |
| 334 |
$strcalc .= " AND monthname(old_issues.timestamp) like '" . @$filters[8]."'" if (@$filters[8]); |
368 |
$strcalc .= " AND borrowers.categorycode like '" . @$filters[8] ."'" if ( @$filters[8] ); |
| 335 |
@$filters[9]=~ s/\*/%/g if (@$filters[9]); |
369 |
@$filters[9]=~ s/\*/%/g if (@$filters[9]); |
| 336 |
$strcalc .= " AND year(old_issues.timestamp) like '" . @$filters[9] ."'" if ( @$filters[9] ); |
370 |
$strcalc .= " AND dayname(old_issues.timestamp) like '" . @$filters[9]."'" if (@$filters[9]); |
|
|
371 |
@$filters[10]=~ s/\*/%/g if (@$filters[10]); |
| 372 |
$strcalc .= " AND monthname(old_issues.timestamp) like '" . @$filters[10]."'" if (@$filters[10]); |
| 373 |
@$filters[11]=~ s/\*/%/g if (@$filters[11]); |
| 374 |
$strcalc .= " AND year(old_issues.timestamp) like '" . @$filters[11] ."'" if ( @$filters[11] ); |
| 337 |
|
375 |
|
| 338 |
$strcalc .= " group by biblio.biblionumber"; |
376 |
$strcalc .= " group by biblio.biblionumber"; |
| 339 |
$strcalc .= ", $colfield" if ($column); |
377 |
$strcalc .= ", $colfield" if ($column); |
|
Lines 345-351
sub calculate {
Link Here
|
| 345 |
my $previous_col; |
383 |
my $previous_col; |
| 346 |
my %indice; |
384 |
my %indice; |
| 347 |
while (my @data = $dbcalc->fetchrow) { |
385 |
while (my @data = $dbcalc->fetchrow) { |
| 348 |
my ($row, $rank, $id, $col )=@data; |
386 |
my ($row, $rank, $id, $ccode, $loc, $col )=@data; |
| 349 |
$col = "zzEMPTY" if (!defined($col)); |
387 |
$col = "zzEMPTY" if (!defined($col)); |
| 350 |
$indice{$col}=1 if (not($indice{$col})); |
388 |
$indice{$col}=1 if (not($indice{$col})); |
| 351 |
$table[$indice{$col}]->{$col}->{'name'}=$row; |
389 |
$table[$indice{$col}]->{$col}->{'name'}=$row; |
| 352 |
- |
|
|