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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt (-25 lines)
Lines 275-305 Link Here
275
                    <td colspan="4"><input type="hidden" name="Filter" /></td>
275
                    <td colspan="4"><input type="hidden" name="Filter" /></td>
276
                </tr>
276
                </tr>
277
            [% END %]
277
            [% END %]
278
            [% IF (statisticvalue) %]
279
                <tr>
280
                    <td>[% statisticvalue_label %]</td>
281
                    <td><input type="radio" name="Line"   value="items.statisticvalue" /></td>
282
                    <td><input type="radio" name="Column" value="items.statisticvalue" /></td>
283
                    <td>
284
                        [% IF (statisticvalue_avlist) %]
285
                            <select name="Filter" id="statisticvalue">
286
                                <option value="">&nbsp;</option>
287
                                [% FOREACH av IN statisticvalue_avlist %]
288
                                    <option value="[% av.authorised_value %]">
289
                                        [% av.lib %]
290
                                    </option>
291
                                [% END %]
292
                            </select>
293
                        [% ELSE %]
294
                            <input type="text" name="Filter" id="statisticvalue" />
295
                        [% END %]
296
                    </td>
297
                </tr>
298
            [% ELSE %]
299
                <tr style="display:none">
300
                    <td colspan="4"><input type="hidden" name="Filter" /></td>
301
                </tr>
302
            [% END %]
303
            <tr>
278
            <tr>
304
                <td colspan="3">Filter barcode</td>
279
                <td colspan="3">Filter barcode</td>
305
                <td>
280
                <td>
(-)a/reports/catalogue_stats.pl (-32 / +23 lines)
Lines 164-170 if ($do_it) { Link Here
164
        push @locations, { code => $_, description => "$_ - " . $locations->{$_} };
164
        push @locations, { code => $_, description => "$_ - " . $locations->{$_} };
165
    }
165
    }
166
166
167
    foreach my $kohafield (qw(items.notforloan items.materials items.statisticvalue)) {
167
    foreach my $kohafield (qw(items.notforloan items.materials)) {
168
        my $subfield_structure = GetMarcSubfieldStructureFromKohaField($kohafield);
168
        my $subfield_structure = GetMarcSubfieldStructureFromKohaField($kohafield);
169
        if($subfield_structure) {
169
        if($subfield_structure) {
170
            my $avlist;
170
            my $avlist;
Lines 195-201 if ($do_it) { Link Here
195
        CGIextChoice => \@mime,
195
        CGIextChoice => \@mime,
196
        CGIsepChoice => GetDelimiterChoices,
196
        CGIsepChoice => GetDelimiterChoices,
197
        item_itype   => $item_itype,
197
        item_itype   => $item_itype,
198
        DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
199
    );
198
    );
200
199
201
}
200
}
Lines 238-244 sub calculate { Link Here
238
    my @loopfilter;
237
    my @loopfilter;
239
    for ( my $i = 0 ; $i <= @$filters ; $i++ ) {
238
    for ( my $i = 0 ; $i <= @$filters ; $i++ ) {
240
        my %cell;
239
        my %cell;
241
        if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 16 ) {
240
        if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 15 ) {
242
            if ( ( ( $i == 1 ) or ( $i == 3 ) or ( $i == 5 ) or ( $i == 9 ) ) and ( @$filters[ $i - 1 ] ) ) {
241
            if ( ( ( $i == 1 ) or ( $i == 3 ) or ( $i == 5 ) or ( $i == 9 ) ) and ( @$filters[ $i - 1 ] ) ) {
243
                $cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] );
242
                $cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] );
244
            }
243
            }
