From 5210230f38c9aa07977ca099ca580012b46321d1 Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Wed, 15 Jan 2025 19:59:37 +0000 Subject: [PATCH] Bug 38892: Show correct error message when we attempt to add guarantor as a child MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we attempt to add child as guarantor the error message shown is 'A guarantor cannot be a guarantee.' it doesn't make sense To recreate: 1. Go to Patrons 2. Click 'New patron' > 'Kid' 3. Fill out surname and cardnumber 4. Under Patron guarantor, click Add guarantor 5. Search for category = Kid and choose one of the patrons 6. Choose the relationship 7. Click 'Save' --> Error A guarantor cannot be a guarantee. 8. Apply the patch 9. repeat previous steps 10. After clicking Save --> the error message shown is «Child patron cannot be a guarantor.» Signed-off-by: David Nind Signed-off-by: Nick Clemens --- .../intranet-tmpl/prog/en/modules/members/memberentrygen.tt | 3 +++ members/memberentry.pl | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) 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 f281e9b61cd..234a42fa7e1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -219,6 +219,9 @@ [% IF ( ERROR_child_no_guarantor ) %]
  • A child patron needs a guarantor.
  • [% END %] + [% IF ( ERROR_child_is_guarantor ) %] +
  • Child patron cannot be a guarantor.
  • + [% END %] [% IF ( ERROR_guarantor_is_guarantee ) %]
  • A guarantor cannot be a guarantee.
  • [% END %] diff --git a/members/memberentry.pl b/members/memberentry.pl index 49fb26daf73..c2df4523366 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -297,7 +297,8 @@ foreach my $guarantor (@guarantors) { if ( ( $op eq 'cud-save' || $op eq 'cud-insert' ) && ( $guarantor->is_child || $guarantor->is_guarantee || ( $patron && $patron->is_guarantor ) ) ) { - push @errors, 'ERROR_guarantor_is_guarantee'; + push @errors, 'ERROR_child_is_guarantor' if ( $guarantor->is_child ); + push @errors, 'ERROR_guarantor_is_guarantee' if ( !$guarantor->is_child ); } } -- 2.39.5