webERP Forum

Full Version: Sales Order required date not reflected in Work Order
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?

Jeff, which script would this be from?
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.
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.
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?


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

Change committed. (credited to Jeff)
Reference URL's