Bug 38532 - Show both credits and debits on checkouts and details tabs in staff
Summary: Show both credits and debits on checkouts and details tabs in staff
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Andrew Fuerste-Henry
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-25 21:29 UTC by Andrew Fuerste-Henry
Modified: 2025-05-08 06:01 UTC (History)
5 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the patron check out and details pages. They now show both charges and credits, for example: - Charges: Patron has outstanding charges of 10.00. - Credits: Patron has outstanding credits of 35.00 Previously, the pages only listed the charges - which could be misleading.
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 38532: show both debits and credits in patron_messages (3.51 KB, patch)
2024-11-26 18:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 38532: show both debits and credits in patron_messages (3.64 KB, patch)
2025-04-22 15:59 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 38532: (follow-up) Use Koha::Patron->account methods (2.42 KB, patch)
2025-04-22 16:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 38532: (follow-up) Use Koha::Patron->account methods (2.41 KB, patch)
2025-04-22 16:01 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 38532: Show both debits and credits on patron's check out and details pages (3.70 KB, patch)
2025-04-26 01:54 UTC, David Nind
Details | Diff | Splinter Review
Bug 38532: (follow-up) Use Koha::Patron->account methods (2.46 KB, patch)
2025-04-26 01:54 UTC, David Nind
Details | Diff | Splinter Review
Bug 38532: (follow-up) Add missing space for credits message (1.46 KB, patch)
2025-04-26 03:30 UTC, David Nind
Details | Diff | Splinter Review
Bug 38532: Show both debits and credits on patron's check out and details pages (3.77 KB, patch)
2025-05-07 06:47 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 38532: (follow-up) Use Koha::Patron->account methods (2.52 KB, patch)
2025-05-07 06:47 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 38532: (follow-up) Add missing space for credits message (1.52 KB, patch)
2025-05-07 06:47 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 Andrew Fuerste-Henry 2024-11-25 21:29:38 UTC
Currently patron_messages.inc gives an accurate but misleading overview of the patron's account in the patron overview.

If the patron has at least 1 debit on their account with an amountoutstanding > 0, we show a message "Patron has outstanding charges of X," where X is the total of all outstanding debits.

If the patron has no outstanding debits and at least 1 credit with an amountoutstanding < 0, we show a message of "Patron has a credit of X," where X is the total of all outstanding credits.

If a patron has 1 debit of $1 and 2 credits of $1,000,000 each, Koha only tells you about the $1 debit.

I suggest we reword the credit message to "Patron has outstanding credits of X" and make it show whenever there is one or more credit with an outstanding amount on the account. So patrons with both credits and debits on their account will show both messages.
Comment 1 Andrew Fuerste-Henry 2024-11-26 18:23:57 UTC
Created attachment 174992 [details] [review]
Bug 38532: show both debits and credits in patron_messages

To test:
1: Have patrons with a variety of credit/debit combinations
2: Confirm Koha shows the total debit amount in patron_messages if any debits exist
3: Confirm Koha does not show anything about creditd in patron_messages if any debits exist
4: Apply patch, restart_all
5: Confirm all patrons show both debit total and credit total
Comment 2 Andrew Fuerste-Henry 2024-11-26 18:28:16 UTC
To be a bit more clear, these changes are to the messages marked with Attention on the patron checkout (/cgi-bin/koha/circ/circulation.pl) and details (/cgi-bin/koha/members/moremember.pl) screens.
Comment 3 Martin Renvoize (ashimema) 2025-04-22 15:59:59 UTC Comment hidden (obsolete)
Comment 4 Martin Renvoize (ashimema) 2025-04-22 16:00:02 UTC Comment hidden (obsolete)
Comment 5 Martin Renvoize (ashimema) 2025-04-22 16:01:10 UTC
Created attachment 181298 [details] [review]
Bug 38532: (follow-up) Use Koha::Patron->account methods

Update the patch to use Koha::Account and it's associated 'outstanding'
methods to ensure we accurately portray outstanding amounts rather than
'all credits' totals.

I also remove the unused `$balance` variable from the
members/moremember.pl controller.
Comment 6 Martin Renvoize (ashimema) 2025-04-22 16:02:44 UTC
You'll want to ensure AccountAutoReconcile is set to not reconcile to test these and ensure partial application of some credits against debts.. that way you'll get an accurate test of all combinations.
Comment 7 David Nind 2025-04-26 01:54:42 UTC
Created attachment 181562 [details] [review]
Bug 38532: Show both debits and credits on patron's check out and details pages

