From 63c291b34dd0e66f3e506f48100e6ffb0e01b208 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 17 Feb 2020 18:18:48 +0100 Subject: [PATCH] Bug 24677: (bug 24002 follow-up) Incorrect DATE value: '00-00-0000' in C4/Serials.pm Oops, wrong copy/paste here! The column order changes was not expected. From bug 24002: commit 3d3336ed6607d80b72502075ebf9567cf48e1709 Bug 24002: Incorrect DATE value: '00-00-0000' in C4/Serials.pm The changes from this patch are like: - year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year, + year(IF(serial.publisheddate IS NULL,serial.publisheddate,serial.planneddate)) as year, This is stilly, if publisheddate is null we do not want to return it. It comes from a wrong copy/paste from the other commits: - ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC"; + ORDER BY IF(publisheddate IS NULL,planneddate,publisheddate) DESC"; ="00-00-0000" vs <>"0000-00-00" Test plan: Eyeball the previous patches from bug 24002 and notice that the changes in the commit listed previously are wrong --- C4/Serials.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 20836995c0..f56309e98c 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -304,7 +304,7 @@ sub GetFullSubscription { serial.publisheddatetext, serial.status, serial.notes as notes, - year(IF(serial.publisheddate IS NULL,serial.publisheddate,serial.planneddate)) as year, + year(IF(serial.publisheddate IS NULL,serial.planneddate,serial.publisheddate)) as year, aqbooksellers.name as aqbooksellername, biblio.title as bibliotitle, subscription.branchcode AS branchcode, @@ -316,7 +316,7 @@ sub GetFullSubscription { LEFT JOIN biblio on biblio.biblionumber=subscription.biblionumber WHERE serial.subscriptionid = ? ORDER BY year DESC, - IF(serial.publisheddate IS NULL,serial.publisheddate,serial.planneddate) DESC, + IF(serial.publisheddate IS NULL,serial.planneddate,serial.publisheddate) DESC, serial.subscriptionid |; $debug and warn "GetFullSubscription query: $query"; @@ -464,7 +464,7 @@ sub GetFullSubscriptionsFromBiblionumber { serial.publisheddatetext, serial.status, serial.notes as notes, - year(IF(serial.publisheddate IS NULL,serial.publisheddate,serial.planneddate)) as year, + year(IF(serial.publisheddate IS NULL,serial.planneddate,serial.publisheddate)) as year, biblio.title as bibliotitle, subscription.branchcode AS branchcode, subscription.subscriptionid AS subscriptionid @@ -475,7 +475,7 @@ sub GetFullSubscriptionsFromBiblionumber { LEFT JOIN biblio on biblio.biblionumber=subscription.biblionumber WHERE subscription.biblionumber = ? ORDER BY year DESC, - IF(serial.publisheddate IS NULL,serial.publisheddate,serial.planneddate) DESC, + IF(serial.publisheddate IS NULL,serial.planneddate,serial.publisheddate) DESC, serial.subscriptionid |; my $sth = $dbh->prepare($query); -- 2.11.0