The plugin works by performing a deep copy on each lines' custom field value collection after a sales order copy has occurred. There is not much code to it, so I'll post it here in additional to the attached plugin XML:
- Code: Select all
Public Class BusinessLogicPlugin
Inherits System.MarshalByRefObject
Implements JiwaApplication.IJiwaBusinessLogicPlugin
Public Overrides Function InitializeLifetimeService() As Object
' returning null here will prevent the lease manager
' from deleting the Object.
Return Nothing
End Function
Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
If TypeOf JiwaBusinessLogic Is JiwaSales.SalesOrder.SalesOrder Then
Dim salesOrderObject As JiwaSales.SalesOrder.SalesOrder = DirectCast(JiwaBusinessLogic, JiwaSales.SalesOrder.SalesOrder)
AddHandler salesOrderObject.CopyEnd, AddressOf salesOrderObject_CopyEnd
End If
End Sub
Public Sub salesOrderObject_CopyEnd(sender As Object, e As System.EventArgs)
Dim salesOrderObject As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)
For Each salesOrderLine As JiwaSales.SalesOrder.SalesOrderLine In salesOrderObject.SalesOrderLines
salesOrderLine.CustomFieldValues.Copy
Next
End Sub
End Class