AX2009
//VAR Changed on 1/5/2013 at 14:49:48 by Tectura7 SOM16
private void THK_allowEditFieldList(FormDataSource _tableDS,
boolean _allowEdit = false)
{
int field;
DictTable dictTable;
DictField dictField;
tableId tableId = _tableDS.table();
fieldId fieldId;
fieldId agreeStatue,tmpId;
Name tmpName;
;
agreeStatue = fieldnum(PurchAgreementHeader, AgreementState);
dictTable = new DictTable(tableId);
setPrefix(dictTable.name());
for (field = 1; field <= dictTable.fieldCnt(); field++)
{
fieldId = dictTable.fieldCnt2Id(field);
dictField = new DictField(tableId, fieldId);
tmpId = dictField.id();
tmpName = dictField.name();
if(! dictField.isSystem())
{
info(tmpName);
if( tmpId != agreeStatue)
_tableDS.object(tmpId).allowEdit(_allowEdit);
//else
// info(tmpName);
}
}
}
AX2012
private void THK_allowEditFieldList(FormDataSource _tableDS,
boolean _allowEdit = false)
{
TableId tableId = _tableDS.table();
fieldid tmpId, agreeStatue = fieldnum(PurchAgreementHeader, AgreementState);
void allowEditAllField(TableId _tableId)
{
SysDictTable sysDictTable = new SysDictTable(_tableId);
SysDictField sysDictField;
FieldId fieldId = 0;
TableId parentTableId = sysDictTable.extends();
;
setPrefix(sysDictTable.name());
if (parentTableId)
{
allowEditAllField(parentTableId);
}
fieldId = sysDictTable.fieldNext(fieldId);
while (fieldId)
{
sysDictField = new SysDictField(_tableId, fieldId);
tmpId = sysDictField.id();
fieldId = sysDictTable.fieldNext(fieldId);
if (sysDictField.isSystem())
continue;
if(tmpId != agreeStatue)
{
_tableDS.object(tmpId).allowEdit(_allowEdit);
}
//info(strFmt("%1[%2]",sysDictField.name(),sysDictField.id()));
}
}
;
allowEditAllField(tableId);
}