Bug 33350 - Show items info several times in notice content
Summary: Show items info several times in notice content
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Adolfo Rodríguez Taboada
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-28 09:16 UTC by Adolfo Rodríguez Taboada
Modified: 2024-03-01 17:13 UTC (History)
1 user (show)

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


Attachments
Allow to show item info several times in notices content (2.56 KB, patch)
2023-03-28 09:25 UTC, Adolfo Rodríguez Taboada
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Adolfo Rodríguez Taboada 2023-03-28 09:16:37 UTC
In Notices such as Overdue notice (ODUE) you may want to show more than once the info of the overdue items.

<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>

Some clients may want to have the info in several languages in the same notice, instead of having a different notice for every language.

Right now, if you put <item></item> more than once, it doesn't work properly, as the function GetPreparedLetter (C4/Letters.pm) does the following.

Example

<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>

<item>"<<biblio.title>>" de <<biblio.author>>, <<items.itemcallnumber>>, Código de barras: <<items.barcode>> Sanción: <<items.fine>></item>

It picks everything from the first <item> to the last </item> and replaces <<items.>> with their values. 

"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>

<item>"<<biblio.title>>" de <<biblio.author>>, <<items.itemcallnumber>>, Código de barras: <<items.barcode>> Sanción: <<items.fine>>

The result is a mess that looks like this:

The following item(s) is/are currently overdue:

"Sucker punch " by Hamilton, Laurell K., , Barcode: CPL22090005 Fine: $0.00

Los siguientes ejemplares tienen retrasos:

"Sucker punch " de Hamilton, Laurell K., , Código de barras: CPL22090005 Multa: $0.00
"Legion of Super-Heroes" by Levitz, Paul, , Barcode: CPL23010002 Fine: $0.00

Los siguientes ejemplares tienen retrasos:

"Legion of Super-Heroes" de Levitz, Paul, , Código de barras: CPL23010002 Multa: $0.00

It should pick the content between the first <item> and the first </item>, and then the same with the second pair, the third pair and so on.
Comment 1 Adolfo Rodríguez Taboada 2023-03-28 09:25:13 UTC
Created attachment 148796 [details] [review]
Allow to show item info several times in notices content

This patch allow to show correctly the info of the items more than once in a notice.

To test
1 Change you ODUE notice to something like this:

Dear <<borrowers.firstname>> <<borrowers.surname>>,

According to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible.

<<branches.branchname>>
<<branches.branchaddress1>>
<<branches.branchaddress2>> <<branches.branchaddress3>>
Phone: <<branches.branchphone>>
Fax: <<branches.branchfax>>
Email: <<branches.branchemail>>

If you have registered a password with the library, and you have a renewal available, you may renew online. If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned.

The following item(s) is/are currently overdue:

<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>

Thank-you for your prompt attention to this matter.

<<branches.branchname>> Staff

Estimado <<borrowers.firstname>> <<borrowers.surname>>,

De acuerdo con nuestros registros actuales, tiene artículos vencidos. Su biblioteca no cobra multas por demora, pero devuélvalos o renuévelos en la sucursal a continuación lo antes posible.

<<branches.branchname>>
<<branches.branchaddress1>>
<<branches.branchaddress2>> <<branches.branchaddress3>>
Teléfono: <<branches.branchphone>>
Fax: <<branches.branchfax>>
Email: <<branches.branchemail>>

Los siguientes ejemplares tienen retrasos:

<item>"<<biblio.title>>" de <<biblio.author>>, <<items.itemcallnumber>>, Código de barras: <<items.barcode>> Sanción: <<items.fine>></item>

Gracias por tu atención.

<<branches.branchname>> Equipo

2 Make sure you have patrons with overdue notices and that they will get the notice you have modified (email, print...)

3 Run the overdue notices cronjob misc/cronjobs/overdue_notices.pl -v

4 Check that the notice isn't generated as expected.

5 Apply patch, restart services

6 Run again the overdue notices cronjob misc/cronjobs/overdue_notices.pl -v

7 Check that the notice has been properly generated.
Comment 2 Lucas Gass (lukeg) 2024-03-01 17:13:06 UTC
Can't we already do this with Template Toolkit? Not sure if adding more complexity to GetPreparedLetter when there is another way to already do this.

But if we do add this I think it needs a unit test in this area.