[Koha-devel] TT notice question

Renvoize, Martin martin.renvoize at ptfs-europe.com
Thu Jan 4 20:25:23 CET 2024


It's probably context related.. perl and TT can be finicky.

.branchcode is a relation accessor as well as the column name so you may
need to call .branchcode.branchcode (ie the branchcode relation followed by
the same named column in the branches table branchcode.

Finally, your mixing <<>> and [%%] syntax. Whilst this does work, it's good
practice to switch as a whole.

As a last note, there's actually some TT helpers for this type of insert.

I'll dig out the docs for it and add a reply here when I'm not in my phone
;)

On Thu, 4 Jan 2024, 4:35 pm Stephen Graham via Koha-devel, <
koha-devel at lists.koha-community.org> wrote:

> Sorry, I was supposed to send this to the general Koha list – please
> ignore!!
>
>
>
> *From:* Koha-devel <koha-devel-bounces at lists.koha-community.org> *On
> Behalf Of *Stephen Graham via Koha-devel
> *Sent:* Thursday, January 4, 2024 4:34 PM
> *To:* koha-devel <koha-devel at lists.koha-community.org>
> *Subject:* [Koha-devel] TT notice question
>
>
>
> Hi All – not specifically Koha I guess, but maybe someone can explain why
> this happens. I had some TT in an email notice like:
>
>
>
> [% IF illrequests.branchcode ==  “CL” %]
>
> College Lane LRC
>
> [% ELSIF illrequests.branchcode == “DH” %]
>
> De Havilland LRC
>
> [% ELSE %]
>
> <<illrequests.branchcode>>
>
> [% END %]
>
>
>
> Every time I generated the email it printed CL, which is the value of
> llrequests.branchcode. I just could not get the first condition to work no
> matter what I did – it never printed College Lane LRC always CL. However, I
> changed it to:
>
>
>
> [% SET localbranch = illrequests.branchcode %]
>
>
>
> [% IF illrequests.branchcode ==  localbranch %]
>
> College Lane LRC
>
> [% ELSIF illrequests.branchcode == localbranch %]
>
> De Havilland LRC
>
> [% ELSE %]
>
> <<illrequests.branchcode>>
>
> [% END %]
>
>
>
> , and this works if I set the illrequests.branchcode to a local variable
> and then check this.
>
>
>
> Not sure why I have to do this? The example I have seen on the wiki look
> like I should be able to test a variable against a string using ==. Just
> couldn’t get it to work. Any ideas?
>
>
>
> Stephen
>
>
>
> --------------------------------------
>
> Stephen Graham
>
> Library Technology Consultant
>
> Library and Computing Services
>
>
>
> University of Hertfordshire
>
> Hatfield, Hertfordshire, AL10 9AB
>
>
>
> Email: s.graham4 at herts.ac.uk
>
> Website: herts.ac.uk
>
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : https://www.koha-community.org/
> git : https://git.koha-community.org/
> bugs : https://bugs.koha-community.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20240104/3b1dc92e/attachment-0001.htm>


More information about the Koha-devel mailing list