From 666a20ee1acd9f5755e31478b1b4da400d1e3a2c Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Mon, 29 Dec 2025 20:05:55 +0200 Subject: [PATCH] Bug 39014: (QA follow-up) Fix tidiness --- Koha/Exceptions/Patron/Relationship.pm | 5 ++++- .../prog/en/modules/members/memberentrygen.tt | 9 ++++++--- members/memberentry.pl | 7 ++++--- t/db_dependent/Koha/Patron.t | 4 ++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Koha/Exceptions/Patron/Relationship.pm b/Koha/Exceptions/Patron/Relationship.pm index 000e95d1097..768d5a1b0fb 100644 --- a/Koha/Exceptions/Patron/Relationship.pm +++ b/Koha/Exceptions/Patron/Relationship.pm @@ -32,7 +32,10 @@ use Exception::Class ( 'Koha::Exceptions::Patron::Relationship::InvalidRelationship' => { isa => 'Koha::Exceptions::Patron::Relationship', description => 'The specified relationship is invalid', - fields => [ 'relationship', 'no_relationship', 'invalid_guarantor', 'child_guarantor', 'guarantor_cant_have_guarantors', 'guarantor' ], + fields => [ + 'relationship', 'no_relationship', 'invalid_guarantor', 'child_guarantor', + 'guarantor_cant_have_guarantors', 'guarantor' + ], }, 'Koha::Exceptions::Patron::Relationship::NoGuarantor' => { isa => 'Koha::Exceptions::Patron::Relationship', 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 140c3fe984b..9e8bf04c0b7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -196,9 +196,12 @@ [% END %] [% IF ( ERROR_guarantor_is_guarantee ) %]
  • - Cannot add a guarantor. The proposed guarantor - [% guarantor_is_guarantee.firstname | html %] [% guarantor_is_guarantee.surname | html %] ([% guarantor_is_guarantee.cardnumber | html %]) - is a guarantee of someone else, and guarantees cannot be guarantors.
  • + Cannot add a guarantor. The proposed guarantor + + [% guarantor_is_guarantee.firstname | html %] [% guarantor_is_guarantee.surname | html %] ([% guarantor_is_guarantee.cardnumber | html %]) + + is a guarantee of someone else, and guarantees cannot be guarantors. [% END %] [% IF ( ERROR_guarantor_cant_have_guarantors ) %]
  • Cannot add a guarantor. This patron is already a guarantor, and guarantors cannot have guarantors.
  • diff --git a/members/memberentry.pl b/members/memberentry.pl index 1f88cceff31..ec02bec7d16 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -23,7 +23,7 @@ use Modern::Perl; use Try::Tiny; # external modules -use CGI qw ( -utf8 ); +use CGI qw ( -utf8 ); use Scalar::Util qw( blessed ); # internal modules @@ -53,8 +53,8 @@ use Koha::SMS::Providers; my $input = CGI->new; my %data; -my $dbh = C4::Context->dbh; -my $logger = Koha::Logger->get({ interface => 'intranet '}); +my $dbh = C4::Context->dbh; +my $logger = Koha::Logger->get( { interface => 'intranet ' } ); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -298,6 +298,7 @@ if ( ( $op eq 'cud-save' || $op eq 'cud-insert' ) && $guarantors_to_be_validated if ( $patron->categorycode eq $categorycode ) { $patron->can_be_guaranteed_by($guarantors_to_be_validated); } else { + # If $patron's categorycode is about to change, check guarantor requirements against # the new category but keep the original $patron object intact # (this clone()s the $patron) diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t index 1b016ecf687..44802ce4ba1 100755 --- a/t/db_dependent/Koha/Patron.t +++ b/t/db_dependent/Koha/Patron.t @@ -2687,8 +2687,8 @@ subtest 'can_be_guaranteed_by() tests' => sub { 'Exception thrown when child patron is added as guarantor.'; t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' ); - $child2->add_guarantor({ guarantor_id => $patron->id, relationship => 'parent' }); - @guarantors = ( $patron2 ); + $child2->add_guarantor( { guarantor_id => $patron->id, relationship => 'parent' } ); + @guarantors = ($patron2); throws_ok { $patron->can_be_guaranteed_by( \@guarantors ); } 'Koha::Exceptions::Patron::Relationship::InvalidRelationship', 'Exception thrown when trying to add a guarantor to a guarantor.'; -- 2.34.1