class DDDInventJournalNameTableEventHandler
{
[DataEventHandler(tableStr(InventJournalName), DataEventType::ValidatingField)]
public static void InventJournalName_onValidatingField(Common sender, DataEventArgs e)
{
ValidateFieldEventArgs validateFieldEventArgs = e as ValidateFieldEventArgs;
InventJournalName inventJournalName = sender as InventJournalName;
boolean ret = validateFieldEventArgs.parmValidateResult();
LedgerJournalName ledgerJournalName;
#Define.defaultGeneraljournal('Please provide the valid default general journal.')
if(ret)
{
switch(validateFieldEventArgs.parmFieldId())
{
case fieldNum(InventJournalName,DDDDefaultGeneralJournal):
select firstonly ledgerJournalName
where ledgerJournalName.JournalName == inventJournalName.DDDDefaultGeneralJournal
&& ledgerJournalName.DDDBudget == NoYes::Yes;
if (!ledgerJournalName.RecId && inventJournalName.DDDDefaultGeneralJournal)
{
ret = checkFailed(#defaultGeneraljournal);
}
break;
}
}
if (!ret)
{
validateFieldEventArgs.parmValidateResult(false);
}
}
}
No comments:
Post a Comment