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

(-)a/admin/categorie.pl (-309 / +97 lines)
Lines 1-24 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
#script to administer the categories table
4
#written 20/02/2002 by paul.poulain@free.fr
5
6
# ALGO :
7
# this script use an $op to know what to do.
8
# if $op is empty or none of the above values,
9
#	- the default screen is build (with all records, or filtered datas).
10
#	- the   user can clic on add, modify or delete record.
11
# if $op=add_form
12
#	- if primkey exists, this is a modification,so we read the $primkey record
13
#	- builds the add/modify form
14
# if $op=add_validate
15
#	- the user has just send datas, so we create/modify the record
16
# if $op=delete_form
17
#	- we show the record having primkey=$primkey and ask for deletion validation form
18
# if $op=delete_confirm
19
#	- we delete the record having primkey=$primkey
20
21
# Copyright 2000-2002 Katipo Communications
3
# Copyright 2000-2002 Katipo Communications
4
# Copyright 2002 Paul Poulain
22
#
5
#
23
# This file is part of Koha.
6
# This file is part of Koha.
24
#
7
#
Lines 43-78 use C4::Auth; Link Here
43
use C4::Branch;
26
use C4::Branch;
44
use C4::Output;
27
use C4::Output;
45
use C4::Form::MessagingPreferences;
28
use C4::Form::MessagingPreferences;
29
use Koha::Borrowers;
46
use Koha::Database;
30
use Koha::Database;
47
use Koha::DateUtils;
31
use Koha::DateUtils;
48
32
use Koha::PatronCategories;
49
sub StringSearch {
50
    my ( $searchstring, $type ) = @_;
51
    my $dbh = C4::Context->dbh;
52
    $searchstring //= '';
53
    $searchstring =~ s/\'/\\\'/g;
54
    my @data = split( ' ', $searchstring );
55
    push @data, q{} if $#data == -1;
56
    my $count = @data;
57
    my $sth   = $dbh->prepare("Select * from categories where (description like ?) order by category_type,description,categorycode");
58
    $sth->execute("$data[0]%");
59
    my @results;
60
61
    while ( my $data = $sth->fetchrow_hashref ) {
62
        push( @results, $data );
63
    }
64
65
    #  $sth->execute;
66
    $sth->finish;
67
    return ( scalar(@results), \@results );
68
}
69
33
70
my $input         = new CGI;
34
my $input         = new CGI;
71
my $searchfield   = $input->param('description');
35
my $searchfield   = $input->param('description') // q||;
72
my $script_name   = "/cgi-bin/koha/admin/categorie.pl";
73
my $categorycode  = $input->param('categorycode');
36
my $categorycode  = $input->param('categorycode');
74
my $op            = $input->param('op') // 'list';
37
my $op            = $input->param('op') // 'list';
75
my $block_expired = $input->param("block_expired");
76
my @messages;
38
my @messages;
77
39
78
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
40
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 86-262 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
86
    }
48
    }
