Bug 10794 - Sorting on billing date column in invoices table doesn't work
Summary: Sorting on billing date column in invoices table doesn't work
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL: /cgi-bin/koha/acqui/invoices.pl?suppl...
Keywords:
Depends on: 9505
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-28 06:23 UTC by Katrin Fischer
Modified: 2014-12-07 20:07 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 10794 - Sorting on billing date column in invoices table doesn't work (2.33 KB, patch)
2013-09-09 18:54 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 10794 - Sorting on billing date column in invoices table doesn't work (2.34 KB, patch)
2013-10-03 01:53 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
Bug 10794 - Sorting on billing date column in invoices table doesn't work (2.50 KB, patch)
2013-10-05 20:38 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2013-08-28 06:23:50 UTC
Sorting by billing date in the invoices table in acquisitions doesn't work. In my case there was only one date and the other fields were empty. Sorting the column didn't result in any change. Other columns sort nicely.
Comment 1 Owen Leonard 2013-09-09 18:54:48 UTC Comment hidden (obsolete)
Comment 2 I'm just a bot 2013-09-29 05:55:16 UTC
Patch applied cleanly, go forth and signoff
Comment 3 Srdjan Jankovic 2013-10-03 01:53:35 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2013-10-05 20:38:40 UTC
Created attachment 21830 [details] [review]
Bug 10794 - Sorting on billing date column in invoices table doesn't work

This patch adds the sorting by title string option to the table of
invoices. This allows column data to be sorted based on the
ISO-formatted date rather than the formatted-for-display date. A "blank"
(0000-00-00) date is added to cells which contain no date data.

To test, view the Acquisitions Invoices page (acqui/invoices.pl) and
confirm that the "Billing date" column is sorted correctly regardless of
the dateformat system preference.

http://bugs.koha-community.org/show_bug.cgi?id=10749

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Template only change, passes all tests and QA script.
Sorting of the billing column now works as expected.
Comment 5 Galen Charlton 2013-10-09 04:17:03 UTC
Pushed to master.  Thanks, Owen!
Comment 6 Joseph Alway 2014-02-13 02:28:49 UTC
This bug is still showing up in Koha 3.14 and 3.14.3. It seems like the patch should have been implemented in one of the more recent updates, but it has not.
Comment 7 Jacek Ablewicz 2014-02-13 07:48:03 UTC
It was implemented and it worked, at least for a while ;)

But indeed, it's not working properly since "Bug 10401: Add ability to merge invoices" has been pushed - there was 1st extra column with checkboxes added, and this code

    $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
        sDom: "t",
        "aoColumns": [
            null,null,{ "sType": "title-string" },null,null,null,null
        ],
        aoColumnDefs: [
            { "bSortable": false, "aTargets": [0, 7] }
        ]
    }));

was not fully adjusted to reflect this change ( "sType": "title-string" now applies to "Vendor" column, not "Billing date"). BTW, I think it may be something else not quite right with this code; that's what I'm getting in 3.14 and in (not so current) master:
1) "Billing date" sorting is not OK,
2) "Vendor" column is not sortable at all,
3) top/bottom DataTables pagination bars are missing (tested in Firefox 27.0, might be browser dependant?) - only "top ten" invoices are always displayed in the table, and it's not possible to change that without pagination bars.

By some trial-and-error, I got it working (1-3) with:

    $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
        aoColumnDefs: [
            { "bSortable": false, "aTargets": [0, 7] },
            { "sType": "string", "aTargets": [ 3 ] }
        ]
    }));

but it's my first real experience with DataTables; not sure if I know what I'm doing.
Comment 8 Jacek Ablewicz 2014-02-13 09:30:28 UTC
Or perhaps something like this

    $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
        bPaginate: false,
        sDom: "t",
        aoColumnDefs: [
            { "bSortable": false, "aTargets": [0, 7] },
            { "sType": "string", "aTargets": [ 3 ] }
        ]
    }));

will be better (= no pagination bars/no filter on table, but all rows being displayed, not just top 10)?
Unless "top ten rows only display" is a feature, and not a bug? If so, personally I find it not very intuitive..
Comment 9 Joseph Alway 2014-02-13 16:54:14 UTC
Yeah, I did notice that it was only displaying 10 items and there was no option to show the rest. Which would be another bug. Unless they are being caused by the same thing. I tested it in Firefox and Google Chrome, so I would guess that the Data Table Pagination bars are not a browser issue.
Comment 10 Jacek Ablewicz 2014-02-20 09:26:43 UTC
(In reply to Joseph Alway from comment #9)
> Yeah, I did notice that it was only displaying 10 items and there was no
> option to show the rest. Which would be another bug. Unless they are being
> caused by the same thing.

Still don't know if the "top 10 only display" is a bug or a feature but I made a patch to fix both issues; see bug 11798.
Comment 11 Jacek Ablewicz 2014-02-24 08:34:11 UTC
(In reply to Joseph Alway from comment #9)

BTW (on a not quite related subject - but we'll be grateful if someone can shed some light on this mystery) we/our translation people were wondering what is the precise meaning of the "Billing date":

- date the invoice was issued by vendor,
- date the invoice was shipped to/given to, or arrived to the client,
- date the payment is due,
- date the payment was actually made ?