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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt (-8 / +61 lines)
Lines 1-5 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE KohaDates %]
3
[% USE Categories %]
2
[% USE Branches %]
4
[% USE Branches %]
5
[% USE AuthorisedValues %]
3
[% USE Koha %]
6
[% USE Koha %]
4
[% USE Asset %]
7
[% USE Asset %]
5
[% PROCESS 'i18n.inc' %]
8
[% PROCESS 'i18n.inc' %]
Lines 53-70 Link Here
53
                <h1>Patrons statistics</h1>
56
                <h1>Patrons statistics</h1>
54
                [% IF ( do_it ) %]
57
                [% IF ( do_it ) %]
55
                    [% FOREACH mainloo IN mainloop %]
58
                    [% FOREACH mainloo IN mainloop %]
56
                        [% IF ( mainloo.loopfilter.size>0 ) %]
59
                        [% IF ( mainloo.loopfilter.size > 0 ) %]
57
                            <p>Filtered on:</p>
60
                            <p>Filtered on:</p>
58
                            [% FOREACH loopfilte IN mainloo.loopfilter %]
61
                            <ul>
59
                                <p>
62
                            [% FOREACH f IN mainloo.loopfilter %]
60
                                    [% loopfilte.crit | html %] = [% loopfilte.filter | html %]
63
                                    [% SWITCH f.crit %]
61
                                </p>
64
                                        [% CASE 'category' %]<li>Patron category: [% Categories.GetName( f.filter ) | html %]</li>
65
                                        [% CASE 'status' %]
66
                                            <li><span>Patron status:</span>
67
                                            [% SWITCH f.filter %]
68
                                                [% CASE 'debarred' %]<span>Restricted</span>
69
                                                [% CASE 'gonenoaddress' %]<span>Gone no address</span>
70
                                                [% CASE 'lost' %]<span>Lost card</span>
71
                                                [% CASE %]<span>[% f.filter | html %]</span>
72
                                            [% END %]
73
                                            </li>
74
                                        [% CASE 'activity' %]
75
                                            <li><span>Patron activity:</span>
76
                                                [% SWITCH f.filter %]
77
                                                    [% CASE 'active' %]<span>Active<span>
78
                                                    [% CASE 'nonactive' %]<span>Not active</span>
79
                                                [% END %]
80
                                            </li>
81
                                        [% CASE 'zip' %]<li>ZIP/Postal code: [% f.filter | html %]</li>
82
                                        [% CASE 'library' %]<li>Library: [% Branches.GetName( f.filter ) | html %]</li>
83
                                        [% CASE 'dob_from' %]<li>Date of birth (from): [% f.filter | $KohaDates %]</li>
84
                                        [% CASE 'dob_to' %]<li>Date of birth (to): [% f.filter | $KohaDates %]</li>
85
                                        [% CASE 'gender' %]
86
                                            <li><span>Gender:</span>
87
                                            [% SWITCH f.filter %]
88
                                                [% CASE 'F' %]<span>Female<span>
89
                                                [% CASE 'M' %]<span>Male</span>
90
                                                [% CASE 'O' %][% tp('gender', 'Other') | html %]
91
                                                [% CASE %]<span>[% f.filter | html %]</span>
92
                                            [% END %]
93
                                            </li>
94
                                        [% CASE 'sort1' %]<li>Sort 1: [% AuthorisedValues.GetByCode('Bsort1', f.filter) | html %]</li>
95
                                        [% CASE 'sort2' %]<li>Sort 2: [% AuthorisedValues.GetByCode('Bsort2', f.filter) | html %]</li>
96
                                        [% CASE %]
97
                                            [% IF f.crit.search("attribute_") %]
98
                                                <li>[% f.crit.replace("attribute_","") | html %]: [% f.filter | html %]</li>
99
                                            [% ELSE %]
100
                                                <li>[% f.crit | html %]: [% f.filter | html %]</li>
101
                                            [% END %]
102
                                    [% END %]
62
                            [% END %]
103
                            [% END %]
104
                            </ul>
63
                        [% END %]
105
                        [% END %]
64
                        <div class="page-section">
106
                        <div class="page-section">
65
                            <table>
107
                            <table>
