General information
Category:
The Mere Mortals Framework
Kevin,
In addition I do not see where the broken Business Rule are cleared without a record movement, so you will probably need a loBizObj.oBizRules.ClearAll() call
after the This.oBizRulesMsg.Show(loBizObj) line.
Thanks again
Rex
>Kevin,
>
>Your DisplayBrokenRules method only checks the primary business object for broken rules. I have fixed it by creating a new method, FindBrokenRule which contains the search code and changed the methods as follows:
>
>
><\pre
>
>PROCEDURE displaybrokenrules
>*---------------------- Location Section ------------------------
>* Library: CForms.vcx
>* Class: CBizObjForm
>* Method: DisplayBrokenRules()
>*----------------------- Usage Section --------------------------
>*) Description:
>*) Passes the call to the broken rules message object.
>*) If a message object is not instantiated, it creates one
>* Scope: Public
>* Parameters:
>* 1. toBizObj - Business object for which broken rules
>* are displayed.
>*$ Usage:
>*$
>* Returns: Logical .T. by default
>*--------------------- Maintenance Section ----------------------
>* Change Log:
>* CREATED 09/28/99 - KJM
>* MODIFIED
>******************************************************************
>LPARAMETERS toBizObj
>
>LOCAL ;
> loBizObj
>
>loBizObj = This.FindBrokenRule(toBizObj)
>IF ISNULL(loBizObj)
> RETURN
>ENDIF
>
>IF This.CreateBrokenRulesMsgObject()
> *---------------------------------------------
> *--- Call the broken rules message object with
> *--- a reference to the business object
> *---------------------------------------------
> This.oBizRulesMsg.Show(loBizObj)
>ENDIF
>ENDPROC
>
>
>*-- Searches related business objects for broken rules
>PROCEDURE findbrokenrule
>* Program....: CBizObjForm.FindBrokenRule
>* Version....: 1.0
>* Author.....: Rex L. Mahel
>* Date.......: November 24, 1999
>* Compiler...: Visual FoxPro 06.00.8492.00 for Windows
>* Abstract...:
>* Changes....:
>LPARAMETER toBizObj
>
>LOCAL ;
> loRetObj,;
> lnRulesCount,;
> lnObjCount,;
> lnCount,;
> loChildBizObj
>
>IF VARTYPE(toBizObj) != 'O'
> IF ! VARTYPE(ThisForm.oBizObj) == 'O'
> RETURN .NULL.
> ENDIF
> toBizObj = ThisForm.oBizObj
>ENDIF
>
>loRetObj = .NULL.
>IF ! VARTYPE(toBizObj.oBizRules) == 'O'
> RETURN loRetObj
>ENDIF
>
>lnRulesCount = toBizObj.oBizRules.GetCount()
>IF lnRulesCount # 0
> RETURN toBizObj
>ENDIF
>
>*---------------------------------------------------------
>*--- If no rules are broken, check child business objects
>*---------------------------------------------------------
>lnObjCount = toBizObj.RefBizObj.GetObjectCount()
>FOR lnCount = 1 to lnObjCount
> loChildBizObj = toBizObj.RefBizObj.Get(lnCount)
> loRetObj = ThisForm.FindBrokenRule(loChildBizObj)
> IF ! ISNULL(loRetObj)
> EXIT
> ENDIF
>ENDFOR
>RETURN loRetObj
>ENDPROC
>
>
>The only potential problem I see is if you have a complex situation where business objects are related, you could get a recursion error in the FindBrokenRule method
>
>Thanks
>
>Rex
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only