"Fossies" - the Fresh Open Source Software Archive

Member "koha-19.11.15/Koha/Library/Groups.pm" (23 Feb 2021, 1865 Bytes) of package /linux/misc/koha-19.11.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Groups.pm" see the Fossies "Dox" file reference documentation.

    1 package Koha::Library::Groups;
    2 
    3 # Copyright ByWater Solutions 2016
    4 #
    5 # This file is part of Koha.
    6 #
    7 # Koha is free software; you can redistribute it and/or modify it under the
    8 # terms of the GNU General Public License as published by the Free Software
    9 # Foundation; either version 3 of the License, or (at your option) any later
   10 # version.
   11 #
   12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
   13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
   14 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
   15 #
   16 # You should have received a copy of the GNU General Public License along
   17 # with Koha; if not, write to the Free Software Foundation, Inc.,
   18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   19 
   20 use Modern::Perl;
   21 
   22 use Carp;
   23 
   24 use Koha::Database;
   25 
   26 use Koha::Library::Group;
   27 
   28 use base qw(Koha::Objects);
   29 
   30 =head1 NAME
   31 
   32 Koha::Library::Groups - Koha Library::Group object set class
   33 
   34 =head1 API
   35 
   36 =head2 Class Methods
   37 
   38 =head3 get_root_groups
   39 
   40 my @root_groups = $self->get_root_group()
   41 
   42 =cut
   43 
   44 sub get_root_groups {
   45     my ( $self ) = @_;
   46 
   47     return $self->search( { parent_id => undef }, { order_by => 'title' } );
   48 }
   49 
   50 =head3 get_search_groups
   51 
   52 my @search_groups = $self->get_search_groups({[interface => 'staff' || 'opac']}))
   53 
   54 Returns search groups for the specified interface.
   55 Defaults to OPAC if no interface is specified.
   56 
   57 =cut
   58 
   59 sub get_search_groups {
   60     my ( $self, $params ) = @_;
   61     my $interface = $params->{interface} || q{};
   62 
   63     my $field = $interface eq 'staff' ? 'ft_search_groups_staff' : 'ft_search_groups_opac';
   64 
   65     return $self->search( { $field => 1 } );
   66 }
   67 
   68 =head3 type
   69 
   70 =cut
   71 
   72 sub _type {
   73     return 'LibraryGroup';
   74 }
   75 
   76 =head3 object_class
   77 
   78 =cut
   79 
   80 sub object_class {
   81     return 'Koha::Library::Group';
   82 }
   83 
   84 =head1 AUTHOR
   85 
   86 Kyle M Hall <kyle@bywatersolutions.com>
   87 
   88 =cut
   89 
   90 1;