From 7948b429d1941e14f5d341b19aa61e5c77ce0eb0 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 27 Oct 2021 11:50:18 +0100 Subject: [PATCH] Bug 29332: Set default library limits in search_for_display Koha::AdditionalContents->search_for_display needs to filter to just items with a 'null' branchcode if no library_id is passed. Test plan 1/ Add some additional content blocks that should display only for specific branches. 2/ Navigate to the OPAC and note that blocks display for all libraries prior to login 3/ Login to the OPAC and note that now you only see you users library block 4/ Apply the patch 5/ Repeat steps 2 and 3 and note that now you see only the 'All libraries' blocks display prior to login and that 'All libraries' + 'Your users library' blocks appear after login. Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- Koha/AdditionalContents.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/AdditionalContents.pm b/Koha/AdditionalContents.pm index a631862b9b..711b187ad3 100644 --- a/Koha/AdditionalContents.pm +++ b/Koha/AdditionalContents.pm @@ -71,7 +71,7 @@ sub search_for_display { my $search_params; $search_params->{location} = $params->{location}; - $search_params->{branchcode} = [ $params->{library_id}, undef ] if $params->{library_id}; + $search_params->{branchcode} = $params->{library_id} ? [ $params->{library_id}, undef ] : undef; $search_params->{published_on} = { '<=' => \'CAST(NOW() AS DATE)' }; $search_params->{-or} = [ expirationdate => { '>=' => \'CAST(NOW() AS DATE)' }, expirationdate => undef ]; -- 2.39.5