Skip to content

Instantly share code, notes, and snippets.

@kjrichardson
Created February 17, 2023 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjrichardson/e5e8b7d2656fa66617e0cb301defebe1 to your computer and use it in GitHub Desktop.
Save kjrichardson/e5e8b7d2656fa66617e0cb301defebe1 to your computer and use it in GitHub Desktop.
//create protected access function that allows the graphs it is extending to access protected methods.
[PXProtectedAccess]
public abstract class POCreate_ProtectedExtension : PXGraphExtension<POCreate_Extension, POCreate>
{
[PXProtectedAccess(typeof(POCreate))]
protected abstract void LinkPOLineToSOLineSplit(POOrderEntry docgraph, SOLineSplit3 soline, POLine line);
}
//standard graph extension
public class POCreate_Extension : PXGraphExtension<POCreate>
{
//protected method that is being overridden
public delegate void LinkPOLineToSOLineSplitDelegate(POOrderEntry docgraph, SOLineSplit3 soline, POLine line);
[PXOverride]
public virtual void LinkPOLineToSOLineSplit(POOrderEntry docgraph, SOLineSplit3 soline, POLine line, LinkPOLineToSOLineSplitDelegate del)
{
del?.Invoke(docgraph, soline, line);
//execute custom code
POLineExt rowExt = line.GetExtension<POLineExt>();
SOLine solineactual = SOLine.PK.Find(docgraph, soline.OrderType, soline.OrderNbr, soline.LineNbr);
SOLineExt lineExt = solineactual.GetExtension<SOLineExt>();
docgraph.Transactions.SetValueExt<POLineExt.usrHWSOPurchasingNote>(line, lineExt.UsrPuchasingNote);
docgraph.Transactions.SetValueExt<POLineExt.usrHWSOPuchaseDeliveryOptions>(line, lineExt.UsrPuchaseDeliveryOptions);
docgraph.Transactions.SetValueExt<POLineExt.usrHWSOPurchasePriority>(line, lineExt.UsrPurchasePriority);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment