1 package Koha::Suggestions;
3 # Copyright ByWater Solutions 2015
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
26 use base qw(Koha::Objects);
30 Koha::Suggestions - Koha Suggestion object set class
38 my $suggestions = Koha::Suggestions->search_limited( $params, $attributes );
40 Returns all the suggestions the logged in user is allowed to see.
45 my ( $self, $params, $attributes ) = @_;
47 my $resultset = $self;
49 # filter on user branch
50 if ( C4::Context->preference('IndependentBranches')
51 && !C4::Context->IsSuperLibrarian() )
53 # If IndependentBranches is set and the logged in user is not superlibrarian
54 # Then we want to filter by the user's library (i.e. cannot see suggestions
55 # from other libraries)
56 my $userenv = C4::Context->userenv;
58 $resultset = $self->search({ branchcode => $userenv->{branch} })
59 if $userenv && $userenv->{branch};
62 return $resultset->search( $params, $attributes);
65 =head2 Internal methods
80 return 'Koha::Suggestion';
85 Kyle M Hall <kyle@bywatersolutions.com>