87
);
49
);
88
50
89
################## ADD_FORM ##################################
90
# called by default. Used to create form to add or  modify a record
91
if ( $op eq 'add_form' ) {
51
if ( $op eq 'add_form' ) {
92
    $template->param( add_form => 1 );
52
    my ( $category, $selected_branches );
93
94
    #---- if primkey exists, it's a modify action, so read values to modify...
95
    my $data;
96
    my @selected_branches;
97
    if ($categorycode) {
53
    if ($categorycode) {
98
        my $dbh = C4::Context->dbh;
54
        $category          = Koha::PatronCategories->find($categorycode);
99
        my $sth =
55
        $selected_branches = $category->branch_limitations;
100
          $dbh->prepare("SELECT * FROM categories WHERE categorycode=?");
101
        $sth->execute($categorycode);
102
        $data = $sth->fetchrow_hashref;
103
104
        $sth = $dbh->prepare(
105
            "SELECT b.branchcode, b.branchname 
106
            FROM categories_branches AS cb, branches AS b 
107
            WHERE cb.branchcode = b.branchcode AND cb.categorycode = ?
108
        ");
109
        $sth->execute($categorycode);
110
        while ( my $branch = $sth->fetchrow_hashref ) {
111
            push @selected_branches, $branch;
112
        }
113
        $sth->finish;
114
    }
56
    }
115
57
116
    if (   $data->{'enrolmentperioddate'}
58
    my $branches = GetBranches;
117
        && $data->{'enrolmentperioddate'} eq '0000-00-00' )
118
    {
119
        $data->{'enrolmentperioddate'} = undef;
120
    }
121
122
    $data->{'category_type'} //= '';
123
124
    my $branches = GetBranches();
125
    my @branches_loop;
59
    my @branches_loop;
126
    foreach my $branch ( sort keys %$branches ) {
60
    foreach my $branchcode ( sort { uc( $branches->{$a}->{branchname} ) cmp uc( $branches->{$b}->{branchname} ) } keys %$branches ) {
127
        my $selected =
61
        my $selected = ( grep { $_ eq $branchcode } @$selected_branches ) ? 1 : 0;
128
          ( grep { $$_{branchcode} eq $branch } @selected_branches ) ? 1 : 0;
129
        push @branches_loop,
62
        push @branches_loop,
130
          {
63
          { branchcode => $branchcode,
131
            branchcode => $$branches{$branch}{branchcode},
64
            branchname => $branches->{$branchcode}->{branchname},
132
            branchname => $$branches{$branch}{branchname},
133
            selected   => $selected,
65
            selected   => $selected,
134
          };
66
          };
135
    }
67
    }
136
68
137
    $template->param(
69
    $template->param(
70
        category => $category,
138
        branches_loop       => \@branches_loop,
71
        branches_loop       => \@branches_loop,
139
        description         => $data->{'description'},
140
        enrolmentperiod     => $data->{'enrolmentperiod'},
141
        enrolmentperioddate => $data->{'enrolmentperioddate'},
142
        upperagelimit       => $data->{'upperagelimit'},
143
        dateofbirthrequired => $data->{'dateofbirthrequired'},
144
        enrolmentfee        => sprintf( "%.2f", $data->{'enrolmentfee'} || 0 ),
145
        overduenoticerequired => $data->{'overduenoticerequired'},
146
        issuelimit            => $data->{'issuelimit'},
147
        reservefee            => sprintf( "%.2f", $data->{'reservefee'} || 0 ),
148
        hidelostitems         => $data->{'hidelostitems'},
149
        category_type         => $data->{'category_type'},
150
        default_privacy       => $data->{'default_privacy'},
151
        SMSSendDriver         => C4::Context->preference("SMSSendDriver"),
152
        "type_" . $data->{'category_type'} => 1,
153
        BlockExpiredPatronOpacActions =>
154
          $data->{'BlockExpiredPatronOpacActions'},
155
        TalkingTechItivaPhone =>
156
          C4::Context->preference("TalkingTechItivaPhoneNotification"),
157
    );
72
    );
158
73
159
    if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
74
    if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
160
        C4::Form::MessagingPreferences::set_form_values(
75
        C4::Form::MessagingPreferences::set_form_values(
161
            { categorycode => $categorycode }, $template );
76
            { categorycode => $categorycode }, $template );
162
    }
77
    }
163
164
    # END $OP eq ADD_FORM
165
################## ADD_VALIDATE ##################################
166
    # called by add_form, used to insert/modify data in DB
167
}
78
}
168
elsif ( $op eq 'add_validate' ) {
79
elsif ( $op eq 'add_validate' ) {
169
80
170
    my $is_a_modif = $input->param("is_a_modif");
81
    my $categorycode = $input->param('categorycode');
82
    my $description = $input->param('description');
83
    my $enrolmentperiod = $input->param('enrolmentperiod');
84
    my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef;
85
    my $upperagelimit = $input->param('upperagelimit');
86
    my $dateofbirthrequired = $input->param('dateofbirthrequired');
87
    my $enrolmentfee = $input->param('enrolmentfee');
88
    my $reservefee = $input->param('reservefee');
89
    my $hidelostitems = $input->param('hidelostitems');
90
    my $overduenoticerequired = $input->param('overduenoticerequired');
91
    my $category_type = $input->param('category_type');
92
    my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions');
93
    my $default_privacy = $input->param('default_privacy');
94
    my @branches = grep { $_ ne q{} } $input->param('branches');
171
95
172
    my $dbh = C4::Context->dbh;
96
    my $is_a_modif = $input->param("is_a_modif");
173
97
174
    if ( $input->param('enrolmentperioddate') ) {
98
    if ( $enrolmentperioddate ) {
175
        my $enrolment_dt = eval { dt_from_string( $input->param('enrolmentperioddate') ) };
99
        $enrolmentperioddate = output_pref({ dt => dt_from_string($enrolmentperioddate), dateformat => 'iso' });
176
        $enrolment_dt = eval { output_pref( { dt => $enrolment_dt, dateonly => 1, dateformat => 'iso' } ) } if ( $enrolment_dt );
177
        $input->param( 'enrolmentperioddate' => $enrolment_dt );
178
    }
100
    }
179
101
180
    if ($is_a_modif) {
102
    if ($is_a_modif) {
181
        my $sth = $dbh->prepare( "
103
        my $category = Koha::PatronCategories->find( $categorycode );
182
                UPDATE categories
104
        $category->categorycode($categorycode);
183
                SET description=?,
105
        $category->description($description);
184
                    enrolmentperiod=?,
106
        $category->enrolmentperiod($enrolmentperiod);
185
                    enrolmentperioddate=?,
107
        $category->enrolmentperioddate($enrolmentperioddate);
186
                    upperagelimit=?,
108
        $category->upperagelimit($upperagelimit);
187
                    dateofbirthrequired=?,
109
        $category->dateofbirthrequired($dateofbirthrequired);
188
                    enrolmentfee=?,
110
        $category->enrolmentfee($enrolmentfee);
189
                    reservefee=?,
111
        $category->reservefee($reservefee);
190
                    hidelostitems=?,
112
        $category->hidelostitems($hidelostitems);
191
                    overduenoticerequired=?,
113
        $category->overduenoticerequired($overduenoticerequired);
192
                    category_type=?,
114
        $category->category_type($category_type);
193
                    BlockExpiredPatronOpacActions=?,
115
        $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
194
                    default_privacy=?
116
        $category->default_privacy($default_privacy);
195
                WHERE categorycode=?"
117
        eval {
196
        );
118
            $category->store;
197
        $sth->execute(
119
            $category->replace_branch_limitations( \@branches );
198
            map { $input->param($_) } (
120
        };
199
                'description',           'enrolmentperiod',
121
        if ( $@ ) {
200
                'enrolmentperioddate',   'upperagelimit',
122
            push @messages, {type => 'error', code => 'error_on_update' };
201
                'dateofbirthrequired',   'enrolmentfee',
202
                'reservefee',            'hidelostitems',
203
                'overduenoticerequired', 'category_type',
204
                'block_expired',         'default_privacy',
205
                'categorycode'
206
            )
207
        );
208
        $sth->finish;
209
    }
210
    else {
211
        my $sth = $dbh->prepare( "
212
            INSERT INTO categories (
213
                categorycode,
214
                description,
215
                enrolmentperiod,
216
                enrolmentperioddate,
217
                upperagelimit,
218
                dateofbirthrequired,
219
                enrolmentfee,
220
                reservefee,
221
                hidelostitems,
222
                overduenoticerequired,
223
                category_type,
224
                BlockExpiredPatronOpacActions,
225
                default_privacy
226
            )
227
            VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)" );
228
        my $inserted = $sth->execute(
229
            map { $input->param($_) } (
230
                'categorycode',    'description',
231
                'enrolmentperiod', 'enrolmentperioddate',
232
                'upperagelimit',   'dateofbirthrequired',
233
                'enrolmentfee',    'reservefee',
234
                'hidelostitems',   'overduenoticerequired',
235
                'category_type',   'block_expired',
236
                'default_privacy',
237
            )
238
        );
239
        if ( $inserted ) {
240
            push @messages, { type => 'message', code => 'success_on_insert' };
241
        } else {
123
        } else {
242
            push @messages, { type => 'error', code => 'error_on_insert' };
124
            push @messages, { type => 'message', code => 'success_on_update' };
243
        }
125
        }
244
    }
126
    }
127
    else {
128
        my $category = Koha::PatronCategory->new({
129
            categorycode => $categorycode,
130
            description => $description,
131
            enrolmentperiod => $enrolmentperiod,
132
            enrolmentperioddate => $enrolmentperioddate,
133
            upperagelimit => $upperagelimit,
134
            dateofbirthrequired => $dateofbirthrequired,
135
            enrolmentfee => $enrolmentfee,
136
            reservefee => $reservefee,
137
            hidelostitems => $hidelostitems,
138
            overduenoticerequired => $overduenoticerequired,
139
            category_type => $category_type,
140
            BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
141
            default_privacy => $default_privacy,
142
        });
143
        eval {
144
            $category->store;
145
            $category->replace_branch_limitations( \@branches );
146
        };
245
147
246
    my @branches = $input->param("branches");
148
        if ( $@ ) {
247
    if (@branches) {
149
            push @messages, { type => 'error', code => 'error_on_insert' };
248
        my $sth = $dbh->prepare(
150
        } else {
249
            "DELETE FROM categories_branches WHERE categorycode = ?"
151
            push @messages, { type => 'message', code => 'success_on_insert' };
250
        );
251
        $sth->execute( $input->param("categorycode") );
252
        $sth = $dbh->prepare(
253
            "INSERT INTO categories_branches ( categorycode, branchcode ) VALUES ( ?, ? )"
254
        );
255
        for my $branchcode (@branches) {
256
            next if not $branchcode;
257
            $sth->bind_param( 1, $input->param("categorycode") );
258
            $sth->bind_param( 2, $branchcode );
259
            $sth->execute;
260
        }
152
        }
261
    }
153
    }
262
154
Lines 267-428 elsif ( $op eq 'add_validate' ) { Link Here
267
159
268
    $searchfield = q||;
160
    $searchfield = q||;
269
    $op = 'list';
161
    $op = 'list';
270
271
    # END $OP eq ADD_VALIDATE
272
################## DELETE_CONFIRM ##################################
273
    # called by default form, used to confirm deletion of data in DB
274
}
162
}
275
elsif ( $op eq 'delete_confirm' ) {
163
elsif ( $op eq 'delete_confirm' ) {
276
    my $schema = Koha::Database->new()->schema();
277
    $template->param( delete_confirm => 1 );
278
164
279
    my $count =
165
    my $count = Koha::Borrowers->search({
280
      $schema->resultset('Borrower')
166
        categorycode => $categorycode
281
      ->search( { categorycode => $categorycode } )->count();
167
    })->count;
282
168
283
    my $category = $schema->resultset('Category')->find($categorycode);
169
    my $category = Koha::PatronCategories->find($categorycode);
284
285
    if ( $category->enrolmentperioddate
286
        && $category->enrolmentperioddate eq '0000-00-00' )
287
    {
288
        $category->{'enrolmentperioddate'} = undef;
289
    }
290
170
291
    $template->param(
171
    $template->param(
292
        category            => $category,
172
        category => $category,
293
        description         => $category->description,
294
        enrolmentperiod     => $category->enrolmentperiod,
295
        enrolmentperioddate => $category->enrolmentperioddate,
296
        patrons_in_category => $count,
173
        patrons_in_category => $count,
297
    );
174
    );
298
175
299
    # END $OP eq DELETE_CONFIRM
300
################## DELETE_CONFIRMED ##################################
301
  # called by delete_confirm, used to effectively confirm deletion of data in DB
302
}
176
}
303
elsif ( $op eq 'delete_confirmed' ) {
177
elsif ( $op eq 'delete_confirmed' ) {
304
    $template->param( delete_confirmed => 1 );
305
    my $dbh = C4::Context->dbh;
306
307
    my $categorycode = uc( $input->param('categorycode') );
178
    my $categorycode = uc( $input->param('categorycode') );
308
179
309
    my $sth = $dbh->prepare("delete from categories where categorycode=?");
180
    my $category = Koha::PatronCategories->find( $categorycode );
310
181
    my $deleted = eval { $category->delete; };
311
    my $deleted = $sth->execute($categorycode);
312
182
313
    if ( $deleted ) {
183
    if ( $@ or not $deleted ) {
314
        push @messages, { type => 'message', code => 'success_on_delete' };
184
        push @messages, {type => 'error', code => 'error_on_delete' };
315
    } else {
185
    } else {
316
        push @messages, { type => 'error', code => 'error_on_delete' };
186
        push @messages, { type => 'message', code => 'success_on_delete' };
317
    }
187
    }
318
188
319
    $op = 'list';
189
    $op = 'list';
320
321
    # END $OP eq DELETE_CONFIRMED
322
}
190
}
323
191
324
if ( $op eq 'list' ) {
192
if ( $op eq 'list' ) {
325
    $template->param( else => 1 );
193
    my $categories = Koha::PatronCategories->search(
326
    my @loop;
194
        {
327
    my ( $count, $results ) = StringSearch( $searchfield, 'web' );
195
            description => { -like => "$searchfield%" }
328
196
        },
329
    my $dbh = C4::Context->dbh;
197
        {
330
    my $sth = $dbh->prepare("
198
            order_by => ['category_type', 'description', 'categorycode' ]
331
        SELECT b.branchcode, b.branchname 
332
        FROM categories_branches AS cb, branches AS b 
333
        WHERE cb.branchcode = b.branchcode AND cb.categorycode = ?
334
    ");
335
336
    for ( my $i = 0 ; $i < $count ; $i++ ) {
337
        $sth->execute( $results->[$i]{'categorycode'} );
338
339
        my @selected_branches;
340
        while ( my $branch = $sth->fetchrow_hashref ) {
341
            push @selected_branches, $branch;
342
        }
343
344
        my $enrolmentperioddate = $results->[$i]{'enrolmentperioddate'};
345
        if ( $enrolmentperioddate && $enrolmentperioddate eq '0000-00-00' ) {
346
            $enrolmentperioddate = undef;
347
        }
348
349
        $results->[$i]{'category_type'} //= '';
350
351
        my %row = (
352
            branches              => \@selected_branches,
353
            categorycode          => $results->[$i]{'categorycode'},
354
            description           => $results->[$i]{'description'},
355
            enrolmentperiod       => $results->[$i]{'enrolmentperiod'},
356
            enrolmentperioddate   => $enrolmentperioddate,
357
            upperagelimit         => $results->[$i]{'upperagelimit'},
358
            dateofbirthrequired   => $results->[$i]{'dateofbirthrequired'},
359
            overduenoticerequired => $results->[$i]{'overduenoticerequired'},
360
            issuelimit            => $results->[$i]{'issuelimit'},
361
            hidelostitems         => $results->[$i]{'hidelostitems'},
362
            category_type         => $results->[$i]{'category_type'},
363
            default_privacy       => $results->[$i]{'default_privacy'},
364
            reservefee => sprintf( "%.2f", $results->[$i]{'reservefee'} || 0 ),
365
            enrolmentfee =>
366
              sprintf( "%.2f", $results->[$i]{'enrolmentfee'} || 0 ),
367
            "type_" . $results->[$i]{'category_type'} => 1,
368
        );
369
370
        if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
371
            my $brief_prefs =
372
              _get_brief_messaging_prefs( $results->[$i]{'categorycode'} );
373
            $row{messaging_prefs} = $brief_prefs if @$brief_prefs;
374
        }
199
        }
375
        push @loop, \%row;
200
    );
376
    }
377
378
    $template->param( loop => \@loop );
379
380
    # check that I (institution) and C (child) exists. otherwise => warning to the user
381
    $sth = $dbh->prepare("select category_type from categories where category_type='C'");
382
    $sth->execute;
383
    my ($categoryChild) = $sth->fetchrow;
384
    $template->param( categoryChild => $categoryChild );
385
386
    $sth = $dbh->prepare("select category_type from categories where category_type='I'");
387
    $sth->execute;
388
    my ($categoryInstitution) = $sth->fetchrow;
389
    $template->param( categoryInstitution => $categoryInstitution );
390
    $sth->finish;
391
201
392
}    #---- END $OP eq DEFAULT
202
    $template->param(
203
        categories => $categories,
204
    )
205
}
393
206
394
$template->param(
207
$template->param(
395
    script_name  => $script_name,
396
    categorycode => $categorycode,
208
    categorycode => $categorycode,
397
    searchfield  => $searchfield,
209
    searchfield  => $searchfield,
398
    messages     => \@messages,
210
    messages     => \@messages,
211
    op => $op,
399
);
212
);
400
213
401
output_html_with_http_headers $input, $cookie, $template->output;
214
output_html_with_http_headers $input, $cookie, $template->output;
402
215
403
exit 0;
216
exit 0;
404
405
sub _get_brief_messaging_prefs {
406
    my $categorycode      = shift;
407
    my $messaging_options = C4::Members::Messaging::GetMessagingOptions();
408
    my $results           = [];
409
    PREF: foreach my $option (@$messaging_options) {
410
        my $pref = C4::Members::Messaging::GetMessagingPreferences(
411
            {
412
                categorycode => $categorycode,
413
                message_name => $option->{'message_name'}
414
            }
415
        );
416
        next unless $pref->{'transports'};
417
        my $brief_pref = {
418
            message_attribute_id      => $option->{'message_attribute_id'},
419
            message_name              => $option->{'message_name'},
420
            $option->{'message_name'} => 1
421
        };
422
        foreach my $transport ( keys %{ $pref->{'transports'} } ) {
423
            push @{ $brief_pref->{'transports'} }, { transport => $transport };
424
        }
425
        push @$results, $brief_pref;
426
    }
427
    return $results;
428
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc (-4 / +5 lines)
Lines 1-3 Link Here
1
[% USE Koha %]
1
<!-- snippet for form to set borrower and patron category messaging preferences -->
2
<!-- snippet for form to set borrower and patron category messaging preferences -->
2
<script type="text/javascript">//<![CDATA[
3
<script type="text/javascript">//<![CDATA[
3
	$(document).ready(function(){
4
	$(document).ready(function(){
Lines 22-29 Link Here
22
  <table>
23
  <table>
23
    <tr><th></th>
24
    <tr><th></th>
24
        <th>Days in advance</th>
25
        <th>Days in advance</th>
25
        [% IF ( SMSSendDriver ) %]<th>SMS</th>[% END %]
26
        [% IF Koha.Preference('SMSSendDriver') %]<th>SMS</th>[% END %]
26
        [% IF ( TalkingTechItivaPhone ) %]<th>Phone</th>[% END %]
27
        [% IF Koha.Preference('TalkingTechItivaPhoneNotification') %]<th>Phone</th>[% END %]
27
        <th>Email</th>
28
        <th>Email</th>
28
        <th>Digests only <i id="info_digests" data-toggle="tooltip" title="You can ask for a digest to reduce the number of messages. Messages will be saved and sent as a single message." data-placement="right" class="icon fa fa-info-sign"></i></th>
29
        <th>Digests only <i id="info_digests" data-toggle="tooltip" title="You can ask for a digest to reduce the number of messages. Messages will be saved and sent as a single message." data-placement="right" class="icon fa fa-info-sign"></i></th>
29
        <!-- <th>RSS</th> -->
30
        <!-- <th>RSS</th> -->
Lines 56-62 Link Here
56
      <td>-</td>
57
      <td>-</td>
57
      [% END %]
58
      [% END %]
58
59
59
      [% IF ( SMSSendDriver ) %]<td>
60
      [% IF Koha.Preference('SMSSendDriver') %]<td>
60
          [% IF ( messaging_form_inactive ) %]
61
          [% IF ( messaging_form_inactive ) %]
61
              [% IF ( messaging_preference.transports_sms ) %]
62
              [% IF ( messaging_preference.transports_sms ) %]
62
                 <input type="checkbox"
63
                 <input type="checkbox"
Lines 84-90 Link Here
84
          [% END %]
85
          [% END %]
85
      </td>[% END %]
86
      </td>[% END %]
86
87
87
      [% IF ( TalkingTechItivaPhone ) %]<td>
88
      [% IF Koha.Preference('TalkingTechItivaPhoneNotification') %]<td>
88
          [% IF ( messaging_form_inactive ) %]
89
          [% IF ( messaging_form_inactive ) %]
89
              [% IF ( messaging_preference.transports_phone ) %]
90
              [% IF ( messaging_preference.transports_phone ) %]
90
                 <input type="checkbox"
91
                 <input type="checkbox"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt (-279 / +323 lines)
Lines 1-7 Link Here
1
[% USE Koha %]
1
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Price %]
2
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration &rsaquo; Patron categories &rsaquo; [% IF ( add_form ) %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
5
<title>Koha &rsaquo; Administration &rsaquo; Patron categories &rsaquo; [% IF op == 'add_form' %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
4
[% IF ( delete_confirm ) %][% IF ( patrons_in_category > 0 ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
6
[% IF op == 'delete_confirm' %][% IF ( patrons_in_category > 0 ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
5
</title>
7
</title>
6
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'calendar.inc' %]
9
[% INCLUDE 'calendar.inc' %]
Lines 96-105 Link Here
96
[% INCLUDE 'header.inc' %]
98
[% INCLUDE 'header.inc' %]
97
[% INCLUDE 'patrons-admin-search.inc' %]
99
[% INCLUDE 'patrons-admin-search.inc' %]
98
100
99
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( add_form ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
101
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF op == 'add_form' %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
100
[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; [% IF ( patrons_in_category > 0 ) %]Cannot delete: Category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
102
[% IF op == 'delete_confirm' %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; [% IF ( patrons_in_category > 0 ) %]Cannot delete: Category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
101
[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Category deleted[% END %]
103
[% IF op == 'delete_confirmed' %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Category deleted[% END %]
102
[% IF ( else ) %]Patron categories[% END %]</div>
104
[% IF op == 'list' %]Patron categories[% END %]</div>
103
105
104
<div id="doc3" class="yui-t2">
106
<div id="doc3" class="yui-t2">
105
   
107
   
Lines 110-424 Link Here
110
[% FOR m IN messages %]
112
[% FOR m IN messages %]
111
    <div class="dialog [% m.type %]">
113
    <div class="dialog [% m.type %]">
112
        [% SWITCH m.code %]
114
        [% SWITCH m.code %]
115
        [% CASE 'error_on_update' %]
116
            An error occurred when updating this patron category. Perhaps it already exists.
113
        [% CASE 'error_on_insert' %]
117
        [% CASE 'error_on_insert' %]
114
            An error occurred when inserting this patron category. The patron category might already exist.
118
            An error occurred when inserting this patron category. The patron category might already exist.
115
        [% CASE 'error_on_delete' %]
119
        [% CASE 'error_on_delete' %]
116
            An error occurred when deleting this patron category. Check the logs.
120
            An error occurred when deleting this patron category. Check the logs.
121
        [% CASE 'success_on_update' %]
122
            Patron category updated successfully.
117
        [% CASE 'success_on_insert' %]
123
        [% CASE 'success_on_insert' %]
118
            Patron category added successfully
124
            Patron category inserted successfully.
119
        [% CASE 'success_on_delete' %]
125
        [% CASE 'success_on_delete' %]
120
            Patron category deleted successfully.
126
            Patron category deleted successfully.
127
        [% CASE 'already_exists' %]
128
            This patron category already exists.
121
        [% CASE %]
129
        [% CASE %]
122
            [% m.code %]
130
            [% m.code %]
123
        [% END %]
131
        [% END %]
124
    </div>
132
    </div>
125
[% END %]
133
[% END %]
126
134
127
[% IF ( add_form ) %]
135
[% IF op == 'add_form' %]
128
	<form name="Aform" action="[% script_name %]" method="post">
136
    <form name="Aform" action="/cgi-bin/koha/admin/categorie.pl" method="post">
129
	<input type="hidden" name="op" value="add_validate" />
137
        <input type="hidden" name="op" value="add_validate" />
130
	<input type="hidden" name="checked" value="0" />
138
        <input type="hidden" name="checked" value="0" />
131
[% IF ( categorycode ) %]
139
        [% IF category %]
132
		<h1>Modify category [% categorycode |html %]</h1>
140
            <h1>Modify category [% categorycode |html %]</h1>
133
	[% ELSE %]
141
        [% ELSE %]
134
		<h1>New category</h1>
142
            <h1>New category</h1>
135
	[% END %]
143
        [% END %]
136
	<fieldset class="rows">
144
        <fieldset class="rows">
137
	<ol>[% IF ( categorycode ) %]
145
            <ol>
138
    <li><span class="label">Category code: </span>[% categorycode |html %]
146
                [% IF category %]
139
				<input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
147
                    <li>
140
	[% ELSE %]
148
                        <span class="label">Category code: </span>[% categorycode |html %]
141
    <li>
149
                        <input type="hidden" name="categorycode" value="[% category.categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" />
142
        <label for="categorycode" class="required">Category code: </label>
150
                    </li>
143
        <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" />
151
                [% ELSE %]
144
        <span class="required">Required</span>
152
                    <li>
145
    </li>
153
                        <label for="categorycode" class="required">Category code: </label>
146
	[% END %]
154
                        <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" />
147
    <li>
155
                        <span class="required">Required</span>
148
        <label for="description" class="required">Description: </label>
156
                    </li>
149
        <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" />
157
                [% END %]
150
        <span class="required">Required</span>
158
                <li>
151
    </li>
159
                    <label for="description" class="required">Description: </label>
152
    <li><label for="enrolmentperiod" class="required">Enrollment period: </label>
160
                    <input type="text" name="description" id="description" size="40" maxlength="80" value="[% category.description |html %]" />
153
	<fieldset>
161
                    <span class="required">Required</span>
154
	<legend>Choose one</legend>
162
                </li>
155
	<ol>
163
                <li>
156
	<li><label for="enrolmentperiod" style="width:6em;">In months: </label>
164
                    <label for="enrolmentperiod" class="required">Enrollment period: </label>
157
		<input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
165
                    <fieldset>
158
	<li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
166
                        <legend>Choose one</legend>
159
        <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate | $KohaDates %]" />
167
                        <ol>
160
		<div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
168
                            <li>
161
	</li>
169
                                <label for="enrolmentperiod" style="width:6em;">In months: </label>
162
	</ol>
170
                                <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months
163
	</fieldset>
171
                            </li>
164
	</li>
172
                            <li>
165
	<li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
173
                                <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
166
	<li><label for="upperagelimit">Upperage limit: </label> <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li>
174
                                <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
167
	<li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% enrolmentfee %]" /></li>
175
                                <div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
168
	<li><label for="overduenoticerequired">Overdue notice required: </label> <select name="overduenoticerequired" id="overduenoticerequired">
176
                            </li>
169
			[% IF ( overduenoticerequired ) %]
177
                        </ol>
170
						<option value="0">No</option>
178
                    </fieldset>
171
						<option value="1" selected="selected">Yes</option>
179
                </li>
172
			[% ELSE %]
180
                <li>
173
						<option value="0" selected="selected">No</option>
181
                    <label for="dateofbirthrequired">Age required: </label>
174
						<option value="1">Yes</option>
182
                    <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% category.dateofbirthrequired %]" size="3" maxlength="3" /> years
175
			[% END %]
183
                </li>
176
					</select></li>
184
                <li>
177
    <li><label for="hidelostitems">Lost items in staff client: </label> <select name="hidelostitems" id="hidelostitems">
185
                    <label for="upperagelimit">Upperage limit: </label>
178
			[% IF ( hidelostitems ) %]
186
                    <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% category.upperagelimit %]" /> years
179
						<option value="0">Shown</option>
187
                </li>
180
						<option value="1" selected="selected">Hidden by default</option>
188
                <li>
181
			[% ELSE %]
189
                    <label for="enrolmentfee">Enrollment fee: </label>
182
						<option value="0" selected="selected">Shown</option>
190
                    <input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% category.enrolmentfee | $Price on_editing => 1 %]" />
183
						<option value="1">Hidden by default</option>
191
                </li>
184
			[% END %]
192
                <li>
185
					</select></li>
193
                    <label for="overduenoticerequired">Overdue notice required: </label>
186
	<li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
194
                    <select name="overduenoticerequired" id="overduenoticerequired">
187
    <li>
195
                        [% IF category.overduenoticerequired %]
188
        <label for="category_type" class="required">Category type: </label>
196
                            <option value="0">No</option>
189
        <select name="category_type" id="category_type">
197
                            <option value="1" selected="selected">Yes</option>
190
                        [% IF ( type_n ) %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
198
                        [% ELSE %]
191
					[% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
199
                            <option value="0" selected="selected">No</option>
192
					[% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
200
                            <option value="1">Yes</option>
193
					[% IF ( type_S ) %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
201
                        [% END %]
194
					[% IF ( type_I ) %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
202
                    </select>
195
					[% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
203
                </li>
196
					[% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
204
                <li>
197
					</select>
205
                    <label for="hidelostitems">Lost items in staff client: </label>
198
        <span class="required">Required</span>
206
                    <select name="hidelostitems" id="hidelostitems">
199
    </li>
207
                        [% IF category.hidelostitems %]
200
    <li><label for="branches">Branches limitation: </label>
208
                            <option value="0">Shown</option>
201
        <select id="branches" name="branches" multiple size="10">
209
                            <option value="1" selected="selected">Hidden by default</option>
202
            <option value="">All branches</option>
210
                        [% ELSE %]
203
            [% FOREACH branch IN branches_loop %]
211
                            <option value="0" selected="selected">Shown</option>
204
              [% IF ( branch.selected ) %]
212
                            <option value="1">Hidden by default</option>
205
                <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
213
                        [% END %]
206
              [% ELSE %]
214
                    </select>
207
                <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
215
                </li>
208
              [% END %]
216
                <li>
209
            [% END %]
217
                    <label for="reservefee">Hold fee: </label>
210
        </select>
218
                    <input type="text" name="reservefee" id="reservefee" size="6" value="[% category.reservefee | $Price on_editing => 1 %]" />
211
        <span>Select <i>All branches</i> if this category type must to be displayed all the time. Otherwise select libraries you want to associate with this value.
219
                </li>
212
        </span>
220
                <li>
213
    </li>
221
                    <label for="category_type" class="required">Category type: </label>
214
    <li><label for="block_expired">Block expired patrons</label>
222
                    <select name="category_type" id="category_type">
215
        <select name="block_expired" id="block_expired">
223
                        [% UNLESS category %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
216
            [% IF ( BlockExpiredPatronOpacActions == -1  ) %]
224
                        [% IF category and category.category_type == 'A' %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
217
                <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
225
                        [% IF category and category.category_type == 'C' %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
218
            [% ELSE %]
226
                        [% IF category and category.category_type == 'S' %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
219
                <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option>
227
                        [% IF category and category.category_type == 'I' %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
220
            [% END %]
228
                        [% IF category and category.category_type == 'P' %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
221
229
                        [% IF category and category.category_type == 'X' %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
222
            [% IF ( BlockExpiredPatronOpacActions == 1   ) %]
230
                    </select>
223
                <option value="1" selected="selected"> Block </option>
231
                    <span class="required">Required</span>
224
            [% ELSE %]
232
                </li>
225
                <option value="1"> Block </option>
233
                <li><label for="branches">Branches limitation: </label>
226
            [% END %]
234
                    <select id="branches" name="branches" multiple size="10">
235
                        <option value="">All branches</option>
236
                        [% FOREACH branch IN branches_loop %]
237
                          [% IF branch.selected %]
238
                            <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
239
                          [% ELSE %]
240
                            <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
241
                          [% END %]
242
                        [% END %]
243
                    </select>
244
                    <span>Select <i>All branches</i> if this category type must to be displayed all the time. Otherwise select libraries you want to associate with this value.
245
                    </span>
246
                </li>
247
                <li><label for="block_expired">Block expired patrons</label>
248
                    <select name="BlockExpiredPatronOpacActions" id="block_expired">
249
                        [% IF not category or category.BlockExpiredPatronOpacActions == -1%]
250
                            <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
251
                        [% ELSE %]
252
                            <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option>
253
                        [% END %]
227
254
228
            [% IF ( BlockExpiredPatronOpacActions == 0   ) %]
255
                        [% IF category and category.BlockExpiredPatronOpacActions == 1 %]
229
                <option value="0" selected="selected"> Don't block </option>
256
                            <option value="1" selected="selected"> Block </option>
230
            [% ELSE %]
257
                        [% ELSE %]
231
                <option value="0"> Don't block </option>
258
                            <option value="1"> Block </option>
232
            [% END %]
259
                        [% END %]
233
        </select>
234
        <span>
235
            Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired.   
236
        </span>
237
    </li>
238
    <li>
239
        <label for="default_privacy">Default privacy: </label>
240
        <select id="default_privacy" name="default_privacy">
241
            [% SWITCH default_privacy %]
242
            [% CASE 'forever' %]
243
                <option value="default">Default</option>
244
                <option value="never">Never</option>
245
                <option value="forever" selected="selected">Forever</option>
246
            [% CASE 'never' %]
247
                <option value="default">Default</option>
248
                <option value="never" selected="selected">Never</option>
249
                <option value="forever">Forever</option>
250
            [% CASE %]
251
                <option value="default" selected="selected">Default</option>
252
                <option value="never">Never</option>
253
                <option value="forever">Forever</option>
254
            [% END %]
255
        </select>
256
        <span>Controls how long a patrons checkout history is kept for new patrons of this category. "Never" anonymizes checkouts on return, and "Forever" keeps a patron's checkout history indefinitely. When set to "Default", the amount of history kept is controlled by the cronjob <i>batch_anonymise.pl</i> which should be set up by your system administrator.</span>
257
    </li>
258
    </ol>
259
</fieldset>
260
260
261
    [% IF ( EnhancedMessagingPreferences ) %]
261
                        [% IF category and category.BlockExpiredPatronOpacActions == 0 %]
262
      <fieldset class="rows">
262
                            <option value="0" selected="selected"> Don't block </option>
263
        <h4>Default messaging preferences for this patron category</h4>
263
                        [% ELSE %]
264
        [% INCLUDE 'messaging-preference-form.inc' %]
264
                            <option value="0"> Don't block </option>
265
      </fieldset>
265
                        [% END %]
266
    [% END %]
266
                    </select>
267
	<fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
267
                    <span>
268
	</form>
268
                        Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired.
269
                    </span>
270
                </li>
271
                <li>
272
                    <label for="default_privacy">Default privacy: </label>
273
                    <select id="default_privacy" name="default_privacy">
274
                        [% SET default_privacy = 'default' %]
275
                        [% IF category %][% SET default_privacy = category.default_privacy %][% END %]
276
                        [% SWITCH default_privacy %]
277
                        [% CASE 'forever' %]
278
                            <option value="default">Default</option>
279
                            <option value="never">Never</option>
280
                            <option value="forever" selected="selected">Forever</option>
281
                        [% CASE 'never' %]
282
                            <option value="default">Default</option>
283
                            <option value="never" selected="selected">Never</option>
284
                            <option value="forever">Forever</option>
285
                        [% CASE %]
286
                            <option value="default" selected="selected">Default</option>
287
                            <option value="never">Never</option>
288
                            <option value="forever">Forever</option>
289
                        [% END %]
290
                    </select>
291
                    <span>Controls how long a patrons checkout history is kept for new patrons of this category. "Never" anonymizes checkouts on return, and "Forever" keeps a patron's checkout history indefinitely. When set to "Default", the amount of history kept is controlled by the cronjob <i>batch_anonymise.pl</i> which should be set up by your system administrator.</span>
292
                </li>
293
            </ol>
294
        </fieldset>
269
295
296
        [% IF ( EnhancedMessagingPreferences ) %]
297
            <fieldset class="rows">
298
                <h4>Default messaging preferences for this patron category</h4>
299
                [% INCLUDE 'messaging-preference-form.inc' %]
300
            </fieldset>
301
        [% END %]
302
        <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
303
    </form>
270
[% END %]
304
[% END %]
271
305
272
[% IF ( delete_confirm ) %]
306
[% IF op == 'delete_confirm' %]
273
    <form action="[% script_name %]" method="post">
307
    <form action="/cgi-bin/koha/admin/categorie.pl" method="post">
274
        <fieldset>
308
        <fieldset>
275
            <legend>
309
            <legend>
276
                [% IF ( patrons_in_category > 0 ) %]
310
                [% IF patrons_in_category > 0 %]
277
                    Category [% categorycode |html %] is in use.  Deletion not possible!
311
                    Category [% categorycode |html %] is in use.  Deletion not possible!
278
                [% ELSE %]
312
                [% ELSE %]
279
                    Confirm deletion of category [% categorycode |html %]
313
                    Confirm deletion of category [% categorycode |html %]
280
                [% END %]
314
                [% END %]
281
            </legend>
315
            </legend>
282
316
283
[% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %]
317
            [% IF patrons_in_category > 0  %]
284
	<table>
318
                <div class="dialog alert">
285
	<tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr>
319
                    <strong>This category is used [% patrons_in_category %] times</strong>. Deletion not possible
286
	<tr><th scope="row">Description: </th><td>[% description |html %]</td></tr>
320
                </div>
287
	<tr><th scope="row">Enrollment period: </th>
288
		<td>
289
			[% IF ( enrolmentperiod ) %]
290
				[% enrolmentperiod %] months
291
			[% ELSE %]
292
				until [% enrolmentperioddate | $KohaDates %]
293
			[% END %]
294
		</td>
295
	</tr>
296
	<tr><th scope="row">Age required: </th><td>[% dateofbirthrequired %] years</td></tr>
297
	<tr><th scope="row">Upperage limit: </th><td>[% upperagelimit %] years</td></tr>
298
	<tr><th scope="row">Enrollment fee: </th><td>[% enrolmentfee %]</td></tr>
299
	<tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr>
300
	<tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
301
	<tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
302
    <tr>
303
        <th scope="row">Default privacy: </th>
304
        <td>
305
            [% SWITCH category.default_privacy %]
306
            [% CASE 'default' %]
307
                Default
308
            [% CASE 'never' %]
309
                Never
310
            [% CASE 'forever' %]
311
                Forever
312
            [% END %]
321
            [% END %]
313
        </td>
322
            <table>
314
    </tr>
323
                <tr><th scope="row">Category code: </th><td>[% category.categorycode |html %]</td></tr>
315
</table>
324
                <tr><th scope="row">Description: </th><td>[% category.description |html %]</td></tr>
316
		<fieldset class="action">[% IF ( totalgtzero ) %]
325
                <tr><th scope="row">Enrollment period: </th>
317
<input type="submit" value="OK" /></form>
326
                    <td>
318
		[% ELSE %]
327
                        [% IF category.enrolmentperiod %]
319
			<input type="hidden" name="op" value="delete_confirmed" />
328
                            [% category.enrolmentperiod %] months
320
            <input type="hidden" name="categorycode" value="[% categorycode |html %]" /> <input type="submit" value="Delete this category" /> <a class="cancel" href="/cgi-bin/koha/admin/categorie.pl">Cancel</a>
329
                        [% ELSE %]
321
		[% END %]</fieldset></fieldset></form>
330
                            until [% category.enrolmentperioddate | $KohaDates %]
331
                        [% END %]
332
                    </td>
333
                </tr>
334
                <tr><th scope="row">Age required: </th><td>[% category.dateofbirthrequired %] years</td></tr>
335
                <tr><th scope="row">Upperage limit: </th><td>[% category.upperagelimit %] years</td></tr>
336
                <tr><th scope="row">Enrollment fee: </th><td>[% category.enrolmentfee | $Price %]</td></tr>
337
                <tr><th scope="row">Receives overdue notices: </th><td>[% IF category. overduenoticerequired %]Yes[% ELSE %]No[% END %]</td></tr>
338
                <tr><th scope="row">Lost items in staff client</th><td>[% IF category.hidelostitems %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
339
                <tr><th scope="row">Hold fee: </th><td>[% category.reservefee | $Price %]</td></tr>
340
                <tr>
341
                    <th scope="row">Default privacy: </th>
342
                    <td>
343
                        [% SWITCH category.default_privacy %]
344
                        [% CASE 'default' %]
345
                            Default
346
                        [% CASE 'never' %]
347
                            Never
348
                        [% CASE 'forever' %]
349
                            Forever
350
                        [% END %]
351
                    </td>
352
                </tr>
353
            </table>
354
            <fieldset class="action">
355
                [% IF patrons_in_category > 0 %]
356
                    <input type="submit" value="OK" />
357
                [% ELSE %]
358
                    <input type="hidden" name="op" value="delete_confirmed" />
359
                    <input type="hidden" name="categorycode" value="[% categorycode |html %]" />
360
                    <input type="submit" value="Delete this category" />
361
                    <a class="cancel" href="/cgi-bin/koha/admin/categorie.pl">Cancel</a>
362
                [% END %]
363
            </fieldset>
364
        </fieldset>
365
    </form>
322
[% END %]
366
[% END %]
323
367
324
[% IF ( else ) %]
368
[% IF op == 'list' %]
325
369
326
<div id="toolbar" class="btn-toolbar">
370
    <div id="toolbar" class="btn-toolbar">
327
    <a class="btn btn-small" id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form"><i class="fa fa-plus"></i> New category</a>
371
        <a class="btn btn-small" id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form"><i class="fa fa-plus"></i> New category</a>
328
</div>
372
    </div>
329
373
330
<h2>Patron category administration</h2>
374
    <h2>Patron category administration</h2>
331
[% IF ( searchfield ) %]
375
    [% IF searchfield %]
332
		You Searched for [% searchfield %]</span>
376
        You Searched for [% searchfield %]</span>
333
	[% END %]
377
    [% END %]
334
[% IF ( loop ) %]
378
    [% IF categories%]
335
<div id="pagertable_categorie">
336
</div>
337
        <table id="table_categorie">
379
        <table id="table_categorie">
338
		<thead>
380
            <thead>
339
        <tr>
381
                <tr>
340
			<th scope="col">Code</th>
382
                    <th scope="col">Code</th>
341
			<th scope="col">Category name</th>
383
                    <th scope="col">Category name</th>
342
			<th scope="col">Type</th>
384
                    <th scope="col">Type</th>
343
			<th scope="col">Enrollment period</th>
385
                    <th scope="col">Enrollment period</th>
344
			<th scope="col">Age required</th>
386
                    <th scope="col">Age required</th>
345
			<th scope="col">Upper age limit</th>
387
                    <th scope="col">Upper age limit</th>
346
			<th scope="col">Enrollment fee</th>
388
                    <th scope="col">Enrollment fee</th>
347
			<th scope="col">Overdue</th>
389
                    <th scope="col">Overdue</th>
348
            <th scope="col">Lost items</th>
390
                    <th scope="col">Lost items</th>
349
 			<th scope="col">Hold fee</th>
391
                    <th scope="col">Hold fee</th>
350
            [% IF ( EnhancedMessagingPreferences ) %]
392
                    [% IF ( EnhancedMessagingPreferences ) %]
351
            <th scope="col">Messaging</th>
393
                    <th scope="col">Messaging</th>
352
            [% END %]
394
                    [% END %]
353
            <th scope="col">Branches limitations</th>
395
                    <th scope="col">Branches limitations</th>
354
            <th scope="col">Default privacy</th>
396
                    <th scope="col">Default privacy</th>
355
            <th scope="col">&nbsp; </th>
397
                    <th scope="col">&nbsp; </th>
356
            <th scope="col">&nbsp; </th>
398
                    <th scope="col">&nbsp; </th>
357
        </tr>
399
                </tr>
358
		</thead>
400
            </thead>
359
        <tbody>
401
            <tbody>
360
		[% FOREACH loo IN loop %]
402
                [% FOREACH category IN categories %]
361
			<tr>
403
                    <tr>
362
                        <td>[% loo.categorycode |html %]</td>
404
                        <td>[% category.categorycode |html %]</td>
363
                        <td>
405
                        <td>
364
                            <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |uri %]">[% loo.description |html %]</a>
406
                            <a href="/cgi-bin/koha/admin/categorie.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]">[% category.description |html %]</a>
365
                        </td>
407
                        </td>
366
                        <td>
408
                        <td>
367
                            [% IF ( loo.type_A ) %]Adult[% END %]
409
                            [% SWITCH category.category_type %]
368
                            [% IF ( loo.type_C ) %]Child[% END %]
410
                                [% CASE 'A' %]Adult
369
                            [% IF ( loo.type_P ) %]Prof.[% END %]
411
                                [% CASE 'C' %]Child
370
                            [% IF ( loo.type_I ) %]Org.[% END %]
412
                                [% CASE 'P' %]Prof.
371
                            [% IF ( loo.type_S ) %]Staff[% END %]
413
                                [% CASE 'I' %]Org.
372
                            [% IF ( loo.type_X ) %]Statistical[% END %]
414
                                [% CASE 'S' %]Staff
415
                                [% CASE 'X' %]Statistical
416
                            [% END %]
373
                        </td>
417
                        </td>
374
                        <td>
418
                        <td>
375
                        	[% IF ( loo.enrolmentperiod ) %]
419
                            [% IF ( category.enrolmentperiod ) %]
376
                        		[% loo.enrolmentperiod %] months
420
                                [% category.enrolmentperiod %] months
377
                        	[% ELSE %]
378
                        		until [% loo.enrolmentperioddate | $KohaDates %]
379
                        	[% END %]
380
                        
381
                        </td>
382
                        <td>[% loo.dateofbirthrequired %] years</td>
383
			<td>[% loo.upperagelimit %] years</td>
384
                        <td>[% loo.enrolmentfee %]</td>
385
                        <td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
386
                        <td>[% IF ( loo.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
387
                        <td>[% loo.reservefee %]</td>
388
                        [% IF ( EnhancedMessagingPreferences ) %]
389
                        <td style="white-space: nowrap; font-size:80%;">
390
                            [% IF ( loo.messaging_prefs ) %]
391
                              [% FOREACH prefs IN loo.messaging_prefs %]
392
	                                [% FOREACH transport IN prefs.transports %]
393
                                         [% IF ( transport.transport ) %]
394
                                            [% IF ( prefs.Item_Due ) %]Item due
395
                                            [% ELSIF ( prefs.Advance_Notice ) %]Advance notice
396
                                            [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming events
397
                                            [% ELSIF ( prefs.Hold_Filled ) %]Hold filled
398
                                            [% ELSIF ( prefs.Item_Check_in ) %]Item check-in
399
                                            [% ELSIF ( prefs.Item_Checkout ) %]Item checkout
400
			                                [% ELSE %]Unknown
401
			                                [% END %]:
402
				                            <strong>[% transport.transport %]</strong><br />
403
				                         [% ELSE %]None<br />[% END %]
404
	                                [% END %]
405
                                [% END %]
406
                            [% ELSE %]
421
                            [% ELSE %]
407
                                None
422
                                until [% category.enrolmentperioddate | $KohaDates %]
408
                            [% END %]
423
                            [% END %]
409
                        </td>
424
                        </td>
425
                        <td>[% category.dateofbirthrequired %] years</td>
426
                        <td>[% category.upperagelimit %] years</td>
427
                        <td>[% category.enrolmentfee | $Price %]</td>
428
                        <td>[% IF ( category.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
429
                        <td>[% IF ( category.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
430
                        <td>[% category.reservefee | $Price %]</td>
431
                        [% IF Koha.Preference('EnhancedMessagingPreferences') %]
432
                            <td style="white-space: nowrap; font-size:80%;">
433
                                [% SET default_messaging = category.default_messaging %]
434
                                [% IF default_messaging.size %]
435
                                    [% FOREACH prefs IN default_messaging %]
436
                                        [% FOREACH transport IN prefs.transports %]
437
                                            [% IF ( transport.transport ) %]
438
                                                [% IF ( prefs.Item_Due ) %]Item due
439
                                                [% ELSIF ( prefs.Advance_Notice ) %]Advance notice
440
                                                [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming events
441
                                                [% ELSIF ( prefs.Hold_Filled ) %]Hold filled
442
                                                [% ELSIF ( prefs.Item_Check_in ) %]Item check-in
443
                                                [% ELSIF ( prefs.Item_Checkout ) %]Item checkout
444
                                                [% ELSE %]Unknown
445
                                                [% END %]:
446
                                                <strong>[% transport.transport %]</strong><br />
447
                                            [% ELSE %]None<br />[% END %]
448
                                        [% END %]
449
                                    [% END %]
450
                                [% ELSE %]
451
                                    None
452
                                [% END %]
453
                            </td>
410
                        [% END %]
454
                        [% END %]
411
                        <td>
455
                        <td>
412
                            [% IF loo.branches.size > 0 %]
456
                            [% SET branch_limitations = category.branch_limitations %]
457
                            [% IF branch_limitations.size > 0 %]
413
                                [% branches_str = "" %]
458
                                [% branches_str = "" %]
414
                                [% FOREACH branch IN loo.branches %]
459
                                [% FOREACH branch IN branch_limitations %]
415
                                    [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
460
                                    [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
416
                                [% END %]
461
                                [% END %]
417
                                <span title="[% branches_str %]">
462
                                <span title="[% branches_str %]">
418
                                    [% IF loo.branches.size > 1 %]
463
                                    [% IF branch_limitations.size > 1 %]
419
                                        [% loo.branches.size %] branches limitations
464
                                        [% branch_limitations.size %] branches limitations
420
                                    [% ELSE %]
465
                                    [% ELSE %]
421
                                        [% loo.branches.size %] branch limitation
466
                                        [% branch_limitations.size %] branch limitation
422
                                    [% END %]
467
                                    [% END %]
423
                                </span>
468
                                </span>
424
                            [% ELSE %]
469
                            [% ELSE %]
Lines 426-432 Link Here
426
                            [% END %]
471
                            [% END %]
427
                        </td>
472
                        </td>
428
                        <td>
473
                        <td>
429
                            [% SWITCH loo.default_privacy %]
474
                            [% SWITCH category.default_privacy %]
430
                            [% CASE 'default' %]
475
                            [% CASE 'default' %]
431
                                Default
476
                                Default
432
                            [% CASE 'never' %]
477
                            [% CASE 'never' %]
Lines 435-449 Link Here
435
                                Forever
480
                                Forever
436
                            [% END %]
481
                            [% END %]
437
                        </td>
482
                        </td>
438
                        <td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |uri %]">Edit</a></td>
483
                        <td><a href="/cgi-bin/koha/admin/categorie.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]">Edit</a></td>
439
                        <td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |uri %]">Delete</a></td>
484
                        <td><a href="/cgi-bin/koha/admin/categorie.pl?op=delete_confirm&amp;categorycode=[% category.categorycode |uri %]">Delete</a></td>
440
		</tr>
485
                    </tr>
441
		[% END %]
486
                [% END %]
442
        </tbody>
487
            </tbody>
443
	</table>
488
        </table>
444
[% ELSE %]
489
    [% ELSE %]
445
	<div class="dialog alert">No categories have been defined. <a href="/cgi-bin/koha/admin/categorie.pl?op=add_form">Create a new category</a>.</div>
490
        <div class="dialog alert">No categories have been defined. <a href="/cgi-bin/koha/admin/categorie.pl?op=add_form">Create a new category</a>.</div>
446
[% END %]
491
    [% END %]
447
[% END %]
492
[% END %]
448
493
449
</div>
494
</div>
450
- 

Return to bug 14836