Bug 24298: (RM follow-up) Schema Class Update
[koha.git] / Koha / Illrequests.pm
blob8228debcc43029f1640829a7f1b9d56f085e37af
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
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>.
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