From 2326b50e69be984c4c5ae8cb4a50f20ec607a4f9 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 16 Feb 2023 14:42:21 +0100 Subject: [PATCH] Bug 32980: Show checkouts of all guarantors/guarantees (staff interface) Test plan: 1. Create a patron category of type 'Professional' (or any type that allows guarantors) 2. Create 3 patrons in this category. Let's call them A, B, and C 3. Do at least one checkout for A and at least one for C 4. Make A the guarantor of B, and B the guarantor of C 5. Go to B details page. You should see the checkouts of A and C in the "Relatives' checkouts" tab 6. Go to B checkout page. You should see the checkouts of A and C in the "Relatives' checkouts" tab Signed-off-by: Owen Leonard --- circ/circulation.pl | 9 +++------ members/moremember.pl | 9 +-------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 9b925e29ad..5888c3f329 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -560,12 +560,9 @@ my $view = $batch my @relatives; if ( $patron ) { - if ( my @guarantors = $patron->guarantor_relationships()->guarantors->as_list ) { - push( @relatives, $_->id ) for @guarantors; - push( @relatives, $_->id ) for $patron->siblings->as_list; - } else { - push( @relatives, $_->id ) for $patron->guarantee_relationships()->guarantees->as_list; - } + my @guarantors = $patron->guarantor_relationships()->guarantors->as_list; + my @guarantees = $patron->guarantee_relationships()->guarantees->as_list; + @relatives = map { $_->id } (@guarantors, $patron->siblings->as_list, @guarantees); } my $relatives_issues_count = Koha::Database->new()->schema()->resultset('Issue') diff --git a/members/moremember.pl b/members/moremember.pl index 5813c8d87f..b8a568d908 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -97,17 +97,10 @@ if ( $patron->is_debarred ) { $template->param( flagged => 1 ) if $patron->account_locked; -my @relatives; my $guarantor_relationships = $patron->guarantor_relationships; my @guarantees = $patron->guarantee_relationships->guarantees->as_list; my @guarantors = $guarantor_relationships->guarantors->as_list; -if (@guarantors) { - push( @relatives, $_->id ) for @guarantors; - push( @relatives, $_->id ) for $patron->siblings->as_list; -} -else { - push( @relatives, $_->id ) for @guarantees; -} +my @relatives = map { $_->id } (@guarantors, $patron->siblings->as_list, @guarantees); $template->param( guarantor_relationships => $guarantor_relationships, guarantees => \@guarantees, -- 2.30.2