Bug 39331: If patron category cant be guarantee do not continue with add_guarantors

To test:
1 - Remove age limits from a Child and Adult category in Administration->Patron categories. Ensure Child category can be guarantor and Adult cannot
2 - The above step is to avoid any age checks and form resubmission which removes the guarantor fields
3 - Find/create a child patron
4 - Add a guarantee from the Adult category to the child
5 - Check the DB:
   SELECT * FROM borrower_relationships WHERE guarantee_id={borrowernumber of child};
6 - Note the id colum
7 - Edit the child patron to Adult category
8 - Repeat 5
9 - Note the relationship still exists and the id is incremented
10 - Oof!
11 - APPLY PATCH, restart_all
12 - Try again steps 3 - 8
13 - The relationship should not be re-added
14 - Try with more than 1 guarantor on the record, confirming all are deleted
15 - Try adding some guarantor to patron types that should be able to, they relationship should work.
16 - Try changing some patrons to categories that do allow guarantors, making sure the relationship does stay.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
This commit is contained in:
Lucas Gass 2025-03-14 22:28:37 +00:00 committed by Jesse Maseto
parent 9da8740955
commit c8ac0e8255
No known key found for this signature in database
GPG Key ID: 4D16BFCF78FFFDEC
1 changed files with 4 additions and 0 deletions

View File

@ -989,6 +989,10 @@ sub patron_attributes_form {
sub add_guarantors {
my ( $patron, $input ) = @_;
unless ( $patron->category->can_be_guarantee ) {
return;
}
my @new_guarantor_id = $input->multi_param('new_guarantor_id');
my @new_guarantor_relationship = $input->multi_param('new_guarantor_relationship');