Bug 6254: (follow-up) tidy admin/categorie.pl ( whitespace changes only )
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / categorie.tt
blobd03309a000466bf90d9ae1f200229baefcef8f5f
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         }));
23     $( "#enrolmentperioddate" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future
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' %]
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>
106 <div id="doc3" class="yui-t2">
107    
108    <div id="bd">
109         <div id="yui-main">
110         <div class="yui-b">
112 [% IF ( add_form ) %]
113         
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><label for="categorycode" class="required">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
131         [% END %]
132     <li><label for="description" class="required">Description: </label> <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
133     <li><label for="enrolmentperiod" class="required">Enrollment period: </label>
134         <fieldset>
135         <legend>Choose one</legend>
136         <ol>
137         <li><label for="enrolmentperiod" style="width:6em;">In months: </label>
138                 <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
139         <li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
140         <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate | $KohaDates %]" />
141                 <div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
142         </li>
143         </ol>
144         </fieldset>
145         </li>
146         <li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
147         <li><label for="upperagelimit">Upperage limit: </label> <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li>
148         <li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% enrolmentfee %]" /></li>
149         <li><label for="overduenoticerequired">Overdue notice required: </label> <select name="overduenoticerequired" id="overduenoticerequired">
150                         [% IF ( overduenoticerequired ) %]
151                                                 <option value="0">No</option>
152                                                 <option value="1" selected="selected">Yes</option>
153                         [% ELSE %]
154                                                 <option value="0" selected="selected">No</option>
155                                                 <option value="1">Yes</option>
156                         [% END %]
157                                         </select></li>
158     <li><label for="hidelostitems">Lost items in staff client: </label> <select name="hidelostitems" id="hidelostitems">
159                         [% IF ( hidelostitems ) %]
160                                                 <option value="0">Shown</option>
161                                                 <option value="1" selected="selected">Hidden by default</option>
162                         [% ELSE %]
163                                                 <option value="0" selected="selected">Shown</option>
164                                                 <option value="1">Hidden by default</option>
165                         [% END %]
166                                         </select></li>
167         <li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
168     <li><label for="category_type" class="required">Category type: </label> <select name="category_type" id="category_type">
169                         [% IF ( type_n ) %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
170                                         [% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
171                                         [% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
172                                         [% IF ( type_S ) %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
173                                         [% IF ( type_I ) %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
174                                         [% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
175                                         [% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
176                                         </select>
177     </li>
178     <li><label for="branches">Branches limitation: </label>
179         <select id="branches" name="branches" multiple size="10">
180             <option value="">All branches</option>
181             [% FOREACH branch IN branches_loop %]
182               [% IF ( branch.selected ) %]
183                 <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
184               [% ELSE %]
185                 <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
186               [% END %]
187             [% END %]
188         </select>
189         <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.
190         </span>
191     </li>
192     <li><label for="block_expired">Block expired patrons</label>
193         <select name="block_expired" id="block_expired">
194             [% IF ( BlockExpiredPatronOpacActions == -1  ) %]
195                 <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
196             [% ELSE %]
197                 <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option>
198             [% END %]
200             [% IF ( BlockExpiredPatronOpacActions == 1   ) %]
201                 <option value="1" selected="selected"> Block </option>
202             [% ELSE %]
203                 <option value="1"> Block </option>
204             [% END %]
206             [% IF ( BlockExpiredPatronOpacActions == 0   ) %]
207                 <option value="0" selected="selected"> Don't block </option>
208             [% ELSE %]
209                 <option value="0"> Don't block </option>
210             [% END %]
211         </select>
212         <span>
213             Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired.   
214         </span>
215     </li>
216     <li>
217         <label for="default_privacy">Default privacy: </label>
218         <select id="default_privacy" name="default_privacy">
219             [% SWITCH default_privacy %]
220             [% CASE 'forever' %]
221                 <option value="default">Default</option>
222                 <option value="never">Never</option>
223                 <option value="forever" selected="selected">Forever</option>
224             [% CASE 'never' %]
225                 <option value="default">Default</option>
226                 <option value="never" selected="selected">Never</option>
227                 <option value="forever">Forever</option>
228             [% CASE %]
229                 <option value="default" selected="selected">Default</option>
230                 <option value="never">Never</option>
231                 <option value="forever">Forever</option>
232             [% END %]
233         </select>
234         <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>
235     </li>
236     </ol>
237 </fieldset>
239     [% IF ( EnhancedMessagingPreferences ) %]
240       <fieldset class="rows">
241         <h4>Default messaging preferences for this patron category</h4>
242         [% INCLUDE 'messaging-preference-form.inc' %]
243       </fieldset>
244     [% END %]
245         <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
246         </form>
248 [% END %]
250 [% IF ( add_validate ) %]
251 <h3>Data recorded</h3>
252         <form action="[% script_name %]" method="post">
253                 <input type="submit" value="OK" />
254         </form>
255 [% END %]
257 [% IF ( delete_confirm ) %]
258     <form action="[% script_name %]" method="post">
259         <fieldset>
260             <legend>
261                 [% IF ( patrons_in_category > 0 ) %]
262                     Category [% categorycode |html %] is in use.  Deletion not possible!
263                 [% ELSE %]
264                     Confirm deletion of category [% categorycode |html %]
265                 [% END %]
266             </legend>
268 [% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %]
269         <table>
270         <tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr>
271         <tr><th scope="row">Description: </th><td>[% description |html %]</td></tr>
272         <tr><th scope="row">Enrollment period: </th>
273                 <td>
274                         [% IF ( enrolmentperiod ) %]
275                                 [% enrolmentperiod %] months
276                         [% ELSE %]
277                                 until [% enrolmentperioddate | $KohaDates %]
278                         [% END %]
279                 </td>
280         </tr>
281         <tr><th scope="row">Age required: </th><td>[% dateofbirthrequired %] years</td></tr>
282         <tr><th scope="row">Upperage limit: </th><td>[% upperagelimit %] years</td></tr>
283         <tr><th scope="row">Enrollment fee: </th><td>[% enrolmentfee %]</td></tr>
284         <tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr>
285         <tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
286         <tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
287     <tr>
288         <th scope="row">Default privacy: </th>
289         <td>
290             [% SWITCH category.default_privacy %]
291             [% CASE 'default' %]
292                 Default
293             [% CASE 'never' %]
294                 Never
295             [% CASE 'forever' %]
296                 Forever
297             [% END %]
298         </td>
299     </tr>
300 </table>
301                 <fieldset class="action">[% IF ( totalgtzero ) %]
302 <input type="submit" value="OK" /></form>
303                 [% ELSE %]
304                         <input type="hidden" name="op" value="delete_confirmed" />
305             <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>
306                 [% END %]</fieldset></fieldset></form>
307 [% END %]
309 [% IF ( delete_confirmed ) %]
310 <h3>Category deleted</h3>
312         <form action="[% script_name %]" method="post">
313         <input type="submit" value="OK" />
314         </form>
315 [% END %]
317 [% IF ( else ) %]
319 <div id="toolbar" class="btn-toolbar">
320     <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>
321 </div>
323 <h2>Patron category administration</h2>
324 [% IF ( searchfield ) %]
325                 You Searched for [% searchfield %]</span>
326         [% END %]
327 [% IF ( loop ) %]
328 <div id="pagertable_categorie">
329 </div>
330         <table id="table_categorie">
331                 <thead>
332         <tr>
333                         <th scope="col">Code</th>
334                         <th scope="col">Category name</th>
335                         <th scope="col">Type</th>
336                         <th scope="col">Enrollment period</th>
337                         <th scope="col">Age required</th>
338                         <th scope="col">Upper age limit</th>
339                         <th scope="col">Enrollment fee</th>
340                         <th scope="col">Overdue</th>
341             <th scope="col">Lost items</th>
342                         <th scope="col">Hold fee</th>
343             [% IF ( EnhancedMessagingPreferences ) %]
344             <th scope="col">Messaging</th>
345             [% END %]
346             <th scope="col">Branches limitations</th>
347             <th scope="col">Default privacy</th>
348             <th scope="col">&nbsp; </th>
349             <th scope="col">&nbsp; </th>
350         </tr>
351                 </thead>
352         <tbody>
353                 [% FOREACH loo IN loop %]
354                         <tr>
355                         <td>[% loo.categorycode |html %]</td>
356                         <td>
357                             <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |uri %]">[% loo.description |html %]</a>
358                         </td>
359                         <td>
360                             [% IF ( loo.type_A ) %]Adult[% END %]
361                             [% IF ( loo.type_C ) %]Child[% END %]
362                             [% IF ( loo.type_P ) %]Prof.[% END %]
363                             [% IF ( loo.type_I ) %]Org.[% END %]
364                             [% IF ( loo.type_S ) %]Staff[% END %]
365                             [% IF ( loo.type_X ) %]Statistical[% END %]
366                         </td>
367                         <td>
368                                 [% IF ( loo.enrolmentperiod ) %]
369                                         [% loo.enrolmentperiod %] months
370                                 [% ELSE %]
371                                         until [% loo.enrolmentperioddate | $KohaDates %]
372                                 [% END %]
373                         
374                         </td>
375                         <td>[% loo.dateofbirthrequired %] years</td>
376                         <td>[% loo.upperagelimit %] years</td>
377                         <td>[% loo.enrolmentfee %]</td>
378                         <td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
379                         <td>[% IF ( loo.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
380                         <td>[% loo.reservefee %]</td>
381                         [% IF ( EnhancedMessagingPreferences ) %]
382                         <td style="white-space: nowrap; font-size:80%;">
383                             [% IF ( loo.messaging_prefs ) %]
384                               [% FOREACH prefs IN loo.messaging_prefs %]
385                                         [% FOREACH transport IN prefs.transports %]
386                                          [% IF ( transport.transport ) %]
387                                             [% IF ( prefs.Item_Due ) %]Item due
388                                             [% ELSIF ( prefs.Advance_Notice ) %]Advance notice
389                                             [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming events
390                                             [% ELSIF ( prefs.Hold_Filled ) %]Hold filled
391                                             [% ELSIF ( prefs.Item_Check_in ) %]Item check-in
392                                             [% ELSIF ( prefs.Item_Checkout ) %]Item checkout
393                                                         [% ELSE %]Unknown
394                                                         [% END %]:
395                                                             <strong>[% transport.transport %]</strong><br />
396                                                          [% ELSE %]None<br />[% END %]
397                                         [% END %]
398                                 [% END %]
399                             [% ELSE %]
400                                 None
401                             [% END %]
402                         </td>
403                         [% END %]
404                         <td>
405                             [% IF loo.branches.size > 0 %]
406                                 [% branches_str = "" %]
407                                 [% FOREACH branch IN loo.branches %]
408                                     [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
409                                 [% END %]
410                                 <span title="[% branches_str %]">
411                                     [% IF loo.branches.size > 1 %]
412                                         [% loo.branches.size %] branches limitations
413                                     [% ELSE %]
414                                         [% loo.branches.size %] branch limitation
415                                     [% END %]
416                                 </span>
417                             [% ELSE %]
418                                 No limitation
419                             [% END %]
420                         </td>
421                         <td>
422                             [% SWITCH loo.default_privacy %]
423                             [% CASE 'default' %]
424                                 Default
425                             [% CASE 'never' %]
426                                 Never
427                             [% CASE 'forever' %]
428                                 Forever
429                             [% END %]
430                         </td>
431                         <td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |uri %]">Edit</a></td>
432                         <td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |uri %]">Delete</a></td>
433                 </tr>
434                 [% END %]
435         </tbody>
436         </table>
437 [% ELSE %]
438         <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>
439 [% END %]
440 [% END %]
442 </div>
443 </div>
444 <div class="yui-b">
445 [% INCLUDE 'admin-menu.inc' %]
446 </div>
447 </div>
448 [% INCLUDE 'intranet-bottom.inc' %]