Bug 31656 - Expand TT access for CHECKOUT notice
Summary: Expand TT access for CHECKOUT notice
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-29 16:48 UTC by Caroline Cyr La Rose
Modified: 2024-03-05 21:50 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2022-09-29 16:48:45 UTC
The FOREACH loop TT syntax doesn't work in the CHECKOUT notice. I suspect this is due to it being generated in C4/Circulation.pm, as described here https://wiki.koha-community.org/wiki/Customising_Notices_and_Slips#Notice_Specific_Markup

You can only use four dashes to repeat information in this notice.

To test:
1. Edit the CHECKOUT notice
1.1. Go to Tools > Notices and slips
1.2. Search for the CHECKOUT notice and click Edit
1.3. In the Email tab, use the following code for the letter (should be the one by default)

The following items have been checked out:
----
[% biblio.title %]
----
Thank you for visiting [% branch.branchname %].

1.4. Save

2. In a patron file, choose to get the Item checkout email notice
2.1. Go to a patron file
2.2. Click on the Edit button next to the patron messaging preferences table
2.3. Check Email for the Item checkout
2.4. Save

3. Check out items to the same patron
3.1. Go to the Check out tab in the patron file
3.2. Check out at least two items

4. Check the generated notice
4.1. Go to the Notices tab in the patron file
4.2. Click on the Checkouts notice to view the contents
--> It should show both titles

5. Change the CHECKOUT notice, redo steps 1.x using the following letter content

The following items have been checked out:

[% FOREACH checkout IN checkouts %]
[%~ SET item = checkout.item %]
[%~ SET biblio = checkout.item.biblio %]
[% biblio.title %]
[% END %]

Thank you for visiting [% branch.branchname %].

6. Try checking out again, redo steps 2-4 with a different patron
--> There are no titles and the letter is repeated twice
Comment 1 Caroline Cyr La Rose 2022-09-29 17:02:06 UTC
As for the use case for this, I had a library who wanted to use the CHECKOUT emails instead of printing the ISSUESLIP. They also wanted the value of items like it is possible to get in the ISSUESLIP https://wiki.koha-community.org/wiki/Notices_and_Slips_Library#Add_total_value_of_items_on_issue_slip

Adding the price to totalValue doesn't work when using four dashes. In the end, it only shows one of the prices.

This is what I tried (among many things)



[%- USE KohaDates -%]
[%- USE Price -%]
[% totalValue = 0 %]
<p>Hello [% borrower.firstname %] [% borrower.surname %] </p>

<p>You have checked out the following items:</p>

----
[% totalValue = item.price + totalValue %]
<p>[% biblio.title %]<br />
Barcode: [% item.barcode %]<br />
Due date: [% checkout.date_due | $KohaDates %]<br/>
Value: [% item.price %]</p>
----

<p>You saved [% totalValue | $Price %] by using the library today!</p>

<p>The [% branch.branchname %] team</p>



And this is the result



Hello Henry Acevedo

You have checked out the following items:

1492
Barcode: 000687
Due date: 10/13/2022
Value: 12.95

A Book of Scoundrels
Barcode: 000629
Due date: 10/13/2022
Value: 18.95

You saved 18.95 by using the library today!

The Centerville team


As you can see, it doesn't add the two values.