Main Koha release repository https://koha-community.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

320 lines
15 KiB

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE AuthorisedValues %]
[% USE Branches %]
[% USE scalar %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Patron attribute types
[% IF ( attribute_type_form ) %]
[% IF ( edit_attribute_type ) %]
&rsaquo; Modify patron attribute type
[% ELSE %]
&rsaquo; Add patron attribute type
[% END %]
[% END %]
[% IF ( delete_attribute_type_form ) %]
&rsaquo; Confirm deletion of patron attribute type &quot;[% code | html %]&quot;
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_patron-attr-types" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'prefs-admin-search.inc' %]
<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 %]
[% IF ( attribute_type_form ) %]
[% IF ( edit_attribute_type ) %]
&rsaquo; Modify patron attribute type
[% ELSE %]
&rsaquo; Add patron attribute type
[% END %]
[% END %]
[% IF ( delete_attribute_type_form ) %]
&rsaquo; Confirm deletion of patron attribute type &quot;[% code | html %]&quot;
[% END %]
</div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% IF ( WARNING_extended_attributes_off ) %]
<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>
[% END %]
[% IF ( attribute_type_form ) %]
[% IF ( edit_attribute_type ) %]
<h2>Modify patron attribute type</h2>
[% ELSE %]
<h2>Add patron attribute type</h2>
[% END %]
[% IF ( duplicate_code_error ) %]
<div class="dialog message">Could not add patron attribute type &quot;[% duplicate_code_error | html %]&quot;
&mdash; one with that code already exists.
</div>
[% END %]
<form action="[% script_name | html %]" class="validated" method="post">
<input type="hidden" name="op" value="[% confirm_op | html %]" />
<fieldset class="rows">
<ol>
<li>
[% IF attribute_type %]
<span class="label">Patron attribute type code: </span>
<input type="hidden" name="code" value="[% attribute_type.code |html %]" />
[% attribute_type.code |html %]
[% ELSE %]
<label for="code" class="required">Patron attribute type code: </label>
<input type="text" id="code" name="code" required="required" class="required" size="10" maxlength="10" />
<span class="required">Required</span>
[% END %]
</li>
<li><label for="description" class="required">Description: </label>
<input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% attribute_type.description |html %]" />
<span class="required">Required</span>
</li>
<li><label for="repeatable">Repeatable: </label>
[% IF attribute_type %]
[% IF attribute_type.repeatable %]
<input type="checkbox" id="repeatable" name="repeatable" checked="checked" disabled="disabled" />
[% ELSE %]
<input type="checkbox" id="repeatable" name="repeatable" disabled="disabled" />
[% END %]
[% ELSE %]
<input type="checkbox" id="repeatable" name="repeatable" />
[% END %]
<span>Check to let a patron record have multiple values of this attribute.
This setting cannot be changed after an attribute is defined.</span>
</li>
<li><label for="unique_id">Unique identifier: </label>
[% IF attribute_type %]
[% IF attribute_type.unique_id %]
<input type="checkbox" id="unique_id" name="unique_id" checked="checked" disabled="disabled" />
[% ELSE %]
<input type="checkbox" id="unique_id" name="unique_id" disabled="disabled" />
[% END %]
[% ELSE %]
<input type="checkbox" id="unique_id" name="unique_id" />
[% END %]
<span>If checked, attribute will be a unique identifier &mdash; if a value is given to a patron record, the same value
cannot be given to a different record. This setting cannot be changed after an attribute is defined.</span>
</li>
<li><label for="opac_display">Display in OPAC: </label>
[% IF attribute_type AND attribute_type.opac_display %]
<input type="checkbox" id="opac_display" name="opac_display" checked="checked" />
[% ELSE %]
<input type="checkbox" id="opac_display" name="opac_display" />
[% END %]
<span>Check to display this attribute on a patron's details page in the OPAC.</span>
</li>
<li><label for="opac_editable">Editable in OPAC: </label>
[% IF attribute_type AND attribute_type.opac_editable %]
<input type="checkbox" id="opac_editable" name="opac_editable" checked="checked" />
[% ELSE %]
<input type="checkbox" id="opac_editable" name="opac_editable" />
[% END %]
<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> if set.)</span>
</li>
<li><label for="staff_searchable">Searchable: </label>
[% IF attribute_type AND attribute_type.staff_searchable %]
<input type="checkbox" id="staff_searchable" name="staff_searchable" checked="checked" />
[% ELSE %]
<input type="checkbox" id="staff_searchable" name="staff_searchable" />
[% END %]
<span>Check to make this attribute staff_searchable in the staff patron search.</span>
</li>
<li><label for="mandatory">Mandatory: </label>
[% IF attribute_type AND attribute_type.mandatory %]
<input type="checkbox" id="mandatory" name="mandatory" checked="checked" />
[% ELSE %]
<input type="checkbox" id="mandatory" name="mandatory" />
[% END %]
<span>Check to make this attribute mandatory when creating or editing a patron.</span>
</li>
<li><label for="display_checkout">Display in patron's brief information: </label>
[% IF attribute_type AND attribute_type.display_checkout %]
<input type="checkbox" id="display_checkout" name="display_checkout" checked="checked" />
[% ELSE %]
<input type="checkbox" id="display_checkout" name="display_checkout" />
[% END %]
<span>Check to show this attribute in the brief information panel in the patron's record (staff interface).</span>
</li>
[% IF Koha.Preference('Pseudonymization') %]
<li>
<label for="keep_for_pseudonymization">Keep for pseudonymization: </label>
[% IF attribute_type AND attribute_type.keep_for_pseudonymization %]
<input type="checkbox" id="keep_for_pseudonymization" name="keep_for_pseudonymization" checked="checked" />
[% ELSE %]
<input type="checkbox" id="keep_for_pseudonymization" name="keep_for_pseudonymization" />
[% END %]
<span>Check to make this attribute copied to the patron's pseudonymized attributes.</span>
</li>
[% END %]
<li><label for="authorised_value_category">Authorized value category: </label>
<select name="authorised_value_category" id="authorised_value_category">
<option value=""></option>
[% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => attribute_type.authorised_value_category ) %]
</select>
<span>Authorized value category; 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.</span>
</li>
<li><label for="branches">Branches limitation: </label>
<select id="branches" name="branches" multiple size="10">
<option value="">All branches</option>
[% PROCESS options_for_libraries libraries => Branches.all( selecteds => attribute_type.library_limits ) %]
</select>
<span>Select All if this attribute type must to be displayed all the time. Otherwise select libraries you want to associate with this value.
</span>
</li>
<li>
<label for="category">Category: </label>
<select name="category_code" id="category">
<option value=""></option>
[% FOREACH cat IN categories %]
[% 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 %]
[% END %]
</select>
<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>
</li>
<li>
<label for="class">Class: </label>
[% PROCESS 'av-build-dropbox.inc' name="class", category="PA_CLASS" default=attribute_type.class %]
<span>Group attributes types with a block title (based on authorized values category 'PA_CLASS')</span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Save" />
<a class="cancel" href="/cgi-bin/koha/admin/patron-attr-types.pl">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF ( delete_attribute_type_form ) %]
<div class="dialog alert">
<h3>Confirm deletion of patron attribute type <span class="ex">'[% code | html %]' ([% description | html %])</span>?</h3>
<form action="[% script_name | html %]" name="Aform" method="post">
<input type="hidden" name="op" value="[% confirm_op | html %]" />
<input type="hidden" name="code" value="[% code | html %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete patron attribute type</button>
</form>
<form action="[% script_name | html %]" method="get">
<button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
</form>
</div>
[% END %]
[% IF ( display_list ) %]
<div id="toolbar" class="btn-toolbar">
<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>
</div>
<h2>Patron attribute types</h2>
[% IF ( added_attribute_type ) %]
<div class="dialog message">Added patron attribute type &quot;[% added_attribute_type | html %]&quot;</div>
[% END %]
[% IF ( edited_attribute_type ) %]
<div class="dialog message">Modified patron attribute type &quot;[% edited_attribute_type | html %]&quot;</div>
[% END %]
[% IF ( deleted_attribute_type ) %]
<div class="dialog message">Deleted patron attribute type &quot;[% deleted_attribute_type | html %]&quot;</div>
[% END %]
[% IF ( ERROR_delete_in_use ) %]
<div class="dialog message">Could not delete patron attribute type &quot;[% ERROR_delete_in_use | html %]&quot;
&mdash; it is in use by [% ERROR_num_patrons | html %] patron records</div>
[% END %]
[% IF ( ERROR_delete_not_found ) %]
<div class="dialog message">Could not delete patron attribute type &quot;[% ERROR_delete_not_found | html %]&quot;
&mdash; it was already absent from the database.</div>
[% END %]
[% IF ( available_attribute_types ) %]
[% FOREACH attribute IN available_attribute_types %]
[% IF attribute.class %]
<h4>[% attribute.lib | html %]</h4>
[% END %]
<table class="patron_attributes_types">
<thead>
<tr>
<th>Code</th>
<th>Description</th>
<th>Branches limitation</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH item IN attribute.items %]
<tr>
<td>[% item.code | html %]</td>
<td>[% item.description | html %]</td>
<td>
[% SET libraries = item.library_limits %]
[% IF ( libraries && libraries.count > 0 ) %]
[% branches_str = "" %]
[% FOREACH branch IN libraries %]
[% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
[% END %]
<span title="[% branches_str | html %]">
[% IF libraries.count > 1 %]
[% libraries.count | html %] branches limitations
[% ELSE %]
[% libraries.count | html %] branch limitation
[% END %]
</span>
[% ELSE %]
No limitation
[% END %]
</td>
<td class="actions">
<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>
<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>
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
[% ELSE %]
<p>There are no saved patron attribute types.</p>
[% END %]
<div class="pages">[% pagination_bar | $raw %]</div>
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'admin-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
<script>
$(document).ready(function() {
if ( $("#branches option:selected").length < 1 ) {
$("#branches option:first").attr("selected", "selected");
}
$("#opac_display").change( function() {
if ( this.checked ) {
$("#opac_editable").removeAttr('disabled').parent().removeAttr('aria-disabled');
} else {
$("#opac_editable").attr('disabled', true).parent().attr('aria-disabled', 'true');
}
} ).change();
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]