|
Lines 20-26
package Koha::Bookings;
Link Here
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Koha::Database; |
22 |
use Koha::Database; |
| 23 |
use Koha::DateUtils qw( dt_from_string ); |
|
|
| 24 |
use Koha::Booking; |
23 |
use Koha::Booking; |
| 25 |
|
24 |
|
| 26 |
use base qw(Koha::Objects); |
25 |
use base qw(Koha::Objects); |
|
Lines 39-60
Koha::Bookings - Koha Booking object set class
Link Here
|
| 39 |
|
38 |
|
| 40 |
$bookings->filter_by_future; |
39 |
$bookings->filter_by_future; |
| 41 |
|
40 |
|
| 42 |
Will return the bookings starting from now. |
41 |
Will return the bookings starting from now. |
| 43 |
|
42 |
|
| 44 |
=cut |
43 |
=cut |
| 45 |
|
44 |
|
| 46 |
sub filter_by_future { |
45 |
sub filter_by_future { |
| 47 |
my ($self) = @_; |
46 |
my ($self) = @_; |
| 48 |
my $now = dt_from_string; |
47 |
return $self->search( { start_date => { '>' => \'NOW()' } } ); |
| 49 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
|
|
| 50 |
return $self->search( { start_date => { '>' => $dtf->format_datetime($now) } } ); |
| 51 |
} |
48 |
} |
| 52 |
|
49 |
|
| 53 |
=head2 Internal Methods |
50 |
=head2 Internal Methods |
| 54 |
|
51 |
|
| 55 |
=cut |
52 |
=cut |
| 56 |
|
53 |
|
| 57 |
=head3 type |
54 |
=head3 _type |
| 58 |
|
55 |
|
| 59 |
=cut |
56 |
=cut |
| 60 |
|
57 |
|
| 61 |
- |
|
|