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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt (+17 lines)
Lines 125-130 Link Here
125
    </select>
125
    </select>
126
      </li>
126
      </li>
127
      <li> 
127
      <li> 
128
        <label for="itemcallnumber">Call number: </label><input type="text" name="Filter" id="itemcallnumber" value="" />
129
      </li>
130
      <li>
131
        <label for="ccode">Collection code: </label><select name="Filter" id="ccode"><option value="" > Any collection code</option>
132
    [% FOREACH ccodeloo IN ccodeloop %]
133
        <option value="[% ccodeloo.value %]" >[% ccodeloo.description %] </option>
134
     [% END %]
135
    </select>
136
      </li>
137
      <li>
138
        <label for="shelvingloc">Shelving location: </label><select name="Filter" id="shelvingloc"><option value="" > Any shelving location</option>
139
    [% FOREACH shelvinglocloo IN shelvinglocloop %]
140
        <option value="[% shelvinglocloo.value %]" >[% shelvinglocloo.description %] </option>
141
     [% END %]
142
    </select>
143
      </li>
144
      <li>
128
        <label for="patroncategory">Patron category: </label><select name="Filter" id="patroncategory"><option value="" > Any Category code</option>
145
        <label for="patroncategory">Patron category: </label><select name="Filter" id="patroncategory"><option value="" > Any Category code</option>
129
    [% FOREACH borcatloo IN borcatloop %]
146
    [% FOREACH borcatloo IN borcatloop %]
130
        <option value="[% borcatloo.value %]" >[% borcatloo.description %] </option>  
147
        <option value="[% borcatloo.value %]" >[% borcatloo.description %] </option>  
(-)a/reports/cat_issues_top.pl (-16 / +57 lines)
Lines 129-135 if ($do_it) { Link Here
129
                            );
129
                            );
130
            push @itemtypeloop, \%row;
130
            push @itemtypeloop, \%row;
131
    }
131
    }
132
    
132
133
    #ccode
134
    my $ccodes = GetAuthorisedValues('CCODE');
135
    my @ccodeloop;
136
    for my $thisccode (@$ccodes) {
137
            my %row = (value => $thisccode->{authorised_value},
138
                       description => $thisccode->{lib},
139
                            );
140
            push @ccodeloop, \%row;
141
    }
142
143
    @ccodeloop = sort {$a->{value} cmp $b->{value}} @ccodeloop;
144
145
    #shelvingloc
146
    my $shelvinglocs = GetAuthorisedValues('LOC');
147
    my @shelvinglocloop;
148
    for my $thisloc (@$shelvinglocs) {
149
            my %row = (value => $thisloc->{authorised_value},
150
                       description => $thisloc->{lib},
151
                            );
152
            push @shelvinglocloop, \%row;
153
    }
154
155
    @shelvinglocloop = sort {$a->{value} cmp $b->{value}} @shelvinglocloop;
156
133
    #borcat
157
    #borcat
134
    my ($codes,$labels) = GetborCatFromCatType(undef,undef);
158
    my ($codes,$labels) = GetborCatFromCatType(undef,undef);
135
    my @borcatloop;
159
    my @borcatloop;
Lines 147-152 if ($do_it) { Link Here
147
                    CGIsepChoice => $CGIsepChoice,
171
                    CGIsepChoice => $CGIsepChoice,
148
                    branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}),
172
                    branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}),
149
                    itemtypeloop =>\@itemtypeloop,
173
                    itemtypeloop =>\@itemtypeloop,
174
                    ccodeloop =>\@ccodeloop,
175
                    shelvinglocloop =>\@shelvinglocloop,
150
                    borcatloop =>\@borcatloop,
176
                    borcatloop =>\@borcatloop,
151
                    );
177
                    );
