Bug 36109

Summary: Port default ODUE notice to Template Toolkit
Product: Koha Reporter: Emily Lamancusa (emlam) <emily.lamancusa>
Component: NoticesAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: andrew, caroline.cyr-la-rose, lisette, lucas, martin.renvoize, r.delahunty
Version: MainKeywords: RM_priority, roadmap_24_05
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17967
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 17976    
Bug Blocks: 15278    
Attachments: Bug 36109: Convert sample ODUE notice to TT
Digest with singular / plural dealt with
Bug 36109: Convert sample ODUE notice to TT
Bug 36109: Typo corrections

Description Emily Lamancusa (emlam) 2024-02-15 21:23:44 UTC
Bug 17967 added tests to show how the default ODUE notice at the time could be rendered in Template Toolkit - that patch could be used for reference here.

At the time, bug 17976 was filed to add a TT equivalent for <<items.fine>>. That bug is still in NEW status, and TemplateToolkit.t still has the related #FIXME. That may need to be added before updating this notice.

Strangely, the current default notice both says "Your library does not charge late fines" and lists the late fine. That contradiction should be corrected too. I'd be inclined to keep the listing of the late fine so it can serve as an example, and remove the sentence about not charging late fines.
Comment 1 Martin Renvoize (ashimema) 2024-10-01 08:42:37 UTC
So, you can get all charges for the checkouts, including overdue charges.. so we could plausibly convert the notice without any other code changes.

I'll take a look at creating the template.
Comment 2 Martin Renvoize (ashimema) 2024-10-01 15:02:18 UTC
Poping this here for reference:

[%- USE Price -%]
Dear [% borrower.firstname %] [% borrower.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.

[% branch.branchname %]
[% branch.branchaddress1 %]
[% branch.branchaddress2 %] [% branch.branchaddress3 %]
Phone: [% branch.branchphone %]
Fax: [% branch.branchfax %]
Email: [% branch.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:

[% FOREACH overdue IN overdues %]
[%~ SET item = overdue.item ~%]
"[% item.biblio.title %]" by [% item.biblio.author %], [% item.itemcallnumber %], Barcode: [% item.barcode %], Fine: [% overdue.overdue_fines.total_outstanding | \$Price %]
[% END %]
[% FOREACH overdue IN overdues %]
[%~ SET item = overdue.item ~%]
[% overdue.date_due | \$KohaDates %]\t[% item.biblio.title %]\t[% item.barcode %]\t[% item.biblio.author %]\t[% item.itemnumber %]
[% END %]

Thank-you for your prompt attention to this matter.

[% branch.branchname %] Staff


-----------

The above only works with 17976 applied, however you can get almost the same by replacing [% overdue.overdue_fines.total_outstanding | $Price %] with [% overdue.account_lines.total_outstanding | $Price %].  The only difference is that the later will include other related charges, like a rental.

-----------
What I'd be really interested in know is what people might like the 'perfect' notice to include.. we have the opportunity to 'upgrade' it here..
Comment 3 Martin Renvoize (ashimema) 2024-10-01 18:17:05 UTC
Created attachment 172285 [details] [review]
Bug 36109: Convert sample ODUE notice to TT

This is an initial submission to convert the existing <<>> sample notice
to TT.

We could do more here, like including the due date and making the fines
display more clearly optional.
Comment 4 Ray Delahunty 2024-10-04 07:19:30 UTC
Created attachment 172377 [details]
Digest with singular / plural dealt with
Comment 5 Ray Delahunty 2024-10-04 07:20:50 UTC
(In reply to Martin Renvoize (ashimema) from comment #2)
[...] 
> What I'd be really interested in know is what people might like the
> 'perfect' notice to include.. we have the opportunity to 'upgrade' it here..
Ah, the 'perfect notice'! We are doing lots of (relatively simple) work to improve our notices. One feature we find useful is the inclusion of the success / error counters in the AUTO_RENEWALS_DGST as it allows us to deal with singular & plural problems. We'd love to see counters available in other notices so we could use them. The screen grab of our DGST email shows how we have used the counters, and shows some other changes we have made (and exposes a puzzle that isn't relevant to the 'perfect notice' discussion).
Comment 6 Martin Renvoize (ashimema) 2024-10-08 09:31:14 UTC
I'm really impressed by what you've achieved there Ray, thanks for the example.
Comment 7 Lisette Scheer 2024-10-25 20:36:26 UTC
> What I'd be really interested in know is what people might like the
> 'perfect' notice to include.. we have the opportunity to 'upgrade' it here..

I always like to do things like:
[% IF branch.branchaddress2 %][% branch.branchaddress2 %][% END %]
So there aren't blank lines if there's no branchaddress2. 

Though I wonder if instead we might want to do a branch-address.inc that does all that logic for you, like with biblio-title.inc and patron_title.inc
Comment 8 Lucas Gass (lukeg) 2024-10-25 20:51:34 UTC
> What I'd be really interested in know is what people might like the
> 'perfect' notice to include.. we have the opportunity to 'upgrade' it here..

Is the perfect notice an HTML one, or no HTML? 

If I am printing a notice the perfect one fits within my envelope window when I fold it. 

If its emailed the perfect one includes HTML and is responsive to the device I am looking at it on.
Comment 9 Katrin Fischer 2024-11-14 14:41:57 UTC
The dependencies have been resolved, but time is a bit short with translations now.
Comment 10 Caroline Cyr La Rose 2024-12-18 20:04:43 UTC
(In reply to Emily Lamancusa (emlam) from comment #0)

> Strangely, the current default notice both says "Your library does not
> charge late fines" and lists the late fine. That contradiction should be
> corrected too. I'd be inclined to keep the listing of the late fine so it
> can serve as an example, and remove the sentence about not charging late
> fines.

Thank you! I was just coming here to say this :)

I think the current patch looks fine. It simply changes the syntax and the above sentence which is what the bug report is about.

The only minor things I would change are the capitalization of "Staff" at the end and the hypen in "Thank-you". But this is not a blocker for me.

If we enhance it, I'd like to see Lisette's suggestions of adding IFs to prevent blank lines included, but I wouldn't consider this a blocker either.

Also, I never understood why we include the library's address in the middle of the message, before the list of overdue items, which is the most important information IMO. If the patron needs the address, I would put it at the end with the signature. But I don't consider this a blocker either.
Comment 11 Caroline Cyr La Rose 2024-12-18 20:09:42 UTC
Created attachment 175673 [details] [review]
Bug 36109: Convert sample ODUE notice to TT

This is an initial submission to convert the existing <<>> sample notice
to TT.

We could do more here, like including the due date and making the fines
display more clearly optional.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 12 Caroline Cyr La Rose 2024-12-18 20:09:44 UTC
Created attachment 175674 [details] [review]
Bug 36109: Typo corrections
Comment 13 Caroline Cyr La Rose 2024-12-18 20:10:33 UTC
I added a mini patch for the "Thank-you" and "Staff"...