To test:
1: Have patrons with a variety of credit/debit combinations
2: Confirm Koha shows the total debit amount in patron_messages if any debits exist
3: Confirm Koha does not show anything about creditd in patron_messages if any debits exist
4: Apply patch, restart_all
5: Confirm all patrons show both debit total and credit total

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2025-04-26 01:54:45 UTC
Created attachment 181563 [details] [review]
Bug 38532: (follow-up) Use Koha::Patron->account methods

Update the patch to use Koha::Account and it's associated 'outstanding'
methods to ensure we accurately portray outstanding amounts rather than
'all credits' totals.

I also remove the unused `$balance` variable from the
members/moremember.pl controller.

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2025-04-26 02:06:02 UTC
I edited the title of the first commit message.

How I tested (using KTD):
1. Used Mary Burton as the patron.
2. Added some manual debits and credits:
   - Manual invoice 1: $5.00
   - Manual invoice 2: $5.00
   - Manual credit 1: $15.00
   - Manual credit 2: $15.00
3. If you look at the patron's check out and details pages, they only
   show the total charges ($10 in this case): 
   ==> Charges: Patron has outstanding charges of 10.00.
4. Apply the patches.
5. Re-check the pages, they now show:
   ==> Charges: Patron has outstanding charges of 10.00.  
       Credits: Patron has outstanding creditsof 35.00

I'll add a follow-up to add a space for the credits message.
Comment 10 David Nind 2025-04-26 03:30:19 UTC
Created attachment 181564 [details] [review]
Bug 38532: (follow-up) Add missing space for credits message

Fix credit message to add a missing space:
- Previously: Credits: Patron has outstanding creditsof
- Now: Credits: Patron has outstanding credits of

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 Martin Renvoize (ashimema) 2025-05-07 06:41:31 UTC
Nice one David, thanks for the thorough testing and follow-up.
Comment 12 Martin Renvoize (ashimema) 2025-05-07 06:47:46 UTC
Created attachment 182011 [details] [review]
Bug 38532: Show both debits and credits on patron's check out and details pages

To test:
1: Have patrons with a variety of credit/debit combinations
2: Confirm Koha shows the total debit amount in patron_messages if any debits exist
3: Confirm Koha does not show anything about creditd in patron_messages if any debits exist
4: Apply patch, restart_all
5: Confirm all patrons show both debit total and credit total

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 13 Martin Renvoize (ashimema) 2025-05-07 06:47:49 UTC
Created attachment 182012 [details] [review]
Bug 38532: (follow-up) Use Koha::Patron->account methods

Update the patch to use Koha::Account and it's associated 'outstanding'
methods to ensure we accurately portray outstanding amounts rather than
'all credits' totals.

I also remove the unused `$balance` variable from the
members/moremember.pl controller.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 14 Martin Renvoize (ashimema) 2025-05-07 06:47:52 UTC
Created attachment 182013 [details] [review]
Bug 38532: (follow-up) Add missing space for credits message

Fix credit message to add a missing space:
- Previously: Credits: Patron has outstanding creditsof
- Now: Credits: Patron has outstanding credits of

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 15 Martin Renvoize (ashimema) 2025-05-07 06:49:02 UTC
(In reply to David Nind from comment #10)
> Created attachment 181564 [details] [review] [review]
> Bug 38532: (follow-up) Add missing space for credits message
> 
> Fix credit message to add a missing space:
> - Previously: Credits: Patron has outstanding creditsof
> - Now: Credits: Patron has outstanding credits of
> 
> Signed-off-by: David Nind <david@davidnind.com>

Oh.. this is an odd one.. the tidy script nukes the space.. I've reworked your patch to add the space before the template toolkit condition and that appeases the QA script and tidy... little odd though.. I'll raise it with Jonathan.
Comment 16 David Nind 2025-05-07 12:09:26 UTC
(In reply to Martin Renvoize (ashimema) from comment #15)
> (In reply to David Nind from comment #10)
> > Created attachment 181564 [details] [review] [review] [review]
> > Bug 38532: (follow-up) Add missing space for credits message
> > 
> > Fix credit message to add a missing space:
> > - Previously: Credits: Patron has outstanding creditsof
> > - Now: Credits: Patron has outstanding credits of
> > 
> > Signed-off-by: David Nind <david@davidnind.com>
> 
> Oh.. this is an odd one.. the tidy script nukes the space.. I've reworked
> your patch to add the space before the template toolkit condition and that
> appeases the QA script and tidy... little odd though.. I'll raise it with
> Jonathan.

THanks Martin!
Comment 17 Katrin Fischer 2025-05-08 06:01:13 UTC
Pushed for 25.05!

Well done everyone, thank you!