Bug 40305 - Collected and change variables are inconsistent in controllers and notice templates
Summary: Collected and change variables are inconsistent in controllers and notice tem...
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on: 24381
Blocks: 36846
  Show dependency treegraph
 
Reported: 2025-07-04 09:07 UTC by Martin Renvoize (ashimema)
Modified: 2025-07-04 09:09 UTC (History)
8 users (show)

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


Attachments
Bug 40305: Fix 'tendered' vs 'collected' variable name inconsistency (13.94 KB, patch)
2025-07-04 09:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 40305: Add database update to fix existing notice templates (4.52 KB, patch)
2025-07-04 09:08 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 Martin Renvoize (ashimema) 2025-07-04 09:07:23 UTC
We've tried fixing this a few times but never fully achieved it.

We need to get these consistent across the board to ensure the feature is working correctly out of the box everywhere.

collected => tendered
change_given => change
Comment 1 Martin Renvoize (ashimema) 2025-07-04 09:08:39 UTC
Created attachment 183787 [details] [review]
Bug 40305: Fix 'tendered' vs 'collected' variable name inconsistency

"One Ring to rule them all, one Ring to find them, One Ring to bring
them all and in the darkness bind them"

We've been battling against this for years, with a mixed use of
terminology and thus confusion in templates vs controllers and notice
templates.  I've decided to just try and make sure all the terminology
matches throughout, and use the more popular 'tendered' term over the
'collected' term.

This patch standardizes the terminology used throughout the payment
  system to consistently use 'tendered' instead of the mixed usage of
  'collected' and 'tendered' that has caused confusion over the years.

Changes include:
  - Update all payment form templates to use 'tendered' input names
  - Update JavaScript validation and change calculation logic
  - Update controller parameter handling in pos/pay.pl, pos/printreceipt.pl,
    and members/paycollect.pl
  - Update sample notice templates (RECEIPT) to use 'tendered' variable
  - Add null check for $total_tendered to prevent perl warnings

Test plan:
  1. Test Point of Sale payments with tendered amounts and change calculation
  2. Test member account payments with tendered amounts
  3. Test receipt generation (both print and email)
  4. Verify JavaScript validation works correctly
  5. Confirm no perl warnings when tendered amount is undefined
Comment 2 Martin Renvoize (ashimema) 2025-07-04 09:08:42 UTC
Created attachment 183788 [details] [review]
Bug 40305: Add database update to fix existing notice templates

This database update fixes existing RECEIPT and ACCOUNT_CREDIT notice
templates that may still use the old 'collected' variable instead of
'tendered'. It handles various formatting patterns and provides
verification that the conversion was successful.