Hi all,
I have been thinking of a mechanism of approvals for our application.
There are lots of classes which are involved in the approval process. Some
documents have a series of approvals, and after approvals, some of them
require some post process.
So I created a persistent ApprovalType class with ID and Explanation.
Another class is Approval, which holds the user, datetime stamp, a note and
the type of Approval.
I am planning to attach Approvals collection to the related classes.
I am also planning to write a procedure for %OnAfterSave, which will have a
case statement and depending on the type of the approval call the related
post-approval procedure.
Do you think that this is a good way of handling approvals? One possible
disadvantage of this method will be that the %OnAfterSave method will look
sth like that:
If (%this.ApprovalType=1) {
Do Confirmed^OrderApprovalPostProcess(<<How to pass the owner object
(order reference) here, as many different classes will be using this? One
solution is that every approval might also have owner class and ID
properties>>)
}
elseif (%this.ApprovalType=2) {
Do Delivered^OrderApprovalPostProcess(<<Again Order reference>>)
}
....
elseif (%this.ApprovalType=425) {
Do ManagerApproved^PurchasingRequestApprovalPostProcess(<<Purchasing
Request Reference>>)
}
.....
It seems to me that the function will not be easy to maintain. Also the
Approval Types are just simple key value pairs in the database and that
might eventually cause problems, I suspect...
Yet this solution will handle most, if not all, approval processes.
Any suggestions?
Thanks, regards.
Teoman