Created attachment 151469 [details] [review] Bug 33783: (bug 8179 follow-up) Populate actual cost with ecost during receiving if not set This restores behavior prior to 8179 to use the estimated cost when receiving if the actual cost is not set To test: 1 - Add some orders to a basket, do not set actual cost field 2 - Close basket, receive orders 3 - Note actual cost field is blank 4 - Cancel receipt 5 - Apply patch 6 - Receive again 7 - Note actual cost is populated 8 - Complete receipt and confirm actual cost correctly saved
Created a new basket and added various items to basket, giving each one a vendor price, however leaving actual cost blank. After adding to basket, I closed basket and received the orders. Actual cost field was blank on the receipt. Canceled the receipt and applied patch. Received orders again. This time when I was receiving I noticed that the actual cost was showing up while receiving, however after finishing and viewing the receipt, the actual cost was still left blank.
The problem is that the form expects you to enter a value - if you don't we don't fire an event to update the table rows, which are considered the source of truth. We need some way to check the form values when 'Save changes' is clicked
Created attachment 151758 [details] [review] Bug 33783: (bug 8179 follow-up) Populate actual cost with ecost during receiving if not set This restores behavior prior to 8179 to use the estimated cost when receiving if the actual cost is not set. We set the unitprice in the table row so that it will be used when editing and will be saved even if not adjusted To test: 1 - Add some orders to a basket, do not set actual cost field 2 - Close basket, receive orders 3 - Note actual cost field is blank 4 - Cancel receipt 5 - Apply patch 6 - Receive again 7 - Note actual cost is populated 8 - Complete receipt and confirm actual cost correctly saved
Created attachment 151761 [details] [review] Bug 33783: (bug 8179 follow-up) Populate actual cost with ecost during receiving if not set This restores behavior prior to 8179 to use the estimated cost when receiving if the actual cost is not set. We set the unitprice in the table row so that it will be used when editing and will be saved even if not adjusted To test: 1 - Add some orders to a basket, do not set actual cost field 2 - Close basket, receive orders 3 - Note actual cost field is blank 4 - Cancel receipt 5 - Apply patch 6 - Receive again 7 - Note actual cost is populated 8 - Complete receipt and confirm actual cost correctly saved Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Applied patch, restart_all, but the actual cost remains 0 on receive, for both multi and single receive :( Any hints?
Just noting: I tested the process in 20.11 and the actual cost is pre-populated there. So I can confirm this bug is a regression.
Created attachment 151789 [details] [review] Bug 33783: Make sure the value is populated on load time The original patch makes the form set the right values in the order row (before storing it) but misses to load the right value on page load, which is still a regression. This patch solves that. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 151794 [details] [review] Bug 33783: (bug 8179 follow-up) Populate actual cost with ecost during receiving if not set This restores behavior prior to 8179 to use the estimated cost when receiving if the actual cost is not set. We set the unitprice in the table row so that it will be used when editing and will be saved even if not adjusted To test: 1 - Add some orders to a basket, do not set actual cost field 2 - Close basket, receive orders 3 - Note actual cost field is blank 4 - Cancel receipt 5 - Apply patch 6 - Receive again 7 - Note actual cost is populated 8 - Complete receipt and confirm actual cost correctly saved Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 151795 [details] [review] Bug 33783: Make sure the value is populated on load time The original patch makes the form set the right values in the order row (before storing it) but misses to load the right value on page load, which is still a regression. This patch solves that. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
wait
416 [% IF (invoiceincgst) %] 417 [% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_included : order.ecost_tax_included %] 418 <input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" /> <span class="hint">(tax inclusive)</span> 419 [% ELSE %] 420 [% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_excluded : order.ecost_tax_excluded %] 421 <input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" /> <span class="hint">(tax exclusive)</span> 422 [% END %]
You need to get ecost only if unitprice has not been passed when ordering.
Created attachment 151817 [details] [review] Bug 33783: Only use ecost if unitprice has not been set on ordering Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pushed to master for 23.05.00
Dependencies missing - not backporting to 22.11.x