@@ -, +, @@ result --------- with all access to the staff client except superserials. the non-superlibrarian. -- note the number of results. -- note the number should be less, note the number. -- the number will still be the same at the one in step #8. -- the number should now match the one in step #5. --- C4/Serials.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/C4/Serials.pm +++ a/C4/Serials.pm @@ -736,12 +736,20 @@ sub SearchSubscriptions { my $results = $sth->fetchall_arrayref( {} ); $sth->finish; + my $cant_display_other_branches = 0; + if (my $env = C4::Context->userenv) { + my $userid = $env->{'id'}; + $cant_display_other_branches = + C4::Context->preference('IndependentBranches') && + !C4::Context->IsSuperLibrarian() && + !C4::Auth::haspermission( $userid, {serials => 'superserials'}); + } + my $user_branch = C4::Context->userenv->{'branch'}; for my $subscription ( @$results ) { $subscription->{cannotedit} = not can_edit_subscription( $subscription ); $subscription->{cannotdisplay} = - ( C4::Context->preference("IndependentBranches") && - (!C4::Context->IsSuperLibrarian()) && - $subscription->{branchcode} ne C4::Context->userenv->{'branch'} ) ? 1 : 0; + $cant_display_other_branches && + $subscription->{branchcode} ne $user_branch; } return @$results; --