Bug 19780 - Actual price is not updated after it has been amended post receiving an order
Summary: Actual price is not updated after it has been amended post receiving an order
Status: Patch doesn't apply
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Hayley Pelham
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-07 20:38 UTC by Alex Buckley
Modified: 2020-08-14 11:40 UTC (History)
6 users (show)

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


Attachments
Bug 19780 - Updating the invoice costs after updating of the actual value post receiving of the order (6.18 KB, patch)
2017-12-08 01:17 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 19780 - Updating the invoice costs after updating the actual cost of an order following the receival of the order (5.47 KB, patch)
2018-03-27 23:45 UTC, Alex Buckley
Details | Diff | Splinter Review
Fixed merge conflicts - (6.30 KB, patch)
2019-04-10 05:39 UTC, Hayley Pelham
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Buckley 2017-12-07 20:38:14 UTC
The steps to replicate this bug are as follows:

1. Create an order and set the actual price to 9.00

2. Receieve the order changing the actual price value to 10.00. This is to represent the librarian accidentally entering in a different actual price value at receival.

3. Modify the actual value by clicking on the order line. The order page will appear and notice the actual price of 10.00 is displayed. Change this actual price value to 9.00 and save. 

4.View invoices and notice that the actual price displayed for the order is still 10.00 (set in step 2) when it should be 9.00
Comment 1 Alex Buckley 2017-12-08 01:17:12 UTC
Created attachment 69622 [details] [review]
Bug 19780 - Updating the invoice costs after updating of the actual value post receiving of the order

This invoice will update the invoice values if the order actual price
value is modified after the order has been received.

Test plan:
1. Create an order with the vendor price: 10.00 and actual price of
12.00

2. Close the order and receive the shipment. Change the actual price in
the receival page to 14.00

3. View the invoices and notice that 14.00 is the value displayed

4. Go back to the order and click on the order line to modify the order.
Change the actual price to 15.00

5. View the invoice now and notice that 14.00 is still the value being
displayed

6. Apply patch

7. Repeat steps 1,2,3,4 and 5 and notice that 15.00 is the value
displayed in the invoice

8. Now repeat steps 1. View the aqorders database table and notice after
step 1 is completed the order has unitprice:12.00 and
unitprice_tax_included and unitprice_tax_excluded values of NULL

9. Now before closing the order modify it and set the actual price to
14.00

10. Check the aqorders table again and notice that the unitprice is
14.00 and the unitprice_tax_included and unitprice_tax_excluded both
equal NULL. This means the unitprice_tax_included and
unitprice_tax_excluded values are not being updated before the order has
been receieved by they are being correctly updated if the order has been
received and the actual price is changed.

Sponsored-by: Horowhenua Distircit Council
Comment 2 Jon Knight 2017-12-20 17:02:32 UTC
I applied this patch but in step 7 I still seem to have 14.00 shown in the invoice.

I wonder if this patch would benefit from a test script too?
Comment 3 Alex Buckley 2018-03-27 23:45:51 UTC
Created attachment 73359 [details] [review]
Bug 19780 - Updating the invoice costs after updating the actual cost of an order following the receival of the order

This patch builds on the previous patch attached to the bug report 19780.

The purpose of this patch is to fix the current bug in Koha which is if
you have accidently written in the incorrect value into an order
receival form then try to correct the value by clicking on the order
line link and writing in a new value into the actual value input field
of the order and then save the form and go and view the invoice you
notice that the invoice amount has not been updated to match the newly
entered actual value of the order.

This bug was reported by Horowhenua District Library

Now with this patch after clicking on the order line link and writing in
a new actual value for a received order the database is correctly
updated with the new actual value and if you now view the appropriate
invoice for that order you will notice that the invoice amount has been updated.

To make the testing of this patch easier I have made a before and after
screencast video to compliment the test plan.

Updated test plan:
1. Create an order with the vendor price: 10.00 and actual price of
12.00

2. Close the order and receive the shipment. Change the actual price in
the receival page to 14.00

3. Open a new tab and view the invoice for the newly received order and notice that 14.00 is the value displayed

