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 160-166 if ($do_it) { Link Here
160
        push @locations, { code => $_, description => "$_ - " . $locations->{$_} };
160
        push @locations, { code => $_, description => "$_ - " . $locations->{$_} };
161
    }
161
    }
162
162
163
    foreach my $kohafield (qw(items.notforloan items.materials items.statisticvalue)) {
163
    foreach my $kohafield (qw(items.notforloan items.materials)) {
164
        my $subfield_structure = GetMarcSubfieldStructureFromKohaField($kohafield);
164
        my $subfield_structure = GetMarcSubfieldStructureFromKohaField($kohafield);
165
        if($subfield_structure) {
165
        if($subfield_structure) {
166
            my $avlist;
166
            my $avlist;
Lines 191-197 if ($do_it) { Link Here
191
        CGIextChoice => \@mime,
191
        CGIextChoice => \@mime,
192
        CGIsepChoice => GetDelimiterChoices,
192
        CGIsepChoice => GetDelimiterChoices,
193
        item_itype   => $item_itype,
193
        item_itype   => $item_itype,
194
        DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
195
    );
194
    );
196
195
197
}
196
}
Lines 234-240 sub calculate { Link Here
234
    my @loopfilter;
233
    my @loopfilter;
235
    for ( my $i = 0 ; $i <= @$filters ; $i++ ) {
234
    for ( my $i = 0 ; $i <= @$filters ; $i++ ) {
236
        my %cell;
235
        my %cell;
237
        if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 16 ) {
236
        if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 15 ) {
238
            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 ] ) ) {
239
                $cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] );
238
                $cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] );
240
            }
239
            }
