View | Details | Raw Unified | Return to bug 25670
Collapse All | Expand All

(-)a/Koha/Acquisition/Orders.pm (-4 / +51 lines)
Lines 23-28 use Koha::Database; Link Here
23
23
24
use Koha::DateUtils qw( dt_from_string );
24
use Koha::DateUtils qw( dt_from_string );
25
use Koha::Acquisition::Order;
25
use Koha::Acquisition::Order;
26
use Koha::Exceptions::Exception;
26
27
27
use base qw(Koha::Objects);
28
use base qw(Koha::Objects);
28
29
Lines 32-38 Koha::Acquisition::Orders object set class Link Here
32
33
33
=head1 API
34
=head1 API
34
35
35
=head2 Class Methods
36
=head2 Class methods
36
37
37
=head3 filter_by_lates
38
=head3 filter_by_lates
38
39
Lines 130-135 sub filter_by_lates { Link Here
130
    );
131
    );
131
}
132
}
132
133
134
=head3 filter_by_active
135
136
    my $new_rs = $orders->filter_by_active;
137
138
Returns a new resultset filtering orders that are not active.
139
140
=cut
141
142
sub filter_by_active {
143
    my ($self) = @_;
144
    return $self->search(
145
        {
146
            orderstatus => [ 'new', 'ordered', 'partial' ]
147
        }
148
    );
149
}
150
133
=head3 filter_by_current
151
=head3 filter_by_current
134
152
135
    $orders->filter_by_current
153
    $orders->filter_by_current
Lines 164-172 sub filter_by_cancelled { Link Here
164
    );
182
    );
165
}
183
}
166
184
185
=head3 filter_by_id_including_transfers
186
187
    my $orders = $orders->filter_by_id_including_transfers(
188
        {
189
            ordernumber => $ordernumber
190
        }
191
    );
192
193
When searching for orders by I<ordernumber>, include the aqorders_transfers table
194
so we can find orders that have changed their ordernumber as the result of a transfer
195
196
=cut
197
198
sub filter_by_id_including_transfers {
199
    my ( $self, $params ) = @_;
200
201
    Koha::Exceptions::MissingParameter->throw( "The ordernumber param is mandatory" )
202
        unless $params->{ordernumber};
203
204
    return $self->search(
205
        {
206
            -or => [
207
                { 'me.ordernumber' => $params->{ordernumber} },
208
                { 'aqorders_transfers_ordernumber_to.ordernumber_from' => $params->{ordernumber} }
209
            ]
210
        },
211
        { join => 'aqorders_transfers_ordernumber_to' }
212
    );
213
}
214
167
=head2 Internal methods
215
=head2 Internal methods
168
216
169
=head3 _type (internal)
217
=head3 _type
170
218
171
=cut
219
=cut
172
220
Lines 174-180 sub _type { Link Here
174
    return 'Aqorder';
222
    return 'Aqorder';
175
}
223
}
176
224
177
=head3 object_class (internal)
225
=head3 object_class
178
226
179
=cut
227
=cut
180
228
181
- 

Return to bug 25670