152
output_html_with_http_headers $input, $cookie, $template->output;
178
output_html_with_http_headers $input, $cookie, $template->output;
Lines 171-177 sub calculate { Link Here
171
# Checking filters
197
# Checking filters
172
#
198
#
173
    my @loopfilter;
199
    my @loopfilter;
174
    for (my $i=0;$i<=6;$i++) {
200
    for (my $i=0;$i<=12;$i++) {
175
        my %cell;
201
        my %cell;
176
        if ( @$filters[$i] ) {
202
        if ( @$filters[$i] ) {
177
            if (($i==1) and (@$filters[$i-1])) {
203
            if (($i==1) and (@$filters[$i-1])) {
Lines 190-199 sub calculate { Link Here
190
            $cell{crit} .="Return To" if ($i==3);
216
            $cell{crit} .="Return To" if ($i==3);
191
            $cell{crit} .="Branch" if ($i==4);
217
            $cell{crit} .="Branch" if ($i==4);
192
            $cell{crit} .="Doc Type" if ($i==5);
218
            $cell{crit} .="Doc Type" if ($i==5);
193
            $cell{crit} .="Bor Cat" if ($i==6);
219
            $cell{crit} .="Call number" if ($i==6);
194
            $cell{crit} .="Day" if ($i==7);
220
            $cell{crit} .="Collection code" if ($i==7);
195
            $cell{crit} .="Month" if ($i==8);
221
            $cell{crit} .="Shelving location" if ($i==8);
196
            $cell{crit} .="Year" if ($i==9);
222
            $cell{crit} .="Bor Cat" if ($i==9);
223
            $cell{crit} .="Day" if ($i==10);
224
            $cell{crit} .="Month" if ($i==11);
225
            $cell{crit} .="Year" if ($i==12);
197
            push @loopfilter, \%cell;
226
            push @loopfilter, \%cell;
198
        }
227
        }
199
    }
228
    }
Lines 212-222 sub calculate { Link Here
212
        $colfilter[1] = @$filters[3] if ($column =~ /returndate/ )  ;
241
        $colfilter[1] = @$filters[3] if ($column =~ /returndate/ )  ;
213
        $colfilter[0] = @$filters[4] if ($column =~ /branch/ )  ;
242
        $colfilter[0] = @$filters[4] if ($column =~ /branch/ )  ;
214
        $colfilter[0] = @$filters[5] if ($column =~ /itemtype/ )  ;
243
        $colfilter[0] = @$filters[5] if ($column =~ /itemtype/ )  ;
215
        $colfilter[0] = @$filters[6] if ($column =~ /category/ )  ;
244
      # These limits does not currently exist, maybe later?
216
    # 	$colfilter[0] = @$filters[11] if ($column =~ /sort2/ ) ;
245
      # $colfilter[0] = @$filters[6] if ($column =~ /ccode/ )  ;
217
        $colfilter[0] = @$filters[7] if ($column =~ /timestamp/ ) ;
246
      # $colfilter[0] = @$filters[7] if ($column =~ /location/ )  ;
218
        $colfilter[0] = @$filters[8] if ($column =~ /timestamp/ ) ;
247
        $colfilter[0] = @$filters[8] if ($column =~ /category/ )  ;
248
      # This commented out row (sort2) was not removed when adding new filters for ccode, shelving location and call number
249
      # $colfilter[0] = @$filters[11] if ($column =~ /sort2/ ) ;
219
        $colfilter[0] = @$filters[9] if ($column =~ /timestamp/ ) ;
250
        $colfilter[0] = @$filters[9] if ($column =~ /timestamp/ ) ;
251
        $colfilter[0] = @$filters[10] if ($column =~ /timestamp/ ) ;
252
        $colfilter[0] = @$filters[11] if ($column =~ /timestamp/ ) ;
220
    #warn "filtre col ".$colfilter[0]." ".$colfilter[1];
253
    #warn "filtre col ".$colfilter[0]." ".$colfilter[1];
221
                                                
254
                                                
222
    # loop cols.
255
    # loop cols.
Lines 301-306 sub calculate { Link Here
301
    
334
    
302
# Processing average loanperiods
335
# Processing average loanperiods
303
    $strcalc .= "SELECT DISTINCT biblio.title, COUNT(biblio.biblionumber) AS RANK, biblio.biblionumber AS ID";
336
    $strcalc .= "SELECT DISTINCT biblio.title, COUNT(biblio.biblionumber) AS RANK, biblio.biblionumber AS ID";
337
    $strcalc .= ", itemcallnumber as CALLNUM";
338
    $strcalc .= ", ccode as CCODE";
339
    $strcalc .= ", location as LOC";
304
    $strcalc .= " , $colfield " if ($colfield);
340
    $strcalc .= " , $colfield " if ($colfield);
305
    $strcalc .= " FROM `old_issues` 
341
    $strcalc .= " FROM `old_issues` 
306
                  LEFT JOIN items USING(itemnumber) 
342
                  LEFT JOIN items USING(itemnumber) 
Lines 329-341 sub calculate { Link Here
329
        $strcalc .= "'" . @$filters[5] ."'" ;
365
        $strcalc .= "'" . @$filters[5] ."'" ;
330
    }
366
    }
331
    @$filters[6]=~ s/\*/%/g if (@$filters[6]);
367
    @$filters[6]=~ s/\*/%/g if (@$filters[6]);
332
    $strcalc .= " AND borrowers.categorycode like '" . @$filters[6] ."'" if ( @$filters[6] );
368
    $strcalc .= " AND itemcallnumber like '" . @$filters[6] ."'" if ( @$filters[6] );
333
    @$filters[7]=~ s/\*/%/g if (@$filters[7]);
369
    @$filters[7]=~ s/\*/%/g if (@$filters[7]);
334
    $strcalc .= " AND dayname(old_issues.timestamp) like '" . @$filters[7]."'" if (@$filters[7]);
370
    $strcalc .= " AND ccode like '" . @$filters[7] ."'" if ( @$filters[7] );
335
    @$filters[8]=~ s/\*/%/g if (@$filters[8]);
371
    @$filters[8]=~ s/\*/%/g if (@$filters[8]);
336
    $strcalc .= " AND monthname(old_issues.timestamp) like '" . @$filters[8]."'" if (@$filters[8]);
372
    $strcalc .= " AND location like '" . @$filters[8] ."'" if ( @$filters[8] );
337
    @$filters[9]=~ s/\*/%/g if (@$filters[9]);
373
    @$filters[9]=~ s/\*/%/g if (@$filters[9]);
338
    $strcalc .= " AND year(old_issues.timestamp) like '" . @$filters[9] ."'" if ( @$filters[9] );
374
    $strcalc .= " AND borrowers.categorycode like '" . @$filters[9] ."'" if ( @$filters[9] );
375
    @$filters[10]=~ s/\*/%/g if (@$filters[10]);
376
    $strcalc .= " AND dayname(old_issues.timestamp) like '" . @$filters[10]."'" if (@$filters[10]);
377
    @$filters[11]=~ s/\*/%/g if (@$filters[11]);
378
    $strcalc .= " AND monthname(old_issues.timestamp) like '" . @$filters[11]."'" if (@$filters[11]);
379
    @$filters[12]=~ s/\*/%/g if (@$filters[12]);
380
    $strcalc .= " AND year(old_issues.timestamp) like '" . @$filters[12] ."'" if ( @$filters[12] );
339
    
381
    
340
    $strcalc .= " group by biblio.biblionumber";
382
    $strcalc .= " group by biblio.biblionumber";
341
    $strcalc .= ", $colfield" if ($column);
383
    $strcalc .= ", $colfield" if ($column);
Lines 347-353 sub calculate { Link Here
347
    my $previous_col;
389
    my $previous_col;
348
    my %indice;
390
    my %indice;
349
    while (my  @data = $dbcalc->fetchrow) {
391
    while (my  @data = $dbcalc->fetchrow) {
350
        my ($row, $rank, $id, $col )=@data;
392
        my ($row, $rank, $id, $callnum, $ccode, $loc, $col )=@data;
351
        $col = "zzEMPTY" if (!defined($col));
393
        $col = "zzEMPTY" if (!defined($col));
352
        $indice{$col}=1 if (not($indice{$col}));
394
        $indice{$col}=1 if (not($indice{$col}));
353
        $table[$indice{$col}]->{$col}->{'name'}=$row;
395
        $table[$indice{$col}]->{$col}->{'name'}=$row;
354
- 

Return to bug 10154