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

(-)a/reports/catalogue_stats.pl (-23 / +16 lines)
Lines 233-239 sub calculate { Link Here
233
    my @loopfilter;
233
    my @loopfilter;
234
    for ( my $i = 0 ; $i <= @$filters ; $i++ ) {
234
    for ( my $i = 0 ; $i <= @$filters ; $i++ ) {
235
        my %cell;
235
        my %cell;
236
        if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 16 ) {
236
        if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 15 ) {
237
            if ( ( ( $i == 1 ) or ( $i == 3 ) or ( $i == 5 ) or ( $i == 9 ) ) and ( @$filters[ $i - 1 ] ) ) {
237
            if ( ( ( $i == 1 ) or ( $i == 3 ) or ( $i == 5 ) or ( $i == 9 ) ) and ( @$filters[ $i - 1 ] ) ) {
238
                $cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] );
238
                $cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] );
239
            }
239
            }
Lines 292-302 sub calculate { Link Here
292
    $linefilter[0] = @$filters[12] if ( $line =~ /items\.ccode/ );
292
    $linefilter[0] = @$filters[12] if ( $line =~ /items\.ccode/ );
293
    $linefilter[0] = @$filters[13] if ( $line =~ /items\.notforloan/ );
293
    $linefilter[0] = @$filters[13] if ( $line =~ /items\.notforloan/ );
294
    $linefilter[0] = @$filters[14] if ( $line =~ /items\.materials/ );
294
    $linefilter[0] = @$filters[14] if ( $line =~ /items\.materials/ );
295
    $linefilter[0] = @$filters[15] if ( $line =~ /items\.statisticvalue/ );
295
    $linefilter[0] = @$filters[17] if ( $line =~ /items\.dateaccessioned/ );
296
    $linefilter[0] = @$filters[18] if ( $line =~ /items\.dateaccessioned/ );
296
    $linefilter[1] = @$filters[18] if ( $line =~ /items\.dateaccessioned/ );
297
    $linefilter[1] = @$filters[19] if ( $line =~ /items\.dateaccessioned/ );
297
    $linefilter[0] = @$filters[19] if ( $line =~ /deleteditems\.timestamp/ );
298
    $linefilter[0] = @$filters[20] if ( $line =~ /deleteditems\.timestamp/ );
298
    $linefilter[1] = @$filters[20] if ( $line =~ /deleteditems\.timestamp/ );
299
    $linefilter[1] = @$filters[21] if ( $line =~ /deleteditems\.timestamp/ );
300
299
301
    my @colfilter;
300
    my @colfilter;
302
    $colfilter[0] = @$filters[0] if ( $column =~ /dewey/ );
301
    $colfilter[0] = @$filters[0] if ( $column =~ /dewey/ );
Lines 318-328 sub calculate { Link Here
318
    $colfilter[0] = @$filters[12] if ( $column =~ /items\.ccode/ );
317
    $colfilter[0] = @$filters[12] if ( $column =~ /items\.ccode/ );
319
    $colfilter[0] = @$filters[13] if ( $column =~ /items\.notforloan/ );
318
    $colfilter[0] = @$filters[13] if ( $column =~ /items\.notforloan/ );
320
    $colfilter[0] = @$filters[14] if ( $column =~ /items\.materials/ );
319
    $colfilter[0] = @$filters[14] if ( $column =~ /items\.materials/ );
321
    $colfilter[0] = @$filters[15] if ( $column =~ /items\.statisticvalue/ );
320
    $colfilter[0] = @$filters[17] if ( $column =~ /items.dateaccessioned/ );
322
    $colfilter[0] = @$filters[18] if ( $column =~ /items.dateaccessioned/ );
321
    $colfilter[1] = @$filters[18] if ( $column =~ /items\.dateaccessioned/ );
323
    $colfilter[1] = @$filters[19] if ( $column =~ /items\.dateaccessioned/ );
322
    $colfilter[0] = @$filters[19] if ( $column =~ /deleteditems\.timestamp/ );
324
    $colfilter[0] = @$filters[20] if ( $column =~ /deleteditems\.timestamp/ );
323
    $colfilter[1] = @$filters[20] if ( $column =~ /deleteditems\.timestamp/ );
325
    $colfilter[1] = @$filters[21] if ( $column =~ /deleteditems\.timestamp/ );
326
324
327
    # 1st, loop rows.
325
    # 1st, loop rows.
328
    my $origline = $line;
326
    my $origline = $line;
Lines 538-562 sub calculate { Link Here
538
        @$filters[14] =~ s/\*/%/g;
536
        @$filters[14] =~ s/\*/%/g;
539
        $strcalc .= " AND $itemstable.materials  LIKE '" . @$filters[14] . "'";
537
        $strcalc .= " AND $itemstable.materials  LIKE '" . @$filters[14] . "'";
540
    }
538
    }
541
    if ( defined @$filters[15] and @$filters[15] ne '' ) {
539
    if ( @$filters[17] ) {
542
        @$filters[15] =~ s/\*/%/g;
540
        @$filters[17] =~ s/\*/%/g;
543
        $strcalc .= " AND $itemstable.statisticvalue  LIKE '" . @$filters[15] . "'";
541
        $strcalc .= " AND $itemstable.dateaccessioned >= '@$filters[17]' ";
544
    }
542
    }
545
    if ( @$filters[18] ) {
543
    if ( @$filters[18] ) {
546
        @$filters[18] =~ s/\*/%/g;
544
        @$filters[18] =~ s/\*/%/g;
547
        $strcalc .= " AND $itemstable.dateaccessioned >= '@$filters[18]' ";
545
        $strcalc .= " AND $itemstable.dateaccessioned <= '@$filters[18]' ";
548
    }
546
    }
549
    if ( @$filters[19] ) {
547
    if ( $cellvalue eq 'deleteditems' and @$filters[19] ) {
550
        @$filters[19] =~ s/\*/%/g;
548
        @$filters[19] =~ s/\*/%/g;
551
        $strcalc .= " AND $itemstable.dateaccessioned <= '@$filters[19]' ";
549
        $strcalc .= " AND DATE(deleteditems.timestamp) >= '@$filters[19]' ";
552
    }
550
    }
553
    if ( $cellvalue eq 'deleteditems' and @$filters[20] ) {
551
    if ( $cellvalue eq 'deleteditems' and @$filters[20] ) {
554
        @$filters[20] =~ s/\*/%/g;
552
        @$filters[20] =~ s/\*/%/g;
555
        $strcalc .= " AND DATE(deleteditems.timestamp) >= '@$filters[20]' ";
553
        $strcalc .= " AND DATE(deleteditems.timestamp) <= '@$filters[20]' ";
556
    }
557
    if ( $cellvalue eq 'deleteditems' and @$filters[21] ) {
558
        @$filters[21] =~ s/\*/%/g;
559
        $strcalc .= " AND DATE(deleteditems.timestamp) <= '@$filters[21]' ";
560
    }
554
    }
561
    $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield";
555
    $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield";
562
    $debug and warn "SQL: $strcalc";
556
    $debug and warn "SQL: $strcalc";
563
- 

Return to bug 7683