https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911

--- Comment #1 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 208991
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208991&action=edit
Bug 43911: Respect PAYMENT_TYPE library limitations in cashup

CashupPaymentTypes is a global list of PAYMENT_TYPE authorised value
codes, and the cashup code read those values without looking at their
library limitations. A register at library B therefore still listed, and
asked staff to count, a payment type that is limited to library A and
that library B cannot take. The payment type drop-downs elsewhere apply
the limitation.

Add Koha::Cash::Register->available_cashup_payment_types, which returns
the configured types that apply to the register's library:

- a type with no authorised value, or with no library limitations, is
  always kept
- a type limited to other libraries is dropped
- a dropped type is kept if the register has takings of that type in the
  current cashup period, so money already taken is never lost from the
  cashup
- if everything would be dropped the full configured list is returned,
  so a cashup can always be completed

cashup_payment_types_breakdown now uses it. That is what the Complete
cashup modal, the "Bankable by payment type" summary, the registers
list labels and the Quick cashup (balanced_reconciliations) are built
from. cashup_payment_types is unchanged and still returns every
configured type, which add_cashup validation and the cashup summary of
completed cashups rely on, so historical cashups are not affected.

To test:
1. Set UseCashRegisters and set CashupPaymentTypes to CASH,CHEQUE
2. In the PAYMENT_TYPE authorised values, limit CHEQUE to library A only
3. Create a register at library B and take a CASH payment on it
4. At library B open the register page, click Record cashup, then Start
   cashup and Complete cashup
   => Before: a CHEQUE row appears in the modal
   => After: only CASH appears, and entering the cash amount completes
      the cashup
5. Repeat at library A: both CASH and CHEQUE appear
6. prove t/db_dependent/Koha/Cash/Register.t

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to