From ef1c6140e81c370a743e20bdacb4dcec0d3e6e3e Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 8 May 2017 21:23:22 +0000 Subject: [PATCH] Bug 18557 [QA Followup] - Use dt_from_string Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- Koha/Clubs.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Koha/Clubs.pm b/Koha/Clubs.pm index 677408df3a..eeaf4ef337 100644 --- a/Koha/Clubs.pm +++ b/Koha/Clubs.pm @@ -22,6 +22,7 @@ use Modern::Perl; use Carp; use Koha::Database; +use Koha::DateUtils qw( dt_from_string ); use Koha::Club; @@ -56,10 +57,18 @@ sub get_enrollable { } } + my $dtf = Koha::Database->new->schema->storage->datetime_parser; + # Only clubs with no end date or an end date in the future can be enrolled in $params->{'-and'} = [ - -or => [ date_end => { '>=' => \'CAST(now() AS date)' }, date_end => undef], - -or => [ 'me.branchcode' => $borrower->branchcode, 'me.branchcode' => undef ] + -or => [ + date_end => { '>=' => $dtf->format_datetime( dt_from_string() ) }, + date_end => undef, + ], + -or => [ + 'me.branchcode' => $borrower->branchcode, + 'me.branchcode' => undef, + ] ]; my $rs = $self->_resultset()->search( $params, { prefetch => 'club_template' } ); -- 2.39.5