Bug 32409

Summary: Cannot search cashups using non-latin-1 scripts
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi <tomascohen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, david, dcook, lucas, martin.renvoize, tomascohen, wainuiwitikapark
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32406
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes the cashup history table so that filters can use non latin-1 characters (Point of sale > Cash summary for <library> > select register). Before this fix, the table was not filtered or refreshed if you entered non latin-1 characters.
Version(s) released in:
23.05.00,22.11.03,22.05.10,21.11.16
Bug Depends on:    
Bug Blocks: 32401    
Attachments: Bug 32409: Fix cashup searching with non latin-1 chars
Bug 32409: Fix cashup searching with non latin-1 chars
Bug 32409: Fix cashup searching with non latin-1 chars

Description Tomás Cohen Arazi 2022-12-06 13:49:48 UTC
Same as bug 32406, but on cash register cashups.
Comment 1 Tomás Cohen Arazi 2022-12-06 14:14:21 UTC
Created attachment 144449 [details] [review]
Bug 32409: Fix cashup searching with non latin-1 chars

This patch fixes a problem with the way queries are passed to the API so
cashups are searchable with non-laint1 chars.

To test:
1. Have two superlibrarian users, one with non-latin1 chars on the name
   (e.g. خمسة)
2. Setup a debit type that can be sold.
3. Use the POS module to have some activity, using both your regular
   user and the other one.
4. Go to the register you used, and choose 'Transaction history'
5. Perform a couple cashups with each user ('Record cashup').
6. Look at the 'Cashup history' table
=> SUCCESS: You see cashups for both users
7. Use the 'Search' filter with latin chars
=> SUCCESS: Your user with only latin1 chars is displayed on the table
8. Repeat, using some non-latin1 char found on the other user
=> FAIL: Table is not refreshed or filtered!
9. Apply this patch
10. Reload the page
11. Repeat 8
=> SUCCESS: Filtering works now!
12. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 David Nind 2022-12-07 00:30:42 UTC
Created attachment 144461 [details] [review]
Bug 32409: Fix cashup searching with non latin-1 chars

This patch fixes a problem with the way queries are passed to the API so
cashups are searchable with non-laint1 chars.

To test:
1. Have two superlibrarian users, one with non-latin1 chars on the name
   (e.g. خمسة)
2. Setup a debit type that can be sold.
3. Use the POS module to have some activity, using both your regular
   user and the other one.
4. Go to the register you used, and choose 'Transaction history'
5. Perform a couple cashups with each user ('Record cashup').
6. Look at the 'Cashup history' table
=> SUCCESS: You see cashups for both users
7. Use the 'Search' filter with latin chars
=> SUCCESS: Your user with only latin1 chars is displayed on the table
8. Repeat, using some non-latin1 char found on the other user
=> FAIL: Table is not refreshed or filtered!
9. Apply this patch
10. Reload the page
11. Repeat 8
=> SUCCESS: Filtering works now!
12. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Cook 2022-12-14 06:33:28 UTC
I would like to QA this one, but the instructions in the test plan aren't detailed enough. I can't get to "Transaction history" or "Cashup history". 

Leaving this for someone else to do unless a new test plan is added.
Comment 4 David Nind 2023-01-17 09:39:11 UTC
(In reply to David Cook from comment #3)
> I would like to QA this one, but the instructions in the test plan aren't
> detailed enough. I can't get to "Transaction history" or "Cashup history". 
> 
> Leaving this for someone else to do unless a new test plan is added.

Some notes on setting up for testing:

1. Enable the UseCashRegisters system preference.

2. Enabled the EnablePointOfSale system preference.

3. Create a cash register for Centerville (Administration > New cash register > call it CASH).

4. Add some debit types for some products from Administration > Accounting > Debit types > New debit type (change the code, description, and amount to add multiple debit types):
   - Debit type code: PRODUCT1
   - Default amount: 10.00
   - Description: Description for product 1
   - Can be manually invoiced? Selected
   - Can be sold?: Selected

5. Add some POS transactions using the koha user from Home > Point of sale

6. Select 'Transaction history for CASH' from the menu on the left.

7. Select the 'Record cashup' from the option at the top.

6. Repeat steps 5-7 as the other staff user created in step 1 of the test plan.

7. For step 6 of the test plan, select 'Transaction history for CASH' from the menu on the left.

8. Scroll down to the bottom of the page - you should see a heading with "Cashup history".

Then the rest of the test plan.

Hope this helps!
Comment 5 Jonathan Druart 2023-02-01 10:10:30 UTC
Created attachment 145925 [details] [review]
Bug 32409: Fix cashup searching with non latin-1 chars

This patch fixes a problem with the way queries are passed to the API so
cashups are searchable with non-laint1 chars.

To test:
1. Have two superlibrarian users, one with non-latin1 chars on the name
   (e.g. خمسة)
2. Setup a debit type that can be sold.
3. Use the POS module to have some activity, using both your regular
   user and the other one.
4. Go to the register you used, and choose 'Transaction history'
5. Perform a couple cashups with each user ('Record cashup').
6. Look at the 'Cashup history' table
=> SUCCESS: You see cashups for both users
7. Use the 'Search' filter with latin chars
=> SUCCESS: Your user with only latin1 chars is displayed on the table
8. Repeat, using some non-latin1 char found on the other user
=> FAIL: Table is not refreshed or filtered!
9. Apply this patch
10. Reload the page
11. Repeat 8
=> SUCCESS: Filtering works now!
12. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Tomás Cohen Arazi 2023-02-02 15:02:05 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 7 Jacob O'Mara 2023-02-06 15:58:17 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 8 Lucas Gass 2023-02-14 21:36:28 UTC
Backported to 22.05.x for upcoming 22.05.10
Comment 9 Arthur Suzuki 2023-02-17 10:06:55 UTC
applied to 21.11.x for 21.11.16
Comment 10 wainuiwitikapark 2023-03-15 01:43:53 UTC
Not backported to 21.05.x