Bug 6115

Summary: Acquisition reports : date filter & sorting don't work
Product: Koha Reporter: Paul Poulain <paul.poulain>
Component: ReportsAssignee: Paul Poulain <paul.poulain>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P3 CC: chris, frederic.durand, katrin.fischer, m.de.rooy, nengard
Version: 3.6   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: proposed patch
proposed patch (updated)
columns sorted wrong
rows sorting right
proposed patch (updated again)
proposed patch (updated again)
before patch
after patch
wrong order screenshot
wrong order screenshot
BZ6115: Acquisition reports : date filter & sorting don't work
BZ6115: Acquisition reports : date filter & sorting don't work

Description Paul Poulain 2011-04-07 13:39:53 UTC
* the filter on dates don't work
* when displaying by day or month, it was 100% alphabetic, april was before january for example. Adding the month number before the month name to get proper sorting
Comment 1 Paul Poulain 2011-04-07 13:41:12 UTC Comment hidden (obsolete)
Comment 2 Frederic Durand 2011-04-08 12:44:01 UTC
This patch working for sort grouping by month (march is getting before april).
But not for day of week : 4-Friday is coming before 0-Monday.
Comment 3 Paul Poulain 2011-05-23 12:59:25 UTC Comment hidden (obsolete)
Comment 4 Nicole C. Engard 2011-07-06 16:07:42 UTC
Saturday is coming before Wednesday in the column headings - but is right in the row headings.  marking failed-qa
Comment 5 Nicole C. Engard 2011-07-06 16:08:02 UTC
Created attachment 4567 [details]
columns sorted wrong
Comment 6 Nicole C. Engard 2011-07-06 16:08:17 UTC
Created attachment 4568 [details]
rows sorting right
Comment 7 Paul Poulain 2011-07-19 15:53:55 UTC Comment hidden (obsolete)
Comment 8 Paul Poulain 2011-07-22 08:25:56 UTC Comment hidden (obsolete)
Comment 9 Paul Poulain 2011-07-22 08:26:43 UTC
diff between the previous one and the correct one: 
-    $strsth2 .= " ORDER BY $column";
+    $strsth2 .= " ORDER BY $colfield";
Comment 10 Nicole C. Engard 2011-08-05 00:04:52 UTC
Created attachment 4851 [details]
before patch

I'm not sure I like the change this patch applies.  The reports are in order by date just fine without the patch as shown in the attachment.
Comment 11 Nicole C. Engard 2011-08-05 00:05:24 UTC
Created attachment 4852 [details]
after patch

after the patch it's showing the month number which is kind of distracting ... or am i missing what else this patch is doing?
Comment 12 Paul Poulain 2011-08-05 09:28:02 UTC
Created attachment 4856 [details]
wrong order screenshot

Nicole, here is a screenshot with the problems (it's for weekdays).
Comment 13 Paul Poulain 2011-08-05 09:31:09 UTC
Created attachment 4857 [details]
wrong order screenshot

Here is a wrong screenshot based on months

Nicole: after investigating, it seems that the problem is visible only under certain circumstances.
I think -but am not sure- if your datas alway have closedate ordered like basketid, then the result is correct, but it's by chance.
My test DB contains :
mysql> select closedate,basketno FROM aqbasket;
+------------+----------+
| closedate  | basketno |
+------------+----------+
| 2011-06-20 |        1 |
| 2010-07-20 |        2 |

(basket 1 closed after basket 2)
Comment 14 Katrin Fischer 2011-12-21 05:26:18 UTC
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y
Applying: BZ6115: Acquisition reports : date filter & sorting don't work
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging reports/acquisitions_stats.pl
CONFLICT (content): Merge conflict in reports/acquisitions_stats.pl
Failed to merge in the changes.
Patch failed at 0001 BZ6115: Acquisition reports : date filter & sorting don't work
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
Comment 15 Paul Poulain 2011-12-26 17:23:31 UTC Comment hidden (obsolete)
Comment 16 Chris Cormack 2011-12-27 23:26:05 UTC
Created attachment 6939 [details] [review]
BZ6115: Acquisition reports : date filter & sorting don't work

* the filter on dates don't work
* when displaying by day or month, it was 100% alphabetic, april was before
january for example. Adding the month number before the month name to get
proper sorting
* removed many commented warn & lines

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 17 Chris Cormack 2011-12-27 23:28:09 UTC
Testing results

1/ Date filters work well

2/ Grouping by month/day of week/year produces a well sorted list
Comment 18 Marcel de Rooy 2012-01-18 12:50:48 UTC
QA Comment:
Looks good. Lots of warns removed. Has a solid signoff. patch_status++
Comment 19 Jared Camins-Esakov 2012-05-23 12:55:41 UTC
This fix was included in the 3.6.x branch prior to 3.6.4.