Bug 13355: System preferences tab value wrong in templates
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / categorie.tt
1 [% USE KohaDates -%]
2 [% 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 %]
4 [% IF ( add_validate ) %]Data recorded[% END %]
5 [% 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 ( delete_confirmed ) %]Category deleted[% END %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% INCLUDE 'calendar.inc' %]
9 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
10 [% INCLUDE 'datatables.inc' %]
11 <script type="text/javascript" id="js">
12 //<![CDATA[
13     $(document).ready(function() {
14         $("#table_categorie").dataTable($.extend(true, {}, dataTablesDefaults, {
15             "aoColumnDefs": [
16                 { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
17                 { "aTargets": [ 3,4,5 ], "sType": "natural" },
18             ],
19             "aaSorting": [[ 1, "asc" ]],
20             "sPaginationType": "four_button"
21         }));
22
23     $( "#enrolmentperioddate" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future
24
25     if ( $("#branches option:selected").length < 1 ) {
26         $("#branches option:first").attr("selected", "selected");
27     }
28 });
29         function isNotNull(f,noalert) {
30                 if (f.value.length ==0) {
31    return false;
32                 }
33                 return true;
34         }
35         //
36         function isNum(v,maybenull) {
37         var n = new Number(v.value);
38         if (isNaN(n)) {
39                 return false;
40                 }
41         if (maybenull==0 && v.value=='') {
42                 return false;
43         }
44         return true;
45         }
46         // to check if the data are correctly entered.
47         function Check(ff) {
48             var ok=0;
49                 var _alertString=_("Form not submitted because of the following problem(s)");
50                 _alertString +="\n-------------------------------------------------------------------\n\n";
51                 ff.categorycode.value = ff.categorycode.value.trim();
52                 if (ff.categorycode.value.length==0) {
53                    ok=1;
54                    _alertString += _("- categorycode missing") + "\n";
55                 }
56                 else{
57                    var patt=/^[a-zA-Z0-9\-_]+$/g;
58                    if ( !patt.test(ff.categorycode.value) ) {
59                       ok=1;
60                       _alertString += _("- category code can only contain the following characters: letters, numbers, - and _") + "\n";
61                    }
62                 }
63                 if (!(ff.category_type.value)){
64                     ok=1;
65                     _alertString += _("- category type missing") + "\n";
66                 }
67                 if (!(isNotNull(ff.description,1))) {
68                     ok=1;
69                         _alertString += _("- description missing") + "\n";
70                 }
71                 if (!isNum(ff.upperagelimit,0) && ff.category_type.value=='C') {
72                     ok=1;
73                         _alertString += _("- upperagelimit is not a number") + "\n";
74                                 
75                 }
76                 if(!(ff.enrolmentperioddate.value || ff.enrolmentperiod.value)) {
77                     ok=1;
78                     _alertString += _("- either Enrollment period or Until date must be provided") + "\n";
79                 }
80                 if(ff.enrolmentperioddate.value && ff.enrolmentperiod.value){
81                         document.getElementById('enrolmentmessage').className = "error";
82                         return false;
83                 }
84                 
85                 if (ok) { // if there is a problem
86                     alert(_alertString);
87                     return false;
88                 }
89                 // if all is good
90                 ff.submit();
91         }
92         //]]>
93 </script>
94 <style type="text/css">#enrolmentmessage.hint { display : none; }</style>
95 </head>
96 <body id="admin_categorie" class="admin">
97 [% INCLUDE 'header.inc' %]
98 [% INCLUDE 'patrons-admin-search.inc' %]
99
100 <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 [% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Data recorded[% END %]
102 [% 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 %]
103 [% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Category deleted[% END %]
104 [% IF ( else ) %]Patron categories[% END %]</div>
105
106 <div id="doc3" class="yui-t2">
107    
108    <div id="bd">
109         <div id="yui-main">
110         <div class="yui-b">
111
112 [% IF ( add_form ) %]
113         
114
115
116         
117         <form name="Aform" action="[% script_name %]" method="post">
118         <input type="hidden" name="op" value="add_validate" />
119         <input type="hidden" name="checked" value="0" />
120 [% IF ( categorycode ) %]
121                 <h1>Modify category [% categorycode |html %]</h1>
122         [% ELSE %]
123                 <h1>New category</h1>
124         [% END %]
125         <fieldset class="rows">
126         <ol>[% IF ( categorycode ) %]
127     <li><span class="label">Category code: </span>[% categorycode |html %]
128                                 <input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
129         [% ELSE %]
130     <li>
131         <label for="categorycode" class="required">Category code: </label>
132         <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" />
133         <span class="required">Required</span>
134     </li>
135         [% END %]
136     <li>
137         <label for="description" class="required">Description: </label>
138         <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" />
139         <span class="required">Required</span>
140     </li>
141     <li><label for="enrolmentperiod" class="required">Enrollment period: </label>
142         <fieldset>
143         <legend>Choose one</legend>
144         <ol>
145         <li><label for="enrolmentperiod" style="width:6em;">In months: </label>
146                 <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
147         <li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
148         <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate | $KohaDates %]" />
149                 <div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
150         </li>
151         </ol>
152         </fieldset>
153         </li>
154         <li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
155         <li><label for="upperagelimit">Upperage limit: </label> <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li>
156         <li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% enrolmentfee %]" /></li>
157         <li><label for="overduenoticerequired">Overdue notice required: </label> <select name="overduenoticerequired" id="overduenoticerequired">
158                         [% IF ( overduenoticerequired ) %]
159                                                 <option value="0">No</option>
160                                                 <option value="1" selected="selected">Yes</option>
161                         [% ELSE %]
162                                                 <option value="0" selected="selected">No</option>
163                                                 <option value="1">Yes</option>
164                         [% END %]
165                                         </select></li>
166     <li><label for="hidelostitems">Lost items in staff client: </label> <select name="hidelostitems" id="hidelostitems">
167                         [% IF ( hidelostitems ) %]
168                                                 <option value="0">Shown</option>
169                                                 <option value="1" selected="selected">Hidden by default</option>
170                         [% ELSE %]
171                                                 <option value="0" selected="selected">Shown</option>
172                                                 <option value="1">Hidden by default</option>
173                         [% END %]
174                                         </select></li>
175         <li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
176     <li>
177         <label for="category_type" class="required">Category type: </label>
178         <select name="category_type" id="category_type">
179                         [% IF ( type_n ) %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
180                                         [% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
181                                         [% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
182                                         [% IF ( type_S ) %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
183                                         [% IF ( type_I ) %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
184                                         [% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
185                                         [% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
186                                         </select>
187         <span class="required">Required</span>
188     </li>
189     <li><label for="branches">Branches limitation: </label>
190         <select id="branches" name="branches" multiple size="10">
191             <option value="">All branches</option>
192             [% FOREACH branch IN branches_loop %]
193               [% IF ( branch.selected ) %]
194                 <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
195               [% ELSE %]
196                 <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
197               [% END %]
198             [% END %]
199         </select>
200         <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.
201         </span>
202     </li>
203     <li><label for="block_expired">Block expired patrons</label>
204         <select name="block_expired" id="block_expired">
205             [% IF ( BlockExpiredPatronOpacActions == -1  ) %]
206                 <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
207             [% ELSE %]
208                 <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option>
209             [% END %]
210
211             [% IF ( BlockExpiredPatronOpacActions == 1   ) %]
212                 <option value="1" selected="selected"> Block </option>
213             [% ELSE %]
214                 <option value="1"> Block </option>
215             [% END %]
216
217             [% IF ( BlockExpiredPatronOpacActions == 0   ) %]
218                 <option value="0" selected="selected"> Don't block </option>
219             [% ELSE %]
220                 <option value="0"> Don't block </option>
221             [% END %]
222         </select>
223         <span>
224             Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired.   
225         </span>
226     </li>
227     <li>
228         <label for="default_privacy">Default privacy: </label>
229         <select id="default_privacy" name="default_privacy">
230             [% SWITCH default_privacy %]
231             [% CASE 'forever' %]
232                 <option value="default">Default</option>
233                 <option value="never">Never</option>
234                 <option value="forever" selected="selected">Forever</option>
235             [% CASE 'never' %]
236                 <option value="default">Default</option>
237                 <option value="never" selected="selected">Never</option>
238                 <option value="forever">Forever</option>
239             [% CASE %]
240                 <option value="default" selected="selected">Default</option>
241                 <option value="never">Never</option>
242                 <option value="forever">Forever</option>
243             [% END %]
244         </select>
245         <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>
246     </li>
247     </ol>
248 </fieldset>
249
250     [% IF ( EnhancedMessagingPreferences ) %]
251       <fieldset class="rows">
252         <h4>Default messaging preferences for this patron category</h4>
253         [% INCLUDE 'messaging-preference-form.inc' %]
254       </fieldset>
255     [% END %]
256         <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
257         </form>
258
259 [% END %]
260
261 [% IF ( add_validate ) %]
262 <h3>Data recorded</h3>
263         <form action="[% script_name %]" method="post">
264                 <input type="submit" value="OK" />
265         </form>
266 [% END %]
267
268 [% IF ( delete_confirm ) %]
269     <form action="[% script_name %]" method="post">
270         <fieldset>
271             <legend>
272                 [% IF ( patrons_in_category > 0 ) %]
273                     Category [% categorycode |html %] is in use.  Deletion not possible!
274                 [% ELSE %]
275                     Confirm deletion of category [% categorycode |html %]
276                 [% END %]
277             </legend>
278
279 [% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %]
280         <table>
281         <tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr>
282         <tr><th scope="row">Description: </th><td>[% description |html %]</td></tr>
283         <tr><th scope="row">Enrollment period: </th>
284                 <td>
285                         [% IF ( enrolmentperiod ) %]
286                                 [% enrolmentperiod %] months
287                         [% ELSE %]
288                                 until [% enrolmentperioddate | $KohaDates %]
289                         [% END %]
290                 </td>
291         </tr>
292         <tr><th scope="row">Age required: </th><td>[% dateofbirthrequired %] years</td></tr>
293         <tr><th scope="row">Upperage limit: </th><td>[% upperagelimit %] years</td></tr>
294         <tr><th scope="row">Enrollment fee: </th><td>[% enrolmentfee %]</td></tr>
295         <tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr>
296         <tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
297         <tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
298     <tr>
299         <th scope="row">Default privacy: </th>
300         <td>
301             [% SWITCH category.default_privacy %]
302             [% CASE 'default' %]
303                 Default
304             [% CASE 'never' %]
305                 Never
306             [% CASE 'forever' %]
307                 Forever
308             [% END %]
309         </td>
310     </tr>
311 </table>
312                 <fieldset class="action">[% IF ( totalgtzero ) %]
313 <input type="submit" value="OK" /></form>
314                 [% ELSE %]
315                         <input type="hidden" name="op" value="delete_confirmed" />
316             <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>
317                 [% END %]</fieldset></fieldset></form>
318 [% END %]
319
320 [% IF ( delete_confirmed ) %]
321 <h3>Category deleted</h3>
322
323         <form action="[% script_name %]" method="post">
324         <input type="submit" value="OK" />
325         </form>
326 [% END %]
327
328 [% IF ( else ) %]
329
330 <div id="toolbar" class="btn-toolbar">
331     <a class="btn btn-small" id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form"><i class="icon-plus"></i> New category</a>
332 </div>
333
334 <h2>Patron category administration</h2>
335 [% IF ( searchfield ) %]
336                 You Searched for [% searchfield %]</span>
337         [% END %]
338 [% IF ( loop ) %]
339 <div id="pagertable_categorie">
340 </div>
341         <table id="table_categorie">
342                 <thead>
343         <tr>
344                         <th scope="col">Code</th>
345                         <th scope="col">Category name</th>
346                         <th scope="col">Type</th>
347                         <th scope="col">Enrollment period</th>
348                         <th scope="col">Age required</th>
349                         <th scope="col">Upper age limit</th>
350                         <th scope="col">Enrollment fee</th>
351                         <th scope="col">Overdue</th>
352             <th scope="col">Lost items</th>
353                         <th scope="col">Hold fee</th>
354             [% IF ( EnhancedMessagingPreferences ) %]
355             <th scope="col">Messaging</th>
356             [% END %]
357             <th scope="col">Branches limitations</th>
358             <th scope="col">Default privacy</th>
359             <th scope="col">&nbsp; </th>
360             <th scope="col">&nbsp; </th>
361         </tr>
362                 </thead>
363         <tbody>
364                 [% FOREACH loo IN loop %]
365                         <tr>
366                         <td>[% loo.categorycode |html %]</td>
367                         <td>
368                             <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |uri %]">[% loo.description |html %]</a>
369                         </td>
370                         <td>
371                             [% IF ( loo.type_A ) %]Adult[% END %]
372                             [% IF ( loo.type_C ) %]Child[% END %]
373                             [% IF ( loo.type_P ) %]Prof.[% END %]
374                             [% IF ( loo.type_I ) %]Org.[% END %]
375                             [% IF ( loo.type_S ) %]Staff[% END %]
376                             [% IF ( loo.type_X ) %]Statistical[% END %]
377                         </td>
378                         <td>
379                                 [% IF ( loo.enrolmentperiod ) %]
380                                         [% loo.enrolmentperiod %] months
381                                 [% ELSE %]
382                                         until [% loo.enrolmentperioddate | $KohaDates %]
383                                 [% END %]
384                         
385                         </td>
386                         <td>[% loo.dateofbirthrequired %] years</td>
387                         <td>[% loo.upperagelimit %] years</td>
388                         <td>[% loo.enrolmentfee %]</td>
389                         <td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
390                         <td>[% IF ( loo.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
391                         <td>[% loo.reservefee %]</td>
392                         [% IF ( EnhancedMessagingPreferences ) %]
393                         <td style="white-space: nowrap; font-size:80%;">
394                             [% IF ( loo.messaging_prefs ) %]
395                               [% FOREACH prefs IN loo.messaging_prefs %]
396                                         [% FOREACH transport IN prefs.transports %]
397                                          [% IF ( transport.transport ) %]
398                                             [% IF ( prefs.Item_Due ) %]Item due
399                                             [% ELSIF ( prefs.Advance_Notice ) %]Advance notice
400                                             [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming events
401                                             [% ELSIF ( prefs.Hold_Filled ) %]Hold filled
402                                             [% ELSIF ( prefs.Item_Check_in ) %]Item check-in
403                                             [% ELSIF ( prefs.Item_Checkout ) %]Item checkout
404                                                         [% ELSE %]Unknown
405                                                         [% END %]:
406                                                             <strong>[% transport.transport %]</strong><br />
407                                                          [% ELSE %]None<br />[% END %]
408                                         [% END %]
409                                 [% END %]
410                             [% ELSE %]
411                                 None
412                             [% END %]
413                         </td>
414                         [% END %]
415                         <td>
416                             [% IF loo.branches.size > 0 %]
417                                 [% branches_str = "" %]
418                                 [% FOREACH branch IN loo.branches %]
419                                     [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
420                                 [% END %]
421                                 <span title="[% branches_str %]">
422                                     [% IF loo.branches.size > 1 %]
423                                         [% loo.branches.size %] branches limitations
424                                     [% ELSE %]
425                                         [% loo.branches.size %] branch limitation
426                                     [% END %]
427                                 </span>
428                             [% ELSE %]
429                                 No limitation
430                             [% END %]
431                         </td>
432                         <td>
433                             [% SWITCH loo.default_privacy %]
434                             [% CASE 'default' %]
435                                 Default
436                             [% CASE 'never' %]
437                                 Never
438                             [% CASE 'forever' %]
439                                 Forever
440                             [% END %]
441                         </td>
442                         <td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |uri %]">Edit</a></td>
443                         <td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |uri %]">Delete</a></td>
444                 </tr>
445                 [% END %]
446         </tbody>
447         </table>
448 [% ELSE %]
449         <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>
450 [% END %]
451 [% END %]
452
453 </div>
454 </div>
455 <div class="yui-b">
456 [% INCLUDE 'admin-menu.inc' %]
457 </div>
458 </div>
459 [% INCLUDE 'intranet-bottom.inc' %]