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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tmpl (-13 / +1 lines)
Lines 204-222 function Dopop(link) { Link Here
204
     <!--/TMPL_LOOP --> 
204
     <!--/TMPL_LOOP --> 
205
    </select>
205
    </select>
206
			</li>
206
			</li>
207
			<li>
208
				<label for="day">Day: </label>
209
				<input type="text" name="Filter" id="day" value="" />
210
			</li>
211
			<li>
212
				<label for="month">Month: </label>
213
				<input type="text" name="Filter" id="month" value="" />
214
			</li>
215
			<li>
216
				<label for="year">Year: </label>
217
				<input type="text" name="Filter" id="year" value="" />
218
			</li>
219
220
		</ol>
207
		</ol>
221
	</fieldset>
208
	</fieldset>
222
	
209
	
Lines 227-232 function Dopop(link) { Link Here
227
						<option value ="10">10</option>
214
						<option value ="10">10</option>
228
						<option value ="15">15</option>
215
						<option value ="15">15</option>
229
						<option value ="20">20</option>
216
						<option value ="20">20</option>
217
                        <option value ="">No Limit</option>
230
	<!--					<option value ="25">25</option>
218
	<!--					<option value ="25">25</option>
231
						<option value ="40">40</option>
219
						<option value ="40">40</option>
232
						<option value ="50">50</option>
220
						<option value ="50">50</option>
(-)a/reports/bor_issues_top.pl (-29 / +5 lines)
Lines 151-157 output_html_with_http_headers $input, $cookie, $template->output; Link Here
151
151
152
152
153
sub calculate {
153
sub calculate {
154
    my ($line, $column, $filters) = @_;
154
    my ($limit, $column, $filters) = @_;
155
155
    my @loopcol;
156
    my @loopcol;
156
    my @loopline;
157
    my @loopline;
157
    my @looprow;
158
    my @looprow;
Lines 209-219 sub calculate { Link Here
209
		} elsif ($column =~ /sort2/   ) {
210
		} elsif ($column =~ /sort2/   ) {
210
			# $colfilter[0] = @$filters[11];
211
			# $colfilter[0] = @$filters[11];
211
		}
212
		}
212
        # $colfilter[0] = @$filters[7] if ($column =~ /timestamp/ ) ; FIXME This can't be right.
213
        # $colfilter[0] = @$filters[8] if ($column =~ /timestamp/ ) ; FIXME 
214
        # $colfilter[0] = @$filters[9] if ($column =~ /timestamp/ ) ; FIXME Only this line would have effect.
215
216
    #warn "filtre col ".$colfilter[0]." ".$colfilter[1];
217
                                                
213
                                                
218
    # loop cols.
214
    # loop cols.
219
        if ($column eq "Day") {
215
        if ($column eq "Day") {
Lines 281-295 sub calculate { Link Here
281
        $columns{''} = 1;
277
        $columns{''} = 1;
282
    }
278
    }
283
279
284
    #Initialization of cell values.....
285
    my @table;
286
    for (my $i=1;$i<=$line;$i++) {
287
        foreach (keys %columns) {
288
#			warn " init table : $row->{rowtitle} / $_ ";
289
            $table[$i]->{ $_ || "total" }->{'name'}=0;
290
        }
291
    }
292
293
    my $strcalc ;
280
    my $strcalc ;
294
281
295
# Processing average loanperiods
282
# Processing average loanperiods
Lines 302-318 sub calculate { Link Here
302
                  WHERE old_issues.borrowernumber IS NOT NULL
289
                  WHERE old_issues.borrowernumber IS NOT NULL
303
                  ";
290
                  ";
304
	my @filterterms = (
291
	my @filterterms = (
305
		'old_issues.timestamp  >',
292
		'old_issues.issuedate >',
306
		'old_issues.timestamp  <',
293
		'old_issues.issuedate <',
307
		'old_issues.returndate >',
294
		'old_issues.returndate >',
308
		'old_issues.returndate <',
295
		'old_issues.returndate <',
309
		'old_issues.branchcode  like',
296
		'old_issues.branchcode  like',
310
		'biblioitems.itemtype   like',
297
		'biblioitems.itemtype   like',
311
		'borrowers.categorycode like',
298
		'borrowers.categorycode like',
312
		'dayname(old_issues.timestamp) like',
313
		'monthname(old_issues.timestamp) like',
314
		'monthname(old_issues.timestamp) like',
315
		'year(old_issues.timestamp) like',
316
	);
299
	);
317
    foreach ((@$filters)[0..9]) {
300
    foreach ((@$filters)[0..9]) {
318
		my $term = shift @filterterms;	# go through both arrays in step
301
		my $term = shift @filterterms;	# go through both arrays in step
Lines 320-335 sub calculate { Link Here
320
		s/\*/%/g;
303
		s/\*/%/g;
321
		$strcalc .= " AND $term '$_' ";
304
		$strcalc .= " AND $term '$_' ";
322
	}
305
	}
323
    
324
    $strcalc .= " GROUP BY borrowers.borrowernumber";
306
    $strcalc .= " GROUP BY borrowers.borrowernumber";
325
    $strcalc .= ", $colfield" if ($column);
307
    $strcalc .= ", $colfield" if ($column);
326
    $strcalc .= " ORDER BY RANK DESC";
308
    $strcalc .= " ORDER BY RANK DESC";
327
    $strcalc .= ",$colfield " if ($colfield);
309
    $strcalc .= ",$colfield " if ($colfield);
328
# 	my $max;
310
    $strcalc .= " LIMIT $limit" if ($limit);
329
# 	if (@loopcol) {
330
# 		$max = $line*@loopcol;
331
# 	} else { $max=$line;}
332
# 	$strcalc .= " LIMIT 0,$max";
333
311
334
    $debug and print DEBUG "(old_issues) SQL : $strcalc\n";
312
    $debug and print DEBUG "(old_issues) SQL : $strcalc\n";
335
    my $dbcalc = $dbh->prepare($strcalc);
313
    my $dbcalc = $dbh->prepare($strcalc);
Lines 414-420 sub calculate { Link Here
414
 	# the foot (totals by borrower type)
392
 	# the foot (totals by borrower type)
415
    $globalline{loopfooter} = [];
393
    $globalline{loopfooter} = [];
416
    $globalline{total}= $grantotal;		# FIXME: useless
394
    $globalline{total}= $grantotal;		# FIXME: useless
417
    $globalline{line} = $line;
418
    $globalline{column} = $column;
395
    $globalline{column} = $column;
419
    return [\%globalline];	# reference to a 1 element array: that element is a hashref
396
    return [\%globalline];	# reference to a 1 element array: that element is a hashref
420
}
397
}
421
- 

Return to bug 5157