4. In your first tab now click on the order line link to modify the order.
Change the actual price to 15.00

5. View the invoice now and notice that 14.00 is still the value being
displayed

6. Apply patch

7. Repeat steps 1,2,3,4 and 5 and notice that 15.00 is the value
displayed in the invoice

Sponsored-By: Catalyst IT
Comment 4 Alex Buckley 2018-03-28 00:31:13 UTC
When testing this I can email the videos of the test plan before and after applying the patches because they are too large to attach to this bug report
Comment 5 Koha Team University Lyon 3 2018-09-15 17:21:11 UTC
Hello Alex,
I can't reproduce this part :
4. In your first tab now click on the order line link to modify the order.
Change the actual price to 15.00

When I'm clicking on the title, it goes to biblio record. To change my actual price, I have to cancel receipt and redo it but then if I change the actual price, it is correctly updated.

Perhaps, I haven't the same value in AcqCreateItem preference system : I have : " "Create an item when placing an order..."
Comment 6 Caroline Cyr La Rose 2018-10-19 19:27:22 UTC
I get several conflicts when trying to apply

koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
acqui/neworderempty.pl
Comment 7 Hayley Pelham 2019-04-10 05:39:53 UTC
Created attachment 87696 [details] [review]
Fixed merge conflicts -

Bug 19780 - Updating the invoice costs after updating of the actual value post receiving of the order

This invoice will update the invoice values if the order actual price
value is modified after the order has been received.

Test plan:
1. Create an order with the vendor price: 10.00 and actual price of
12.00

2. Close the order and receive the shipment. Change the actual price in
the receival page to 14.00

3. View the invoices and notice that 14.00 is the value displayed

4. Go back to the order and click on the order line to modify the order.
Change the actual price to 15.00

5. View the invoice now and notice that 14.00 is still the value being
displayed

6. Apply patch

7. Repeat steps 1,2,3,4 and 5 and notice that 15.00 is the value
displayed in the invoice

8. Now repeat steps 1. View the aqorders database table and notice after
step 1 is completed the order has unitprice:12.00 and
unitprice_tax_included and unitprice_tax_excluded values of NULL

9. Now before closing the order modify it and set the actual price to
14.00

10. Check the aqorders table again and notice that the unitprice is
14.00 and the unitprice_tax_included and unitprice_tax_excluded both
equal NULL. This means the unitprice_tax_included and
unitprice_tax_excluded values are not being updated before the order has
been receieved by they are being correctly updated if the order has been
received and the actual price is changed.

Sponsored-by: Horowhenua Distircit Council
Comment 8 Séverine Queune 2019-10-04 12:08:46 UTC
Some problems occurred applying patches from bug 19780:
<h1>Something went wrong !</h1>Applying: Bug 19780 - Updating the invoice costs after updating the actual cost of an order following the receival of the order
fatal: sha1 information is lacking or useless (acqui/addorder.pl).
error: could not build fake ancestor
Patch failed at 0001 Bug 19780 - Updating the invoice costs after updating the actual cost of an order following the receival of the order
The copy of the patch that failed is found in: .git/rebase-apply/patch
Comment 9 Katrin Fischer 2019-11-02 11:16:30 UTC
I think there went something wrong when Hayley rebased it, so old and new patch were both on the bug, but even after obsoleting the older, this won't apply:

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 19780 - Updating the invoice costs after updating of the actual value post receiving of the order
Using index info to reconstruct a base tree...
M	acqui/neworderempty.pl
M	koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
M	koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
Auto-merging acqui/neworderempty.pl
CONFLICT (content): Merge conflict in acqui/neworderempty.pl
error: Failed to merge in the changes.
Patch failed at 0001 Bug 19780 - Updating the invoice costs after updating of the actual value post receiving of the order
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Fixed-merge-conflicts---zTWP_q.patch
Comment 10 Fridolin Somers 2020-08-14 11:40:28 UTC
Adds a :
+use Data::Dumper;

This was for debug I bet.

+my $modify = $input->param('modifying');
This looks strange to me.
We usually use a param named "op" with "edit".
For example acqui/orderreceive.pl