Bug 17976 - TT syntax for notices - Add an equivalence for items.fine
Summary: TT syntax for notices - Add an equivalence for items.fine
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Kyle M Hall (khall)
URL:
Keywords:
Depends on: 22421 14757
Blocks: 36109 36110
  Show dependency treegraph
 
Reported: 2017-01-23 18:01 UTC by Jonathan Druart
Modified: 2024-11-11 16:48 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch adds an easy accessor method for fetching a checkouts overdue fines. This is of particular interest to notice template authors as you can now use the following snippet in your notices: `[% overdue.overdue_fines.total_outstanding | $Price %]`
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 17976: Update test to include fines (2.09 KB, patch)
2024-10-01 14:57 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 17976: Add overdue_fines accessor to Koha::Checkout (1.22 KB, patch)
2024-10-01 14:57 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 17976: Unit tests (2.75 KB, patch)
2024-10-01 15:46 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 17976: Update test to include fines (2.16 KB, patch)
2024-10-02 13:58 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 17976: Add overdue_fines accessor to Koha::Checkout (1.29 KB, patch)
2024-10-02 13:58 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 17976: Unit tests (2.82 KB, patch)
2024-10-02 13:58 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 17976: Update test to include fines (2.24 KB, patch)
2024-10-02 18:35 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 17976: Add overdue_fines accessor to Koha::Checkout (1.36 KB, patch)
2024-10-02 18:36 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 17976: Unit tests (2.89 KB, patch)
2024-10-02 18:36 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 17976: (QA follow-up) Tidy code (7.75 KB, patch)
2024-10-02 18:36 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 17976: (QA follow-up) Add missing transaction rollback (1.70 KB, patch)
2024-11-11 13:20 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2017-01-23 18:01:32 UTC
The items.fine is a trick of our historical syntax.
We need to provide a way to access this value from the a notice template using the TT syntax.
Comment 1 Martin Renvoize (ashimema) 2020-10-12 08:09:23 UTC
[% checkout.overdue_fine.amount | $Price %] feels like the 'right' syntax for this to me.. problem is, half the relations don't exist yet to do that.. and worse still we've not got the constraints either.
Comment 2 Katrin Fischer 2020-10-18 17:06:33 UTC
[% checkout.overdue_fine.amount | $Price %] would work for me - I imagine overdue_fine could be used to pull other values from the account line?
Comment 3 Martin Renvoize (ashimema) 2024-10-01 14:57:27 UTC
Created attachment 172277 [details] [review]
Bug 17976: Update test to include fines

This patch updates the existing test to include checking the alternative
to items.fine syntax.

We could use the account_lines relation, however that would include
other charges linked to the checkout, for example rental charges.

I opt to add a new accessor to give us more options and refine to just
overdue fines.
Comment 4 Martin Renvoize (ashimema) 2024-10-01 14:57:29 UTC
Created attachment 172278 [details] [review]
Bug 17976: Add overdue_fines accessor to Koha::Checkout

This patch adds a new filtered relation accessor to the Koha::Checkout
object to return just overdue fine type account lines related to the
checkout.

Whilst this is easy to chain in code, it's not available via TT and so
this accessor is useful for the notices case.
Comment 5 Martin Renvoize (ashimema) 2024-10-01 14:58:47 UTC
Unit test inbound
Comment 6 Martin Renvoize (ashimema) 2024-10-01 15:46:30 UTC
Created attachment 172283 [details] [review]
Bug 17976: Unit tests

Add unit tests for the newly introduced overdue fines relation accessor.
Comment 7 Martin Renvoize (ashimema) 2024-10-01 15:48:23 UTC
This is mostly behind the scenes stuff.. i.e the test plan is to run the included unit tests.

The real benefit will be for bug 36109 where I intend to add a new sample notice for ODUE
Comment 8 Emily Lamancusa (emlam) 2024-10-02 13:58:22 UTC
Created attachment 172304 [details] [review]
Bug 17976: Update test to include fines

This patch updates the existing test to include checking the alternative
to items.fine syntax.

We could use the account_lines relation, however that would include
other charges linked to the checkout, for example rental charges.

I opt to add a new accessor to give us more options and refine to just
overdue fines.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 9 Emily Lamancusa (emlam) 2024-10-02 13:58:23 UTC
Created attachment 172305 [details] [review]
Bug 17976: Add overdue_fines accessor to Koha::Checkout

This patch adds a new filtered relation accessor to the Koha::Checkout
object to return just overdue fine type account lines related to the
checkout.

Whilst this is easy to chain in code, it's not available via TT and so
this accessor is useful for the notices case.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 10 Emily Lamancusa (emlam) 2024-10-02 13:58:25 UTC
Created attachment 172306 [details] [review]
Bug 17976: Unit tests

Add unit tests for the newly introduced overdue fines relation accessor.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 11 Emily Lamancusa (emlam) 2024-10-02 14:02:04 UTC
This is great, thanks Martin!
Comment 12 Kyle M Hall (khall) 2024-10-02 18:35:55 UTC
Created attachment 172328 [details] [review]
Bug 17976: Update test to include fines

This patch updates the existing test to include checking the alternative
to items.fine syntax.

We could use the account_lines relation, however that would include
other charges linked to the checkout, for example rental charges.

I opt to add a new accessor to give us more options and refine to just
overdue fines.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 13 Kyle M Hall (khall) 2024-10-02 18:36:02 UTC
Created attachment 172329 [details] [review]
Bug 17976: Add overdue_fines accessor to Koha::Checkout

This patch adds a new filtered relation accessor to the Koha::Checkout
object to return just overdue fine type account lines related to the
checkout.

Whilst this is easy to chain in code, it's not available via TT and so
this accessor is useful for the notices case.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 14 Kyle M Hall (khall) 2024-10-02 18:36:05 UTC
Created attachment 172330 [details] [review]
Bug 17976: Unit tests

Add unit tests for the newly introduced overdue fines relation accessor.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 15 Kyle M Hall (khall) 2024-10-02 18:36:07 UTC
Created attachment 172331 [details] [review]
Bug 17976: (QA follow-up) Tidy code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 16 Kyle M Hall (khall) 2024-10-02 18:37:15 UTC
PQA but blocked by 22421
Comment 17 Katrin Fischer 2024-10-24 07:14:22 UTC
I'd really really like to have this. 

Can we resolve the FQA on the dependent bug 22421 somehow?
Comment 18 Katrin Fischer 2024-11-08 11:34:14 UTC
(In reply to Katrin Fischer from comment #17)
> I'd really really like to have this. 
> 
> Can we resolve the FQA on the dependent bug 22421 somehow?

I have 22421 on my branch, but have trouble with the Tidy Code patch from Kyle giving me an sha1 error. I will leave it out for now.
Comment 19 Katrin Fischer 2024-11-08 11:46:01 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 20 Martin Renvoize (ashimema) 2024-11-11 13:20:41 UTC
Created attachment 174324 [details] [review]
Bug 17976: (QA follow-up) Add missing transaction rollback

We were missing the transaction wrapper for the overdue_fines test added
in this patchset.  This caused problems in subsequent tests.
Comment 21 Katrin Fischer 2024-11-11 13:56:42 UTC
Follow-up picked for main.