webERP Forum
Sales Order required date not reflected in Work Order - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (/forumdisplay.php?fid=1)
+--- Forum: Problems / Bugs? (/forumdisplay.php?fid=8)
+--- Thread: Sales Order required date not reflected in Work Order (/showthread.php?tid=8134)



Sales Order required date not reflected in Work Order - Jeff Harr - 03-14-2018 01:44 AM

If I have a sales order with a required date of, say, May 13, 2018 and Auto Create Work Orders set to "Yes" the Work Order still shows today's date as the required date, not May 13. I tested this on my installation. Was unable to test it on the demo site. Shouldn't these dates match?

Thanks,
Jeff


RE: Sales Order required date not reflected in Work Order - TurboPT - 03-14-2018 04:57 AM

Jeff, which script would this be from?


RE: Sales Order required date not reflected in Work Order - Jeff Harr - 03-14-2018 05:21 AM

I think it is generated from DeliveryDetails.php, but data may be passed to it from SelectOrderItems.php
SelectOrderItems.php has the individual line item Due date field(s) where DeliveryDetails.php just has the Estimated Delivery Date field.


RE: Sales Order required date not reflected in Work Order - TurboPT - 03-14-2018 09:12 AM

Tim (or anyone else that might be familiar)

I'm somewhat confused on the flow, but in DeliveryDetails.php, there are two big condition blocks at lines 329 and 649.
(The SelectOrderItems script, line 1191, does pass an identifier to DeliveryDetails via a link, which happens after a 'DeliveryDetails' submit at line 1478)

Both of these conditions have an insert into workorders at lines 499 and 697.

The insert at line 499 uses the current date for requiredby, but the line 697 insert uses the requiredby date from the contract.

So possibly it is that the $_SESSION['ExistingOrder'.$identifier] is not set correctly somewhere between the two scripts that Jeff mentions, or there may be some other contributing situation?

=====

Looking a bit more, I wonder if the submit at 1478 that gets redirected by line 1190 may losing the original identifier? (or that the session's ExistingOrder mentioned above should be set before the rediect?) It seems that the redirect might be getting a new identifier value, but perhaps not, as the form at line 833 has the identifier with the URL but I have not been able to test that far, just yet.


RE: Sales Order required date not reflected in Work Order - Jeff Harr - 03-17-2018 01:03 AM

I don't know if this is a good solution, but with my (minimal) testing this gave the desired result.

replaced line 507: '" . Date('Y-m-d') . "',
with: '" . FormatDateForSQL($StockItem->ItemDue) . "',

Maybe someone with more webERP and PHP knowledge can review?

Thanks!

Jeff


RE: Sales Order required date not reflected in Work Order - TurboPT - 03-17-2018 11:38 AM

That minor change definitely seems plausible for that area, though I cannot give a test run.

Change committed. (credited to Jeff)