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