From a32888c88569f9f5cf211dbaa157bfd6ace83354 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 --- Koha/Clubs.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Koha/Clubs.pm b/Koha/Clubs.pm index 677408d..eeaf4ef 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.1.4