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