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