Bug 25879: Improve display of guarantor information in the patron entry form

This patch makes some changes to the patron entry template to improve
the display of guarantor information.

To test, apply the patch and locate a patron with a "Child" type
category.

 - Edit the patron's record
 - Under "Guarantor information," click the "Search to add" button.
 - Search for and select a patron.
 - The guarantor information should be added to the patron edit
   form. The information should be correct and well formatted.
 - Click the "Remove" link. The guarantor information should be
   removed.
 - Search for an select a guarantor again and save the record.
 - Edit the patron record again. The saved guarantor information should
   look correct.

Looks great!

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2020-06-26 18:51:15 +00:00 committed by Jonathan Druart
parent bd29f99a86
commit ec630b4b6c
2 changed files with 20 additions and 51 deletions

View file

@ -407,45 +407,30 @@ legend:hover {
[% IF show_guarantor || guarantor %]
[% SET possible_relationships = Koha.Preference('borrowerRelationship') %]
<span id="memberentry_guarantor_anchor">
<div id="memberentry_guarantor_anchor">
<fieldset id="memberentry_guarantor" class="rows">
<legend>Guarantor information</legend>
<span id="guarantor_relationships">
<div id="guarantor_relationships">
[% FOREACH r IN relationships %]
<fieldset class="rows">
<fieldset>
<ol>
[% IF category_type == 'I' %]
<li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
<span class="label">Organization #:</span> [% IF ( r.guarantor_id ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% r.guarantor_id | uri %]" target="blank">[% r.guarantor_id | html %]</a>[% END %]
<span class="label">Organization:</span>
[% INCLUDE 'patron-title.inc' patron=r.guarantor hide_patron_infos_if_needed=1 %]
</li>
<li>
<label for="guarantor_surname">Organization name: </label>
<span>[% r.guarantor.surname | html %]</span>
<span class="label">Relationship:</span>
<span>[% r.relationship | html %]</span>
</li>
[% ELSE %]
<li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
<span class="label">Patron card number:</span>
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% r.guarantor_id | uri %]" target="blank">[% r.guarantor.cardnumber | html %]</a>
<span class="label">Guarantor:</span>
[% INCLUDE 'patron-title.inc' patron=r.guarantor hide_patron_infos_if_needed=1 %]
</li>
[% IF r.guarantor.surname %]
<li>
<label for="guarantor_surname">Surname: </label>
<span>[% r.guarantor.surname | html %]</span>
</li>
[% END %]
[% IF r.guarantor.firstname %]
<li>
<label for="guarantor_firstname">First name: </label>
<span>[% r.guarantor.firstname | html %]</span>
</li>
[% END %]
<li>
<label for="relationship">Relationship: </label>
<span class="label">Relationship:</span>
<span>[% r.relationship | html %]</span>
</li>
@ -466,16 +451,6 @@ legend:hover {
<input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value="[% guarantor.borrowernumber | html %]"/>
</li>
<li>
<label for="guarantor_surname">Surname: </label>
<span class="new_guarantor_surname_text">[% guarantor.surname | html %]</span>
</li>
<li>
<label for="guarantor_firstname">First name: </label>
<span class="new_guarantor_firstname_text">[% guarantor.firstname | html %]</span>
</li>
<li>
[% UNLESS empty_relationship_allowed %]
<label for="guarantor_relationship" class="required">Relationship: </label>
@ -503,26 +478,19 @@ legend:hover {
</ol>
</fieldset>
[% END %]
</span> <!-- #/guarantor_relationships -->
</div> <!-- #/guarantor_relationships -->
<fieldset class="rows guarantor" id="guarantor_template">
<fieldset class="guarantor" id="guarantor_template">
<ol>
<li class="guarantor-details" data-borrowernumber="0">
<span class="label">Patron card number:</span>
<span class="new_guarantor_id_text"></span>
<span class="label">Guarantor:</span>
<a class="new_guarantor_link" href="#" target="blank">
<span class="new_guarantor_firstname_text"></span> <span class="new_guarantor_surname_text"></span>
(<span class="new_guarantor_id_text"></span>)
</a>
<input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value=""/>
</li>
<li>
<label for="guarantor_surname">Surname: </label>
<span class="new_guarantor_surname_text"></span>
</li>
<li>
<label for="guarantor_firstname">First name: </label>
<span class="new_guarantor_firstname_text"></span>
</li>
<li>
[% UNLESS empty_relationship_allowed %]
<label for="guarantor_relationship" class="required">Relationship: </label>
@ -545,7 +513,7 @@ legend:hover {
<li>
<label for="guarantor_cancel">&nbsp;</label>
<span><a href="#" class="guarantor_cancel">Remove</a></span>
<span><a href="#" class="guarantor_cancel"><i class="fa fa-trash"></i> Remove</a></span>
</li>
</ol>
</fieldset>
@ -591,7 +559,7 @@ legend:hover {
[% END %]
</ol>
</fieldset> <!-- /#memberentry_guarantor -->
</span> <!-- #/memberentry_guarantor_anchor -->
</div> <!-- #/memberentry_guarantor_anchor -->
[% END # /IF show_guarantor || guarantor %]
[% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %]

View file

@ -182,6 +182,7 @@ function select_user(borrowernumber, borrower, relationship) {
if ( guarantor_id ) {
fieldset.find('.new_guarantor_id').first().val( guarantor_id );
fieldset.find('.new_guarantor_id_text').first().text( borrower.cardnumber );
fieldset.find('.new_guarantor_link').first().attr("href", "/cgi-bin/koha/members/moremember.pl?borrowernumber=" + guarantor_id );
} else {
fieldset.find('.guarantor_id').first().hide();
}