View | Details | Raw Unified | Return to bug 13914
Collapse All | Expand All

(-)a/reports/reserves_stats.pl (-6 / +2 lines)
Lines 221-227 sub calculate { Link Here
221
        			($process == 3) ? "(COUNT(DISTINCT reserves.itemnumber)) calculation"      : 
221
        			($process == 3) ? "(COUNT(DISTINCT reserves.itemnumber)) calculation"      : 
222
        			($process == 4) ? "(COUNT(DISTINCT reserves.biblionumber)) calculation"    : '*';
222
        			($process == 4) ? "(COUNT(DISTINCT reserves.biblionumber)) calculation"    : '*';
223
	$strcalc .= "
223
	$strcalc .= "
224
        FROM reserves
224
        FROM (select * from reserves union select * from old_reserves) reserves
225
        LEFT JOIN borrowers USING (borrowernumber)
225
        LEFT JOIN borrowers USING (borrowernumber)
226
	";
226
	";
227
	$strcalc .= "LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber "
227
	$strcalc .= "LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber "
Lines 266-279 sub calculate { Link Here
266
	$strcalc .= " WHERE ".join(" AND ",@sqlwhere) if (@sqlwhere);
266
	$strcalc .= " WHERE ".join(" AND ",@sqlwhere) if (@sqlwhere);
267
	$strcalc .= " AND (".join(" OR ",@sqlor).")" if (@sqlor);
267
	$strcalc .= " AND (".join(" OR ",@sqlor).")" if (@sqlor);
268
	$strcalc .= " GROUP BY line, col )";
268
	$strcalc .= " GROUP BY line, col )";
269
	my $strcalc_old=$strcalc;
270
	$strcalc_old=~s/reserves/old_reserves/g;
271
	$strcalc.=qq{ UNION $strcalc_old ORDER BY line, col};
272
	($debug) and print STDERR $strcalc;
269
	($debug) and print STDERR $strcalc;
273
	my $dbcalc = $dbh->prepare($strcalc);
270
	my $dbcalc = $dbh->prepare($strcalc);
274
	push @loopfilter, {crit=>'SQL =', sql=>1, filter=>$strcalc};
271
	push @loopfilter, {crit=>'SQL =', sql=>1, filter=>$strcalc};
275
	@sqlparams=(@sqlparams,@sqlorparams);
272
	@sqlparams=(@sqlparams,@sqlorparams);
276
	$dbcalc->execute(@sqlparams,@sqlparams);
273
	$dbcalc->execute(@sqlparams);
277
	my ($emptycol,$emptyrow); 
274
	my ($emptycol,$emptyrow); 
278
	my $data = $dbcalc->fetchall_hashref([qw(line col)]);
275
	my $data = $dbcalc->fetchall_hashref([qw(line col)]);
279
	my %cols_hash;
276
	my %cols_hash;
280
- 

Return to bug 13914