66
                                <tr>
108
                                <tr>
67
                                    <th>[% mainloo.line | html %] / [% mainloo.column | html %]</th>
109
                                    [%- BLOCK row_column -%]
110
                                        [%- SWITCH code -%]
111
                                            [%- CASE 'categorycode' -%]<span>Patron category</span>
112
                                            [%- CASE 'zipcode' -%]<span>ZIP/Postal code</span>
113
                                            [%- CASE 'branchcode' -%]<span>Library</span>
114
                                            [%- CASE 'sex' -%]<span>Gender</span>
115
                                            [%- CASE 'sort1' -%]<span>Sort 1</span>
116
                                            [%- CASE 'sort2' -%]<span>Sort 2</span>
117
                                            [%- CASE -%][% code | html %]
118
                                        [%- END -%]
119
                                    [%- END -%]
120
                                    <th>[%- PROCESS row_column code=mainloo.line -%] / [%- PROCESS row_column code=mainloo.column -%]</th>
68
                                    [% FOREACH loopco IN mainloo.loopcol %]
121
                                    [% FOREACH loopco IN mainloo.loopcol %]
69
                                        <th>
122
                                        <th>
70
                                            [% IF ( loopco.coltitle_display ) %][% loopco.coltitle_display | html %][% ELSE %][% loopco.coltitle | html %][% END %]
123
                                            [% IF ( loopco.coltitle_display ) %][% loopco.coltitle_display | html %][% ELSE %][% loopco.coltitle | html %][% END %]
Lines 207-213 Link Here
207
                                        <td colspan="2"></td>
260
                                        <td colspan="2"></td>
208
                                        <td>
261
                                        <td>
209
                                            <label for="from">From</label>
262
                                            <label for="from">From</label>
210
                                            <input type="text" size="10" id="from" name="Filter" class="flatpickr"data-date_to="to" />
263
                                            <input type="text" size="10" id="from" name="Filter" class="flatpickr" data-date_to="to" />
211
                                            <label for="to">To</label>
264
                                            <label for="to">To</label>
212
                                            <input size="10" id="to" name="Filter" value="" type="text" class="flatpickr" />
265
                                            <input size="10" id="to" name="Filter" value="" type="text" class="flatpickr" />
213
                                            <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
266
                                            <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
Lines 235-241 Link Here
235
                                                <select id="sort1" name="Filter">
288
                                                <select id="sort1" name="Filter">
236
                                                    <option value=""/>
289
                                                    <option value=""/>
237
                                                    [% FOREACH SORT1_LOO IN SORT1_LOOP %]
290
                                                    [% FOREACH SORT1_LOO IN SORT1_LOOP %]
238
                                                        <option value="[% SORT1_LOO.authorized_value | html %]">[% SORT1_LOO.lib | html %]</option>
291
                                                        <option value="[% SORT1_LOO.authorised_value | html %]">[% SORT1_LOO.lib | html %]</option>
239
                                                    [% END %]
292
                                                    [% END %]
240
                                                </select>
293
                                                </select>
241
                                            </td>
294
                                            </td>
