Bug 13813 changed koha-news.pl to remove use of C4::Dates However, dt_from_string defaults to today when passed a blank value, so news now must have an expiration date and it defaults to today
Created attachment 51642 [details] [review] Bug 16550: Can't set opac news expiration date to NULL, it reverts to today This patch fixes an issue with the expiration dates for news always reverting to today if empty. To test: - Apply patch - Go to Home > Tools > News - Create a news item, do not set expiration date - Verify that expiration date stays empty - Edit this news item - Do not set expiration date - Verify that expiration date stays empty - Do the same with expiration dates - Verify that they are saved properly
Created attachment 51650 [details] [review] Bug 16550: Add test to NewsChannels.t To test: Run t/db_dependent/NewsChannels.t Tests adding and retreiving a news item without expiration date. This test should fail without patch for Bug 16550 and pass OK with patch.
When editing the news item the date is populated to today's date and must be cleared. It does save as empty, but shouldn't auto-populate Tests pass
Hi Nick, I just re-tested: - Applied both patches - With MySql, emptied table opac_news - Went to Home > Tools > News - New entry, save it without filling in Expiration date Result OK: News has no Expiration date in list - Edit the entry Result OK: In edit form, Expiration date is empty, does not auto-populate - Change title, leave Expiration date empty, save Result OK: News has no Expiration date in list - Edit News, add an expiration date, save Result OK: Expiration date appears in list - Edit News again, remove date from Expiration date, save Result OK: No expiration date in list
Created attachment 51655 [details] [review] Bug 16550: Can't set opac news expiration date to NULL, it reverts to today This patch fixes an issue with the expiration dates for news always reverting to today if empty. To test: - Apply patch - Go to Home > Tools > News - Create a news item, do not set expiration date - Verify that expiration date stays empty - Edit this news item - Do not set expiration date - Verify that expiration date stays empty - Do the same with expiration dates - Verify that they are saved properly Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 51656 [details] [review] Bug 16550: Add test to NewsChannels.t To test: Run t/db_dependent/NewsChannels.t Tests adding and retreiving a news item without expiration date. This test should fail without patch for Bug 16550 and pass OK with patch. Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 51668 [details] [review] Bug 16550: Can't set opac news expiration date to NULL, it reverts to today This patch fixes an issue with the expiration dates for news always reverting to today if empty. To test: - Apply patch - Go to Home > Tools > News - Create a news item, do not set expiration date - Verify that expiration date stays empty - Edit this news item - Do not set expiration date - Verify that expiration date stays empty - Do the same with expiration dates - Verify that they are saved properly Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 51669 [details] [review] Bug 16550: Add test to NewsChannels.t To test: Run t/db_dependent/NewsChannels.t Tests adding and retreiving a news item without expiration date. This test should fail without patch for Bug 16550 and pass OK with patch. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 51670 [details] [review] Bug 16550: Clean the tests - replace ok with is - remove diag - replace $dbh->prepare->execute->fetchrow with $dbh->selectrow_array And remove unecessary force to scalar context in pl Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to master for 16.05, thanks Marc, Jonathan!
Patches pushed to 3.22.x, will be in 3.22.7