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