Bug 9084 - Dates in notices should be formatted according to dateformat system preference
Summary: Dates in notices should be formatted according to dateformat system preference
Status: RESOLVED DUPLICATE of bug 11244
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Mason James
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-14 20:14 UTC by Katrin Fischer
Modified: 2014-01-20 02:03 UTC (History)
7 users (show)

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


Attachments
Bug 9084 - Dates in notices should be formatted according to dateformat system preference (1.52 KB, patch)
2013-04-18 14:11 UTC, Mason James
Details | Diff | Splinter Review
Bug 9084 - Dates in notices should be formatted according to dateformat system preference (1.35 KB, patch)
2013-04-18 14:12 UTC, Mason James
Details | Diff | Splinter Review
Bug 9084 - Dates in notices should be formatted according to dateformat system preference (1.29 KB, patch)
2013-04-18 14:20 UTC, Mason James
Details | Diff | Splinter Review
Bug 9084 - Dates in notices should be formatted according to dateformat system preference (41.61 KB, patch)
2013-04-30 02:38 UTC, Mason James
Details | Diff | Splinter Review
Bug 9084 - Dates in notices should be formatted according to dateformat system preference (2.52 KB, patch)
2013-04-30 02:48 UTC, Mason James
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2012-11-14 20:14:21 UTC
For some more rare cases this is already done, but a lot of dates are still in 'database format'. Example: 2012-11-14 20:50:00. This bug is for listing the problematic dates.

Check in notice:
 <<old_issues.date_due>>
 <<old_issues.branchcode>>
 <<old_issues.returndate>>
 <<old_issues.issuedate>>

Check out notice:
 <<issue_date>> 
Note: <<issue_date_due>> doesn't work at all
Comment 1 Katrin Fischer 2012-11-14 20:18:47 UTC
Note: <<issue_date_due>> doesn't work at all < that's wrong, it was a typo in my template.:)

Check in notice:
 <<old_issues.date_due>>
 <<old_issues.branchcode>>
 <<old_issues.returndate>>
 <<old_issues.issuedate>>

Check out notice:
 <<issue_date>> 
 <<issue_date_due>>
Comment 2 Mason James 2013-04-17 02:49:35 UTC
(In reply to comment #0)
> For some more rare cases this is already done, but a lot of dates are still
> in 'database format'. Example: 2012-11-14 20:50:00. This bug is for listing
> the problematic dates.


hmmm, we have just bumped into this issue too...

i may be attempting a fix for this - if no one else has a fix already?
Comment 3 Mason James 2013-04-18 14:11:34 UTC Comment hidden (obsolete)
Comment 4 Mason James 2013-04-18 14:12:51 UTC Comment hidden (obsolete)
Comment 5 Mason James 2013-04-18 14:20:03 UTC Comment hidden (obsolete)
Comment 6 Mason James 2013-04-30 02:38:01 UTC Comment hidden (obsolete)
Comment 7 Mason James 2013-04-30 02:48:30 UTC
Created attachment 17828 [details] [review]
Bug 9084 - Dates in notices should be formatted according to dateformat system preference

to test…

- apply patch

- choose a patron to checkout item

- in 'Patron messaging preferences' section, of patrons 'details' page - tick 'email' box for 'Item checkout'
----------------------------------------
Patron messaging preferences
        Days in advance Email
Item checkout   -       x <====
Hold filled     -       -
Item due        -       -
Item check-in   -       -
----------------------------------------

- cut/paste below notice, for CHECKOUT, in 'Home › Tools › Notices & Slips › Modify notice'

bib: <<biblio.title>>  due: <<issues.date_due>> issue: <<issues.issuedate>> return: <<issues.returndate>>

- delete issues and message_queue tables, before test
mysql> truncate issues;
mysql> truncate message_queue;

- issue a test item to patron

- check message_queue table for notice, with correctly formatted dates, with stripped time

mysql> select content from message_queue\G
content: bib: TESTAMENTS OF LOVE due: 20/05/2013 issue: 30/04/2013 return: 30/04/2013
1 row in set (0.00 sec)
Comment 8 Srdjan Jankovic 2013-06-11 05:38:31 UTC
Perhaps it would be better (quicker) if you made a hash instead of array, and use if $h{$field} instead of grep?
Comment 9 I'm just a bot 2013-09-29 05:58:05 UTC
Patch applied cleanly, go forth and signoff
Comment 10 David Cook 2013-10-11 05:51:40 UTC
I'm happy to see that someone else has already started work on this one. 

However, I have a few reservations about this patch at the moment.

1) The list of tables.fields for which to format dates:

This list isn't comprehensive (it should probably include all date columns). Also, being hard-coded, it makes for a bit of a maintenance nightmare, I think.

The overdue_notices.pl and advanced-notices.pl scripts use this regex "/^date|date$/" to choose columns for which to format dates when using items.content. I think that this would make sense here too. 

Of course, "items.onloan" wouldn't be included in this, so we might need to use a hard-coded list, or regex + a shorter hard-coded list.

2) I don't know if we want to strip the time from all of these fields. 

I imagine there might be fields, like duedate, where we might want to include the time. 

We might not. I'm not 100% on this one. 

--

In any case, if the list were expanded, I would be happy to sign off.
Comment 11 I'm just a bot 2013-10-30 07:08:36 UTC
Patch applied cleanly, go forth and signoff
Comment 12 David Cook 2014-01-20 02:03:57 UTC
I hope it's appropriate that I mark this RESOLVED - DUPLICATE, but bug 11244 identifies the same problem and offers a more robust solution.

*** This bug has been marked as a duplicate of bug 11244 ***