Hi Martin – be great to have a look at the docs when you can send them.  Seems 
that I’ve got a lot to learn!

So, when you start to use TT syntax in notices then the best practice is to not 
use the standard <<>> “variables”, but to use TT syntax ONLY throughout the 
notice?

Cheers, Stephen

From: Renvoize, Martin <martin.renvo...@ptfs-europe.com>
Sent: Thursday, January 4, 2024 7:25 PM
To: Stephen Graham <s.grah...@herts.ac.uk>
Cc: koha-devel <koha-devel@lists.koha-community.org>
Subject: Re: [Koha-devel] TT notice question

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@lists.koha-community.org<mailto:koha-devel@lists.koha-community.org>>
 wrote:
Sorry, I was supposed to send this to the general Koha list – please ignore!!

From: Koha-devel 
<koha-devel-boun...@lists.koha-community.org<mailto:koha-devel-boun...@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@lists.koha-community.org<mailto:koha-devel@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.grah...@herts.ac.uk<mailto:s.grah...@herts.ac.uk>
Website: herts.ac.uk<http://herts.ac.uk>

_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org<mailto:Koha-devel@lists.koha-community.org>
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel>
website : https://www.koha-community.org/<https://www.koha-community.org>
git : https://git.koha-community.org/<https://git.koha-community.org>
bugs : https://bugs.koha-community.org/<https://bugs.koha-community.org>
_______________________________________________
Koha-devel mailing list
Koha-devel@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/

Reply via email to