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