Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / categories.tt
blobc71e6fb7e454635db3982b3e16d2bf5386f3e937
1 [% USE Asset %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE Price %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Administration &rsaquo; Patron categories &rsaquo; [% IF op == 'add_form' %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
8 [% 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 %]
9 </title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 [% Asset.css("css/datatables.css") %]
12 <style type="text/css">#enrolmentmessage.hint { display : none; }</style>
13 </head>
15 <body id="admin_categorie" class="admin">
16 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'patrons-admin-search.inc' %]
19 <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/categories.pl">Patron categories</a> &rsaquo; [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
20 [% IF op == 'delete_confirm' %] <a href="/cgi-bin/koha/admin/categories.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 %]
21 [% IF op == 'delete_confirmed' %] <a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a> &rsaquo; Category deleted[% END %]
22 [% IF op == 'list' %]Patron categories[% END %]</div>
24 <div id="doc3" class="yui-t2">
25    <div id="bd">
26     <div id="yui-main">
27     <div class="yui-b">
29 [% FOR m IN messages %]
30     <div class="dialog [% m.type %]">
31         [% SWITCH m.code %]
32         [% CASE 'error_on_update' %]
33             An error occurred when updating this patron category. Perhaps it already exists.
34         [% CASE 'error_on_insert' %]
35             An error occurred when inserting this patron category. The patron category might already exist.
36         [% CASE 'error_on_delete' %]
37             An error occurred when deleting this patron category. Check the logs.
38         [% CASE 'success_on_update' %]
39             Patron category updated successfully.
40         [% CASE 'success_on_insert' %]
41             Patron category inserted successfully.
42         [% CASE 'success_on_delete' %]
43             Patron category deleted successfully.
44         [% CASE 'already_exists' %]
45             This patron category already exists.
46         [% CASE %]
47             [% m.code %]
48         [% END %]
49     </div>
50 [% END %]
52 [% IF op == 'add_form' %]
53     <form id="category_form" action="/cgi-bin/koha/admin/categories.pl" method="post">
54         <input type="hidden" name="op" value="add_validate" />
55         <input type="hidden" name="checked" value="0" />
56         [% IF category %]
57             <h1>Modify category [% categorycode |html %]</h1>
58         [% ELSE %]
59             <h1>New category</h1>
60         [% END %]
61         <fieldset class="rows">
62             <ol>
63                 [% IF category %]
64                     <li>
65                         <span class="label">Category code: </span>[% categorycode |html %]
66                         <input type="hidden" name="categorycode" value="[% category.categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" />
67                     </li>
68                 [% ELSE %]
69                     <li>
70                         <label for="categorycode" class="required">Category code: </label>
71                         <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" class="required" required="required" />
72                         <span class="required">Required</span>
73                     </li>
74                 [% END %]
75                 <li>
76                     <label for="description" class="required">Description: </label>
77                     <input type="text" name="description" id="description" size="40" maxlength="80" class="required" required="required" value="[% category.description |html %]" />
78                     <span class="required">Required</span>
79                 </li>
80                 <li>
81                     <span class="label">Enrollment period: </span>
82                     <fieldset>
83                         <legend>Choose one</legend>
84                         <ol>
85                             <li>
86                                 <label for="enrolmentperiod" style="width:6em;">In months: </label>
87                                 [% IF category.enrolmentperiod %]
88                                     <input type="text" class="enrollmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% category.enrolmentperiod %]" /> months
89                                [% ELSE %]
90                                     <input type="text" class="enrollmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="" /> months
91                                [% END %]
92                             </li>
93                             <li>
94                                 <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
95                                 <input type="text" class="enrollmentperiod datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
96                             </li>
97                         </ol>
98                     </fieldset>
99                 </li>
100                 <li>
101                     <label for="dateofbirthrequired">Age required: </label>
102                     <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% category.dateofbirthrequired %]" size="3" maxlength="3" /> years
103                 </li>
104                 <li>
105                     <label for="upperagelimit">Upperage limit: </label>
106                     <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% category.upperagelimit %]" /> years
107                 </li>
108                 <li>
109                     <label for="enrolmentfee">Enrollment fee: </label>
110                     <input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% category.enrolmentfee | $Price on_editing => 1 %]" />
111                 </li>
112                 <li>
113                     <label for="overduenoticerequired">Overdue notice required: </label>
114                     <select name="overduenoticerequired" id="overduenoticerequired">
115                         [% IF category.overduenoticerequired %]
116                             <option value="0">No</option>
117                             <option value="1" selected="selected">Yes</option>
118                         [% ELSE %]
119                             <option value="0" selected="selected">No</option>
120                             <option value="1">Yes</option>
121                         [% END %]
122                     </select>
123                 </li>
124                 <li>
125                     <label for="hidelostitems">Lost items in staff client: </label>
126                     <select name="hidelostitems" id="hidelostitems">
127                         [% IF category.hidelostitems %]
128                             <option value="0">Shown</option>
129                             <option value="1" selected="selected">Hidden by default</option>
130                         [% ELSE %]
131                             <option value="0" selected="selected">Shown</option>
132                             <option value="1">Hidden by default</option>
133                         [% END %]
134                     </select>
135                 </li>
136                 <li>
137                     <label for="reservefee">Hold fee: </label>
138                     <input type="text" name="reservefee" id="reservefee" size="6" value="[% category.reservefee | $Price on_editing => 1 %]" />
139                 </li>
140                 <li>
141                     <label for="category_type" class="required">Category type: </label>
142                     <select name="category_type" id="category_type">
143                         [% UNLESS category %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
144                         [% IF category and category.category_type == 'A' %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
145                         [% IF category and category.category_type == 'C' %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
146                         [% IF category and category.category_type == 'S' %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
147                         [% IF category and category.category_type == 'I' %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
148                         [% IF category and category.category_type == 'P' %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
149                         [% IF category and category.category_type == 'X' %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
150                     </select>
151                     <span class="required">Required</span>
152                 </li>
153                 <li><label for="branches">Branches limitation: </label>
154                     <select id="branches" name="branches" multiple size="10">
155                         <option value="">All branches</option>
156                         [% FOREACH branch IN branches_loop %]
157                           [% IF branch.selected %]
158                             <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname |html %]</option>
159                           [% ELSE %]
160                             <option value="[% branch.branchcode %]">[% branch.branchname |html %]</option>
161                           [% END %]
162                         [% END %]
163                     </select>
164                     <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.
165                     </span>
166                 </li>
167                 <li><label for="block_expired">Block expired patrons:</label>
168                     <select name="BlockExpiredPatronOpacActions" id="block_expired">
169                         [% IF not category or category.BlockExpiredPatronOpacActions == -1%]
170                             <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
171                         [% ELSE %]
172                             <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option>
173                         [% END %]
175                         [% IF category and category.BlockExpiredPatronOpacActions == 1 %]
176                             <option value="1" selected="selected"> Block </option>
177                         [% ELSE %]
178                             <option value="1"> Block </option>
179                         [% END %]
181                         [% IF category and category.BlockExpiredPatronOpacActions == 0 %]
182                             <option value="0" selected="selected"> Don't block </option>
183                         [% ELSE %]
184                             <option value="0"> Don't block </option>
185                         [% END %]
186                     </select>
187                     <span>
188                         Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired.
189                     </span>
190                 </li>
191                 [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' )  %]
192                   <li><label for="checkprevcheckout">Check for previous checkouts: </label>
193                       <select name="checkprevcheckout" id="checkprevcheckout">
194                           [% IF category.checkprevcheckout == 'yes' %]
195                           <option value="yes" selected="selected">Yes and try to override system preferences</option>
196                           <option value="no">No and try to override system preferences</option>
197                           <option value="inherit">Inherit from system preferences</option>
198                           [% ELSIF category.checkprevcheckout == 'no' %]
199                           <option value="yes">Yes and try to override system preferences</option>
200                           <option value="no" selected="selected">No and try to override system preferences</option>
201                           <option value="inherit">Inherit from system preferences</option>
202                           [% ELSE %]
203                           <option value="yes">Yes and try to override system preferences</option>
204                           <option value="no">No and try to override system preferences</option>
205                           <option value="inherit" selected="selected">Inherit from system preferences</option>
206                           [% END %]
207                       </select>
208                       <span>
209                           Choose whether patrons of this category by default are reminded if they try to borrow an item they borrowed before.
210                       </span>
211                   </li>
212                 [% END %]
213                 <li>
214                     <label for="default_privacy">Default privacy: </label>
215                     <select id="default_privacy" name="default_privacy">
216                         [% SET default_privacy = 'default' %]
217                         [% IF category %][% SET default_privacy = category.default_privacy %][% END %]
218                         [% SWITCH default_privacy %]
219                         [% CASE 'forever' %]
220                             <option value="default">Default</option>
221                             <option value="never">Never</option>
222                             <option value="forever" selected="selected">Forever</option>
223                         [% CASE 'never' %]
224                             <option value="default">Default</option>
225                             <option value="never" selected="selected">Never</option>
226                             <option value="forever">Forever</option>
227                         [% CASE %]
228                             <option value="default" selected="selected">Default</option>
229                             <option value="never">Never</option>
230                             <option value="forever">Forever</option>
231                         [% END %]
232                     </select>
233                     <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>
234                 </li>
235             </ol>
236         </fieldset>
238         [% IF ( EnhancedMessagingPreferences ) %]
239             <fieldset class="rows">
240                 <h4>Default messaging preferences for this patron category</h4>
241                 [% INCLUDE 'messaging-preference-form.inc' %]
242             </fieldset>
243         [% END %]
244         <fieldset class="action">
245             <input type="submit" value="Save" />
246             <a href="/cgi-bin/koha/admin/categories.pl" class="cancel">Cancel</a>
247         </fieldset>
248     </form>
249 [% END %]
251 [% IF op == 'delete_confirm' %]
252     <form action="/cgi-bin/koha/admin/categories.pl" method="post">
253         <fieldset>
254             <legend>
255                 [% IF patrons_in_category > 0 %]
256                     Category [% categorycode |html %] is in use.  Deletion not possible!
257                 [% ELSE %]
258                     Confirm deletion of category [% categorycode |html %]
259                 [% END %]
260             </legend>
262             [% IF patrons_in_category > 0  %]
263                 <div class="dialog alert">
264                     <strong>This category is used [% patrons_in_category %] times</strong>. Deletion not possible
265                 </div>
266             [% END %]
267             <table>
268                 <tr><th scope="row">Category code: </th><td>[% category.categorycode |html %]</td></tr>
269                 <tr><th scope="row">Description: </th><td>[% category.description |html %]</td></tr>
270                 <tr><th scope="row">Enrollment period: </th>
271                     <td>
272                         [% IF category.enrolmentperiod %]
273                             [% category.enrolmentperiod %] months
274                         [% ELSE %]
275                             until [% category.enrolmentperioddate | $KohaDates %]
276                         [% END %]
277                     </td>
278                 </tr>
279                 <tr><th scope="row">Age required: </th><td>[% category.dateofbirthrequired %] years</td></tr>
280                 <tr><th scope="row">Upperage limit: </th><td>[% category.upperagelimit %] years</td></tr>
281                 <tr><th scope="row">Enrollment fee: </th><td>[% category.enrolmentfee | $Price %]</td></tr>
282                 <tr><th scope="row">Receives overdue notices: </th><td>[% IF category. overduenoticerequired %]Yes[% ELSE %]No[% END %]</td></tr>
283                 <tr><th scope="row">Lost items in staff client</th><td>[% IF category.hidelostitems %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
284                 <tr><th scope="row">Hold fee: </th><td>[% category.reservefee | $Price %]</td></tr>
286                 [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
287                   <tr>
288                       <th scope="row">Check previous checkouts: </th>
289                       <td>
290                           [% SWITCH category.checkprevcheckout %]
291                           [% CASE 'yes' %]
292                               Yes
293                           [% CASE 'no' %]
294                               No
295                           [% CASE 'inherit' %]
296                               Inherit
297                           [% END %]
298                       </td>
299                   </tr>
300                 [% END %]
301                 <tr>
302                     <th scope="row">Default privacy: </th>
303                     <td>
304                         [% SWITCH category.default_privacy %]
305                         [% CASE 'default' %]
306                             Default
307                         [% CASE 'never' %]
308                             Never
309                         [% CASE 'forever' %]
310                             Forever
311                         [% END %]
312                     </td>
313                 </tr>
314             </table>
315             <fieldset class="action">
316                 [% IF patrons_in_category > 0 %]
317                     <input type="submit" value="OK" />
318                 [% ELSE %]
319                     <input type="hidden" name="op" value="delete_confirmed" />
320                     <input type="hidden" name="categorycode" value="[% categorycode |html %]" />
321                     <input type="submit" value="Delete this category" />
322                     <a class="cancel" href="/cgi-bin/koha/admin/categories.pl">Cancel</a>
323                 [% END %]
324             </fieldset>
325         </fieldset>
326     </form>
327 [% END %]
329 [% IF op == 'list' %]
331     <div id="toolbar" class="btn-toolbar">
332         <a class="btn btn-default btn-sm" id="newcategory" href="/cgi-bin/koha/admin/categories.pl?op=add_form"><i class="fa fa-plus"></i> New category</a>
333     </div>
335     <h2>Patron categories</h2>
336     [% IF searchfield %]
337         You Searched for [% searchfield |html %]</span>
338     [% END %]
339     [% IF categories%]
340         <table id="table_categorie">
341             <thead>
342                 <tr>
343                     <th scope="col">Code</th>
344                     <th scope="col">Category name</th>
345                     <th scope="col">Type</th>
346                     <th scope="col">Enrollment period</th>
347                     <th scope="col">Age required</th>
348                     <th scope="col">Upper age limit</th>
349                     <th scope="col">Enrollment fee</th>
350                     <th scope="col">Overdue</th>
351                     <th scope="col">Lost items</th>
352                     <th scope="col">Hold fee</th>
353                     [% IF ( EnhancedMessagingPreferences ) %]
354                     <th scope="col">Messaging</th>
355                     [% END %]
356                     <th scope="col">Branches limitations</th>
357                     [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
358                     <th scope="col">Check previous checkout?</th>
359                     [% END %]
360                     <th scope="col">Default privacy</th>
361                     <th scope="col">Actions</th>
362                 </tr>
363             </thead>
364             <tbody>
365                 [% FOREACH category IN categories %]
366                     <tr>
367                         <td>[% category.categorycode |html %]</td>
368                         <td>
369                             <a href="/cgi-bin/koha/admin/categories.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]">[% category.description |html %]</a>
370                         </td>
371                         <td>
372                             [% SWITCH category.category_type %]
373                                 [% CASE 'A' %]Adult
374                                 [% CASE 'C' %]Child
375                                 [% CASE 'P' %]Prof.
376                                 [% CASE 'I' %]Org.
377                                 [% CASE 'S' %]Staff
378                                 [% CASE 'X' %]Statistical
379                             [% END %]
380                         </td>
381                         <td>
382                             [% IF ( category.enrolmentperiod ) %]
383                                 [% category.enrolmentperiod %] months
384                             [% ELSE %]
385                                 until [% category.enrolmentperioddate | $KohaDates %]
386                             [% END %]
387                         </td>
388                         [% IF (category.dateofbirthrequired) %]
389                             <td>[% category.dateofbirthrequired %] years</td>
390                         [% ELSE %]
391                             <td>-</td>
392                         [% END %]
393                         [% IF (category.upperagelimit) %]
394                             <td>[% category.upperagelimit %] years</td>
395                         [% ELSE %]
396                             <td>-</td>
397                         [% END %]
398                         [% IF (category.enrolmentfee > 0) %]
399                             <td>[% category.enrolmentfee | $Price %]</td>
400                         [% ELSE %]
401                             <td>-</td>
402                         [% END %]
403                         <td>[% IF ( category.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
404                         <td>[% IF ( category.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
405                         [% IF (category.reservefee > 0) %]
406                             <td>[% category.reservefee | $Price %]</td>
407                         [% ELSE %]
408                             <td>-</td>
409                         [% END %]
410                         [% IF Koha.Preference('EnhancedMessagingPreferences') %]
411                             <td style="white-space: nowrap; font-size:80%;">
412                                 [% SET default_messaging = category.default_messaging %]
413                                 [% IF default_messaging.size %]
414                                     [% FOREACH prefs IN default_messaging %]
415                                         [% FOREACH transport IN prefs.transports %]
416                                             [% IF ( transport.transport ) %]
417                                                 [% IF ( prefs.Item_Due ) %]Item due
418                                                 [% ELSIF ( prefs.Advance_Notice ) %]Advance notice
419                                                 [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming events
420                                                 [% ELSIF ( prefs.Hold_Filled ) %]Hold filled
421                                                 [% ELSIF ( prefs.Item_Check_in ) %]Item check-in
422                                                 [% ELSIF ( prefs.Item_Checkout ) %]Item checkout
423                                                 [% ELSE %]Unknown
424                                                 [% END %]:
425                                                 <strong>[% transport.transport %]</strong><br />
426                                             [% ELSE %]None<br />[% END %]
427                                         [% END %]
428                                     [% END %]
429                                 [% ELSE %]
430                                     None
431                                 [% END %]
432                             </td>
433                         [% END %]
434                         <td>
435                             [% SET branch_limitations = category.branch_limitations %]
436                             [% IF branch_limitations.size > 0 %]
437                                 [% branches_str = "" %]
438                                 [% FOREACH branch IN branch_limitations %]
439                                     [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
440                                 [% END %]
441                                 <span title="[% branches_str %]">
442                                     [% IF branch_limitations.size > 1 %]
443                                         [% branch_limitations.size %] branches limitations
444                                     [% ELSE %]
445                                         [% branch_limitations.size %] branch limitation
446                                     [% END %]
447                                 </span>
448                             [% ELSE %]
449                                 No limitation
450                             [% END %]
451                         </td>
452                         [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
453                           <td>
454                               [% SWITCH category.checkprevcheckout %]
455                               [% CASE 'yes' %]
456                               Yes
457                               [% CASE 'no' %]
458                               No
459                               [% CASE 'inherit' %]
460                               Inherit
461                               [% END %]
462                           </td>
463                         [% END %]
464                         <td>
465                             [% SWITCH category.default_privacy %]
466                             [% CASE 'default' %]
467                                 Default
468                             [% CASE 'never' %]
469                                 Never
470                             [% CASE 'forever' %]
471                                 Forever
472                             [% END %]
473                         </td>
474                         <td class="actions">
475                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]"><i class="fa fa-pencil"></i> Edit</a>
476                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=delete_confirm&amp;categorycode=[% category.categorycode |uri %]"><i class="fa fa-trash"></i> Delete</a>
477                         </td>
478                     </tr>
479                 [% END %]
480             </tbody>
481         </table>
482     [% ELSE %]
483         <div class="dialog alert">No categories have been defined. <a href="/cgi-bin/koha/admin/categories.pl?op=add_form">Create a new category</a>.</div>
484     [% END %]
485 [% END %]
487 </div>
488 </div>
489 <div class="yui-b">
490 [% INCLUDE 'admin-menu.inc' %]
491 </div>
492 </div>
494 [% MACRO jsinclude BLOCK %]
495     [% Asset.js("js/admin-menu.js") %]
496     [% Asset.js("js/messaging-preference-form.js") %]
497     [% INCLUDE 'calendar.inc' %]
498     [% INCLUDE 'datatables.inc' %]
499     <script type="text/javascript">
500         var MSG_CATEGORYCODE_CHARS = _("Category code can only contain the following characters: letters, numbers, - and _.");
501         var MSG_ONE_ENROLLMENTPERIOD = ("Please choose an enrollment period in months OR by date.");
502     </script>
503     [% Asset.js("js/categories.js") %]
504 [% END %]
505 [% INCLUDE 'intranet-bottom.inc' %]