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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt (-1 / +1 lines)
Lines 24-30 Link Here
24
[% IF ( do_it ) %]
24
[% IF ( do_it ) %]
25
	[% FOREACH mainloo IN mainloop %]
25
	[% FOREACH mainloo IN mainloop %]
26
		<h1>Patrons statistics</h1>
26
		<h1>Patrons statistics</h1>
27
		[% IF ( mainloo.loopfilter ) %]
27
        [% IF ( mainloo.loopfilter.size>0 ) %]
28
            <p>Filtered on:</p>
28
            <p>Filtered on:</p>
29
			[% FOREACH loopfilte IN mainloo.loopfilter %]
29
			[% FOREACH loopfilte IN mainloo.loopfilter %]
30
				<p>
30
				<p>
(-)a/reports/borrowers_stats.pl (-12 lines)
Lines 232-239 sub calculate { Link Here
232
    my @branchcodes = map { $_->branchcode } Koha::Libraries->search;
232
    my @branchcodes = map { $_->branchcode } Koha::Libraries->search;
233
	($status  ) and push @loopfilter,{crit=>"Status",  filter=>$status  };
233
	($status  ) and push @loopfilter,{crit=>"Status",  filter=>$status  };
234
	($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
234
	($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
235
    push @loopfilter,{debug=>1, crit=>"Branches",filter=>join(" ", sort @branchcodes)};
236
	push @loopfilter,{debug=>1, crit=>"(line, column)", filter=>"($line,$column)"};
237
# year of activity
235
# year of activity
238
	my ( $period_year, $period_month, $period_day )=Add_Delta_YM( Today(),-$period, 0);
236
	my ( $period_year, $period_month, $period_day )=Add_Delta_YM( Today(),-$period, 0);
239
	my $newperioddate=$period_year."-".$period_month."-".$period_day;
237
	my $newperioddate=$period_year."-".$period_month."-".$period_day;
Lines 252-263 sub calculate { Link Here
252
        $linefield = $line;
250
        $linefield = $line;
253
    }
251
    }
254
    my $patron_categories = Koha::Patron::Categories->search({}, {order_by => ['categorycode']});
252
    my $patron_categories = Koha::Patron::Categories->search({}, {order_by => ['categorycode']});
255
    push @loopfilter,
256
        {
257
            debug  => 1,
258
            crit   => "Patron category",
259
            filter => join( ", ", map { $_->categorycode . ' (' . ( $_->description || 'NO_DESCRIPTION' ) . ')' } $patron_categories->as_list ),
260
        };
261
253
262
    my $strsth;
254
    my $strsth;
263
    my @strparams; # bind parameters for the query
255
    my @strparams; # bind parameters for the query
Lines 278-284 sub calculate { Link Here
278
	$strsth .= " AND $status='1' " if ($status);
270
	$strsth .= " AND $status='1' " if ($status);
279
    $strsth .=" order by $linefield";
271
    $strsth .=" order by $linefield";
280
	
272
	
281
	push @loopfilter, {sql=>1, crit=>"Query", filter=>$strsth};
282
	my $sth = $dbh->prepare($strsth);
273
	my $sth = $dbh->prepare($strsth);
283
    $sth->execute(@strparams);
274
    $sth->execute(@strparams);
284
 	while (my ($celvalue) = $sth->fetchrow) {
275
 	while (my ($celvalue) = $sth->fetchrow) {
Lines 325-331 sub calculate { Link Here
325
	$strsth2 .= " AND $status='1' " if ($status);
316
	$strsth2 .= " AND $status='1' " if ($status);
326
317
327
    $strsth2 .= " order by $colfield";
318
    $strsth2 .= " order by $colfield";
328
	push @loopfilter, {sql=>1, crit=>"Query", filter=>$strsth2};
329
	my $sth2 = $dbh->prepare($strsth2);
319
	my $sth2 = $dbh->prepare($strsth2);
330
    $sth2->execute(@strparams2);
320
    $sth2->execute(@strparams2);
331
 	while (my ($celvalue) = $sth2->fetchrow) {
321
 	while (my ($celvalue) = $sth2->fetchrow) {
Lines 422-428 sub calculate { Link Here
422
        $strcalc .= " $colfield ";
412
        $strcalc .= " $colfield ";
423
    }
413
    }
424
414
425
	push @loopfilter, {sql=>1, crit=>"Query", filter=>$strcalc};
426
	my $dbcalc = $dbh->prepare($strcalc);
415
	my $dbcalc = $dbh->prepare($strcalc);
427
	(scalar(@calcparams)) ? $dbcalc->execute(@calcparams) : $dbcalc->execute();
416
	(scalar(@calcparams)) ? $dbcalc->execute(@calcparams) : $dbcalc->execute();
428
	
417
	
429
- 

Return to bug 9188