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>.
24 use Koha::ILL::Request::Config;
26 use base qw(Koha::Objects);
30 Koha::Illrequests - Koha Illrequests Object class
36 ##### To be implemented Facade
40 my $illRequests = Koha::Illrequests->new();
42 Create an ILLREQUESTS object, a singleton through which we can interact with
43 ILLREQUEST objects stored in the database or search for ILL candidates at API
49 my ( $class, $attributes ) = @_;
51 my $self = $class->SUPER::new($class, $attributes);
53 my $config = Koha::ILL::Request::Config->new; # <- Necessary
54 $self->{_config} = $config; # <- Necessary
59 =head3 filter_by_visible
61 my $visible_requests = $requests->filter_by_visible;
63 Returns a I<Koha::Illrequests> resultset, filtered by statuses that are not listed
64 as hidden in the I<ILLHiddenRequestStatuses> system preference.
68 sub filter_by_visible {
71 my $hidden_statuses_string = C4::Context->preference('ILLHiddenRequestStatuses') // q{};
72 my $hidden_statuses = [ split '\|', $hidden_statuses_string ];
74 if ( scalar @{$hidden_statuses} ) {
78 status => { 'not in' => $hidden_statuses },
79 status_alias => [ -or =>
80 { 'not in' => $hidden_statuses },
91 =head3 search_incomplete
93 my $requests = $illRequests->search_incomplete;
95 A specialised version of `search`, returning all requests currently
96 not considered completed.
100 sub search_incomplete {
104 -and => { '!=', 'COMP' }, { '!=', 'GENCOMP' }
109 =head2 Internal methods
124 return 'Koha::Illrequest';
129 Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>