Description
Katrin Fischer
2023-08-03 13:30:21 UTC
Solution: it should not be possible to modify received order lines in any basket. *** Bug 34254 has been marked as a duplicate of this bug. *** Created attachment 154287 [details] [review] Bug 34469: Block editing for received order lines When an already received order line is modified/edited, we experience data loss. Most prominently, we will lose the linked invoiceid. Therefore we should not allow editing an order line that was already received. If something needs to be changed, the receipt should be cancelled first. To test: * Create basket as standing order with items added in cataloguing * Add an order line * Receive shipment * Go to the basket summary page, click on 'Modify' * Change the actual cost * Save * Verify that the invoice is now empty * In the database aqorders.invoiceid will be NULL * Apply patch * Receive another shipment for the standing order * Go back to basket summary page * Verify the 'Modify' link is no longer present * Click 'Modify' on the unreceived order line * Edit the URL parameter odernumber to have the number of an already received order line * Verify you see a nice error message: This order cannot be edited, the basket is closed or the order was already received. Created attachment 154288 [details] [review] Bug 34469: Block editing for received order lines When an already received order line is modified/edited, we experience data loss. Most prominently, we will lose the linked invoiceid. Therefore we should not allow editing an order line that was already received. If something needs to be changed, the receipt should be cancelled first. To test: * Create basket as standing order with items added in cataloguing * Add an order line * Receive shipment * Go to the basket summary page, click on 'Modify' * Change the actual cost * Save * Verify that the invoice is now empty * In the database aqorders.invoiceid will be NULL * Apply patch * Receive another shipment for the standing order * Go back to basket summary page * Verify the 'Modify' link is no longer present * Click 'Modify' on the unreceived order line * Edit the URL parameter odernumber to have the number of an already received order line * Verify you see a nice error message: This order cannot be edited, the basket is closed or the order was already received. Signed-off-by: Sam Lau <samalau@gmail.com> Hi Katrin, Thank you so much for working on this patch! In testing, everything was working as described until these steps: * Click 'Modify' on the unreceived order line * Edit the URL parameter ordernumber to have the number of an already received order line. When I edited the URL parameter with an order number that was already received, it let me make modifications without receiving an error message. I then confirmed that the received item line was removed from the invoice. (In reply to Laura Escamilla from comment #5) > > When I edited the URL parameter with an order number that was already > received, it let me make modifications without receiving an error message. I > then confirmed that the received item line was removed from the invoice. Hi Laura, I tried to reproduce that in a sandbox and there is an error message : "This order cannot be edited, the basket is closed or the order was already received." Please have a look here: http://staff-b34469.sandboxes.ptfs-europe.co.uk/cgi-bin/koha/acqui/neworderempty.pl?ordernumber=3&booksellerid=1&basketno=2 Acq Log is active and there is a SQL-Report for aqorders. I also checked the use case described in bug 34254 (In reply to Laura Escamilla from comment #5) > Hi Katrin, > > Thank you so much for working on this patch! > > In testing, everything was working as described until these steps: > * Click 'Modify' on the unreceived order line > * Edit the URL parameter ordernumber to have the number of an > already received order line. > > When I edited the URL parameter with an order number that was already > received, it let me make modifications without receiving an error message. I > then confirmed that the received item line was removed from the invoice. Hi Laura, that's not nice! It looks like I committed all changes and it worked for me (on the other computer) - I'll retest, but maybe you could confirm that you did a restart_all before testing? Now I overlapped with Michaela also testing - glad to see the acq bugs getting so much attention :) Hope we can resolve! Created attachment 154293 [details]
Error Message order cannot be edited, the order was already received.
Message:
order cannot be edited, the basket is closed or the order was already received.
Created attachment 154294 [details] [review] Bug 34469: Block editing for received order lines When an already received order line is modified/edited, we experience data loss. Most prominently, we will lose the linked invoiceid. Therefore we should not allow editing an order line that was already received. If something needs to be changed, the receipt should be cancelled first. To test: * Create basket as standing order with items added in cataloguing * Add an order line * Receive shipment * Go to the basket summary page, click on 'Modify' * Change the actual cost * Save * Verify that the invoice is now empty * In the database aqorders.invoiceid will be NULL * Apply patch * Receive another shipment for the standing order * Go back to basket summary page * Verify the 'Modify' link is no longer present * Click 'Modify' on the unreceived order line * Edit the URL parameter odernumber to have the number of an already received order line * Verify you see a nice error message: This order cannot be edited, the basket is closed or the order was already received. Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> status back to signed Off (In reply to Michaela Sieber from comment #11) > status back to signed Off My apologies, Katrin! I missed that pesky restart_all step! It works as expected and I did in fact get the error message. Thank you again for working on this patch so quickly! (In reply to Laura Escamilla from comment #12) > (In reply to Michaela Sieber from comment #11) > > status back to signed Off > > My apologies, Katrin! I missed that pesky restart_all step! It works as > expected and I did in fact get the error message. > > Thank you again for working on this patch so quickly! Glad that resolved it :) And very happy to be able to kill an evil bug! Created attachment 154356 [details] [review] Bug 34469: Block editing for received order lines When an already received order line is modified/edited, we experience data loss. Most prominently, we will lose the linked invoiceid. Therefore we should not allow editing an order line that was already received. If something needs to be changed, the receipt should be cancelled first. To test: * Create basket as standing order with items added in cataloguing * Add an order line * Receive shipment * Go to the basket summary page, click on 'Modify' * Change the actual cost * Save * Verify that the invoice is now empty * In the database aqorders.invoiceid will be NULL * Apply patch * Receive another shipment for the standing order * Go back to basket summary page * Verify the 'Modify' link is no longer present * Click 'Modify' on the unreceived order line * Edit the URL parameter odernumber to have the number of an already received order line * Verify you see a nice error message: This order cannot be edited, the basket is closed or the order was already received. Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com> Added Laura's signoff :) Works, makes sense, QA script happy, code looks good, passing QA :) Pushed to master for 23.11. Nice work everyone, thanks! Pushed to 23.05.x for 23.05.03 Nice work everyone! Pushed to 22.11.x for next release |