From e79299ffbae778626e33aec5ad230c0395cb56ff Mon Sep 17 00:00:00 2001
From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Date: Wed, 11 Sep 2024 13:22:34 +0200
Subject: [PATCH] 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>
---
.../prog/en/modules/members/memberentrygen.tt | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
index e271740a771..27ad51c391b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ -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 %]
--
2.46.0