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 188-197 sub calculate { Link Here
188
            $cell{crit} .="Return To" if ($i==3);
214
            $cell{crit} .="Return To" if ($i==3);
189
            $cell{crit} .="Branch" if ($i==4);
215
            $cell{crit} .="Branch" if ($i==4);
190
            $cell{crit} .="Doc Type" if ($i==5);
216
            $cell{crit} .="Doc Type" if ($i==5);
191
            $cell{crit} .="Bor Cat" if ($i==6);
217
            $cell{crit} .="Call number" if ($i==6);
192
            $cell{crit} .="Day" if ($i==7);
218
            $cell{crit} .="Collection code" if ($i==7);
193
            $cell{crit} .="Month" if ($i==8);
219
            $cell{crit} .="Shelving location" if ($i==8);
194
            $cell{crit} .="Year" if ($i==9);
220
            $cell{crit} .="Bor Cat" if ($i==9);
221
            $cell{crit} .="Day" if ($i==10);
222
            $cell{crit} .="Month" if ($i==11);
223
            $cell{crit} .="Year" if ($i==12);
195
            push @loopfilter, \%cell;
224
            push @loopfilter, \%cell;
196
        }
225
        }
197
    }
226
    }
Lines 210-220 sub calculate { Link Here
210
        $colfilter[1] = @$filters[3] if ($column =~ /returndate/ )  ;
239
        $colfilter[1] = @$filters[3] if ($column =~ /returndate/ )  ;
211
        $colfilter[0] = @$filters[4] if ($column =~ /branch/ )  ;
240
        $colfilter[0] = @$filters[4] if ($column =~ /branch/ )  ;
212
        $colfilter[0] = @$filters[5] if ($column =~ /itemtype/ )  ;
241
        $colfilter[0] = @$filters[5] if ($column =~ /itemtype/ )  ;
213
        $colfilter[0] = @$filters[6] if ($column =~ /category/ )  ;
242
      # These limits does not currently exist, maybe later?
214
    # 	$colfilter[0] = @$filters[11] if ($column =~ /sort2/ ) ;
243
      # $colfilter[0] = @$filters[6] if ($column =~ /ccode/ )  ;
215
        $colfilter[0] = @$filters[7] if ($column =~ /timestamp/ ) ;
244
      # $colfilter[0] = @$filters[7] if ($column =~ /location/ )  ;
216
        $colfilter[0] = @$filters[8] if ($column =~ /timestamp/ ) ;
245
        $colfilter[0] = @$filters[8] if ($column =~ /category/ )  ;
246
      # This commented out row (sort2) was not removed when adding new filters for ccode, shelving location and call number    
247
      # $colfilter[0] = @$filters[11] if ($column =~ /sort2/ ) ;
217
        $colfilter[0] = @$filters[9] if ($column =~ /timestamp/ ) ;
248
        $colfilter[0] = @$filters[9] if ($column =~ /timestamp/ ) ;
249
        $colfilter[0] = @$filters[10] if ($column =~ /timestamp/ ) ;
250
        $colfilter[0] = @$filters[11] if ($column =~ /timestamp/ ) ;
218
    #warn "filtre col ".$colfilter[0]." ".$colfilter[1];
251
    #warn "filtre col ".$colfilter[0]." ".$colfilter[1];
219
                                                
252
                                                
220
    # loop cols.
253
    # loop cols.
Lines 299-304 sub calculate { Link Here
299
    
332
    
300
# Processing average loanperiods
333
# Processing average loanperiods
301
    $strcalc .= "SELECT DISTINCT biblio.title, COUNT(biblio.biblionumber) AS RANK, biblio.biblionumber AS ID";
334
    $strcalc .= "SELECT DISTINCT biblio.title, COUNT(biblio.biblionumber) AS RANK, biblio.biblionumber AS ID";
335
    $strcalc .= ", itemcallnumber as CALLNUM";
336
    $strcalc .= ", ccode as CCODE";
337
    $strcalc .= ", location as LOC";
302
    $strcalc .= " , $colfield " if ($colfield);
338
    $strcalc .= " , $colfield " if ($colfield);
303
    $strcalc .= " FROM `old_issues` 
339
    $strcalc .= " FROM `old_issues` 
304
                  LEFT JOIN items USING(itemnumber) 
340
                  LEFT JOIN items USING(itemnumber) 
Lines 327-339 sub calculate { Link Here
327
        $strcalc .= "'" . @$filters[5] ."'" ;
363
        $strcalc .= "'" . @$filters[5] ."'" ;
328
    }
364
    }
329
    @$filters[6]=~ s/\*/%/g if (@$filters[6]);
365
    @$filters[6]=~ s/\*/%/g if (@$filters[6]);
330
    $strcalc .= " AND borrowers.categorycode like '" . @$filters[6] ."'" if ( @$filters[6] );
366
    $strcalc .= " AND itemcallnumber like '" . @$filters[6] ."'" if ( @$filters[6] );
331
    @$filters[7]=~ s/\*/%/g if (@$filters[7]);
367
    @$filters[7]=~ s/\*/%/g if (@$filters[7]);
332
    $strcalc .= " AND dayname(old_issues.timestamp) like '" . @$filters[7]."'" if (@$filters[7]);
368
    $strcalc .= " AND ccode like '" . @$filters[7] ."'" if ( @$filters[7] );
333
    @$filters[8]=~ s/\*/%/g if (@$filters[8]);
369
    @$filters[8]=~ s/\*/%/g if (@$filters[8]);
334
    $strcalc .= " AND monthname(old_issues.timestamp) like '" . @$filters[8]."'" if (@$filters[8]);
370
    $strcalc .= " AND location like '" . @$filters[8] ."'" if ( @$filters[8] );
335
    @$filters[9]=~ s/\*/%/g if (@$filters[9]);
371
    @$filters[9]=~ s/\*/%/g if (@$filters[9]);
336
    $strcalc .= " AND year(old_issues.timestamp) like '" . @$filters[9] ."'" if ( @$filters[9] );
372
    $strcalc .= " AND borrowers.categorycode like '" . @$filters[9] ."'" if ( @$filters[9] );
373
    @$filters[10]=~ s/\*/%/g if (@$filters[10]);
374
    $strcalc .= " AND dayname(old_issues.timestamp) like '" . @$filters[10]."'" if (@$filters[10]);
375
    @$filters[11]=~ s/\*/%/g if (@$filters[11]);
376
    $strcalc .= " AND monthname(old_issues.timestamp) like '" . @$filters[11]."'" if (@$filters[11]);
377
    @$filters[12]=~ s/\*/%/g if (@$filters[12]);
378
    $strcalc .= " AND year(old_issues.timestamp) like '" . @$filters[12] ."'" if ( @$filters[12] );
337
    
379
    
338
    $strcalc .= " group by biblio.biblionumber";
380
    $strcalc .= " group by biblio.biblionumber";
339
    $strcalc .= ", $colfield" if ($column);
381
    $strcalc .= ", $colfield" if ($column);
Lines 345-351 sub calculate { Link Here
345
    my $previous_col;
387
    my $previous_col;
346
    my %indice;
388
    my %indice;
347
    while (my  @data = $dbcalc->fetchrow) {
389
    while (my  @data = $dbcalc->fetchrow) {
348
        my ($row, $rank, $id, $col )=@data;
390
        my ($row, $rank, $id, $callnum, $ccode, $loc, $col )=@data;
349
        $col = "zzEMPTY" if (!defined($col));
391
        $col = "zzEMPTY" if (!defined($col));
350
        $indice{$col}=1 if (not($indice{$col}));
392
        $indice{$col}=1 if (not($indice{$col}));
351
        $table[$indice{$col}]->{$col}->{'name'}=$row;
393
        $table[$indice{$col}]->{$col}->{'name'}=$row;
352
- 

Return to bug 10154