From f8a7ed16f579b4c1fc6661eb7187daa35856f44b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 15 Nov 2022 10:08:46 +0100 Subject: [PATCH] Bug 32187: Correct join on borrowers in Koha::Acq::Orders->filter_by_late --- Koha/Acquisition/Orders.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Koha/Acquisition/Orders.pm b/Koha/Acquisition/Orders.pm index e429475dc3e..0d85dfd7672 100644 --- a/Koha/Acquisition/Orders.pm +++ b/Koha/Acquisition/Orders.pm @@ -128,7 +128,7 @@ sub filter_by_lates { ( C4::Context->preference('IndependentBranches') && !C4::Context->IsSuperLibrarian - ? ( 'borrower.branchcode' => C4::Context->userenv->{branch} ) + ? ( 'authorisedby.branchcode' => C4::Context->userenv->{branch} ) : () ), @@ -142,7 +142,14 @@ sub filter_by_lates { '+as' => [qw/ calculated_estimated_delivery_date /], - join => { 'basketno' => 'booksellerid' }, + join => ( + ( + C4::Context->preference('IndependentBranches') + && !C4::Context->IsSuperLibrarian + ) + ? { 'basketno' => [ 'authorisedby', 'booksellerid' ] } + : { 'basketno' => 'booksellerid' } + ), prefetch => {'basketno' => 'booksellerid'}, } ); -- 2.25.1