Bug 35514 - New order line form: Total prices not updated when adding multiple items
Summary: New order line form: Total prices not updated when adding multiple items
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Thibaud Guillot
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-07 16:04 UTC by Thibaud Guillot
Modified: 2024-02-02 04:49 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.03


Attachments
Bug 35514: Fix costs update when adding multiple items from staged file (1.34 KB, patch)
2023-12-07 16:13 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 35514: Fix costs update when adding multiple items from staged file (1.48 KB, patch)
2024-01-05 06:40 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 35514: Fix costs update when adding multiple items from staged file (1.54 KB, patch)
2024-01-17 00:28 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 35514: Fix costs update when adding multiple items from staged file (1.52 KB, patch)
2024-01-17 00:46 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 35514: Fix total cost update when adding multiple items to order (1.49 KB, patch)
2024-01-17 00:49 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Thibaud Guillot 2023-12-07 16:04:24 UTC
Hello everyone,

When you add an order line to a basket from a staged file, on the neworderempty.pl page during entry the prices are correctly calculated when you add item one by one, but if you add multiple items simultaneously the total costs are not updated and adding the line leads to having the prices set to 0.
Comment 1 Thibaud Guillot 2023-12-07 16:13:15 UTC
Created attachment 159656 [details] [review]
Bug 35514: Fix costs update when adding multiple items from staged file

Test plan:

1) Stage a file with records
2) Create a basket and add order line from imported records to go on
   neworderempty.pl
3) Choose to add one item and repeat the operation
4) See on form that the total cost is updated without update vendor
   price
5) Now add multiple items, for example, "2" you will see that the total
   cost is not updated and if you save "0" price will be set
6) Apply this patch and repeat step 5
Comment 2 PTFS Europe Sandboxes 2024-01-05 06:40:14 UTC
Created attachment 160564 [details] [review]
Bug 35514: Fix costs update when adding multiple items from staged file

Test plan:

1) Stage a file with records
2) Create a basket and add order line from imported records to go on
   neworderempty.pl
3) Choose to add one item and repeat the operation
4) See on form that the total cost is updated without update vendor
   price
5) Now add multiple items, for example, "2" you will see that the total
   cost is not updated and if you save "0" price will be set
6) Apply this patch and repeat step 5

Signed-off-by: Michał Dudzik <dudzikmichal@wp.pl>
Comment 3 Victor Grousset/tuxayo 2024-01-17 00:28:20 UTC
Created attachment 161081 [details] [review]
Bug 35514: Fix costs update when adding multiple items from staged file

Test plan:

1) Stage a file with records
2) Create a basket and add order line from imported records to go on
   neworderempty.pl
3) Choose to add one item and repeat the operation
4) See on form that the total cost is updated without update vendor
   price
5) Now add multiple items, for example, "2" you will see that the total
   cost is not updated and if you save "0" price will be set
6) Apply this patch and repeat step 5

Signed-off-by: Michał Dudzik <dudzikmichal@wp.pl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 4 Victor Grousset/tuxayo 2024-01-17 00:34:58 UTC
Works, makes sense, QA script happy, code looks good, passing QA :)

testing note: Turns out it's not related to imports. It's just multiple item additions. For example adding an order from an existing record or a new empty record was also affected and fixed.

Feel free to better phrase the title. The "New order line form:" part is my attempt to make it more clear which page in the order process it is. I got a bit lost in the workflow that includes before finding the right page. (maybe it's more obvious now that there isn't a the import part)
Comment 5 Victor Grousset/tuxayo 2024-01-17 00:46:41 UTC
Created attachment 161082 [details] [review]
Bug 35514: Fix costs update when adding multiple items from staged file

Test plan:

1) Stage a file with records
2) Create a basket and add order line from imported records to go on
   neworderempty.pl
3) Choose to add one item and repeat the operation
4) See on form that the total cost is updated without update vendor
   price
5) Now add multiple items, for example, "2" you will see that the total
   cost is not updated
6) Apply this patch, refresh form and repeat steps 3 to 5

Signed-off-by: Michał Dudzik <dudzikmichal@wp.pl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 6 Victor Grousset/tuxayo 2024-01-17 00:49:24 UTC
Created attachment 161083 [details] [review]
Bug 35514: Fix total cost update when adding multiple items to order

Test plan:

1) Create a basket and add an order line to go on neworderempty.pl
   (the new order form)
2) Choose to add one item and repeat the operation
3) See on form that the total cost is updated without update vendor
   price
4) Now add multiple items, for example, "2" you will see that the total
   cost is not updated
5) Apply this patch, refresh form and repeat steps 3 to 5

Signed-off-by: Michał Dudzik <dudzikmichal@wp.pl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 7 Victor Grousset/tuxayo 2024-01-17 01:05:27 UTC
(In reply to Victor Grousset/tuxayo from comment #4)
> testing note: Turns out it's not related to imports. It's just multiple item
> additions. For example adding an order from an existing record or a new
> empty record was also affected and fixed.

Also, as far as I tested, it doesn't impact the final saved order. I couldn't get a difference between orders when hitting the bug or not (with new empty record, exiting record, staged file). The total doesn't seem to come from the form so it's correct.

That divergence is weird though. @Thibaud if you indeed can reproduce an issue with the saved order, feel free to add a mention it in "Text to go in the release notes" in the ticket. (and if you can, fill it because it's empty now)

@Michał did you got that part of step 5 of the original test plan? «and if you save "0" price will be set»

Anyway, updated commit title and test plan to simplify and keep only the stuff that is certain. Patch can still move forward.
Comment 8 Thibaud Guillot 2024-01-17 10:28:22 UTC
Thanks @Victor for feedback.. 
You're right in test plan it's not necessary to have a file staged and import from this one.

On the other hand, I do have the corrected behavior after applying my patch. Have you cleared the cache by any chance? I don't understand this difference in behavior
Comment 9 Victor Grousset/tuxayo 2024-01-17 16:37:04 UTC
> On the other hand, I do have the corrected behavior after applying my patch

yes, I never seen an issue with your patch.

It's the part of step 5 of the original test plan «and if you save "0" price will be set»
I never see that initial issue.
Comment 10 Thibaud Guillot 2024-01-18 14:11:50 UTC
ah right... that's my mistake... I meant to say that the price is simply not updated... I misspoke.
Comment 11 Katrin Fischer 2024-01-29 11:28:46 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 12 Fridolin Somers 2024-02-01 14:53:16 UTC
Pushed to 23.11.x for 23.11.03
Comment 13 Victor Grousset/tuxayo 2024-02-02 04:49:24 UTC
(In reply to Thibaud Guillot from comment #10)
> ah right... that's my mistake... I meant to say that the price is simply not
> updated... I misspoke.

Great news, so no weird stuff happens to only some setups :D