Bug 24677 - [19.11] Wrong year picked in serials
Summary: [19.11] Wrong year picked in serials
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Serials (show other bugs)
Version: 19.11
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 24002
Blocks:
  Show dependency treegraph
 
Reported: 2020-02-18 08:08 UTC by Jonathan Druart
Modified: 2020-03-18 16:39 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
19.11.04


Attachments
Bug 24677: (bug 24002 follow-up) Incorrect DATE value: '00-00-0000' in C4/Serials.pm (3.29 KB, patch)
2020-02-18 08:11 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24677: (bug 24002 follow-up) Incorrect DATE value: '00-00-0000' in C4/Serials.pm (3.34 KB, patch)
2020-02-18 11:26 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Test case (81.24 KB, image/png)
2020-02-18 13:53 UTC, Janusz Kaczmarek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2020-02-18 08:08:55 UTC
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"
Comment 1 Jonathan Druart 2020-02-18 08:11:18 UTC
Created attachment 99147 [details] [review]
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
Comment 2 Janusz Kaczmarek 2020-02-18 11:26:42 UTC
Created attachment 99174 [details] [review]
Bug 24677: (bug 24002 follow-up) Incorrect DATE value: '00-00-0000' in C4/Serials.pm

The patch applies smoothly on master and does what is supposed to do.
Comment 3 Katrin Fischer 2020-02-18 12:11:40 UTC
Can we get a test plan please?
Comment 4 Jonathan Druart 2020-02-18 12:35:20 UTC
The serial's year need to be the planneddate if publisheddate is null. The changes is obvious when you read the previous commit and this patch.
Comment 5 Janusz Kaczmarek 2020-02-18 13:53:27 UTC
Created attachment 99187 [details]
Test case

Test plan:

- receive some back issues (of past years)
- see that they are aggregated under current year (i.e. 2020)
- apply the patch
- check that the attribution of volumes/issues to years is OK now
Comment 6 Martin Renvoize 2020-02-18 18:24:36 UTC
Ooops, I pushed the followup added to bug 24002 before I realized this one existed.

Closing as fixed.
Comment 7 Jonathan Druart 2020-02-21 09:40:03 UTC
(In reply to Martin Renvoize from comment #6)

This needs to be backported. I think we should reopen it for Rmaints.
Comment 8 Martin Renvoize 2020-02-22 10:30:23 UTC
Reopened and I will alert them to it personally in Monday.
Comment 9 Joy Nelson 2020-02-24 16:23:18 UTC
I'll push this to 19.11.x soon.

joy

(In reply to Martin Renvoize from comment #8)
> Reopened and I will alert them to it personally in Monday.
Comment 10 Joy Nelson 2020-03-06 00:54:20 UTC
Pushed to 19.11.x branch for 19.11.04
Comment 11 Lucas Gass 2020-03-18 16:39:47 UTC
missing dependency for 19.05.x, no backport