[Koha] Template toolkit puzzle 1.

Katrin Fischer katrin.fischer.83 at web.de
Thu Dec 8 09:30:49 NZDT 2022


Hi Raymund,

I think Tomas is right, you are using SQL, but we need something more
TT/Perl.

I found a nice example on the wiki that could do the trick:

https://wiki.koha-community.org/wiki/Notices_and_Slips_Library#Manipulating_Dates_in_Notices_using_Template_Toolkit

[%- USE date -%]
[%- manip = date.manip -%]
[%- date_prev = manip.DateCalc( hold.expirationdate, '1 day ago' ) -%]
[%- formatted_date_prev = manip.UnixDate(date_prev,"%m/%d/%Y") -%]
Pick up hold on or before: [% formatted_date_prev %]

Hope this helps,

Katrin

On 07.12.22 12:06, Tomas Cohen Arazi wrote:
> Are you sure the MySQL syntax for dates works on Template::Toolkit?
>
> El mié, 7 dic 2022 5:59, Raymund Delahunty<r.delahunty at arts.ac.uk>
> escribió:
>
>> I had one last crack at this, as I realised I should be looking for users
>> whose datexpiry is **yesterday**, when preparing the ODUE email at 1am
>> after the account expires the previous day:
>> [% IF borrower.dateexpiry = DATE_SUB(CURDATE(), INTERVAL 1 DAY)  %]
>> That didn't work either- no ODUE sent at all, so I am giving up on the TT
>> for now.
>>
>> -----Original Message-----
>> From: Koha<koha-bounces at lists.katipo.co.nz>  On Behalf Of Raymund
>> Delahunty
>> Sent: 06 December 2022 08:07
>> To: Thomas Klausner<domm at plix.at>;koha at lists.katipo.co.nz
>> Subject: Re: [Koha] Template toolkit puzzle 1.
>>
>> Thanks Domm, for pointing out the typo, but that typo was only in the
>> email sent to the list. I have rerun two tests using two ‘bracketed’
>> versions and have received different results.
>> [% IF borrower.dateexpiry == CURDATE()  %] [% IF (borrower.dateexpiry =
>> CURDATE() ) %] The first version triggered the use of the second optional
>> wording wrongly, while the second version triggered the use of the first
>> wording wrongly. I have no idea what’s going on and might as well give up
>> on the TT code testing, which is very disappointing as I had high hopes for
>> improving our notices with the TT. (And especially if I could make it stop
>> sending notices in specific defined situations).
>> Ray Delahunty
>> University of the Arts London
>>
>>
>>
>>
>> .
>>
>> -----Original Message-----
>> From: Koha<koha-bounces at lists.katipo.co.nz>  On Behalf Of Thomas Klausner
>> Sent: 02 December 2022 06:57
>> To:koha at lists.katipo.co.nz
>> Subject: Re: [Koha] Template toolkit puzzle 1.
>>
>> Hi!
>>
>> On Fri, Dec 02, 2022 at 06:31:31AM +0000, Raymund Delahunty wrote:
>>
>>> But when I try to use a TT rule in the ODUE message, no email is sent at
>> all- there appears to be an error:
>>> [% IF (borrower.dateexpiry == CURDATE() %]
>> Hot sure how much pseudocode this is, but you're missing a closing
>> parenthesis after CURDATE():
>>
>>    [% IF (borrower.dateexpiry == CURDATE() ** ) ** %]
>>
>> Greetings,
>> domm
>>
>>
>> --
>> #!/usr/bin/perlhttps://domm.plix.at
>> for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
>> _______________________________________________
>>
>> Koha mailing listhttp://koha-community.org  Koha at lists.katipo.co.nz
>> Unsubscribe:https://lists.katipo.co.nz/mailman/listinfo/koha
>> This email and any attachments are intended solely for the addressee and
>> may contain confidential information. If you are not the intended recipient
>> of this email and/or its attachments you must not take any action based
>> upon them and you must not copy or show them to anyone. Please send the
>> email back to us and immediately and permanently delete it and its
>> attachments. Where this email is unrelated to the business of University of
>> the Arts London or of any of its group companies the opinions expressed in
>> it are the opinions of the sender and do not necessarily constitute those
>> of University of the Arts London (or the relevant group company). Where the
>> sender's signature indicates that the email is sent on behalf of UAL Short
>> Courses Limited the following also applies: UAL Short Courses Limited is a
>> company registered in England and Wales under company number 02361261.
>> Registered Office: University of the Arts London, 272 High Holborn, London
>> WC1V 7EY _______________________________________________
>>
>> Koha mailing listhttp://koha-community.org  Koha at lists.katipo.co.nz
>> Unsubscribe:https://lists.katipo.co.nz/mailman/listinfo/koha
>> This email and any attachments are intended solely for the addressee and
>> may contain confidential information. If you are not the intended recipient
>> of this email and/or its attachments you must not take any action based
>> upon them and you must not copy or show them to anyone. Please send the
>> email back to us and immediately and permanently delete it and its
>> attachments. Where this email is unrelated to the business of University of
>> the Arts London or of any of its group companies the opinions expressed in
>> it are the opinions of the sender and do not necessarily constitute those
>> of University of the Arts London (or the relevant group company). Where the
>> sender's signature indicates that the email is sent on behalf of UAL Short
>> Courses Limited the following also applies: UAL Short Courses Limited is a
>> company registered in England and Wales under company number 02361261.
>> Registered Office: University of the Arts London, 272 High Holborn, London
>> WC1V 7EY
>> _______________________________________________
>>
>> Koha mailing listhttp://koha-community.org
>> Koha at lists.katipo.co.nz
>> Unsubscribe:https://lists.katipo.co.nz/mailman/listinfo/koha
>>
> _______________________________________________
>
> Koha mailing listhttp://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe:https://lists.katipo.co.nz/mailman/listinfo/koha


More information about the Koha mailing list