Bug 30650: Allow to restrict curbside pickup for waiting holds only
[koha.git] / Koha / CurbsidePickups.pm
1 package Koha::CurbsidePickups;
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18 use Modern::Perl;
19
20 use Carp;
21
22 use Koha::Database;
23
24 use Koha::CurbsidePickup;
25
26 use base qw(Koha::Objects);
27
28 =head1 NAME
29
30 Koha::CurbsidePickups - Koha Curbside Pickup Object set class
31
32 =head1 API
33
34 =head2 Class Methods
35
36 =cut
37
38 =head3 filter_by_to_be_staged
39
40 Filter by pickups that have not been staged yet
41
42 =cut
43
44 sub filter_by_to_be_staged {
45     my ($self) = @_;
46     return $self->search( { staged_datetime => undef } );
47 }
48
49 =head3 filter_by_staged_and_ready
50
51 Filter by pickups that have been staged and are ready
52
53 =cut
54
55 sub filter_by_staged_and_ready {
56     my ($self) = @_;
57     return $self->search(
58         { staged_datetime => { -not => undef }, arrival_datetime => undef } );
59 }
60
61 =head3 filter_by_patron_outside
62
63 Filter by pickups with patrons waiting outside
64
65 =cut
66
67 sub filter_by_patron_outside {
68     my ($self) = @_;
69     return $self->search(
70         { arrival_datetime => { -not => undef }, delivered_datetime => undef }
71     );
72 }
73
74 =head3 filter_by_delivered
75
76 Filter by pickups that have been delivered already
77
78 =cut
79
80 sub filter_by_delivered {
81     my ($self) = @_;
82     return $self->search( { delivered_datetime => { -not => undef } } );
83 }
84
85 =head2 Internal Methods
86
87 =cut
88
89 =head3 _type
90
91 =cut
92
93 sub _type {
94     return 'CurbsidePickup';
95 }
96
97 =head3 object_class
98
99 =cut
100
101 sub object_class {
102     return 'Koha::CurbsidePickup';
103 }
104
105 1;