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

(-)a/reports/catalogue_stats.pl (-6 / +22 lines)
Lines 59-64 if(C4::Context->preference('item-level_itypes')) { Link Here
59
} else {
59
} else {
60
	$item_itype = "itemtype";
60
	$item_itype = "itemtype";
61
}
61
}
62
if(C4::Context->preference('marcflavour') ne "UNIMARC" && ($line=~ /publicationyear/ )) {
63
    $line = "copyrightdate";
64
}
65
if(C4::Context->preference('marcflavour') ne "UNIMARC" && ($column =~ /publicationyear/ )) {
66
    $column = "copyrightdate";
67
}
62
68
63
my ($template, $borrowernumber, $cookie)
69
my ($template, $borrowernumber, $cookie)
64
	= get_template_and_user({template_name => $fullreportname,
70
	= get_template_and_user({template_name => $fullreportname,
Lines 284-290 if($barcodefilter){ Link Here
284
	}
290
	}
285
291
286
	my $strsth = "SELECT DISTINCTROW $linefield FROM biblioitems 
292
	my $strsth = "SELECT DISTINCTROW $linefield FROM biblioitems 
287
	                INNER JOIN items USING (biblioitemnumber)
293
                    INNER JOIN items USING (biblioitemnumber)
294
                    INNER JOIN biblio ON (biblioitems.biblionumber = biblio.biblionumber)
288
	              WHERE $line IS NOT NULL ";
295
	              WHERE $line IS NOT NULL ";
289
    $strsth .= " AND barcode $not LIKE ? " if ($barcodefilter);
296
    $strsth .= " AND barcode $not LIKE ? " if ($barcodefilter);
290
	if ( @linefilter ) {
297
	if ( @linefilter ) {
Lines 337-342 if($barcodefilter){ Link Here
337
	FROM   biblioitems
344
	FROM   biblioitems
338
	INNER JOIN items
345
	INNER JOIN items
339
		USING (biblioitemnumber)
346
		USING (biblioitemnumber)
347
    INNER JOIN biblio
348
        ON (biblioitems.biblionumber = biblio.biblionumber)
340
	WHERE $column IS NOT NULL ";
349
	WHERE $column IS NOT NULL ";
341
	$strsth2 .= " AND barcode $not LIKE ?" if $barcodefilter;
350
	$strsth2 .= " AND barcode $not LIKE ?" if $barcodefilter;
342
	
351
	
Lines 386-392 if($barcodefilter){ Link Here
386
	}
395
	}
387
396
388
# preparing calculation
397
# preparing calculation
389
	my $strcalc = "SELECT $linefield, $colfield, count(*) FROM biblioitems INNER JOIN  items ON (items.biblioitemnumber = biblioitems.biblioitemnumber) WHERE 1 ";
398
    my $strcalc = "
399
        SELECT $linefield, $colfield, count(*)
400
        FROM biblioitems
401
        INNER JOIN items ON (items.biblioitemnumber = biblioitems.biblioitemnumber)
402
        INNER JOIN biblio ON (biblioitems.biblionumber = biblio.biblionumber)
403
        WHERE 1 ";
390
	$strcalc .= "AND barcode $not like ? " if ($barcodefilter); 
404
	$strcalc .= "AND barcode $not like ? " if ($barcodefilter); 
391
	
405
	
392
	if (@$filters[0]){
406
	if (@$filters[0]){
Lines 429-439 if($barcodefilter){ Link Here
429
	}
443
	}
430
	if (@$filters[8]){
444
	if (@$filters[8]){
431
		@$filters[8]=~ s/\*/%/g;
445
		@$filters[8]=~ s/\*/%/g;
432
		$strcalc .= " AND publicationyear >" . @$filters[8];
446
        $strcalc .= " AND " .
447
        (C4::Context->preference('marcflavour') eq 'UNIMARC' ? 'publicationyear' : 'copyrightdate')
448
        . ">" . @$filters[8];
433
	}
449
	}
434
	if (@$filters[9]){
450
	if (@$filters[9]){
435
		@$filters[9]=~ s/\*/%/g;
451
		@$filters[9]=~ s/\*/%/g;
436
		$strcalc .= " AND publicationyear <" . @$filters[9];
452
        $strcalc .= " AND " .
453
        (C4::Context->preference('marcflavour') eq 'UNIMARC' ? 'publicationyear' : 'copyrightdate')
454
        . "<" . @$filters[9];
437
	}
455
	}
438
	if (@$filters[10]){
456
	if (@$filters[10]){
439
		@$filters[10]=~ s/\*/%/g;
457
		@$filters[10]=~ s/\*/%/g;
Lines 457-463 if($barcodefilter){ Link Here
457
	   $dbcalc->execute();
475
	   $dbcalc->execute();
458
	}
476
	}
459
#	warn "filling table";
477
#	warn "filling table";
460
	
461
	my $emptycol; 
478
	my $emptycol; 
462
	while (my ($row, $col, $value) = $dbcalc->fetchrow) {
479
	while (my ($row, $col, $value) = $dbcalc->fetchrow) {
463
#		warn "filling table $row / $col / $value ";
480
#		warn "filling table $row / $col / $value ";
464
- 

Return to bug 12567