/** * Save record. This function calls {@link BizDataObj::updateRecord} method internally * * @return boolean true for success */ public function save() { if (count($this->oldVarValue) > 0) { $ok = $this->bizDataObj->updateRecord($this->varValue, $this->oldVarValue); } else { $ok = $this->bizDataObj->insertRecord($this->varValue); } // repopulate current record with bizdataobj activerecord if ($ok) { $this->varValue = $this->bizDataObj->getActiveRecord(); $this->oldVarValue = $this->varValue; } return $ok; }
/** * Save record. This function calls {@link BizDataObj::updateRecord} method internally * * @return boolean true for success */ public function save() { if (count($this->m_var_old) > 0) { $ok = $this->m_BizObj->updateRecord($this->m_var, $this->m_var_old); } else { $ok = $this->m_BizObj->insertRecord($this->m_var); } // repopulate current record with bizdataobj activerecord if ($ok) { $this->m_var = $this->m_BizObj->getActiveRecord(); $this->m_var_old = $this->m_var; } return $ok; }
/** * Pick the joined object's current record to the current record * * @param BizDataObj $joinDataObj * @param string $joinName name of join (optional) * @return array return a modified record with joined record data */ public function joinRecord($joinDataObj, $joinName = "") { // get the maintable of the joindataobj $joinTable = $joinDataObj->m_MainTable; $joinRecord = null; $returnRecord = array(); // find the proper join according to join name and the maintable foreach ($this->m_TableJoins as $tableJoin) { if (($joinName == $tableJoin->m_Name || $joinName == "") && $tableJoin->m_Table == $joinTable) { // populate the column-fieldvalue to columnRef-fieldvalue // get the field mapping to the column, then get the field value $joinFieldName = $joinDataObj->m_BizRecord->getFieldByColumn($tableJoin->m_Column); // joined-main table if (!$joinFieldName) { continue; } if (!$joinRecord) { $joinRecord = $joinDataObj->getActiveRecord(); } $refFieldName = $this->m_BizRecord->getFieldByColumn($tableJoin->m_ColumnRef); // join table $returnRecord[$refFieldName] = $joinRecord[$joinFieldName]; // populate joinRecord's field to current record foreach ($this->m_BizRecord as $fld) { if ($fld->m_Join == $tableJoin->m_Name) { // use join column to match joinRecord field's column $jfldname = $joinDataObj->m_BizRecord->getFieldByColumn($fld->m_Column); // joined-main table $returnRecord[$fld->m_Name] = $joinRecord[$jfldname]; } } break; } } // return a modified record with joined record data return $returnRecord; }