Koha/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt
Martin Renvoize d5608b8ff0
Bug 21978: Add support for middle name
This patch adds the new 'Middle name' field to the patron record.

To test:
1) Apply patches
2) Update database, restart all and clear the browser cache
3) Load a patron in the staff module
4) Confirm you can see and edit the new 'Middle name' field
5) Confirm the new middle name data displays on patron details
6) Confirm the new middle name data displays on patron search results
7) Confirm the new middle name data displays everywhere patron names are
   displayed.
8) Confirm the new middle name data displays on the OPAC
9) Confirm the 'Middle name' field appears in the OPAC borrower
   modification screens
10) Edit sysprefs `BorrowerMandatoryFields`, `BorrowerUnwantedFields`,
    `SelfModificationBorrowerUnwantedField`, `PatronSelfModificationMandatoryField`,
    `PatronSelfRegistrationBorrowerMandatoryField` and
    `PatronSelfRegistrationBorrowerUnwantedField` to confirm you can make
    the new field required or hidden.
11) Verify that DefaultPatronSearchFields contains the new field if you
    already had 'firstname' in the field list
12) Enable PatronAutoComplete system preference
13) Type patrons surname into checkout or patron search but don't hit
    return
14) Confirm the patrons middle name is displayed in the preview
15) Go to tools > patron lists and attempt to add a patron to a list
16) Patrons middle name should appear in the autocomplete here too

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-06-24 12:24:11 -03:00

