protected void setDocumentState(VersioningDocumentState _versioningState)
{
ttsbegin;
if (this.isChangeRequestInReviewForDraftPurchaseOrder(purchTable, _versioningState))
{
this.updatePurchaseOrderHeaderDistribution();
}
purchTable.selectForUpdate(true);
purchTable.DocumentState = _versioningState;
if (purchTable)
{
// Update the drop shipment status
if ( purchTable.MCRDropShipment
&& (purchTable.DocumentState == VersioningDocumentState::Approved || purchTable.DocumentState == VersioningDocumentState::Confirmed)
&& (changedRecord.TableId != tableNum(PurchLine)) ) // Line update should be handled in the PurchLineType update method. Lines are exluded here to avoid record update conflicts.
{
MCRDropShipStatusUpdate::updateDropShipStatus(purchTable);
}
if (!this.parmSkipUpdatePurchTable())
{
using (var purchTableSkipBusinessLogicContext = PurchTableSkipBusinessLogicContext::construct())
{
purchTableSkipBusinessLogicContext.parmSkipUpdate(true);
purchTable.update();
}
this.updatePurchaseOrderHeaderDistribution();
// If the buffer is shown in a form, we have to reread it to avoid version conflict
if (FormDataUtil::getFormDataSource(purchTable))
{
FormDataUtil::getFormDataSource(purchTable).reread();
}
}
else
{
this.updatePurchaseOrderHeaderDistribution();
}
}
André Arnaud de Cal... 291,791 Super User 2024 Season 2
Martin Dráb 230,488 Most Valuable Professional
nmaenpaa 101,156