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