229 lines
14 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE AuthorisedValues %]
[% USE Branches %]
[% USE Categories %]
[% USE KohaDates %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Update patron records &rsaquo; Patrons &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="pat_update" class="pat">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patron-search-header.inc' %]
[% BLOCK display_names %]
[% SWITCH field %]
[% CASE 'branchcode' %]<span>Home library (branchcode)</span>
[% CASE 'surname' %]<span>Surname</span>
[% CASE 'firstname' %]<span>First name</span>
[% CASE 'middle_name' %]<span>Middle name</span>
[% CASE 'title' %]<span>Title</span>
[% CASE 'othernames' %]<span>Other names</span>
[% CASE 'initials' %]<span>Initials</span>
[% CASE 'streetnumber' %]<span>Street number</span>
[% CASE 'streettype' %]<span>Street type</span>
[% CASE 'address' %]<span>Address</span>
[% CASE 'address2' %]<span>Address 2</span>
[% CASE 'city' %]<span>City</span>
[% CASE 'state' %]<span>State</span>
[% CASE 'zipcode' %]<span>ZIP/Postal code</span>
[% CASE 'country' %]<span>Country</span>
[% CASE 'email' %]<span>Email</span>
[% CASE 'phone' %]<span>Primary phone</span>
[% CASE 'mobile' %]<span>Other phone</span>
[% CASE 'fax' %]<span>Fax</span>
[% CASE 'emailpro' %]<span>Secondary email</span>
[% CASE 'phonepro' %]<span>Secondary phone</span>
[% CASE 'B_streetnumber' %]<span>Alternate address: Street number</span>
[% CASE 'B_streettype' %]<span>Alternate address: Street type</span>
[% CASE 'B_address' %]<span>Alternate address: Address</span>
[% CASE 'B_address2' %]<span>Alternate address: Address 2</span>
[% CASE 'B_city' %]<span>Alternate address: City</span>
[% CASE 'B_state' %]<span>Alternate address: State</span>
[% CASE 'B_zipcode' %]<span>Alternate address: ZIP/Postal code</span>
[% CASE 'B_email' %]<span>Alternate address: Email</span>
[% CASE 'B_phone' %]<span>Alternate address: Phone</span>
[% CASE 'contactnote' %]<span>Alternate address: Contact note</span>
[% CASE 'dateofbirth' %]<span>Date of birth</span>
[% CASE 'contactname' %]<span>Contact: Last name</span>
[% CASE 'contactfirstname' %]<span>Contact: First name</span>
[% CASE 'contacttitle' %]<span>Contact: Title</span>
[% CASE 'relationship' %]<span>Contact: Relationship</span>
[% CASE 'sex' %]<span>Gender</span>
[% CASE 'autorenew_checkouts' %]<span>Auto-renewal</span>
[% CASE 'altcontactfirstname' %]<span>Alternate contact: First name</span>
[% CASE 'altcontactsurname' %]<span>Alternate contact: Surname</span>
[% CASE 'altcontactaddress1' %]<span>Alternate contact: Address</span>
[% CASE 'altcontactaddress2' %]<span>Alternate contact: Address 2</span>
[% CASE 'altcontactaddress3' %]<span>Alternate contact: City</span>
[% CASE 'altcontactstate' %]<span>Alternate contact: State</span>
[% CASE 'altcontactzipcode' %]<span>Alternate contact: ZIP/Postal code</span>
[% CASE 'altcontactcountry' %]<span>Alternate contact: Country</span>
[% CASE 'altcontactphone' %]<span>Alternate contact: Phone</span>
[% CASE 'smsalertnumber' %]<span>SMS alert number</span>
[% CASE 'extended_attributes' %]<span>Additional attributes and identifiers</span>
[% CASE %][% field | html %]
[% END %]
[% END %]
[% BLOCK display_extended_attributes %]
[% IF attrs and attrs.size > 1 %]
<ul>
[% FOREACH attr IN attrs %]
<li>[% PROCESS display_attribute attr=attr type=type %]</li>
[% END %]
<ul>
[% ELSIF attrs %]
[% PROCESS display_attribute attr=attrs.0 type=type %]
[% END %]
[% END %]
[% BLOCK display_attribute %]
[% IF type.authorised_value_category %]
[% AuthorisedValues.GetByCode(type.authorised_value_category,attr.attribute) | html %]
[% ELSE %]
[% attr.attribute | html %]
[% END %]
[% END %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
</li>
<li>
<a href="#" aria-current="page">
Update patron records
</a>
</li>
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1>Update patron records</h1>
[% IF PendingModifications %]
<form method="post" action="members-update-do.pl">
<div id="pending_updates" class="panel-group" role="tablist" aria-multiselectable="true">
[% FOREACH pm IN PendingModifications %]
[% SET borrowernumber = pm.borrowernumber %]
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="panel-header-[% pm.borrowernumber | html %]">
<h3 class="panel-title">
<a role="button" class="collapsed" data-toggle="collapse" data-parent="#pending_updates" aria-controls="panel_modify_[% pm.borrowernumber | html %]" href="#panel_modify_[% pm.borrowernumber | uri %]">[% borrowers.$borrowernumber.surname | html %][% IF ( borrowers.$borrowernumber.firstname ) %], [% borrowers.$borrowernumber.firstname | html %][% END %] - [% Categories.GetName( borrowers.$borrowernumber.categorycode ) | html %] ([% Branches.GetName( borrowers.$borrowernumber.branchcode ) | html %]) ([% borrowers.$borrowernumber.cardnumber | html %]) - Requested on [% pm.timestamp | $KohaDates with_hours = 1 %]</a>
</h3>
</div> <!-- /.panel-heading -->
<div id="panel_modify_[% pm.borrowernumber | html %]" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panel-header-[% pm.borrowernumber | html %]">
<div class="panel-body">
<div class="btn-toolbar">
<input type="radio" id="approve_modify_[% pm.borrowernumber | html %]" name="modify_[% pm.borrowernumber | html %]" value="approve" />
<label for="approve_modify_[% pm.borrowernumber | html %]">Approve</label>
<input type="radio" id="deny_modify_[% pm.borrowernumber | html %]" name="modify_[% pm.borrowernumber | html %]" value="deny" />
<label for="deny_modify_[% pm.borrowernumber | html %]">Deny</label>
<input type="radio" id="ignore_modify_[% pm.borrowernumber | html %]" name="modify_[% pm.borrowernumber | html %]" value="ignore" checked="checked"/>
<label for="ignore_modify_[% pm.borrowernumber | html %]">Ignore</label>
| <a target="_blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% pm.borrowernumber | html %]" >Patron details</a>
</div>
[% IF borrowers.$borrowernumber.gonenoaddress > 0 %]
<div class="dialog message" style="margin-top:.8em">
<h4>Patron's address in doubt</h4>
<p>The <strong>Gone no address</strong> flag is set for this patron. If this modification request resolves the issue, please unset the flag.</p>
<input type="checkbox" id="unset_gna_[% pm.borrowernumber | html %]" name="unset_gna_[% pm.borrowernumber | html %]" value="unset_gna_[% pm.borrowernumber | html %]"/>
<label for="unset_gna_[% pm.borrowernumber | html %]">Unset Gone no address for this patron</label>
</div>
[% END %]
[% IF !pm.extended_attributes and pm.size > 3 or pm.extended_attributes and pm.size > 4 %]
[%# timestamp+verification_token+borrowernumber=3 %]
<div class="members-update-table">
<table>
<tr>
<th>Field</th>
<th>Old value</th>
<th>New value</th>
</tr>
[% FOREACH key IN pm.keys %]
[% IF ( key != "timestamp" and key != "extended_attributes" ) %]
[% IF ( ( pm.$key OR borrowers.$borrowernumber.$key ) && ( pm.$key != borrowers.$borrowernumber.$key ) ) %]
<tr>
<td>[% PROCESS display_names field = key %]</td>
[% IF ( key == "dateofbirth" ) %]
<td>[% borrowers.$borrowernumber.$key | $KohaDates %]</td>
<td>[% pm.$key | $KohaDates %]</td>
[% ELSIF key == 'branchcode' %]
<td>[% Branches.GetName( borrowers.$borrowernumber.$key ) | html %]</td>
<td>[% Branches.GetName( pm.$key ) | html %]</td>
[% ELSE %]
<td>[% borrowers.$borrowernumber.$key | html %]</td>
<td>[% pm.$key | html %]</td>
[% END %]
</tr>
[% END %]
[% END %]
[% END %]
</table>
</div> <!-- /.members-update-table -->
[% END # /!pm.extended_attributes %]
[% IF borrowers.$borrowernumber.modified_attributes %]
<div class="members-update-table">
<h4>[% PROCESS display_names field='extended_attributes' %]</h4>
<table>
<tr>
<th>Field</th>
<th>Old value</th>
<th>New value</th>
</tr>
[% FOREACH attribute_group IN borrowers.$borrowernumber.modified_attributes %]
<tr>
<td>[% attribute_group.type.description | html %]</td>
<td>[% PROCESS display_extended_attributes attrs=attribute_group.before type=attribute_group.type %]</td>
<td>[% PROCESS display_extended_attributes attrs=attribute_group.after type=attribute_group.type %]</td>
</tr>
[% END %]
</table>
</div> <!-- /.members-update-table -->
[% END # / borrowers.$borrowernumber.modified_attributes %]
</div> <!-- /.panel-body -->
</div> <!-- /.panel-collapse.collapse -->
</div> <!-- /panel.panel-default -->
[% END # /FOREACH pm %]
</div> <!-- /#pending-updates -->
<fieldset class="action"><input type="submit" value="Submit" /></fieldset>
</form>
[% ELSE %]
<div class="dialog message">
<p>There are no pending patron modifications.</p>
</div>
[% END %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
<script>
$(document).ready(function(){
[%- IF ( active ) -%]
$("#pending_updates a[href='#panel_modify_" + [% active | html %] + "']").click();
[%- ELSE -%]
$("#pending_updates a.collapsed:eq(0)").click();
[%- END -%]
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]