(-)a/reports/borrowers_stats.pl (-16 / +17 lines)
Lines 181-214 sub calculate { Link Here
181
    else  { $colfilter = ''; }
181
    else  { $colfilter = ''; }
182
182
183
    my @loopfilter;
183
    my @loopfilter;
184
    foreach my $i (0 .. scalar @$filters) {
184
    foreach my $i ( 0 .. scalar @$filters ) {
185
        my %cell;
186
        if ( @$filters[$i] ) {
185
        if ( @$filters[$i] ) {
187
            if    ( $i == 0)  { $cell{crit} = "Cat code"; }
186
            my %cell = ( filter => @$filters[$i] );
188
            elsif ( $i == 1 ) { $cell{crit} = "ZIP/Postal code"; }
187
            if    ( $i == 0 ) { $cell{crit} = "category"; }
189
            elsif ( $i == 2 ) { $cell{crit} = "Branch code"; }
188
            elsif ( $i == 1 ) { $cell{crit} = "zip"; }
190
            elsif ( $i == 3 ||
189
            elsif ( $i == 2 ) { $cell{crit} = "library"; }
191
                    $i == 4 ) { $cell{crit} = "Date of birth"; }
190
            elsif ( $i == 3 ) { $cell{crit} = "dob_from"; }
192
            elsif ( $i == 5 ) { $cell{crit} = "Sex"; }
191
            elsif ( $i == 4 ) { $cell{crit} = "dob_to"; }
193
            elsif ( $i == 6 ) { $cell{crit} = "Sort1"; }
192
            elsif ( $i == 5 ) { $cell{crit} = "gender"; }
194
            elsif ( $i == 7 ) { $cell{crit} = "Sort2"; }
193
            elsif ( $i == 6 ) { $cell{crit} = "sort1"; }
195
            else { $cell{crit} = "Unknown"; }
194
            elsif ( $i == 7 ) { $cell{crit} = "sort2"; }
195
            else              { $cell{crit} = "unknown"; }
196
196
197
            push @loopfilter, \%cell;
197
            push @loopfilter, \%cell;
198
        }
198
        }
199
    }
199
    }
200
200
    foreach my $type (keys %$attr_filters) {
201
    foreach my $type (keys %$attr_filters) {
201
        if($attr_filters->{$type}) {
202
        if($attr_filters->{$type}) {
202
            push @loopfilter, {
203
            push @loopfilter, {
203
                crit => "Attribute $type",
204
                crit => "attribute_$type",
204
                filter => $attr_filters->{$type}
205
                filter => $attr_filters->{$type}
205
            }
206
            }
206
        }
207
        }
207
    }
208
    }
208
209
209
    my @branchcodes = Koha::Libraries->search->get_column('branchcode');
210
    my @branchcodes = Koha::Libraries->search->get_column('branchcode');
210
	($status  ) and push @loopfilter,{crit=>"Status",  filter=>$status  };
211
    ($status)   and push @loopfilter, { crit => "status",   filter => $status };
211
	($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
212
    ($activity) and push @loopfilter, { crit => "activity", filter => $activity };
212
# year of activity
213
# year of activity
213
	my ( $period_year, $period_month, $period_day )=Add_Delta_YM( Today(),-$period, 0);
214
	my ( $period_year, $period_month, $period_day )=Add_Delta_YM( Today(),-$period, 0);
214
	my $newperioddate=$period_year."-".$period_month."-".$period_day;
215
	my $newperioddate=$period_year."-".$period_month."-".$period_day;
Lines 254-259 sub calculate { Link Here
254
		if ($celvalue) {
255
		if ($celvalue) {
255
			$cell{rowtitle} = $celvalue;
256
			$cell{rowtitle} = $celvalue;
256
            $cell{rowtitle_display} = ($patron_categories->find($celvalue)->description || "$celvalue\*") if ($line eq 'categorycode');
257
            $cell{rowtitle_display} = ($patron_categories->find($celvalue)->description || "$celvalue\*") if ($line eq 'categorycode');
258
            $cell{rowtitle_display} = (Koha::Libraries->find($celvalue)->branchname || "$celvalue\*") if ($line eq 'branchcode');
257
		}
259
		}
258
 		$cell{totalrow} = 0;
260
 		$cell{totalrow} = 0;
259
		push @loopline, \%cell;
261
		push @loopline, \%cell;
Lines 299-306 sub calculate { Link Here
299
 		my %cell;
301
 		my %cell;
300
             if (defined $celvalue) {
302
             if (defined $celvalue) {
301
			$cell{coltitle} = $celvalue;
303
			$cell{coltitle} = $celvalue;
302
			# $cell{coltitle_display} = ($colfield eq 'branchcode') ? $branches->{$celvalue}->{branchname} : $celvalue;
303
            $cell{coltitle_display} = $patron_categories->find($celvalue)->description if ($column eq 'categorycode');
304
            $cell{coltitle_display} = $patron_categories->find($celvalue)->description if ($column eq 'categorycode');
305
            $cell{coltitle_display} = (Koha::Libraries->find($celvalue)->branchname || "$celvalue\*") if ($column eq 'branchcode');
304
		}
306
		}
305
		push @loopcol, \%cell;
307
		push @loopcol, \%cell;
306
 	}
308
 	}
307
- 

Return to bug 33452