Bug 11059

Summary: Not possible to sort staged dates in metric format
Product: Koha Reporter: Koha Team University Lyon 3 <koha>
Component: AcquisitionsAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, gmcharlt, koha
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9108
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Not possible to sort staged dates in metric format
Bug 11059 not possible to sort staged dates in metric format
Bug 11059 Not possible to sort staged dates in metric format
Bug 11059 Not possible to sort staged dates in metric format
Bug 11059 - Not possible to sort staged dates in metric format
Bug 11059 - Restore time in staged dates in addorderiso2709.tt
[SIGNED-OFF] Bug 11059 - Restore time in staged dates in addorderiso2709.tt
Bug 11059 - Not possible to sort staged dates in metric format
Bug 11059 - Restore time in staged dates in addorderiso2709.tt

Description Koha Team University Lyon 3 2013-10-16 09:47:24 UTC Comment hidden (obsolete)
Comment 1 Koha Team University Lyon 3 2013-10-16 09:51:50 UTC Comment hidden (obsolete)
Comment 2 Fridolin Somers 2013-10-21 12:00:32 UTC
Adding dateformat to template vars is not necessary in addorderiso2709.pl : 
  $template->param(dateformat => C4::Context->preference('dateformat'));
It is already done in C4/Auth.pm
Comment 3 Koha Team University Lyon 3 2013-10-21 17:02:34 UTC
Maybe that SHOULD work without this line, but it does not. I checked it.
Comment 4 Fridolin Somers 2013-10-22 07:11:44 UTC
Your patch needs a small rebase, because Bug 9108 has already added 
    [% IF (dateformat == 'metric') %]
        dt_add_type_uk_date();
    [% END %]
into addorderiso2709.tt
Comment 5 Fridolin Somers 2013-10-22 07:23:15 UTC
(In reply to Koha Team Lyon 3 from comment #3)
> Maybe that SHOULD work without this line, but it does not. I checked it.
It works for me, in current master code.
Tested it by added in addorderiso2709.tt :
    $(document).ready(function() {
   +    alert('dateformat=[% dateformat %]');
The page displays an alert with "metric" (since I am in France).
Comment 6 Koha Team University Lyon 3 2013-10-22 09:28:37 UTC Comment hidden (obsolete)
Comment 7 Fridolin Somers 2013-10-22 15:04:03 UTC
(In reply to Koha Team Lyon 3 from comment #6)
> Created attachment 22263 [details] [review] [review]
> Bug 11059 Not possible to sort staged dates in metric format
> I rebased and modified for master as you suggested.
Your patch adds : 
    [% IF (dateformat == 'metric') %]
        dt_add_type_uk_date();
    [% END %]
This is not needed, it is done a few lines above.
Comment 8 Owen Leonard 2013-10-22 15:11:05 UTC
I prefer the newer method where the DataTables plugin looks for an ISO-formatted date in a title attribute. This means that we don't need any logic around date format. See booksellers.tt for an example. In the DataTables initialization configuration:

        "aoColumns": [
            null,null,null,null,null,null,{ "sType": "title-string" },{ "sType": "title-string" },null
        ],

...where "sType," the sorting type, is "title-string." This looks for a <span> with a title attribute containing the unformatted date:

 <td><span title="[% basket.creationdate %]">[% basket.creationdate | $KohaDates %]</span></td>
Comment 9 Koha Team University Lyon 3 2013-10-22 15:16:01 UTC
(In reply to Fridolyn SOMERS from comment #7)
> (In reply to Koha Team Lyon 3 from comment #6)
> > Created attachment 22263 [details] [review] [review] [review]
> > Bug 11059 Not possible to sort staged dates in metric format
> > I rebased and modified for master as you suggested.
> Your patch adds : 
>     [% IF (dateformat == 'metric') %]
>         dt_add_type_uk_date();
>     [% END %]
> This is not needed, it is done a few lines above.

?!! I deleted these lines, there are not any more in the last patch. Did you really test this one (id=2263) ?
Comment 10 Fridolin Somers 2013-10-24 11:40:29 UTC
(In reply to Koha Team Lyon 3 from comment #9)
> ?!! I deleted these lines, there are not any more in the last patch. Did you
> really test this one (id=2263) ?
I still see those lines in actual patch.

(In reply to Owen Leonard from comment #8)
> I prefer the newer method where the DataTables plugin looks for an
> ISO-formatted date in a title attribute
Me too, it is more clear and alows to display the time.
Comment 11 Koha Team University Lyon 3 2013-11-12 14:46:34 UTC Comment hidden (obsolete)
Comment 12 Fridolin Somers 2013-11-12 16:20:39 UTC Comment hidden (obsolete)
Comment 13 Fridolin Somers 2013-11-12 16:22:16 UTC Comment hidden (obsolete)
Comment 14 Fridolin Somers 2013-11-12 16:22:37 UTC
Follow-up needs signoff
Comment 15 Owen Leonard 2013-11-14 17:15:50 UTC Comment hidden (obsolete)
Comment 16 Kyle M Hall 2013-11-22 17:33:47 UTC
Created attachment 23098 [details] [review]
Bug 11059 - Not possible to sort staged dates in metric format

Adds title-string sorting type to enable this.

Signed-off-by: Fridolyn SOMERS <fridolyn.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 17 Kyle M Hall 2013-11-22 17:34:24 UTC
Created attachment 23099 [details] [review]
Bug 11059 - Restore time in staged dates in addorderiso2709.tt

Follow-up patch to restore the display of time in
acqui/addorderiso2709.tt in staged date.
Simply uses an option of KohaDates TT plugin.
This time may be usefull if there where several imports in the same day.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 18 Galen Charlton 2013-12-02 15:49:05 UTC
Pushed to master.  Thanks, Oliver!
Comment 19 Fridolin Somers 2013-12-13 15:03:47 UTC
Those patches has been pushed to 3.14.x, will be in 3.14.1