Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / patron-attr-types.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AuthorisedValues %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Administration &rsaquo; Patron attribute types
7 [% IF ( attribute_type_form ) %]
8   [% IF ( edit_attribute_type ) %]
9     &rsaquo; Modify patron attribute type
10   [% ELSE %]
11     &rsaquo; Add patron attribute type
12   [% END %]
13 [% END %]
14 [% IF ( delete_attribute_type_form ) %]
15   &rsaquo; Confirm deletion of patron attribute type &quot;[% code | html %]&quot;
16 [% END %]
17 </title>
18 [% INCLUDE 'doc-head-close.inc' %]
19 </head>
20
21 <body id="admin_patron-attr-types" class="admin">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'prefs-admin-search.inc' %]
24
25 <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 ( display_list ) %]Patron attribute types[% ELSE %]<a href="/cgi-bin/koha/admin/patron-attr-types.pl">Patron attribute types</a>[% END %]
26 [% IF ( attribute_type_form ) %]
27   [% IF ( edit_attribute_type ) %]
28     &rsaquo; Modify patron attribute type
29   [% ELSE %]
30     &rsaquo; Add patron attribute type
31   [% END %]
32 [% END %]
33 [% IF ( delete_attribute_type_form ) %]
34   &rsaquo; Confirm deletion of patron attribute type &quot;[% code | html %]&quot;
35 [% END %]
36 </div>
37
38 <div id="doc3" class="yui-t2">
39
40    <div id="bd">
41     <div id="yui-main">
42     <div class="yui-b">
43
44 [% IF ( WARNING_extended_attributes_off ) %]
45 <div class="dialog message">Because the 'ExtendedPatronAttributes` system preference is currently not enabled, extended patron attributes cannot be given to patron records.  Go <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=ExtendedPatronAttributes">here</a> if you wish to enable this feature.</div>
46 [% END %]
47
48 [% IF ( attribute_type_form ) %]
49   [% IF ( edit_attribute_type ) %]
50 <h2>Modify patron attribute type</h2>
51   [% ELSE %]
52 <h2>Add patron attribute type</h2>
53   [% END %]
54 [% IF ( duplicate_code_error ) %]
55 <div class="dialog message">Could not add patron attribute type &quot;[% duplicate_code_error | html %]&quot; 
56     &mdash; one with that code already exists.
57 </div>
58 [% END %]
59 <form action="[% script_name | html %]" class="validated" method="post">
60   <input type="hidden" name="op" value="[% confirm_op | html %]" />
61   <fieldset class="rows">
62     <ol>
63       <li>
64           [% IF ( edit_attribute_type ) %]
65                   <span class="label">Patron attribute type code: </span>
66             <input type="hidden" name="code" value="[% code | html %]" />
67             [% code | html %]
68           [% ELSE %]
69               <label for="code" class="required">Patron attribute type code: </label>
70               <input type="text" id="code" name="code" required="required" class="required" size="10" maxlength="10" />
71               <span class="required">Required</span>
72           [% END %]
73        </li>
74        <li><label for="description" class="required">Description: </label>
75            <input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% description | html %]" />
76            <span class="required">Required</span>
77        </li>
78        <li><label for="repeatable">Repeatable: </label>
79             [% IF ( repeatable_checked ) %]
80               [% IF ( repeatable_disabled ) %]
81                 <input type="checkbox" id="repeatable" name="repeatable" checked="checked" disabled="disabled" />
82               [% ELSE %]
83                 <input type="checkbox" id="repeatable" name="repeatable" checked="checked" />
84               [% END %]
85             [% ELSE %]
86               [% IF ( repeatable_disabled ) %]
87                 <input type="checkbox" id="repeatable" name="repeatable" disabled="disabled" />
88               [% ELSE %]
89                 <input type="checkbox" id="repeatable" name="repeatable" />
90               [% END %]
91             [% END %]
92             <span>Check to let a patron record have multiple values of this attribute.  
93                   This setting cannot be changed after an attribute is defined.</span>
94        </li>
95        <li><label for="unique_id">Unique identifier: </label>
96             [% IF ( unique_id_checked ) %]
97               [% IF ( unique_id_disabled ) %]
98                 <input type="checkbox" id="unique_id" name="unique_id" checked="checked" disabled="disabled" />
99               [% ELSE %]
100                 <input type="checkbox" id="unique_id" name="unique_id" checked="checked" />
101               [% END %]
102             [% ELSE %]
103               [% IF ( unique_id_disabled ) %]
104                 <input type="checkbox" id="unique_id" name="unique_id" disabled="disabled" />
105               [% ELSE %]
106                 <input type="checkbox" id="unique_id" name="unique_id" />
107               [% END %]
108             [% END %]
109             <span>If checked, attribute will be a unique identifier &mdash; if a value is given to a patron record, the same value
110                   cannot be given to a different record.  This setting cannot be changed after an attribute is defined.</span>
111        </li>
112        <li><label for="opac_display">Display in OPAC: </label>
113           [% IF ( opac_display_checked ) %]
114             <input type="checkbox" id="opac_display" name="opac_display" checked="checked" />
115           [% ELSE %]
116             <input type="checkbox" id="opac_display" name="opac_display" />
117           [% END %]
118             <span>Check to display this attribute on a patron's details page in the OPAC.</span>
119        </li>
120        <li><label for="opac_editable">Editable in OPAC: </label>
121           [% IF ( opac_editable_checked ) %]
122             <input type="checkbox" id="opac_editable" name="opac_editable" checked="checked" />
123           [% ELSE %]
124             <input type="checkbox" id="opac_editable" name="opac_editable" />
125           [% END %]
126             <span>Check to allow patrons to edit this attribute from their details page in the OPAC. (Requires above, does not work with <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=PatronSelfRegistrationVerifyByEmail" target="_blank">PatronSelfRegistrationVerifyByEmail</a>.)</span>
127        </li>
128        <li><label for="staff_searchable">Searchable: </label>
129           [% IF ( staff_searchable_checked ) %]
130             <input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
131           [% ELSE %]
132             <input type="checkbox" id="staff_searchable" name="staff_searchable" />
133           [% END %]
134             <span>Check to make this attribute staff_searchable in the staff patron search.</span>
135        </li>
136        <li><label for="display_checkout">Display in check-out: </label>
137             [% IF display_checkout_checked %]
138                 <input type="checkbox" id="display_checkout" name="display_checkout" checked="checked" />
139             [% ELSE %]
140                 <input type="checkbox" id="display_checkout" name="display_checkout" />
141             [% END %]
142             <span>Check to show this attribute in patron check-out.</span>
143        </li>
144
145         <li><label for="authorised_value_category">Authorized value category: </label>
146             <select name="authorised_value_category" id="authorised_value_category">
147                 <option value=""></option>
148                 [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value_category ) %]
149             </select>
150             <span>Authorized value category; if one is selected, the patron record input page will only allow values 
151                   to be chosen from the authorized value list.  However, an authorized value list is not 
152                   enforced during batch patron import.</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 | html %]">[% branch.branchname | html %]</option>
160                   [% ELSE %]
161                     <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
162                   [% END %]
163                 [% END %]
164             </select>
165             <span>Select All if this attribute type must to be displayed all the time. Otherwise select libraries you want to associate with this value.
166             </span>
167         </li>
168         <li>
169             <label for="category">Category: </label>
170             <select name="category_code" id="category">
171                 <option value=""></option>
172                 [% FOREACH cat IN categories %]
173                     [% IF ( cat.categorycode == category_code ) %]<option value="[% cat.categorycode | html %]" selected="selected">[% cat.description | html %]</option>[% ELSE %]<option value="[% cat.categorycode | html %]">[% cat.description | html %]</option>[% END %]
174                 [% END %]
175             </select>
176             <span>Choose one to limit this attribute to one patron type. Please leave blank if you want these attributes to be available for all types of patrons.</span>
177         </li>
178         <li>
179             <label for="class">Class: </label>
180             <select name="class" id="class">
181                 <option value=""></option>
182                 [% FOREACH class IN classes_val_loop %]
183                     [% IF class.authorised_value == category_class %]
184                         <option value="[% class.authorised_value | html %]" selected="selected">
185                             [% class.lib | html %]
186                         </option>
187                     [% ELSE %]
188                         <option value="[% class.authorised_value | html %]" >
189                             [% class.lib | html %]
190                         </option>
191                     [% END %]
192                 [% END %]
193             </select>
194             <span>Group attributes types with a block title (based on authorized values category 'PA_CLASS')</span>
195         </li>
196     </ol>
197   </fieldset>
198   <fieldset class="action">
199       <input type="submit" value="Save" />
200     <a class="cancel" href="/cgi-bin/koha/admin/patron-attr-types.pl">Cancel</a>
201   </fieldset>
202 </form>
203 [% END %]
204
205 [% IF ( delete_attribute_type_form ) %]
206     <div class="dialog alert">
207         <h3>Confirm deletion of patron attribute type <span class="ex">'[% code | html %]' ([% description | html %])</span>?</h3>
208         <form action="[% script_name | html %]" name="Aform" method="post">
209             <input type="hidden" name="op" value="[% confirm_op | html %]" />
210             <input type="hidden" name="code" value="[% code | html %]" />
211             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete patron attribute type</button>
212         </form>
213         <form action="[% script_name | html %]" method="get">
214             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
215         </form>
216     </div>
217 [% END %]
218
219 [% IF ( display_list ) %]
220
221 <div id="toolbar" class="btn-toolbar">
222     <a class="btn btn-default btn-sm" id="newrule" href="[% script_name | html %]?op=add_attribute_type"><i class="fa fa-plus"></i> New patron attribute type</a>
223 </div>
224
225 <h2>Patron attribute types</h2>
226 [% IF ( added_attribute_type ) %]
227 <div class="dialog message">Added patron attribute type &quot;[% added_attribute_type | html %]&quot;</div>
228 [% END %]
229 [% IF ( edited_attribute_type ) %]
230 <div class="dialog message">Modified patron attribute type &quot;[% edited_attribute_type | html %]&quot;</div>
231 [% END %]
232 [% IF ( deleted_attribute_type ) %]
233 <div class="dialog message">Deleted patron attribute type &quot;[% deleted_attribute_type | html %]&quot;</div>
234 [% END %]
235 [% IF ( ERROR_delete_in_use ) %]
236 <div class="dialog message">Could not delete patron attribute type &quot;[% ERROR_delete_in_use | html %]&quot; 
237     &mdash; it is in use by [% ERROR_num_patrons | html %] patron records</div>
238 [% END %]
239 [% IF ( ERROR_delete_not_found ) %]
240 <div class="dialog message">Could not delete patron attribute type &quot;[% ERROR_delete_not_found | html %]&quot; 
241     &mdash; it was already absent from the database.</div>
242 [% END %]
243 [% IF ( available_attribute_types ) %]
244   [% FOREACH attribute IN available_attribute_types %]
245     [% IF attribute.class %]
246         <h4>[% attribute.lib | html %]</h4>
247     [% END %]
248     <table class="patron_attributes_types">
249       <thead>
250         <tr>
251           <th>Code</th>
252           <th>Description</th>
253           <th>Branches limitation</th>
254           <th>Actions</th>
255         </tr>
256       </thead>
257       <tbody>
258         [% FOREACH item IN attribute.items %]
259           <tr>
260             <td>[% item.code | html %]</td>
261             <td>[% item.description | html %]</td>
262             <td>
263                 [% IF ( item.branches && item.branches.size > 0 ) %]
264                     [% branches_str = "" | html %]
265                     [% FOREACH branch IN item.branches %]
266                         [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" | html %]
267                     [% END %]
268                     <span title="[% branches_str | html %]">
269                         [% IF item.branches.size > 1 %]
270                             [% item.branches.size | html %] branches limitations
271                         [% ELSE %]
272                             [% item.branches.size | html %] branch limitation
273                         [% END %]
274                     </span>
275                 [% ELSE %]
276                     No limitation
277                 [% END %]
278             </td>
279             <td class="actions">
280               <a class="btn btn-default btn-xs" href="[% item.script_name | html %]?op=edit_attribute_type&amp;code=[% item.code | html %]"><i class="fa fa-pencil"></i> Edit</a>
281               <a class="btn btn-default btn-xs" href="[% item.script_name | html %]?op=delete_attribute_type&amp;code=[% item.code | html %]"><i class="fa fa-trash"></i> Delete</a>
282             </td>
283           </tr>
284         [% END %]
285       </tbody>
286     </table>
287   [% END %]
288 [% ELSE %]
289   <p>There are no saved patron attribute types.</p>
290 [% END %]
291
292 <div class="pages">[% pagination_bar | $raw %]</div>
293
294 [% END %]
295  
296 </div>
297 </div>
298 <div class="yui-b">
299 [% INCLUDE 'admin-menu.inc' %]
300 </div>
301 </div>
302
303 [% MACRO jsinclude BLOCK %]
304     [% Asset.js("js/admin-menu.js") | $raw %]
305     <script type="text/javascript">
306         $(document).ready(function() {
307             if ( $("#branches option:selected").length < 1 ) {
308                 $("#branches option:first").attr("selected", "selected");
309             }
310
311             $("#opac_display").change( function() {
312                 if ( this.checked ) {
313                     $("#opac_editable").removeAttr('disabled').parent().removeAttr('aria-disabled');
314                 } else {
315                     $("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
316                 }
317             } ).change();
318         });
319     </script>
320 [% END %]
321 [% INCLUDE 'intranet-bottom.inc' %]