Bug 37881: Fix the delete button for guarantor

This patch fixes issue introduced by BZ32530

Test Plan (on main):
1 - Edit a patron
2 - Do not change anything and submit -> you get an error
3 - Apply both patches
4 - Repeat 1&2 -> everything works fine
5 - Try and delete the guarantor -> it will be deleted

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Baptiste Wojtkowski 2024-09-11 13:22:34 +02:00 committed by Katrin Fischer
parent 8d76a99d47
commit 9223401432
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -515,17 +515,17 @@ legend.collapsed i.fa.fa-caret-down::before {
<li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
<span class="label">Guarantor:</span>
[% INCLUDE 'patron-title.inc' patron=r.guarantor hide_patron_infos_if_needed=1 %]
<input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value="[% r.guarantor_id | $raw %]"/>
<input type="hidden" class="new_guarantor_id relation-[% r.id %]" name="new_guarantor_id" value="[% r.guarantor_id | $raw %]"/>
</li>
<li>
<span class="label">Relationship:</span>
<span>[% r.relationship | html %]</span>
<input type=hidden class="new_guarantor_relationship" name="new_guarantor_relationship" value="[% r.relationship | html %]" />
<input type=hidden class="new_guarantor_relationship relation-[% r.id %]" name="new_guarantor_relationship" value="[% r.relationship | html %]" />
</li>
<li>
<label for="delete_guarantor-[% r.id | uri %]">Remove: </label>
<input type="checkbox" id="delete_guarantor-[% r.id | uri %]" name="delete_guarantor" value="[% r.id | html %]" />
<input type="checkbox" id="delete_guarantor-[% r.id | uri %]" name="delete_guarantor" value="[% r.id | html %]" onclick="toggle_guarantor_field([% r.id | html %])" />
</li>
[% END %]
</ol>
@ -1773,6 +1773,10 @@ legend.collapsed i.fa.fa-caret-down::before {
}
var Sticky;
function toggle_guarantor_field(rel_number){
$(".relation-"+rel_number).prop('disabled', (i, v) => !v);
}
function showHideFields(){
$("#messaging_prefs_loading, #guarantor_template").hide();
[% UNLESS step == 1 %]