[Koha] Possible to customize date format in notices/slips?

Arturo Longoria Arturo.Longoria at sll.texas.gov
Wed Nov 21 05:55:07 NZDT 2018


One final update in case someone else stumbles upon this thread: my problem was using "dateonly" in Koha 18.05. The underlying bug of a date (borrowers.dateexpiry) appearing as a datetime was fixed for 18.05, so there was no need to use the "dateonly" placeholder any longer, as I'd attempted. Simply using <<borrowers.dateexpiry>> in 18.05 works as expected without the "12:00 A.M." time.


Arturo Longoria
Reference Librarian/Web Manager
Texas State Law Library
www.sll.texas.gov

-----Original Message-----
From: Koha <koha-bounces at lists.katipo.co.nz> On Behalf Of Arturo Longoria
Sent: Monday, November 19, 2018 08:21
To: Jonathan Druart <jonathan.druart at bugs.koha-community.org>
Cc: koha at lists.katipo.co.nz
Subject: Re: [Koha] Possible to customize date format in notices/slips?

Hi Jonathan,

Our library was upgraded to Koha 18.05.05 this weekend, so I went back and added the “dateonly” placeholder for the borrowers.dateexpiry field in a notice, but I still see the same issue. Koha does not interpret it correctly and instead just outputs “<<borrowers.dateexpiry | dateonly>>” in the e-mail, which gets interpreted as an invalid HTML element. So unless I’m using it incorrectly, I’m not sure it was fixed by bug 17981? I’ll update the bug to document what I saw: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21829

Arturo

From: Jonathan Druart <jonathan.druart at bugs.koha-community.org>
Sent: Tuesday, November 13, 2018 09:26
To: Arturo Longoria <Arturo.Longoria at sll.texas.gov>
Cc: koha at lists.katipo.co.nz
Subject: Re: [Koha] Possible to customize date format in notices/slips?

I am not sure it's a regression actually.

in master it has been fixed by
commit a236b684fdae8e0da83ca7263b948da971dfc849
    Bug 17981: Add a preview mode for notice templates

modified: C4/Letters.pm
@ Letters.pm:887 @ sub _parseletter {
     my $values = $values_in ? { %$values_in } : {};

     if ( $table eq 'borrowers' && $values->{'dateexpiry'} ){
-        $values->{'dateexpiry'} = format_sqldatetime( $values->{'dateexpiry'} );
+        $values->{'dateexpiry'} = output_pref({ str => 
+ $values->{dateexpiry}, dateonly => 1 });
     }

     if ( $table eq 'reserves' && $values->{'waitingdate'} ) {

On Tue, 13 Nov 2018 at 12:21 Jonathan Druart <jonathan.druart at bugs.koha-community.org<mailto:jonathan.druart at bugs.koha-community.org>> wrote:
Hi Arturo,

I do recreate on 17.11.10, not master. Can you open a bug report?
You should not need to specify the dateonly filter for dateexpiry, it's automatically truncated to only display the date part (as there is no time part!)

Regards,
Jonathan

On Tue, 13 Nov 2018 at 11:14 Arturo Longoria <Arturo.Longoria at sll.texas.gov<mailto:Arturo.Longoria at sll.texas.gov>> wrote:
Thank you for your help, Katrin! As a follow up, I attempted to use the dateonly placeholder for our membership expiry notice, but the generated e-mails did not display as expected. In the notice, I used the following text exactly, with a space before and after the pipe character: "Your account will expire on <<borrowers.dateexpiry | dateonly>>." But the notices that were generated say: "Your account will expire on <>" (with an empty left and right angle brackets.

Our library is on Koha 17.11.10, and looking at the database schema, I see that the borrowers.dateexpiry column is "date", not "datetime", so that could be the reason why the dateonly placeholder doesn't work? But if that's the case, why is the "12:00 AM" added if the db column is a date, not a datetime?


Arturo Longoria
Reference Librarian/Web Manager
Texas State Law Library
www.sll.texas.gov<http://www.sll.texas.gov>

-----Original Message-----
From: Koha <koha-bounces at lists.katipo.co.nz<mailto:koha-bounces at lists.katipo.co.nz>> On Behalf Of Katrin Fischer
Sent: Friday, November 9, 2018 00:59
To: koha at lists.katipo.co.nz<mailto:koha at lists.katipo.co.nz>
Subject: Re: [Koha] Possible to customize date format in notices/slips?

Hi Arturo,

try adding | dateonly to your placeholder variable like this:

<< biblio.timestamp | dateonly >>

Hope this helps,

Katrin

On 07.11.18 15:46, Arturo Longoria wrote:
> Our library recently enabled the MEMBERSHIP_EXPIRY notice to alert patrons of expiring accounts. Currently, these notices display the expiration date along with a time (“Your account will expire on 12/06/2018 12:00 AM”), but is there a way to just display the date without the time? I read through the information on the wiki at https://wiki.koha-community.org/wiki/Customising_Notices_and_Slips as well as the manual, but I did not find any indication that the date format can be customized. I thought I’d check in with the list, though, to make sure I’m not missing anything.
>
> Thanks for any input you may have!
>
>
> Arturo Longoria
> Reference Librarian/Web Manager
> Texas State Law Library
> www.sll.texas.gov<http://www.sll.texas.gov><http://www.sll.texas.gov/>
>
> _______________________________________________
> Koha mailing list  http://koha-community.org 
> Koha at lists.katipo.co.nz<mailto:Koha at lists.katipo.co.nz>
> https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list  http://koha-community.org Koha at lists.katipo.co.nz<mailto:Koha at lists.katipo.co.nz> https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list  http://koha-community.org Koha at lists.katipo.co.nz<mailto:Koha at lists.katipo.co.nz>
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list  http://koha-community.org Koha at lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha


More information about the Koha mailing list