https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33501
--- Comment #8 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 198838 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198838&action=edit Bug 33501: Per-payment-type cashup reconciliation in add_cashup Reworks Koha::Cash::Register->add_cashup to take a 'reconciliations' arrayref. Each entry is reconciled against the expected total for that payment type alone. A non-zero discrepancy creates a CASHUP_SURPLUS or CASHUP_DEFICIT accountline tagged with the relevant payment_type. Balanced types create no reconciliation line. \$register->add_cashup({ manager_id => \$user_id, reconciliations => [ { payment_type => 'CASH', actual_amount => 102.00 }, { payment_type => 'CHEQUE', actual_amount => 20.00, note => 'Drawer short' }, ], }); Each entry must carry its own per-discrepancy 'note' on a discrepant row when CashupReconciliationNoteRequired is on; the note is stored on that surplus/deficit accountline. Balanced rows ignore any 'note' they carry. Adds two helpers: - cashup_payment_types reads CashupPaymentTypes, splits on commas, and falls back to ['CASH'] if empty. - cashup_payment_types_breakdown returns labelled per-type expected totals scoped to the in-progress session (when a CASHUP_START exists) or the outstanding accountlines (otherwise). The previous hardcoded ['CASH','SIP00'] filter in the expected-amount calculation now reads from the preference. cashup_in_progress is updated to return a Koha::Cash::Register::Cashup (rather than ::Action) so callers can use the richer interface (->accountlines, ->summary). Cashup ISA Action so existing attribute access remains valid. The previous single-amount form is removed: the method has only ever been used internally and every caller is updated in this patch series to pass a reconciliations array. The cashup-wide reconciliation_note fallback is also removed — notes are now strictly per-row, matching the modal UI which has no global note input. The 40445 test fixtures that called add_cashup with a single 'amount' or with a cashup-wide 'reconciliation_note' have been migrated mechanically to the equivalent reconciliations-array shape with the note moved onto the single CASH entry. Test plan: 1. Apply the previous patch in this series (the database update), then this patch, and run the database update. 2. Run prove t/db_dependent/Koha/Cash/Register.t — all subtests should pass, including the new ones: - cashup_payment_types - cashup_payment_types_breakdown - cashup_per_payment_type - cashup_per_payment_type_notes 3. Manually: configure CashupPaymentTypes to 'CASH,CHEQUE,CARD', process a transaction in each type, then call add_cashup with a reconciliations array. Verify per-type CASHUP_SURPLUS/DEFICIT lines are created with the correct payment_type, balanced types create no lines, and per-row notes land on the right line. 4. With CashupReconciliationNoteRequired set to "Require", verify that submitting a discrepant row without its own note throws Koha::Exceptions::MissingParameter. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
