How to show description of item type in ISSUESLIP
Hi Our notice ISSUESLIP does contain the following lines: <<biblio.title>> <<items.barcode>><br /> <<items.itype>><br /> Fällig am: <<issues.date_due>><br /> Unfortunately the content of field "items.itype" is coded, so the output of the middle line is just "06" or "20" instead of the actual description of the respectve item type (e. g. "CD" instead of 06, or "DVD" instead of 20). We have tried to replace "<<items.itype>><br />" by [% IF items.itype == '06' %] CD<br /> [% ELSIF items.itype == '20' %] DVD<br /> [% ELSE %] [% END %] or [% IF ( items.itype == '06' ) %] CD<br /> [% ELSIF ( items.itype == '20' ) %] DVD<br /> [% ELSE %] [% END %] or [% IF ( items.itype == '06' ) %] CD<br />[% END %] [% IF ( items.itype == '20' ) %] DVD<br />[% END %] or [% SWITCH items.itype %] [% CASE '06' %] CD<br /> [% CASE '20' %] DVD<br /> [% END %] or [% IF items.itype %] [% USE ItemTypes %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %] Though, none of these worked - nothing happened. Can anyone please tell me the correct way how to achieve this, if this is possible at all? Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch
Hi Michael, ISSUESLIP is not ready for TT syntax. See also bug 15283. Regards, Jonathan Le jeu. 16 mai 2019 à 09:40, Michael Kuhn <mik@adminkuhn.ch> a écrit :
Hi
Our notice ISSUESLIP does contain the following lines:
<<biblio.title>> <<items.barcode>><br /> <<items.itype>><br /> Fällig am: <<issues.date_due>><br />
Unfortunately the content of field "items.itype" is coded, so the output of the middle line is just "06" or "20" instead of the actual description of the respectve item type (e. g. "CD" instead of 06, or "DVD" instead of 20). We have tried to replace "<<items.itype>><br />" by
[% IF items.itype == '06' %] CD<br /> [% ELSIF items.itype == '20' %] DVD<br /> [% ELSE %] [% END %]
or
[% IF ( items.itype == '06' ) %] CD<br /> [% ELSIF ( items.itype == '20' ) %] DVD<br /> [% ELSE %] [% END %]
or
[% IF ( items.itype == '06' ) %] CD<br />[% END %] [% IF ( items.itype == '20' ) %] DVD<br />[% END %]
or
[% SWITCH items.itype %] [% CASE '06' %] CD<br /> [% CASE '20' %] DVD<br /> [% END %]
or
[% IF items.itype %] [% USE ItemTypes %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %]
Though, none of these worked - nothing happened. Can anyone please tell me the correct way how to achieve this, if this is possible at all?
Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
Sorry, I am completely wrong. See an example in the test file: t/db_dependent/Letters/TemplateToolkit.t The variable 'checkout' does not exist, you need to loop on 'checkouts' as there are several checkouts :) Le jeu. 16 mai 2019 à 13:42, Jonathan Druart <jonathan.druart@bugs.koha-community.org> a écrit :
Hi Michael,
ISSUESLIP is not ready for TT syntax. See also bug 15283.
Regards, Jonathan
Le jeu. 16 mai 2019 à 09:40, Michael Kuhn <mik@adminkuhn.ch> a écrit :
Hi
Our notice ISSUESLIP does contain the following lines:
<<biblio.title>> <<items.barcode>><br /> <<items.itype>><br /> Fällig am: <<issues.date_due>><br />
Unfortunately the content of field "items.itype" is coded, so the output of the middle line is just "06" or "20" instead of the actual description of the respectve item type (e. g. "CD" instead of 06, or "DVD" instead of 20). We have tried to replace "<<items.itype>><br />" by
[% IF items.itype == '06' %] CD<br /> [% ELSIF items.itype == '20' %] DVD<br /> [% ELSE %] [% END %]
or
[% IF ( items.itype == '06' ) %] CD<br /> [% ELSIF ( items.itype == '20' ) %] DVD<br /> [% ELSE %] [% END %]
or
[% IF ( items.itype == '06' ) %] CD<br />[% END %] [% IF ( items.itype == '20' ) %] DVD<br />[% END %]
or
[% SWITCH items.itype %] [% CASE '06' %] CD<br /> [% CASE '20' %] DVD<br /> [% END %]
or
[% IF items.itype %] [% USE ItemTypes %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %]
Though, none of these worked - nothing happened. Can anyone please tell me the correct way how to achieve this, if this is possible at all?
Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
And so, this should work: [% USE ItemTypes %] [% FOREACH checkout IN checkouts %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %] Le jeu. 16 mai 2019 à 13:46, Jonathan Druart <jonathan.druart@bugs.koha-community.org> a écrit :
Sorry, I am completely wrong.
See an example in the test file: t/db_dependent/Letters/TemplateToolkit.t The variable 'checkout' does not exist, you need to loop on 'checkouts' as there are several checkouts :)
Le jeu. 16 mai 2019 à 13:42, Jonathan Druart <jonathan.druart@bugs.koha-community.org> a écrit :
Hi Michael,
ISSUESLIP is not ready for TT syntax. See also bug 15283.
Regards, Jonathan
Le jeu. 16 mai 2019 à 09:40, Michael Kuhn <mik@adminkuhn.ch> a écrit :
Hi
Our notice ISSUESLIP does contain the following lines:
<<biblio.title>> <<items.barcode>><br /> <<items.itype>><br /> Fällig am: <<issues.date_due>><br />
Unfortunately the content of field "items.itype" is coded, so the output of the middle line is just "06" or "20" instead of the actual description of the respectve item type (e. g. "CD" instead of 06, or "DVD" instead of 20). We have tried to replace "<<items.itype>><br />" by
[% IF items.itype == '06' %] CD<br /> [% ELSIF items.itype == '20' %] DVD<br /> [% ELSE %] [% END %]
or
[% IF ( items.itype == '06' ) %] CD<br /> [% ELSIF ( items.itype == '20' ) %] DVD<br /> [% ELSE %] [% END %]
or
[% IF ( items.itype == '06' ) %] CD<br />[% END %] [% IF ( items.itype == '20' ) %] DVD<br />[% END %]
or
[% SWITCH items.itype %] [% CASE '06' %] CD<br /> [% CASE '20' %] DVD<br /> [% END %]
or
[% IF items.itype %] [% USE ItemTypes %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %]
Though, none of these worked - nothing happened. Can anyone please tell me the correct way how to achieve this, if this is possible at all?
Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
Hi Jonathan Thanks for the code! I have included it as follows, but in fact the whole thing is in another loop called "checkedout": <checkedout> <p> <<biblio.title>> <<items.barcode>><br /> [% USE ItemTypes %] [% FOREACH checkout IN checkouts %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %] Fällig am: <<issues.date_due>><br /> </p> </checkedout> I tested and there is some output now, but instead of Book1 Barcode1 ItemtypeOfBook1 Fällig am: DueDateBook1 Book2 Barcode2 ItemtypeOfBook2 Fällig am: DueDateBook2 it shows like this: Book1 Barcode1 ItemtypeOfBook1 ItemtypeOfBook2 Fällig am: DueDateBook1 Book2 Barcode2 ItemtypeOfBook1 ItemtypeOfBook2 Fällig am: DueDateBook2 Very often an issue slip does does contain more than two books so for example with seven checked out books for every single book all seven item types of all seven books are shown. Do maybe you know the solution to this problem? Unfortunately I couldn't find the place, where <checkedout></checkedout> or object variable "checkout" is documented. I have found Plugin "ItemTypes" in page https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit but it says it is "To be documented". Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch Am 16.05.19 um 20:52 schrieb Jonathan Druart:
And so, this should work:
[% USE ItemTypes %] [% FOREACH checkout IN checkouts %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %]
Le jeu. 16 mai 2019 à 13:46, Jonathan Druart <jonathan.druart@bugs.koha-community.org> a écrit :
Sorry, I am completely wrong.
See an example in the test file: t/db_dependent/Letters/TemplateToolkit.t The variable 'checkout' does not exist, you need to loop on 'checkouts' as there are several checkouts :)
Le jeu. 16 mai 2019 à 13:42, Jonathan Druart <jonathan.druart@bugs.koha-community.org> a écrit :
Hi Michael,
ISSUESLIP is not ready for TT syntax. See also bug 15283.
Regards, Jonathan
Le jeu. 16 mai 2019 à 09:40, Michael Kuhn <mik@adminkuhn.ch> a écrit :
Hi
Our notice ISSUESLIP does contain the following lines:
<<biblio.title>> <<items.barcode>><br /> <<items.itype>><br /> Fällig am: <<issues.date_due>><br />
Unfortunately the content of field "items.itype" is coded, so the output of the middle line is just "06" or "20" instead of the actual description of the respectve item type (e. g. "CD" instead of 06, or "DVD" instead of 20). We have tried to replace "<<items.itype>><br />" by
[% IF items.itype == '06' %] CD<br /> [% ELSIF items.itype == '20' %] DVD<br /> [% ELSE %] [% END %]
or
[% IF ( items.itype == '06' ) %] CD<br /> [% ELSIF ( items.itype == '20' ) %] DVD<br /> [% ELSE %] [% END %]
or
[% IF ( items.itype == '06' ) %] CD<br />[% END %] [% IF ( items.itype == '20' ) %] DVD<br />[% END %]
or
[% SWITCH items.itype %] [% CASE '06' %] CD<br /> [% CASE '20' %] DVD<br /> [% END %]
or
[% IF items.itype %] [% USE ItemTypes %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %]
Though, none of these worked - nothing happened. Can anyone please tell me the correct way how to achieve this, if this is possible at all?
Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
Replace the whole checkedout "loop" with the FOR loop The example in the test file should give you an idea about how to do that. El vie., 17 may. 2019 07:49, Michael Kuhn <mik@adminkuhn.ch> escribió:
Hi Jonathan
Thanks for the code! I have included it as follows, but in fact the whole thing is in another loop called "checkedout":
<checkedout> <p> <<biblio.title>> <<items.barcode>><br /> [% USE ItemTypes %] [% FOREACH checkout IN checkouts %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %] Fällig am: <<issues.date_due>><br /> </p> </checkedout>
I tested and there is some output now, but instead of
Book1 Barcode1 ItemtypeOfBook1 Fällig am: DueDateBook1
Book2 Barcode2 ItemtypeOfBook2 Fällig am: DueDateBook2
it shows like this:
Book1 Barcode1 ItemtypeOfBook1 ItemtypeOfBook2 Fällig am: DueDateBook1
Book2 Barcode2 ItemtypeOfBook1 ItemtypeOfBook2 Fällig am: DueDateBook2
Very often an issue slip does does contain more than two books so for example with seven checked out books for every single book all seven item types of all seven books are shown. Do maybe you know the solution to this problem?
Unfortunately I couldn't find the place, where <checkedout></checkedout> or object variable "checkout" is documented. I have found Plugin "ItemTypes" in page https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit but it says it is "To be documented".
Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch
Am 16.05.19 um 20:52 schrieb Jonathan Druart:
And so, this should work:
[% USE ItemTypes %] [% FOREACH checkout IN checkouts %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %]
Le jeu. 16 mai 2019 à 13:46, Jonathan Druart <jonathan.druart@bugs.koha-community.org> a écrit :
Sorry, I am completely wrong.
See an example in the test file:
t/db_dependent/Letters/TemplateToolkit.t
The variable 'checkout' does not exist, you need to loop on 'checkouts' as there are several checkouts :)
Le jeu. 16 mai 2019 à 13:42, Jonathan Druart <jonathan.druart@bugs.koha-community.org> a écrit :
Hi Michael,
ISSUESLIP is not ready for TT syntax. See also bug 15283.
Regards, Jonathan
Le jeu. 16 mai 2019 à 09:40, Michael Kuhn <mik@adminkuhn.ch> a écrit :
Hi
Our notice ISSUESLIP does contain the following lines:
<<biblio.title>> <<items.barcode>><br /> <<items.itype>><br /> Fällig am: <<issues.date_due>><br />
Unfortunately the content of field "items.itype" is coded, so the
output
of the middle line is just "06" or "20" instead of the actual description of the respectve item type (e. g. "CD" instead of 06, or "DVD" instead of 20). We have tried to replace "<<items.itype>><br />" by
[% IF items.itype == '06' %] CD<br /> [% ELSIF items.itype == '20' %] DVD<br /> [% ELSE %] [% END %]
or
[% IF ( items.itype == '06' ) %] CD<br /> [% ELSIF ( items.itype == '20' ) %] DVD<br /> [% ELSE %] [% END %]
or
[% IF ( items.itype == '06' ) %] CD<br />[% END %] [% IF ( items.itype == '20' ) %] DVD<br />[% END %]
or
[% SWITCH items.itype %] [% CASE '06' %] CD<br /> [% CASE '20' %] DVD<br /> [% END %]
or
[% IF items.itype %] [% USE ItemTypes %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %]
Though, none of these worked - nothing happened. Can anyone please tell me the correct way how to achieve this, if this is possible at all?
Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
Hi Jonathan
Replace the whole checkedout "loop" with the FOR loop The example in the test file should give you an idea about how to do that.
What test file do you mean? I can't find any hint on what the construct "<checkedout></checkedout>" actually does, neither in the Koha wiki nor in the Koha manual. Unfortunately I don't seem to understand the different concepts between <checkedout></checkedout> and TT-Plugins at all... Indeed the page https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit says "You can mix an match (use hungry alligators <<biblio.title>> together with TT syntax) in one notice template" but after all it's me who's all mixed up... Can you please enlighten me, or give me the link to some kind of documentation? Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch
El vie., 17 may. 2019 07:49, Michael Kuhn <mik@adminkuhn.ch <mailto:mik@adminkuhn.ch>> escribió:
Hi Jonathan
Thanks for the code! I have included it as follows, but in fact the whole thing is in another loop called "checkedout":
<checkedout> <p> <<biblio.title>> <<items.barcode>><br /> [% USE ItemTypes %] [% FOREACH checkout IN checkouts %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %] Fällig am: <<issues.date_due>><br /> </p> </checkedout>
I tested and there is some output now, but instead of
Book1 Barcode1 ItemtypeOfBook1 Fällig am: DueDateBook1
Book2 Barcode2 ItemtypeOfBook2 Fällig am: DueDateBook2
it shows like this:
Book1 Barcode1 ItemtypeOfBook1 ItemtypeOfBook2 Fällig am: DueDateBook1
Book2 Barcode2 ItemtypeOfBook1 ItemtypeOfBook2 Fällig am: DueDateBook2
Very often an issue slip does does contain more than two books so for example with seven checked out books for every single book all seven item types of all seven books are shown. Do maybe you know the solution to this problem?
Unfortunately I couldn't find the place, where <checkedout></checkedout> or object variable "checkout" is documented. I have found Plugin "ItemTypes" in page https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit but it says it is "To be documented".
Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch <mailto:mik@adminkuhn.ch> · W www.adminkuhn.ch <http://www.adminkuhn.ch>
Am 16.05.19 um 20:52 schrieb Jonathan Druart: > And so, this should work: > > [% USE ItemTypes %] > [% FOREACH checkout IN checkouts %] > [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> > [% END %] > > Le jeu. 16 mai 2019 à 13:46, Jonathan Druart > <jonathan.druart@bugs.koha-community.org <mailto:jonathan.druart@bugs.koha-community.org>> a écrit : >> >> Sorry, I am completely wrong. >> >> See an example in the test file: t/db_dependent/Letters/TemplateToolkit.t >> The variable 'checkout' does not exist, you need to loop on >> 'checkouts' as there are several checkouts :) >> >> Le jeu. 16 mai 2019 à 13:42, Jonathan Druart >> <jonathan.druart@bugs.koha-community.org <mailto:jonathan.druart@bugs.koha-community.org>> a écrit : >>> >>> Hi Michael, >>> >>> ISSUESLIP is not ready for TT syntax. >>> See also bug 15283. >>> >>> Regards, >>> Jonathan >>> >>> Le jeu. 16 mai 2019 à 09:40, Michael Kuhn <mik@adminkuhn.ch <mailto:mik@adminkuhn.ch>> a écrit : >>>> >>>> Hi >>>> >>>> Our notice ISSUESLIP does contain the following lines: >>>> >>>> <<biblio.title>> <<items.barcode>><br /> >>>> <<items.itype>><br /> >>>> Fällig am: <<issues.date_due>><br /> >>>> >>>> Unfortunately the content of field "items.itype" is coded, so the output >>>> of the middle line is just "06" or "20" instead of the actual >>>> description of the respectve item type (e. g. "CD" instead of 06, or >>>> "DVD" instead of 20). We have tried to replace "<<items.itype>><br />" by >>>> >>>> [% IF items.itype == '06' %] CD<br /> >>>> [% ELSIF items.itype == '20' %] DVD<br /> >>>> [% ELSE %] >>>> [% END %] >>>> >>>> or >>>> >>>> [% IF ( items.itype == '06' ) %] CD<br /> >>>> [% ELSIF ( items.itype == '20' ) %] DVD<br /> >>>> [% ELSE %] >>>> [% END %] >>>> >>>> or >>>> >>>> [% IF ( items.itype == '06' ) %] CD<br />[% END %] >>>> [% IF ( items.itype == '20' ) %] DVD<br />[% END %] >>>> >>>> or >>>> >>>> [% SWITCH items.itype %] >>>> [% CASE '06' %] CD<br /> >>>> [% CASE '20' %] DVD<br /> >>>> [% END %] >>>> >>>> or >>>> >>>> [% IF items.itype %] >>>> [% USE ItemTypes %] >>>> [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> >>>> [% END %] >>>> >>>> Though, none of these worked - nothing happened. Can anyone please tell >>>> me the correct way how to achieve this, if this is possible at all? >>>> >>>> Best wishes: Michael >>>> -- >>>> Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis >>>> Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz >>>> T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch <mailto:mik@adminkuhn.ch> · W www.adminkuhn.ch <http://www.adminkuhn.ch> >>>> _______________________________________________ >>>> Koha mailing list http://koha-community.org >>>> Koha@lists.katipo.co.nz <mailto:Koha@lists.katipo.co.nz> >>>> https://lists.katipo.co.nz/mailman/listinfo/koha >
-- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch
Hi Michael, This test https://gitlab.com/koha-community/Koha/blob/master/t/db_dependent/Letters/Te... will show you the exact equivalent of the template ISSUESLIP using the TT syntax. You can use both syntax in the same template, but you have to use the variables that exist. Which means you shouldn't use the TT syntax inside a <checkedout> loop. I would suggest you to rewrite the whole template using the TT syntax, it will make it easier to write and more readable. Regards, Jonathan El vie., 17 may. 2019 11:17, Michael Kuhn <mik@adminkuhn.ch> escribió:
Hi Jonathan
Replace the whole checkedout "loop" with the FOR loop The example in the test file should give you an idea about how to do that.
What test file do you mean? I can't find any hint on what the construct "<checkedout></checkedout>" actually does, neither in the Koha wiki nor in the Koha manual.
Unfortunately I don't seem to understand the different concepts between <checkedout></checkedout> and TT-Plugins at all...
Indeed the page https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit says "You can mix an match (use hungry alligators <<biblio.title>> together with TT syntax) in one notice template" but after all it's me who's all mixed up...
Can you please enlighten me, or give me the link to some kind of documentation?
Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch
El vie., 17 may. 2019 07:49, Michael Kuhn <mik@adminkuhn.ch <mailto:mik@adminkuhn.ch>> escribió:
Hi Jonathan
Thanks for the code! I have included it as follows, but in fact the whole thing is in another loop called "checkedout":
<checkedout> <p> <<biblio.title>> <<items.barcode>><br /> [% USE ItemTypes %] [% FOREACH checkout IN checkouts %] [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> [% END %] Fällig am: <<issues.date_due>><br /> </p> </checkedout>
I tested and there is some output now, but instead of
Book1 Barcode1 ItemtypeOfBook1 Fällig am: DueDateBook1
Book2 Barcode2 ItemtypeOfBook2 Fällig am: DueDateBook2
it shows like this:
Book1 Barcode1 ItemtypeOfBook1 ItemtypeOfBook2 Fällig am: DueDateBook1
Book2 Barcode2 ItemtypeOfBook1 ItemtypeOfBook2 Fällig am: DueDateBook2
Very often an issue slip does does contain more than two books so for example with seven checked out books for every single book all seven item types of all seven books are shown. Do maybe you know the solution to this problem?
Unfortunately I couldn't find the place, where <checkedout></checkedout> or object variable "checkout" is documented. I have found Plugin "ItemTypes" in page https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit but it says it is "To be documented".
Best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch <mailto:mik@adminkuhn.ch> · W www.adminkuhn.ch < http://www.adminkuhn.ch>
Am 16.05.19 um 20:52 schrieb Jonathan Druart: > And so, this should work: > > [% USE ItemTypes %] > [% FOREACH checkout IN checkouts %] > [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> > [% END %] > > Le jeu. 16 mai 2019 à 13:46, Jonathan Druart > <jonathan.druart@bugs.koha-community.org <mailto:jonathan.druart@bugs.koha-community.org>> a écrit : >> >> Sorry, I am completely wrong. >> >> See an example in the test file: t/db_dependent/Letters/TemplateToolkit.t >> The variable 'checkout' does not exist, you need to loop on >> 'checkouts' as there are several checkouts :) >> >> Le jeu. 16 mai 2019 à 13:42, Jonathan Druart >> <jonathan.druart@bugs.koha-community.org <mailto:jonathan.druart@bugs.koha-community.org>> a écrit : >>> >>> Hi Michael, >>> >>> ISSUESLIP is not ready for TT syntax. >>> See also bug 15283. >>> >>> Regards, >>> Jonathan >>> >>> Le jeu. 16 mai 2019 à 09:40, Michael Kuhn <mik@adminkuhn.ch <mailto:mik@adminkuhn.ch>> a écrit : >>>> >>>> Hi >>>> >>>> Our notice ISSUESLIP does contain the following lines: >>>> >>>> <<biblio.title>> <<items.barcode>><br /> >>>> <<items.itype>><br /> >>>> Fällig am: <<issues.date_due>><br /> >>>> >>>> Unfortunately the content of field "items.itype" is coded, so the output >>>> of the middle line is just "06" or "20" instead of the actual >>>> description of the respectve item type (e. g. "CD" instead of 06, or >>>> "DVD" instead of 20). We have tried to replace "<<items.itype>><br />" by >>>> >>>> [% IF items.itype == '06' %] CD<br /> >>>> [% ELSIF items.itype == '20' %] DVD<br /> >>>> [% ELSE %] >>>> [% END %] >>>> >>>> or >>>> >>>> [% IF ( items.itype == '06' ) %] CD<br /> >>>> [% ELSIF ( items.itype == '20' ) %] DVD<br /> >>>> [% ELSE %] >>>> [% END %] >>>> >>>> or >>>> >>>> [% IF ( items.itype == '06' ) %] CD<br />[% END %] >>>> [% IF ( items.itype == '20' ) %] DVD<br />[% END %] >>>> >>>> or >>>> >>>> [% SWITCH items.itype %] >>>> [% CASE '06' %] CD<br /> >>>> [% CASE '20' %] DVD<br /> >>>> [% END %] >>>> >>>> or >>>> >>>> [% IF items.itype %] >>>> [% USE ItemTypes %] >>>> [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %]<br /> >>>> [% END %] >>>> >>>> Though, none of these worked - nothing happened. Can anyone please tell >>>> me the correct way how to achieve this, if this is possible at all? >>>> >>>> Best wishes: Michael >>>> -- >>>> Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis >>>> Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz >>>> T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch <mailto:mik@adminkuhn.ch> · W www.adminkuhn.ch < http://www.adminkuhn.ch> >>>> _______________________________________________ >>>> Koha mailing list http://koha-community.org >>>> Koha@lists.katipo.co.nz <mailto:Koha@lists.katipo.co.nz> >>>> https://lists.katipo.co.nz/mailman/listinfo/koha >
-- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch
Hi Jonathan
Replace the whole checkedout "loop" with the FOR loop The example in the test file should give you an idea about how to do that.
I have now replaced the original loop: <checkedout> <p> <<biblio.title>> <<items.barcode>><br /> Fällig am: <<issues.date_due>><br /> </p> </checkedout> with the following: [% FOREACH checkout IN checkouts %] [%~ SET item = checkout.item %] [%~ SET biblio = checkout.item.biblio %] <p>[% biblio.title %] [% item.barcode %]<br /> [% SWITCH item.itype %] [% CASE '01' %] Kinder-/Jugendbuch<br /> [% CASE '02' %] Sachbuch<br /> [% CASE '03' %] Schöne Literatur<br /> [% CASE '05' %] Cassetten<br /> [% CASE '06' %] CD<br /> [% CASE '07' %] Zeitschriften<br /> [% CASE '08' %] Präsenzmedien<br /> [% CASE '09' %] Fernleihen<br /> [% CASE '10' %] Kinder-/Jugendbuch Sene<br /> [% CASE '13' %] Englische Literatur<br /> [% CASE '14' %] Frz. Literatur<br /> [% CASE '16' %] Hörbuch / CD<br /> [% CASE '17' %] Wanderausstellung<br /> [% CASE '18' %] Krimi, Thriller<br /> [% CASE '19' %] Historische Literatur<br /> [% CASE '20' %] DVD<br /> [% CASE '21' %] Leihring<br /> [% CASE '22' %] Spiele<br /> [% CASE '23' %] Weihnachten<br /> [% CASE '24' %] E-Medium<br /> [% END %] Fällig am: [% checkout.date_due %]<br /></p> [% END %] This works as expected. Many thanks & best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch
Hi Michael and Jonathan, I wanted to add this to the wiki and found that Joseph has added another variation that might be a little more elegant as it doesn't require you to change the notice template when changing itemtypes: https://wiki.koha-community.org/wiki/Notices_and_Slips_Library#Checkouts_sli... It uses: [% USE ItemTypes %] and: [% ItemTypes.GetDescription(checkout.item.effective_itemtype) %] Hope this helps, Katrin On 28.05.19 15:11, Michael Kuhn wrote:
Hi Jonathan
Replace the whole checkedout "loop" with the FOR loop The example in the test file should give you an idea about how to do that.
I have now replaced the original loop:
<checkedout> <p> <<biblio.title>> <<items.barcode>><br /> Fällig am: <<issues.date_due>><br /> </p> </checkedout>
with the following:
[% FOREACH checkout IN checkouts %] [%~ SET item = checkout.item %] [%~ SET biblio = checkout.item.biblio %] <p>[% biblio.title %] [% item.barcode %]<br /> [% SWITCH item.itype %] [% CASE '01' %] Kinder-/Jugendbuch<br /> [% CASE '02' %] Sachbuch<br /> [% CASE '03' %] Schöne Literatur<br /> [% CASE '05' %] Cassetten<br /> [% CASE '06' %] CD<br /> [% CASE '07' %] Zeitschriften<br /> [% CASE '08' %] Präsenzmedien<br /> [% CASE '09' %] Fernleihen<br /> [% CASE '10' %] Kinder-/Jugendbuch Sene<br /> [% CASE '13' %] Englische Literatur<br /> [% CASE '14' %] Frz. Literatur<br /> [% CASE '16' %] Hörbuch / CD<br /> [% CASE '17' %] Wanderausstellung<br /> [% CASE '18' %] Krimi, Thriller<br /> [% CASE '19' %] Historische Literatur<br /> [% CASE '20' %] DVD<br /> [% CASE '21' %] Leihring<br /> [% CASE '22' %] Spiele<br /> [% CASE '23' %] Weihnachten<br /> [% CASE '24' %] E-Medium<br /> [% END %] Fällig am: [% checkout.date_due %]<br /></p> [% END %]
This works as expected.
Many thanks & best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
I saw now that you had some issues with that syntax. I've added your code as another example to the wiki: https://wiki.koha-community.org/wiki/Notices_and_Slips_Library#Checkouts_sli... On 01.06.19 10:28, Katrin Fischer wrote:
Hi Michael and Jonathan,
I wanted to add this to the wiki and found that Joseph has added another variation that might be a little more elegant as it doesn't require you to change the notice template when changing itemtypes:
https://wiki.koha-community.org/wiki/Notices_and_Slips_Library#Checkouts_sli...
It uses:
[% USE ItemTypes %]
and:
[% ItemTypes.GetDescription(checkout.item.effective_itemtype) %] Hope this helps, Katrin
On 28.05.19 15:11, Michael Kuhn wrote:
Hi Jonathan
Replace the whole checkedout "loop" with the FOR loop The example in the test file should give you an idea about how to do that.
I have now replaced the original loop:
<checkedout> <p> <<biblio.title>> <<items.barcode>><br /> Fällig am: <<issues.date_due>><br /> </p> </checkedout>
with the following:
[% FOREACH checkout IN checkouts %] [%~ SET item = checkout.item %] [%~ SET biblio = checkout.item.biblio %] <p>[% biblio.title %] [% item.barcode %]<br /> [% SWITCH item.itype %] [% CASE '01' %] Kinder-/Jugendbuch<br /> [% CASE '02' %] Sachbuch<br /> [% CASE '03' %] Schöne Literatur<br /> [% CASE '05' %] Cassetten<br /> [% CASE '06' %] CD<br /> [% CASE '07' %] Zeitschriften<br /> [% CASE '08' %] Präsenzmedien<br /> [% CASE '09' %] Fernleihen<br /> [% CASE '10' %] Kinder-/Jugendbuch Sene<br /> [% CASE '13' %] Englische Literatur<br /> [% CASE '14' %] Frz. Literatur<br /> [% CASE '16' %] Hörbuch / CD<br /> [% CASE '17' %] Wanderausstellung<br /> [% CASE '18' %] Krimi, Thriller<br /> [% CASE '19' %] Historische Literatur<br /> [% CASE '20' %] DVD<br /> [% CASE '21' %] Leihring<br /> [% CASE '22' %] Spiele<br /> [% CASE '23' %] Weihnachten<br /> [% CASE '24' %] E-Medium<br /> [% END %] Fällig am: [% checkout.date_due %]<br /></p> [% END %]
This works as expected.
Many thanks & best wishes: Michael -- Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz T 0041 (0)61 261 55 61 · E mik@adminkuhn.ch · W www.adminkuhn.ch _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
participants (3)
-
Jonathan Druart -
Katrin Fischer -
Michael Kuhn