Bug 34985

Summary: Add a quantity field to the manual invoice form
Product: Koha Reporter: Hammat wele <hammat.wele>
Component: Fines and feesAssignee: Hammat wele <hammat.wele>
Status: RESOLVED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: enhancement    
Priority: P5 - low CC: caroline.cyr-la-rose, fridolin.somers, kkrueger, oleonard, philippe.blouin
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Caroline Cyr La Rose Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/986
Text to go in the release notes:
This patch add a quantity field and a cost field to the manual invoice form. This allows to automatically multiply the amount. The new fields will display and calculate when the selected debit has a default cost set.
Version(s) released in:
23.11.00
Circulation function:
Attachments: Bug 34985: Add a quantity field to the manual invoice form
NoDefaultValue
QuantityFieldDisplay
Bug 34985: Add a quantity field to the manual invoice form
Bug 34985: Add a quantity field to the manual invoice form

Description Hammat wele 2023-10-04 14:47:40 UTC Comment hidden (obsolete)
Comment 1 Hammat wele 2023-10-04 17:03:30 UTC
This patch add a Quantity field and a Cost field to the manual invoice form this will allow to automatically multiply the amount when it has a default amount
Comment 2 Hammat wele 2023-10-04 17:38:07 UTC Comment hidden (obsolete)
Comment 3 Kristi 2023-10-04 21:11:16 UTC
Created attachment 156559 [details]
NoDefaultValue
Comment 4 Kristi 2023-10-04 21:11:44 UTC
Created attachment 156560 [details]
QuantityFieldDisplay
Comment 5 Kristi 2023-10-04 21:15:26 UTC
"2-6) Select a type with no default amount set
        ->Cost field and Quantity field should not be added to the form"

Just to clarify here, these fields are present in the form, but if no default value is set for the Debit Type, the cost is listed as 0.00, and the quantity is 1. See screenshot 34985_NoDefault.PNG 

This does not seem like problematic behavior, but wanted to call it out.
Comment 6 ByWater Sandboxes 2023-10-04 21:16:03 UTC
Created attachment 156561 [details] [review]
Bug 34985: Add a quantity field to the manual invoice form

This patch add a Quantity field and a Cost field to the manual invoice form this will allow to automatically multiply the amount when it has a default amount.

Test plan:

1) Apply the patch
2) Create multiple charge types some with default amount and some without default amount
    1-1) Go to Administraion -> Debit types
    1-2) Click on New Debit types
    1-3) Fill the form check the "Can be manually invoiced?" field
    1-5) Click on save
3) Create a manual invoice
    2-1) Find a patrons
    2-2) Click on Accounting tab
    2-3) Click on Create manual invoice tab
    2-4) Select a type with default amount set
        ->Cost field and Quantity field should be added to the form
    2-5) Edit the Cost field or Quantity field
        ->The amount will be automatically calculate
    2-6) Select a type with no default amount set
        ->Cost field and Quantity field should not be added to the form

Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org>
Comment 7 Katrin Fischer 2023-11-03 20:06:37 UTC
Should we add a hint to the debit types page?
Comment 8 Katrin Fischer 2023-11-03 20:06:55 UTC
Created attachment 158365 [details] [review]
Bug 34985: Add a quantity field to the manual invoice form

This patch add a Quantity field and a Cost field to the manual invoice form this will allow to automatically multiply the amount when it has a default amount.

Test plan:

1) Apply the patch
2) Create multiple charge types some with default amount and some without default amount
    1-1) Go to Administraion -> Debit types
    1-2) Click on New Debit types
    1-3) Fill the form check the "Can be manually invoiced?" field
    1-5) Click on save
3) Create a manual invoice
    2-1) Find a patrons
    2-2) Click on Accounting tab
    2-3) Click on Create manual invoice tab
    2-4) Select a type with default amount set
        ->Cost field and Quantity field should be added to the form
    2-5) Edit the Cost field or Quantity field
        ->The amount will be automatically calculate
    2-6) Select a type with no default amount set
        ->Cost field and Quantity field should not be added to the form

Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Tomás Cohen Arazi (tcohen) 2023-11-08 20:42:53 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 10 Fridolin Somers 2023-11-11 01:20:40 UTC
Enhancement not pushed to 23.05.x