Bug 26540 - Server error when attempting to issue cash credit with UseCashRegisters
Summary: Server error when attempting to issue cash credit with UseCashRegisters
Status: Patch doesn't apply
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: 20.05
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on: 24786
Blocks: 13985
  Show dependency treegraph
 
Reported: 2020-09-25 17:39 UTC by Kelly McElligott
Modified: 2024-09-26 15:46 UTC (History)
6 users (show)

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


Attachments
Bug 26540: Remove 'CASH' type from 'refund' and 'payout' (6.37 KB, patch)
2020-10-02 11:49 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 26540: Remove 'CASH' type from 'refund' and 'payout' (5.14 KB, patch)
2024-06-28 12:07 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 26540: Remove 'CASH' type from 'refund' and 'payout' (6.20 KB, patch)
2024-06-28 13:50 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 Kelly McElligott 2020-09-25 17:39:22 UTC
If a library system has enabled Cash Registers but one branch does not use this.  When using the Issue Credit - CASH option from the Accounting Module, an Internal Server Error will occur. 

1. Turn on Cash Registers
2. Set up a Cash Register for branch A
3. Log into Branch B and try to issue credit with CASH - this will not work and give an ISE.  Other options, such as Check, Credit card, etc will work but not the option for Cash.  

Understandably, it is because there is not a place for the cash to come from if no cash register is enabled.  But I can see this an issue for multi-branch systems where some want to use the Cash register option,but others do not.
Comment 1 Martin Renvoize (ashimema) 2020-09-29 19:35:44 UTC
Hmm, you are indeed correct and the error is partially deliberate to ensure a cash register is set if the preference is set to use registers.

So, are you suggesting that some branches may not want to use registers even though the global preference is set to require them.

I'm just trying to understand how to correctly catch when one is missing but should be present... Should one be able to pay out in cash without a register but at a branch that does have at least one register for example?   Should the 'UseCashRegisters' preference be set at the branch level? Or, should we just check for the presence of at least one register at a branch and fall into the required mode then?

Happy to chat and code it up.
Comment 2 Kelly McElligott 2020-09-30 18:28:22 UTC
Martin,
Thank you for commenting.  I would say, making the 'UseCashRegisters' preference be set at the branch level would probably be ideal.  Because I can see some branches not using cash registers and this would cause issues.
Comment 3 Martin Renvoize (ashimema) 2020-10-02 11:49:38 UTC
Created attachment 111137 [details] [review]
Bug 26540: Remove 'CASH' type from 'refund' and 'payout'

This patch removes the 'CASH' transaction typy, hides the register
selection and adds an alert to the Payout and Refund modals on the
boraccount page if there are no cash registers yet defined at the for
the current branch.
Comment 4 Martin Renvoize (ashimema) 2020-10-02 11:52:44 UTC
This first patch just adds appropriate alerts and disabled the CASH type from being selected if the branch does not yet have registers associated with it.

I'm still contemplating how to set the preference at a branch level..

Options: Set the preference at the branch level so if enabled for a branch but a branch is lacking register definitions we alert and require at least one register to be added... or.. leave the preference at system level but drop the error message for if no registers are defined at a branch yet.
Comment 5 Lucas Gass (lukeg) 2023-02-03 17:39:26 UTC
no longer applies cleanly to master
Comment 6 Martin Renvoize (ashimema) 2024-06-28 12:07:09 UTC
Created attachment 168234 [details] [review]
Bug 26540: Remove 'CASH' type from 'refund' and 'payout'

This patch removes the 'CASH' transaction typy, hides the register
selection and adds an alert to the Payout and Refund modals on the
boraccount page if there are no cash registers yet defined at the for
the current branch.
Comment 7 Martin Renvoize (ashimema) 2024-06-28 12:08:26 UTC
Rebased and ready for testing again.
Comment 8 Martin Renvoize (ashimema) 2024-06-28 13:50:42 UTC
Created attachment 168239 [details] [review]
Bug 26540: Remove 'CASH' type from 'refund' and 'payout'

This patch removes the 'CASH' transaction type, hides the register
selection and adds an alert to the Payout and Refund modals on the
boraccount page if there are no cash registers yet defined at the for
the current branch.

Test plan
1) Enable 'UseCashRegisters'
2) Add a credit to a user account
3) Attempt to 'Issue payout' of the credit to the user and note
3a) A new blue info message appears in the modal letting you know that
    you cannot issue a payout of type 'Cash' to the user without first
    adding a cash register. (If you have the correct permissions, you
    will also see a button in that info box allowing you to add said
    register)
3b) You will not see either the payment type or registers pulldown in
    the modal
4) Add at least one new 'PAYMENT_TYPE' authorized value
5) Repeat step 3
5a) Note the blue info message still appears
5b) You may now select a payment type as defined in step 4, however the
'Cash' option is not available.
5c) There is still not an option to select a cash register
6) Add a cash register for your branch
7) Repeat step 3
7a) You will no longer see the blue info box
7b) You should be able to select 'Cash' from the 'Payment type' options
7c) You will be able to select your cash register

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Shi Yao Wang 2024-09-26 15:46:49 UTC
Patch does not apply