Bug 33613

Summary: Claim return doesn't charge when "Ask if a lost fee should be charged" is selected and marked to charge
Product: Koha Reporter: Lisette Scheer <lisette>
Component: CirculationAssignee: Lucas Gass (lukeg) <lucas>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: david, gmcharlt, jonathan.druart, kyle.m.hall, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.06
Circulation function:
Bug Depends on: 29983    
Bug Blocks:    
Attachments: Bug 33613: Use prop() to evaluate checkbox
Bug 33613: Use prop() to evaluate checkbox
Bug 33613: Use prop() to evaluate checkbox
Bug 33613: Use prop() to evaluate checkbox

Description Lisette Scheer 2023-04-25 22:20:24 UTC
To recreate: 
1. Have an item with a replacement cost checked out to a patron
2. Set the ClaimReturnedChargeFee sys pref to "Ask if a lost fee should be charged" 
3. Make a claim and check the box for charging. 
4. Claim happens but no charge occurs.
Comment 1 Lucas Gass (lukeg) 2023-04-25 23:09:23 UTC
In modal-claims.inc:

let fee = $('#claims-returned-charge-lost-fee').attr('checked') ? true : false;


attr() won't always evaluate to true and I think prop() is a much better choice in this circumstance.
Comment 2 Lucas Gass (lukeg) 2023-04-25 23:12:26 UTC
Created attachment 150237 [details] [review]
Bug 33613: Use prop() to evaluate checkbox

To test:
1. Have an item with a replacement cost checked out to a patron
2. Set the ClaimReturnedChargeFee sys pref to "Ask if a lost fee should be charged"
3. Make a claim and check the box for charging.
4. Claim happens but no charge occurs.
5. Apply patch and try again.
6. A charge should now occur.
Comment 3 David Nind 2023-04-26 12:29:22 UTC
Hi Lucas.

While this works, I'm getting this behavour:

1. When clicking on 'Claim returned' button, I get a spinning icon in place of the button and an error in the web developer console: Uncaught TypeError: value.match is not a function.

2. Even though the button is pressed just once, there are two entries in the Details section under the claims tab - in the Check out 
section claims tab it only appears once.

This was tested using Firefox.

David


Testing notes (using KTD):

1. To set up claims to work: set system preference ClaimReturnedLostValue to 1

2. From a patron's checkout list, Check out > Checkouts tab - click on the Claim returned button in the return claims column:
- Get spinning icon in place of the button
- In the web developer tools console: Uncaught TypeError: value.match is not a function
Comment 4 Lucas Gass (lukeg) 2023-04-26 15:08:14 UTC
David, 

I see that too! It looks like it is happening with or without this patch. I filed a seperate bug for it:

Bug 33616
Comment 5 David Nind 2023-04-26 17:08:46 UTC
(In reply to Lucas Gass from comment #4)
> David, 
> 
> I see that too! It looks like it is happening with or without this patch. I
> filed a seperate bug for it:
> 
> Bug 33616

Thanks Lucas, Sign off for this one coming.
Comment 6 David Nind 2023-04-26 17:42:46 UTC
Created attachment 150252 [details] [review]
Bug 33613: Use prop() to evaluate checkbox

To test:
1. Have an item with a replacement cost checked out to a patron
2. Set the ClaimReturnedChargeFee sys pref to "Ask if a lost fee should be charged"
3. Make a claim and check the box for charging.
4. Claim happens but no charge occurs.
5. Apply patch and try again.
6. A charge should now occur.

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Hinemoea Viault 2023-05-08 16:08:35 UTC
Created attachment 150802 [details] [review]
Bug 33613: Use prop() to evaluate checkbox

To test:
1. Have an item with a replacement cost checked out to a patron
2. Set the ClaimReturnedChargeFee sys pref to "Ask if a lost fee should be charged"
3. Make a claim and check the box for charging.
4. Claim happens but no charge occurs.
5. Apply patch and try again.
6. A charge should now occur.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Hinemoea Viault <hinemoea.viault@inlibro.com>
Comment 8 Jonathan Druart 2023-05-09 09:42:32 UTC
Created attachment 150829 [details] [review]
Bug 33613: Use prop() to evaluate checkbox

To test:
1. Have an item with a replacement cost checked out to a patron
2. Set the ClaimReturnedChargeFee sys pref to "Ask if a lost fee should be charged"
3. Make a claim and check the box for charging.
4. Claim happens but no charge occurs.
5. Apply patch and try again.
6. A charge should now occur.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Hinemoea Viault <hinemoea.viault@inlibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Tomás Cohen Arazi (tcohen) 2023-05-09 14:00:25 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 10 Matt Blenkinsop 2023-05-15 10:36:44 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 11 Lucas Gass (lukeg) 2023-06-15 16:46:36 UTC
Missing dependencies for 22.05.x, no backport.