Bug 20434: Add default authority type
[koha.git] / Koha / Illrequests.pm
blobf09660ec747942ba2d80af39faf9e05976e69a4e
1 package Koha::Illrequests;
3 # Copyright PTFS Europe 2016
5 # This file is part of Koha.
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.
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.
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.
20 use Modern::Perl;
22 use Koha::Database;
23 use Koha::Illrequest;
24 use Koha::Illrequest::Config;
26 use base qw(Koha::Objects);
28 =head1 NAME
30 Koha::Illrequests - Koha Illrequests Object class
32 =head1 API
34 =head2 Class Methods
36 =head3 _type
38 =cut
40 sub _type {
41 return 'Illrequest';
44 =head3 object_class
46 =cut
48 sub object_class {
49 return 'Koha::Illrequest';
52 ##### To be implemented Facade
54 =head3 new
56 my $illRequests = Koha::Illrequests->new();
58 Create an ILLREQUESTS object, a singleton through which we can interact with
59 ILLREQUEST objects stored in the database or search for ILL candidates at API
60 backends.
62 =cut
64 sub new {
65 my ( $class, $attributes ) = @_;
67 my $self = $class->SUPER::new($class, $attributes);
69 my $config = Koha::Illrequest::Config->new; # <- Necessary
70 $self->{_config} = $config; # <- Necessary
72 return $self;
75 =head3 search_incomplete
77 my $requests = $illRequests->search_incomplete;
79 A specialised version of `search`, returning all requests currently
80 not considered completed.
82 =cut
84 sub search_incomplete {
85 my ( $self ) = @_;
86 $self->search( {
87 status => [
88 -and => { '!=', 'COMP' }, { '!=', 'GENCOMP' }
90 } );
93 =head1 AUTHOR
95 Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
97 =cut