From 75f5a5334cf002cf607be2b9677783e9cb14181d Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 19 Oct 2017 13:42:08 -0400 Subject: [PATCH] Bug 18743 - ALTERNATE: Take IndependantBranches syspref into account --- THIS IS AN ALTERNATE PATCH I am submitting it here, because it covers less than Alex's patch, but does so in a simpler fashion. APPLY ONLY THIS PATCH, OR THE OTHER, NOT BOTH. --- Displays suggestions for all libraries when IndependantBranches is set to no, or user is Super librarian by adding a missing if statement. TEST PLAN [0] Apply patch [1] Set IndependentBranches to 'Yes'. [2] Create a suggestion with a user from branch A. [3] As a superlibrarian, visit the suggestion page, you should see the suggestion. [4] As staff from branch A, visit the sugg. page, you should see the suggestion. [5] As staff from branch B, visit the sugg. pase, you should NOT see the suggestion. [6] Set IndependentBranches to 'No'. [7] Redo step 3-5. You should always see the suggestion. [8] Sign-off. [9] Have fun. --- suggestion/suggestion.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 94e6eab..c13f57d 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -261,8 +261,10 @@ if ($op=~/else/) { my @allsuggestions; foreach my $criteriumvalue ( @criteria_dv ) { # By default, display suggestions from current working branch - unless ( exists $$suggestion_ref{'branchcode'} ) { - $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; + if (C4::Context->preference('IndependentBranches') && !C4::Context->IsSuperLibrarian()) { + unless ( exists $$suggestion_ref{'branchcode'} ) { + $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; + } } my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; -- 2.7.4