From 1f065a12c21ad8a90cac7ca6d8cdb1f171ffa79c Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 9 May 2017 07:56:53 -0400 Subject: [PATCH] Bug 18557 - Mysqlim CURRENT_DATE in Koha::Clubs::get_enrollable Test Plan: 1) Apply this patch 2) prove t/db_dependent/Clubs.t Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- Koha/Clubs.pm | 2 +- t/db_dependent/Clubs.t | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Koha/Clubs.pm b/Koha/Clubs.pm index 7d62d2299b..677408df3a 100644 --- a/Koha/Clubs.pm +++ b/Koha/Clubs.pm @@ -58,7 +58,7 @@ sub get_enrollable { # Only clubs with no end date or an end date in the future can be enrolled in $params->{'-and'} = [ - -or => [ date_end => { '>=' => \'CURRENT_DATE()' }, date_end => undef], + -or => [ date_end => { '>=' => \'CAST(now() AS date)' }, date_end => undef], -or => [ 'me.branchcode' => $borrower->branchcode, 'me.branchcode' => undef ] ]; diff --git a/t/db_dependent/Clubs.t b/t/db_dependent/Clubs.t index ed426f9b1a..ab39a6d466 100755 --- a/t/db_dependent/Clubs.t +++ b/t/db_dependent/Clubs.t @@ -124,6 +124,16 @@ is( $club_template->club_template_enrollment_fields->count, 2, 'Club template has two enrollment fields' ); ## Create a club based on this template +Koha::Club->new( + { + club_template_id => $club_template->id, + name => "Test Expired Club", + branchcode => $branchcode, + date_start => '1900-01-01', + date_end => '1900-01-02', + } +)->store(); + my $club = Koha::Club->new( { club_template_id => $club_template->id, -- 2.39.5