From af7d91cbfabeec06c361525df7d8a7db466ef84f Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Wed, 30 Apr 2014 22:49:45 -0400 Subject: [PATCH] Bug 12167 - Patch disappearing news problem This doesn't duplicate on Debian, but it does under Ubuntu. TEST PLAN --------- 1) Update your git master to current. 2) Log into your staff client. 3) The news may have disappeared. -- Make sure to have news entered. The problem portion is the timestamp and date+1 logic don't seem to function properly. 4) Apply the first patch. 5) prove -v t/db_dependent/NewsChannels.t -- It should "fail". 6) Apply the second patch. 7) The news should reappear. -- There is no apparent change under Debian. 8) prove -v t/db_dependent/NewsChannels.t -- It should now "work". --- C4/NewsChannels.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm index 47772ef..83f4096 100644 --- a/C4/NewsChannels.pm +++ b/C4/NewsChannels.pm @@ -197,13 +197,13 @@ sub GetNewsToDisplay { OR expirationdate IS NULL OR expirationdate = '00-00-0000' ) - AND `timestamp` < CURRENT_DATE()+1 + AND CAST( `timestamp` AS DATE ) <= CURRENT_DATE() AND (lang = '' OR lang = ?) AND (branchcode IS NULL OR branchcode = ?) ORDER BY number }; # expirationdate field is NOT in ISO format? - # timestamp has HH:mm:ss, CURRENT_DATE generates 00:00:00 - # by adding 1, that captures today correctly. + # casting timestamp to date truncates HH:mm:ss + # changing to <= CURRENT_DATE() today is captured. my $sth = $dbh->prepare($query); $lang = $lang // q{}; $sth->execute($lang,$branch); -- 1.7.9.5