Lines 259-271 sub calculate { Link Here
259
              : ( $i == 12 ) ? "Collection Code"
258
              : ( $i == 12 ) ? "Collection Code"
260
              : ( $i == 13 ) ? "Status"
259
              : ( $i == 13 ) ? "Status"
261
              : ( $i == 14 ) ? "Materials"
260
              : ( $i == 14 ) ? "Materials"
262
              : ( $i == 15 ) ? "Statistic value"
261
              : ( $i == 16 and $filters->[15] == 0 ) ? "Barcode (not like)"
263
              : ( $i == 17 and $filters->[16] == 0 ) ? "Barcode (not like)"
262
              : ( $i == 16 and $filters->[15] == 1 ) ? "Barcode (like)"
264
              : ( $i == 17 and $filters->[16] == 1 ) ? "Barcode (like)"
263
              : ( $i == 17 ) ? "Acquired date from"
265
              : ( $i == 18 ) ? "Acquired date from"
264
              : ( $i == 18 ) ? "Acquired date to"
266
              : ( $i == 19 ) ? "Acquired date to"
265
              : ( $i == 19 ) ? "Removed date from"
267
              : ( $i == 20 ) ? "Removed date from"
266
              : ( $i == 20 ) ? "Removed date to"
268
              : ( $i == 21 ) ? "Removed date to"
269
              :                '';
267
              :                '';
270
268
271
            push @loopfilter, \%cell;
269
            push @loopfilter, \%cell;
Lines 298-308 sub calculate { Link Here
298
    $linefilter[0] = @$filters[12] if ( $line =~ /items\.ccode/ );
296
    $linefilter[0] = @$filters[12] if ( $line =~ /items\.ccode/ );
299
    $linefilter[0] = @$filters[13] if ( $line =~ /items\.notforloan/ );
297
    $linefilter[0] = @$filters[13] if ( $line =~ /items\.notforloan/ );
300
    $linefilter[0] = @$filters[14] if ( $line =~ /items\.materials/ );
298
    $linefilter[0] = @$filters[14] if ( $line =~ /items\.materials/ );
301
    $linefilter[0] = @$filters[15] if ( $line =~ /items\.statisticvalue/ );
299
    $linefilter[0] = @$filters[17] if ( $line =~ /items\.dateaccessioned/ );
302
    $linefilter[0] = @$filters[18] if ( $line =~ /items\.dateaccessioned/ );
300
    $linefilter[1] = @$filters[18] if ( $line =~ /items\.dateaccessioned/ );
303
    $linefilter[1] = @$filters[19] if ( $line =~ /items\.dateaccessioned/ );
301
    $linefilter[0] = @$filters[19] if ( $line =~ /deleteditems\.timestamp/ );
304
    $linefilter[0] = @$filters[20] if ( $line =~ /deleteditems\.timestamp/ );
302
    $linefilter[1] = @$filters[20] if ( $line =~ /deleteditems\.timestamp/ );
305
    $linefilter[1] = @$filters[21] if ( $line =~ /deleteditems\.timestamp/ );
306
303
307
    my @colfilter;
304
    my @colfilter;
308
    $colfilter[0] = @$filters[0] if ( $column =~ /dewey/ );
305
    $colfilter[0] = @$filters[0] if ( $column =~ /dewey/ );
Lines 324-334 sub calculate { Link Here
324
    $colfilter[0] = @$filters[12] if ( $column =~ /items\.ccode/ );
321
    $colfilter[0] = @$filters[12] if ( $column =~ /items\.ccode/ );
325
    $colfilter[0] = @$filters[13] if ( $column =~ /items\.notforloan/ );
322
    $colfilter[0] = @$filters[13] if ( $column =~ /items\.notforloan/ );
326
    $colfilter[0] = @$filters[14] if ( $column =~ /items\.materials/ );
323
    $colfilter[0] = @$filters[14] if ( $column =~ /items\.materials/ );
327
    $colfilter[0] = @$filters[15] if ( $column =~ /items\.statisticvalue/ );
324
    $colfilter[0] = @$filters[17] if ( $column =~ /items.dateaccessioned/ );
328
    $colfilter[0] = @$filters[18] if ( $column =~ /items.dateaccessioned/ );
325
    $colfilter[1] = @$filters[18] if ( $column =~ /items\.dateaccessioned/ );
329
    $colfilter[1] = @$filters[19] if ( $column =~ /items\.dateaccessioned/ );
326
    $colfilter[0] = @$filters[19] if ( $column =~ /deleteditems\.timestamp/ );
330
    $colfilter[0] = @$filters[20] if ( $column =~ /deleteditems\.timestamp/ );
327
    $colfilter[1] = @$filters[20] if ( $column =~ /deleteditems\.timestamp/ );
331
    $colfilter[1] = @$filters[21] if ( $column =~ /deleteditems\.timestamp/ );
332
328
333
    # 1st, loop rows.
329
    # 1st, loop rows.
334
    my $origline = $line;
330
    my $origline = $line;
Lines 556-580 sub calculate { Link Here
556
        @$filters[14] =~ s/\*/%/g;
552
        @$filters[14] =~ s/\*/%/g;
557
        $strcalc .= " AND $itemstable.materials  LIKE '" . @$filters[14] . "'";
553
        $strcalc .= " AND $itemstable.materials  LIKE '" . @$filters[14] . "'";
558
    }
554
    }
559
    if ( defined @$filters[15] and @$filters[15] ne '' ) {
555
    if ( @$filters[17] ) {
560
        @$filters[15] =~ s/\*/%/g;
556
        @$filters[17] =~ s/\*/%/g;
561
        $strcalc .= " AND $itemstable.statisticvalue  LIKE '" . @$filters[15] . "'";
557
        $strcalc .= " AND $itemstable.dateaccessioned >= '@$filters[17]' ";
562
    }
558
    }
563
    if ( @$filters[18] ) {
559
    if ( @$filters[18] ) {
564
        @$filters[18] =~ s/\*/%/g;
560
        @$filters[18] =~ s/\*/%/g;
565
        $strcalc .= " AND $itemstable.dateaccessioned >= '@$filters[18]' ";
561
        $strcalc .= " AND $itemstable.dateaccessioned <= '@$filters[18]' ";
566
    }
562
    }
567
    if ( @$filters[19] ) {
563
    if ( $cellvalue eq 'deleteditems' and @$filters[19] ) {
568
        @$filters[19] =~ s/\*/%/g;
564
        @$filters[19] =~ s/\*/%/g;
569
        $strcalc .= " AND $itemstable.dateaccessioned <= '@$filters[19]' ";
565
        $strcalc .= " AND DATE(deleteditems.timestamp) >= '@$filters[19]' ";
570
    }
566
    }
571
    if ( $cellvalue eq 'deleteditems' and @$filters[20] ) {
567
    if ( $cellvalue eq 'deleteditems' and @$filters[20] ) {
572
        @$filters[20] =~ s/\*/%/g;
568
        @$filters[20] =~ s/\*/%/g;
573
        $strcalc .= " AND DATE(deleteditems.timestamp) >= '@$filters[20]' ";
569
        $strcalc .= " AND DATE(deleteditems.timestamp) <= '@$filters[20]' ";
574
    }
575
    if ( $cellvalue eq 'deleteditems' and @$filters[21] ) {
576
        @$filters[21] =~ s/\*/%/g;
577
        $strcalc .= " AND DATE(deleteditems.timestamp) <= '@$filters[21]' ";
578
    }
570
    }
579
    $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield";
571
    $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield";
580
    $debug and warn "SQL: $strcalc";
572
    $debug and warn "SQL: $strcalc";
581
- 

Return to bug 7683