Bug 28732

Summary: Order and claim emails don't work well with repeatable information
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: NoticesAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: 20.05   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Katrin Fischer 2021-07-21 16:20:23 UTC
There is an issue with how the repeatable part of the notice is figured out. This sets some strict limits to how you can write the notice template. It appears that the repeat will happen from first to the last placeholder from an acq table used in the notice. The <order> tags don't appear to be used at all.

Test plan: 
- Create a basket with more than one order line
- Set up a notice called ACQORDER for sending order emails (templats below)
- Make sure the vendor has an email set and all checkboxes in the contact are checked
- Make sure your system can send emails
- Click button "send order e-mail" on the basket summary page


------------------------------------------------

ACQORDER TEMPLATE 1:

[%- USE Price -%]
Dear...<br>
<br>
<order><b>Title:</b> <<biblio.title>><br /><b>Author:</b> <<biblio.author>><br /><b>Edition:</b> <<biblioitems.editionstatement>><br /><b>Year:</b> <<biblio.copyrightdate>><br /><b>ISBN:</b> <<biblioitems.isbn>><br /><b>Units:</b> <<aqorders.quantity>><br /><b>Price:</b> [% <<aqorders.listprice>> | $Price %] EUR<br><br></order>

<br><br>
Thank you!


RESULT: Dear and Thank you only appear once. OK.

Dear...

Title: ...
Author: ...
Edition: 1. Auflage, Originalausgabe
Year: 
ISBN: 9783839225837
Units: 1
Price: 13.99 EUR 

Title: ...
Author: 
Edition: 
Year: 2020
ISBN: 
Units: 1
Price: 13.00 EUR 

Thank you! 


------------------------------------------------

ACQORDER TEMPLATE 2: Only addition/change is the second line.

[%- USE Price -%]
<h2>Order: <<aqbasket.basketname>></h2>
Dear...<br>
<br>
<order><b>Title:</b> <<biblio.title>><br /><b>Author:</b> <<biblio.author>><br /><b>Edition:</b> <<biblioitems.editionstatement>><br /><b>Year:</b> <<biblio.copyrightdate>><br /><b>ISBN:</b> <<biblioitems.isbn>><br /><b>Units:</b> <<aqorders.quantity>><br /><b>Price:</b> [% <<aqorders.listprice>> | $Price %] EUR<br><br></order>
</hr>

<br><br>
Thank you!


RESULT: Order:... and Dear... lines are repeated. For information from the basket this doesn't make sense. If you add a field from the branches table, this doesn't appear to cause any additional repeats.

Order: 28.4.2021
Dear...

Title: ...
Author: ...
Edition: 1. Auflage, Originalausgabe
Year: 
ISBN: 9783839225837
Units: 1
Price: 13.99 EUR 
Order: 28.4.2021
Dear...

Title: ...
Author: 
Edition: 
Year: 2020
ISBN: 
Units: 1
Price: 13.00 EUR 

Thank you!