[Bug 43911] New: Cashup payment types should respect PAYMENT_TYPE library limitations
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 Bug ID: 43911 Summary: Cashup payment types should respect PAYMENT_TYPE library limitations Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Point of Sale Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: martin.renvoize@openfifth.co.uk Target Milestone: --- Bug 33501 lets a library choose which PAYMENT_TYPE authorised values take part in cashup reconciliation, using the CashupPaymentTypes system preference. That preference is global, and the cashup code reads the PAYMENT_TYPE values without looking at their library limitations. Elsewhere PAYMENT_TYPE values are limited by library: the payment type drop-downs use AuthorisedValues.GetAuthValueDropbox, which calls search_with_library_limits for the logged-in library, so a type limited to library A is not offered at library B. Koha::Cash::Register->cashup_payment_types and cashup_payment_types_breakdown do not apply the same rule. A register at library B therefore still lists, and asks staff to count, a payment type that library B cannot take. Expected: when reconciling a register's cashup, only the types in CashupPaymentTypes that are available at the register's library are listed in the Complete cashup modal, in "Bankable by payment type" and in the per-type reconciliation. A Quick cashup builds its balanced list from the same set. Open question: takings already recorded against a type that is not available at the register's library must not silently drop out of the cashup, so I suggest keeping a type in the list when the register has outstanding takings of that type. Test plan: 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 and in Bankable by payment type. => After: only CASH appears. 5. Repeat at library A: both CASH and CHEQUE appear. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk Depends on| |33501 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33501 [Bug 33501] Add optional support for different payment types during cashup reconciliation -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |13985 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13985 [Bug 13985] [Omnibus] Cash Management - Koha as 'Point of Sale' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- 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 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com Status|Needs Signoff |Failed QA --- Comment #2 from David Nind <david@davidnind.com> --- Have Failed QA because the tests fail. It is odd, as if I apply the patches (both the dependent bug and this bug, with an updatedatabase, restart_all) - the tests pass. - Note: The library and cash register created by the tests are still in the system. If I reset everything, then work through the test plan and add the transactions, things work as expected (the issue identified is fixed). However, the tests now fail. Test failures: prove t/db_dependent/Koha/Cash/Register.t t/db_dependent/Koha/Cash/Register.t .. 15/18 # Failed test 'One entry per configured payment type, zero when there are no takings' # at t/db_dependent/Koha/Cash/Register.t line 2209. # Structures begin differing at: # $got->[1] = Does not exist # $expected->[1] = ARRAY(0x5572cf09a4b0) # Looks like you failed 1 test of 6. t/db_dependent/Koha/Cash/Register.t .. 16/18 # Failed test 'balanced_reconciliations' # at t/db_dependent/Koha/Cash/Register.t line 2257. t/db_dependent/Koha/Cash/Register.t .. 17/18 # Looks like you failed 1 test of 18. t/db_dependent/Koha/Cash/Register.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/18 subtests Test Summary Report ------------------- t/db_dependent/Koha/Cash/Register.t (Wstat: 256 (exited 1) Tests: 18 Failed: 1) Failed test: 16 Non-zero exit status: 1 Files=1, Tests=18, 91 wallclock secs ( 0.04 usr 0.00 sys + 63.12 cusr 25.20 csys = 88.36 CPU) Result: FAIL Testing notes (using KTD): 1. Libraries used: - Library A = Centerville - Library B = Midway 2. Apply the patches in bug 33501, databaseupdate, yarn build (just in case) and restart_all 3. Add a CHEQUE authorized value to the PAYMENT_TYPE authorized values category (Administration > Basic parameters > Authorized values), and set the "Library limitations" field to Library A (Centerville). 4. Set the UseCashRegisters system preference to "Use". 5. For the new CashupPaymentTypes system preference select "Cheque" payment type. 6. Add two cash registers: - One for Library A (Centerville) - One for Library B (Midway) 7. With the library set to Library A (Centerville): - Create a manual invoice for a patron ([selected patron] > Accounting > Create manual invoice), for Example Mary Burton - Make a payment 8. Go to More > Tools > Cash management > Cash summary for Library A (Centerville) 9. For the register, click Record cashup, then Start cashup and then Complete cashup. ==> Result: Both Cash and Cheque row appears (as expected) 10. Change to Library B (Midway) and repeat steps 7 to 9. ==> Result: Both Cash and Cheque row appears (not as expected, only the Cash row should appear - the Cheque row should only be shown for Library A (Centerville) because of the library limitations set in step 3) 11. Apply the patches for this bug (don't apply the patches for bug 33501, as these are already applied). 12. Go to More > Tools > Cash management > Cash summary for Library B (Midway), and click "Complete cashup": ==> Result: Only the Cash row is shown (as expected) 13. Change to Library A (Centerville) and go to More > Tools > Cash management
Cash summary for Library A (Centerville), and click "Complete cashup": ==> Result: Both the Cash and Cheque rows are shown (as expected) 14. The tests should pass: prove t/db_dependent/Koha/Cash/Register.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208991|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 --- Comment #3 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 209110 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209110&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. The tests set up their own CashupPaymentTypes but not the library limitations of the PAYMENT_TYPE authorised values of the system, so they failed on a system where a payment type such as CHEQUE was limited to one library. Remove the limitations inside the tests' transactions. The cashup_payment_types test also created a library and a register outside of a transaction and left them in the database. 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 It passes also when CHEQUE is limited to a library, and leaves no library or register behind Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 --- Comment #4 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Thanks David, very good catch, and thank you for noting what the tests leave behind. The failure was in the tests rather than the fix: balanced_reconciliations (and the other cashup tests) set up CashupPaymentTypes themselves, with CASH and CHEQUE, but not the library limitations of the PAYMENT_TYPE authorised values. On a system where CHEQUE is limited to one library (as after your manual test plan) the test register, which is created in a random library, correctly no longer lists CHEQUE when it has no takings of it, so the test saw one entry instead of two. On a database where CHEQUE has no limitation they pass, which is why they passed for you before the reset. I reproduced it with CHEQUE limited to one library and the new attachment makes the tests remove the limitations inside their transactions. They now pass with and without such a limitation. The library and cash register left behind came from the cashup_payment_types test (from bug 33501) which created a register outside of a transaction; that is fixed in the same patch and I checked the counts of libraries and registers no longer change after a run. Setting back to Needs Signoff. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 209231 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209231&action=edit Screenshot - Complete cashup window: no library or details Thanks Martin for fixing the tests. I'm not sure if it is related to the updated patch for this bug or bug 33501, but the "Complete cashup" window is no longer working as expected: - The title is "Confirm cashup of" with no cash register/library - Can't enter any details David -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Thanks David, and thanks for the screenshot. I have tried to reproduce this and cannot, so I don't think it is caused by this bug, but I would like to find out what happens on your system. What I tried, on a fresh KTD with the patches of bug 33501 and then this bug (nothing else): CASH and CHEQUE in CashupPaymentTypes, CHEQUE limited to Centerville, one register at each of Centerville and Midway, a cash payment on the Midway register. Then, as Midway: from the register page Record cashup > Start cashup > Complete cashup, and from More > Cash management > Cash summary
Complete cashup. In both cases the window opens with the title "Complete cashup of Reg MPL" (or "Confirm cashup of Reg MPL" from the Cash summary page), a Cash row with the expected amount, and an input to enter the counted amount. There are no errors in the browser console. I also checked a register with takings of the limited type, and the register at Centerville.
This patch only changes Koha::Cash::Register and its tests, so it does not touch the template or the JavaScript of that window. Your screenshot is what the window looks like before the JavaScript that fills it in (the register name, the payment type rows and their inputs) has run, which is why I suspect the page either has an old cached copy of js/modals/cashup_modals.js (the files of bug 33501 changed between its attachments) or an error in the console. Could you: 1. do a hard reload of the page (Ctrl+Shift+R) or clear the browser cache after applying the patches, and run restart_all, 2. if it still happens, tell me from which page you open the window (the register page or the Cash summary page) and whether the browser console shows an error. I have left the status as it is until we know. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #209110|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 --- Comment #7 from David Nind <david@davidnind.com> --- Created attachment 211179 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211179&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. The tests set up their own CashupPaymentTypes but not the library limitations of the PAYMENT_TYPE authorised values of the system, so they failed on a system where a payment type such as CHEQUE was limited to one library. Remove the limitations inside the tests' transactions. The cashup_payment_types test also created a library and a register outside of a transaction and left them in the database. 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 It passes also when CHEQUE is limited to a library, and leaves no library or register behind Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 --- Comment #8 from David Nind <david@davidnind.com> --- (In reply to Martin Renvoize (ashimema) from comment #6)
Thanks David, and thanks for the screenshot. I have tried to reproduce this and cannot, so I don't think it is caused by this bug, but I would like to find out what happens on your system.
What I tried, on a fresh KTD with the patches of bug 33501 and then this bug (nothing else): CASH and CHEQUE in CashupPaymentTypes, CHEQUE limited to Centerville, one register at each of Centerville and Midway, a cash payment on the Midway register. Then, as Midway: from the register page Record cashup > Start cashup > Complete cashup, and from More > Cash management > Cash summary > Complete cashup. In both cases the window opens with the title "Complete cashup of Reg MPL" (or "Confirm cashup of Reg MPL" from the Cash summary page), a Cash row with the expected amount, and an input to enter the counted amount. There are no errors in the browser console. I also checked a register with takings of the limited type, and the register at Centerville.
This patch only changes Koha::Cash::Register and its tests, so it does not touch the template or the JavaScript of that window. Your screenshot is what the window looks like before the JavaScript that fills it in (the register name, the payment type rows and their inputs) has run, which is why I suspect the page either has an old cached copy of js/modals/cashup_modals.js (the files of bug 33501 changed between its attachments) or an error in the console. Could you: 1. do a hard reload of the page (Ctrl+Shift+R) or clear the browser cache after applying the patches, and run restart_all, 2. if it still happens, tell me from which page you open the window (the register page or the Cash summary page) and whether the browser console shows an error.
I have left the status as it is until we know.
I've retested, and can't reproduce what I encountered before in comment #5 - so something must have been wrong with my testing environment. Everything now seems to work as expected (as per my test plan in comment #2) and the tests pass. David -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #209231|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|martin.renvoize@openfifth.c |andrew@bywatersolutions.com |o.uk | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211179|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43911 --- Comment #9 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 212455 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212455&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. The tests set up their own CashupPaymentTypes but not the library limitations of the PAYMENT_TYPE authorised values of the system, so they failed on a system where a payment type such as CHEQUE was limited to one library. Remove the limitations inside the tests' transactions. The cashup_payment_types test also created a library and a register outside of a transaction and left them in the database. 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 It passes also when CHEQUE is limited to a library, and leaves no library or register behind Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org