Bug 31470: Do not change relationship value when adding a patron guarantor

Adding new id "relationship" led to unexpected behaviour
in relationship handling. If one edits patron with
non-patron guarantor and added patron guarantor, non-patron
guarantors relatioship field was set as empty value which is
first option on select field. This patch removes code which
sets relationship select field to use first value of option
automatically when patron guarantor is added.

Also thi patch add missing id to mandatory relatioship field.

To test:
1. Add or edit patron.
2. Add non-patron guarantor for patron and select some value
as their relationship.
3. Then add a patron guarantor.
=> Note that non-patron guarantors relationship is empty.
4. Apply this patch.
5. Repeat steps 1 to 3.
=> Relationship shouldn't change.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit efaa21c80d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Emmi Takkinen 2024-06-05 10:21:43 +03:00 committed by Paul Derscheid
parent 5229252af2
commit 88c4e486ca
2 changed files with 1 additions and 2 deletions

View File

@ -721,7 +721,7 @@ legend.collapsed i.fa.fa-caret-down::before {
<li>
[% IF mandatoryrelationship %]
<label for="relationship" class="required">Relationship: </label>
<select class="relationship" name="relationship" required="required">
<select class="relationship" name="relationship" id="relationship" required="required">
[% ELSE %]
<label for="relationship">Relationship: </label>
<select class="relationship" name="relationship" id="relationship">

View File

@ -118,7 +118,6 @@ function select_user(borrowernumber, borrower, relationship) {
var guarantor_relationship = $('#relationship').val();
fieldset.find('.new_guarantor_relationship').first().val( guarantor_relationship );
$('#relationship').find('option:eq(0)').prop('selected', true);
fieldset.find('.guarantor-details').first().attr( 'data-borrowernumber', borrowernumber );