Bug 30563

Summary: Add system preference to make the cash register field required when collecting a payment
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: PatronsAssignee: Julian Maurice <julian.maurice>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: caroline.cyr-la-rose, fridolin.somers, gmcharlt, kyle.m.hall
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28138
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Caroline Cyr La Rose Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/629
Text to go in the release notes:
Version(s) released in:
22.05.00
Attachments: Bug 30563: Add syspref to make the "cash register" field mandatory
Bug 30563: Add syspref to make the "cash register" field mandatory
Bug 30563: Add syspref to make the "cash register" field mandatory
Bug 30563: (QA follow-up) Fix permission on atomicupdate file
Bug 30563: (QA follow-up) Fix system preference values and add link to description

Description Julian Maurice 2022-04-19 10:01:15 UTC
Currently, the cash register field is required only if the CASH payment type is selected.
Some users want to make it required no matter which payment type is selected.
Comment 1 Julian Maurice 2022-04-19 10:11:10 UTC
Created attachment 133393 [details] [review]
Bug 30563: Add syspref to make the "cash register" field mandatory

Test plan:
1. Apply patch and run updatedatabase
2. Enable 'UseCashRegisters' syspref and create at least one cash
   register for your library
3. Verify that you have several authorized values in the 'PAYMENT_TYPE'
   category. One of them should be 'CASH'
4. Go to a patron accounting tab, create a manual invoice and go to the
   payment form. Select payment type 'CASH' and verify that you cannot
   submit the form if no cash register is selected.
   Select another payment type and verify that you can submit the form
   even if no cash register is selected
5. Set syspref 'RequireCashRegister' to 'always require a cash register'
6. Repeat step 4 but this time you should not be able to submit the form
   if no cash register is selected, no matter which payment type is
   selected.
Comment 2 Lucas Gass 2022-04-22 21:53:51 UTC
Created attachment 133698 [details] [review]
Bug 30563: Add syspref to make the "cash register" field mandatory

Test plan:
1. Apply patch and run updatedatabase
2. Enable 'UseCashRegisters' syspref and create at least one cash
   register for your library
3. Verify that you have several authorized values in the 'PAYMENT_TYPE'
   category. One of them should be 'CASH'
4. Go to a patron accounting tab, create a manual invoice and go to the
   payment form. Select payment type 'CASH' and verify that you cannot
   submit the form if no cash register is selected.
   Select another payment type and verify that you can submit the form
   even if no cash register is selected
5. Set syspref 'RequireCashRegister' to 'always require a cash register'
6. Repeat step 4 but this time you should not be able to submit the form
   if no cash register is selected, no matter which payment type is
   selected.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Katrin Fischer 2022-04-26 12:16:02 UTC
Created attachment 133878 [details] [review]
Bug 30563: Add syspref to make the "cash register" field mandatory

Test plan:
1. Apply patch and run updatedatabase
2. Enable 'UseCashRegisters' syspref and create at least one cash
   register for your library
3. Verify that you have several authorized values in the 'PAYMENT_TYPE'
   category. One of them should be 'CASH'
4. Go to a patron accounting tab, create a manual invoice and go to the
   payment form. Select payment type 'CASH' and verify that you cannot
   submit the form if no cash register is selected.
   Select another payment type and verify that you can submit the form
   even if no cash register is selected
5. Set syspref 'RequireCashRegister' to 'always require a cash register'
6. Repeat step 4 but this time you should not be able to submit the form
   if no cash register is selected, no matter which payment type is
   selected.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Katrin Fischer 2022-04-26 12:16:06 UTC
Created attachment 133879 [details] [review]
Bug 30563: (QA follow-up) Fix permission on atomicupdate file

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Katrin Fischer 2022-04-26 12:16:10 UTC
Created attachment 133880 [details] [review]
Bug 30563: (QA follow-up) Fix system preference values and add link to description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Fridolin Somers 2022-05-05 21:35:28 UTC
BTW we should rewrite koha-tmpl/intranet-tmpl/prog/en/includes/transaction_types.inc to use the same IF/ELSE syntax.
There is a lot of copy/paste in actual code.
Comment 7 Fridolin Somers 2022-05-06 20:34:40 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