Lines 255-267 sub calculate { Link Here
255
              : ( $i == 12 ) ? "Collection Code"
254
              : ( $i == 12 ) ? "Collection Code"
256
              : ( $i == 13 ) ? "Status"
255
              : ( $i == 13 ) ? "Status"
257
              : ( $i == 14 ) ? "Materials"
256
              : ( $i == 14 ) ? "Materials"
258
              : ( $i == 15 ) ? "Statistic value"
257
              : ( $i == 16 and $filters->[15] == 0 ) ? "Barcode (not like)"
259
              : ( $i == 17 and $filters->[16] == 0 ) ? "Barcode (not like)"
258
              : ( $i == 16 and $filters->[15] == 1 ) ? "Barcode (like)"
260
              : ( $i == 17 and $filters->[16] == 1 ) ? "Barcode (like)"
259
              : ( $i == 17 ) ? "Acquired date from"
261
              : ( $i == 18 ) ? "Acquired date from"
260
              : ( $i == 18 ) ? "Acquired date to"
262
              : ( $i == 19 ) ? "Acquired date to"
261
              : ( $i == 19 ) ? "Removed date from"
263
              : ( $i == 20 ) ? "Removed date from"
262
              : ( $i == 20 ) ? "Removed date to"
264
              : ( $i == 21 ) ? "Removed date to"
265
              :                '';
263
              :                '';
266
264
267
            push @loopfilter, \%cell;
265
            push @loopfilter, \%cell;
Lines 294-304 sub calculate { Link Here
294
    $linefilter[0] = @$filters[12] if ( $line =~ /items\.ccode/ );
292
    $linefilter[0] = @$filters[12] if ( $line =~ /items\.ccode/ );
295
    $linefilter[0] = @$filters[13] if ( $line =~ /items\.notforloan/ );
293
    $linefilter[0] = @$filters[13] if ( $line =~ /items\.notforloan/ );
296
    $linefilter[0] = @$filters[14] if ( $line =~ /items\.materials/ );
294
    $linefilter[0] = @$filters[14] if ( $line =~ /items\.materials/ );
297
    $linefilter[0] = @$filters[15] if ( $line =~ /items\.statisticvalue/ );
295
    $linefilter[0] = @$filters[17] if ( $line =~ /items\.dateaccessioned/ );
298
    $linefilter[0] = @$filters[18] if ( $line =~ /items\.dateaccessioned/ );
296
    $linefilter[1] = @$filters[18] if ( $line =~ /items\.dateaccessioned/ );
299
    $linefilter[1] = @$filters[19] if ( $line =~ /items\.dateaccessioned/ );
297
    $linefilter[0] = @$filters[19] if ( $line =~ /deleteditems\.timestamp/ );
300
    $linefilter[0] = @$filters[20] if ( $line =~ /deleteditems\.timestamp/ );
298
    $linefilter[1] = @$filters[20] if ( $line =~ /deleteditems\.timestamp/ );
301
    $linefilter[1] = @$filters[21] if ( $line =~ /deleteditems\.timestamp/ );
302
299
303
    my @colfilter;
300
    my @colfilter;
304
    $colfilter[0] = @$filters[0] if ( $column =~ /dewey/ );
301
    $colfilter[0] = @$filters[0] if ( $column =~ /dewey/ );
Lines 320-330 sub calculate { Link Here
320
    $colfilter[0] = @$filters[12] if ( $column =~ /items\.ccode/ );
317
    $colfilter[0] = @$filters[12] if ( $column =~ /items\.ccode/ );
321
    $colfilter[0] = @$filters[13] if ( $column =~ /items\.notforloan/ );
318
    $colfilter[0] = @$filters[13] if ( $column =~ /items\.notforloan/ );
322
    $colfilter[0] = @$filters[14] if ( $column =~ /items\.materials/ );
319
    $colfilter[0] = @$filters[14] if ( $column =~ /items\.materials/ );
323
    $colfilter[0] = @$filters[15] if ( $column =~ /items\.statisticvalue/ );
320
    $colfilter[0] = @$filters[17] if ( $column =~ /items.dateaccessioned/ );
324
    $colfilter[0] = @$filters[18] if ( $column =~ /items.dateaccessioned/ );
321
    $colfilter[1] = @$filters[18] if ( $column =~ /items\.dateaccessioned/ );
325
    $colfilter[1] = @$filters[19] if ( $column =~ /items\.dateaccessioned/ );
322
    $colfilter[0] = @$filters[19] if ( $column =~ /deleteditems\.timestamp/ );
326
    $colfilter[0] = @$filters[20] if ( $column =~ /deleteditems\.timestamp/ );
323
    $colfilter[1] = @$filters[20] if ( $column =~ /deleteditems\.timestamp/ );
327
    $colfilter[1] = @$filters[21] if ( $column =~ /deleteditems\.timestamp/ );
328
324
329
    # 1st, loop rows.
325
    # 1st, loop rows.
330
    my $origline = $line;
326
    my $origline = $line;
Lines 540-564 sub calculate { Link Here
540
        @$filters[14] =~ s/\*/%/g;
536
        @$filters[14] =~ s/\*/%/g;
541
        $strcalc .= " AND $itemstable.materials  LIKE '" . @$filters[14] . "'";
537
        $strcalc .= " AND $itemstable.materials  LIKE '" . @$filters[14] . "'";
542
    }
538
    }
543
    if ( defined @$filters[15] and @$filters[15] ne '' ) {
539
    if ( @$filters[17] ) {
544
        @$filters[15] =~ s/\*/%/g;
540
        @$filters[17] =~ s/\*/%/g;
545
        $strcalc .= " AND $itemstable.statisticvalue  LIKE '" . @$filters[15] . "'";
541
        $strcalc .= " AND $itemstable.dateaccessioned >= '@$filters[17]' ";
546
    }
542
    }
547
    if ( @$filters[18] ) {
543
    if ( @$filters[18] ) {
548
        @$filters[18] =~ s/\*/%/g;
544
        @$filters[18] =~ s/\*/%/g;
549
        $strcalc .= " AND $itemstable.dateaccessioned >= '@$filters[18]' ";
545
        $strcalc .= " AND $itemstable.dateaccessioned <= '@$filters[18]' ";
550
    }
546
    }
551
    if ( @$filters[19] ) {
547
    if ( $cellvalue eq 'deleteditems' and @$filters[19] ) {
552
        @$filters[19] =~ s/\*/%/g;
548
        @$filters[19] =~ s/\*/%/g;
553
        $strcalc .= " AND $itemstable.dateaccessioned <= '@$filters[19]' ";
549
        $strcalc .= " AND DATE(deleteditems.timestamp) >= '@$filters[19]' ";
554
    }
550
    }
555
    if ( $cellvalue eq 'deleteditems' and @$filters[20] ) {
551
    if ( $cellvalue eq 'deleteditems' and @$filters[20] ) {
556
        @$filters[20] =~ s/\*/%/g;
552
        @$filters[20] =~ s/\*/%/g;
557
        $strcalc .= " AND DATE(deleteditems.timestamp) >= '@$filters[20]' ";
553
        $strcalc .= " AND DATE(deleteditems.timestamp) <= '@$filters[20]' ";
558
    }
559
    if ( $cellvalue eq 'deleteditems' and @$filters[21] ) {
560
        @$filters[21] =~ s/\*/%/g;
561
        $strcalc .= " AND DATE(deleteditems.timestamp) <= '@$filters[21]' ";
562
    }
554
    }
563
    $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield";
555
    $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield";
564
    $debug and warn "SQL: $strcalc";
556
    $debug and warn "SQL: $strcalc";
565
- 

Return to bug 7683