Bug 26265: (QA follow-up) Remove g option from regex, add few dirs
[koha-equinox.git] / Koha / Illrequests.pm
1 package Koha::Illrequests;
2
3 # Copyright PTFS Europe 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 Koha::Database;
23 use Koha::Illrequest;
24 use Koha::Illrequest::Config;
25
26 use base qw(Koha::Objects);
27
28 =head1 NAME
29
30 Koha::Illrequests - Koha Illrequests Object class
31
32 =head1 API
33
34 =head2 Class Methods
35
36 =head3 _type
37
38 =cut
39
40 sub _type {
41     return 'Illrequest';
42 }
43
44 =head3 object_class
45
46 =cut
47
48 sub object_class {
49     return 'Koha::Illrequest';
50 }
51
52 ##### To be implemented Facade
53
54 =head3 new
55
56     my $illRequests = Koha::Illrequests->new();
57
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.
61
62 =cut
63
64 sub new {
65     my ( $class, $attributes ) = @_;
66
67     my $self = $class->SUPER::new($class, $attributes);
68
69     my $config = Koha::Illrequest::Config->new; # <- Necessary
70     $self->{_config} = $config;                 # <- Necessary
71
72     return $self;
73 }
74
75 =head3 search_incomplete
76
77     my $requests = $illRequests->search_incomplete;
78
79 A specialised version of `search`, returning all requests currently
80 not considered completed.
81
82 =cut
83
84 sub search_incomplete {
85     my ( $self ) = @_;
86     $self->search( {
87         status => [
88             -and => { '!=', 'COMP' }, { '!=', 'GENCOMP' }
89         ]
90     } );
91 }
92
93 =head1 AUTHOR
94
95 Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
96
97 =cut
98
99 1;