From 212a07b7d9882d568cd2e64fbd5bd7ebac9e6e02 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 --- 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 2cd85b6dad..d2c2445d47 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -561,12 +561,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 767b1a783b..eda0ba0202 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -96,17 +96,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