src/Service/auditService.php
public function audit($dataObjName)
    {
        // get audit dataobj
        $auditDataObj = Openbizx::getObject($this->auditDataObj);
        if (!$auditDataObj)
            return false;

        // get the source dataobj
        $srcDataObj = Openbizx::getObject($dataObjName);
        if (!$srcDataObj)
            return false;

        // for each onaudit field, add a record in audit dataobj
        $auditFields = $srcDataObj->getOnAuditFields();
        foreach ($auditFields as $field) {
            if ($field->oldValue == $field->value)
                continue;
            $recArr = $auditDataObj->newRecord();
            if ($recArr == false) {
                Openbizx::$app->getLog()->log(LOG_ERR, "DATAOBJ", $auditDataObj->getErrorMessage());
                return false;
            }

            $profile = Openbizx::$app->getUserProfile();
            $recArr['DataObjName'] = $dataObjName;
            $recArr['ObjectId'] = $srcDataObj->getFieldValue("Id");
            $recArr['FieldName'] = $field->objectName;
            $recArr['OldValue'] = $field->oldValue;
            $recArr['NewValue'] = $field->value;
            $recArr['ChangeTime'] = date("Y-m-d H:i:s");
            $recArr['ChangeBy'] = $profile["USERID"];
            $recArr['ChangeFrom'] = $_SERVER['REMOTE_ADDR'];
            $recArr['RequestURI'] = $_SERVER['REQUEST_URI'];
            $recArr['Timestamp'] = date("Y-m-d H:i:s");
            $ok = $auditDataObj->insertRecord($recArr);
            if ($ok == false) {
                Openbizx::$app->getLog()->log(LOG_ERR, "DATAOBJ", $auditDataObj->getErrorMessage());
                return false;
            }
        }
    }
public function audit($dataObjName)
    {
        // get audit dataobj
        $auditDataObj = Openbizx::getObject($this->auditDataObj);
        if (!$auditDataObj)
            return false;

        // get the source dataobj
        $srcDataObj = Openbizx::getObject($dataObjName);
        if (!$srcDataObj)
            return false;

        // for each onaudit field, add a record in audit dataobj
        $auditFields = $srcDataObj->getOnAuditFields();
        foreach ($auditFields as $field) {
            if ($field->oldValue == $field->value)
                continue;
            $recArr = $auditDataObj->newRecord();
            if ($recArr == false) {
                Openbizx::$app->getLog()->log(LOG_ERR, "DATAOBJ", $auditDataObj->getErrorMessage());
                return false;
            }

            $profile = Openbizx::$app->getUserProfile();
            $recArr['DataObjName'] = $dataObjName;
            $recArr['ObjectId'] = $srcDataObj->getFieldValue("Id");
            $recArr['FieldName'] = $field->objectName;
            $recArr['OldValue'] = $field->oldValue;
            $recArr['NewValue'] = $field->value;
            $recArr['ChangeTime'] = date("Y-m-d H:i:s");
            $recArr['ChangeBy'] = $profile["USERID"];
            $recArr['ChangeFrom'] = $_SERVER['REMOTE_ADDR'];
            $recArr['RequestURI'] = $_SERVER['REQUEST_URI'];
            $recArr['Timestamp'] = date("Y-m-d H:i:s");
            $ok = $auditDataObj->insertRecord($recArr);
            if ($ok == false) {
                Openbizx::$app->getLog()->log(LOG_ERR, "DATAOBJ", $auditDataObj->getErrorMessage());
                return false;
            }
        }
    }
Audit DataObj

@param string $dataObjName
@return boolean
@todo all return false? really?