Bugzilla – Attachment 171442 Details for
Bug 37881
Guarantor code broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37881: Editing patron with guarantor won't crash
Bug-37881-Editing-patron-with-guarantor-wont-crash.patch (text/plain), 1.92 KB, created by
Martin Renvoize (ashimema)
on 2024-09-13 11:21:00 UTC
(
hide
)
Description:
Bug 37881: Editing patron with guarantor won't crash
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-09-13 11:21:00 UTC
Size:
1.92 KB
patch
obsolete
>From 359b1e867eaf8b0734a146faec99fb7884b4b9ac Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Wed, 11 Sep 2024 11:54:38 +0200 >Subject: [PATCH] Bug 37881: Editing patron with guarantor won't crash > >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> >--- > members/memberentry.pl | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 2fa5447e4d1..2227df425fb 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -934,17 +934,26 @@ sub add_guarantors { > my @new_guarantor_id = $input->multi_param('new_guarantor_id'); > my @new_guarantor_relationship = $input->multi_param('new_guarantor_relationship'); > >- for ( my $i = 0 ; $i < scalar @new_guarantor_id; $i++ ) { >+ for ( my $i = 0 ; $i < scalar @new_guarantor_id ; $i++ ) { > my $guarantor_id = $new_guarantor_id[$i]; > my $relationship = $new_guarantor_relationship[$i]; > > next unless $guarantor_id; > >- $patron->add_guarantor( >+ my $existing_relationship_count = Koha::Patron::Relationships->search( > { >+ guarantee_id => $patron->id, > guarantor_id => $guarantor_id, >- relationship => $relationship, > } >- ); >+ )->count; >+ >+ if ( $existing_relationship_count == 0 ) { >+ $patron->add_guarantor( >+ { >+ guarantor_id => $guarantor_id, >+ relationship => $relationship, >+ } >+ ); >+ } > } > } >-- >2.46.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37881
:
171302
|
171303
|
171399
|
171400
| 171442 |
171443
|
171444