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

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

Return to bug 13914