Bugzilla – Attachment 130296 Details for
Bug 29886
Add Koha::Suggestions->search_limited
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29886: (QA follow-up)
Bug-29886-QA-follow-up.patch (text/plain), 1.71 KB, created by
Martin Renvoize (ashimema)
on 2022-02-08 15:24:44 UTC
(
hide
)
Description:
Bug 29886: (QA follow-up)
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-02-08 15:24:44 UTC
Size:
1.71 KB
patch
obsolete
>From 26e78d4945fcf1c2dee6aab529296194dad02596 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 3 Feb 2022 16:38:43 +0000 >Subject: [PATCH] Bug 29886: (QA follow-up) > >--- > Koha/Suggestions.pm | 26 +++++++++++--------------- > 1 file changed, 11 insertions(+), 15 deletions(-) > >diff --git a/Koha/Suggestions.pm b/Koha/Suggestions.pm >index 5fadfd163b..6a41aabd15 100644 >--- a/Koha/Suggestions.pm >+++ b/Koha/Suggestions.pm >@@ -44,22 +44,18 @@ Returns all the suggestions the logged in user is allowed to see. > sub search_limited { > my ( $self, $params, $attributes ) = @_; > >- my $resultset = $self; >- >- # filter on user branch >- if ( C4::Context->preference('IndependentBranches') >- && !C4::Context->IsSuperLibrarian() ) >- { >- # If IndependentBranches is set and the logged in user is not superlibrarian >- # Then we want to filter by the user's library (i.e. cannot see suggestions >- # from other libraries) >- my $userenv = C4::Context->userenv; >- >- $resultset = $self->search({ branchcode => $userenv->{branch} }) >- if $userenv && $userenv->{branch}; >+ my $rs = $self; >+ >+ my $userenv = C4::Context->userenv; >+ my @restricted_branchcodes; >+ if ( $userenv and $userenv->{number} ) { >+ my $logged_in_user = Koha::Patrons->find( $userenv->{number} ); >+ @restricted_branchcodes = >+ $logged_in_user->libraries_where_can_see_patrons; >+ $rs = $self->search( { 'me.branchcode' => { -in => \@restricted_branchcodes } } ) >+ if @restricted_branchcodes; > } >- >- return $resultset->search( $params, $attributes); >+ return $rs->search( $params, $attributes ); > } > > =head2 Internal methods >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29886
:
129508
|
129509
|
129709
|
129710
|
130294
|
130295
|
130296