public function Save($blnForceInsert = false, $blnForceUpdate = false) { if (!$this->__blnRestored || $blnForceInsert) { $this->CreatedBy = QApplication::$objUserAccount->UserAccountId; $this->CreationDate = new QDateTime(QDateTime::Now); parent::Save($blnForceInsert, $blnForceUpdate); } else { $this->ModifiedBy = QApplication::$objUserAccount->UserAccountId; // Load the CustomFieldValue object before modifing $objOldCustomFieldValue = CustomFieldValue::LoadByCustomFieldValueId($this->CustomFieldValueId); parent::Save($blnForceInsert, $blnForceUpdate); // If short_description have been modified if ($this->ShortDescription != $objOldCustomFieldValue->ShortDescription) { if ($objCustomField = $this->CustomField) { $objDatabase = CustomFieldValue::GetDatabase(); $objCustomFieldSelectionArray = CustomFieldSelection::LoadArrayByCustomFieldValueId($this->CustomFieldValueId); foreach ($objCustomFieldSelectionArray as $objCustomFieldSelection) { // If helper table exists if ($strHelperTableArray = $this->GetHelperTableByEntityQtypeId($objCustomFieldSelection->EntityQtypeId)) { $strHelperTable = $strHelperTableArray[0]; $strTableName = $strHelperTableArray[1]; // Update the data into helper table $strQuery = sprintf("UPDATE %s SET `cfv_%s`=%s WHERE `%s_id`='%s';", $strHelperTable, $objCustomField->CustomFieldId, $objDatabase->SqlVariable($this->ShortDescription), $strTableName, $objCustomFieldSelection->EntityId); $objDatabase->NonQuery($strQuery); } } } } } }
public function Save($blnForceInsert = false, $blnForceUpdate = false) { if (!$this->__blnRestored || $blnForceInsert) { $this->CreatedBy = QApplication::$objUserAccount->UserAccountId; $this->CreationDate = new QDateTime(QDateTime::Now); } else { $this->ModifiedBy = QApplication::$objUserAccount->UserAccountId; } parent::Save($blnForceInsert, $blnForceUpdate); }