/** * execute method of the class; check if master record exists and return null or error; * @param none * @return mix null or error object if records don't exists * @access public */ function Execute() { $this->errorIfExists(false); $err = parent::Execute(); if ($err != NULL) { $useSavedData = false; if (in_array($this->tNG->transactionType, array('_delete', '_multipleDelete'))) { $useSavedData = true; } $this->errorMsg = KT_DynamicData($this->errorMsg, $this->tNG, '', $useSavedData); $err = new tNG_error('TRIGGER_MESSAGE__CHECK_MASTER_RECORD', array(), array()); if ($this->fkField != '') { // set field error to $this->errorMsg $err->setFieldError($this->fkField, '%s', array($this->errorMsg)); if ($this->tNG->columns[$this->fkField]['method'] != 'POST') { // set composed message as user error $err->addDetails('%s', array($this->errorMsg), array('')); } } else { // set composed message as user error $err->addDetails('%s', array($this->errorMsg), array('')); } } return $err; }
/** * execute method of the class; check if detail record exists and return null or error; * @param none * @return mix null or error object if records exists; * @access public */ function Execute() { $this->setFieldType($this->tNG->getColumnType($this->tNG->getPrimaryKey())); $this->setFieldValue($this->tNG->getPrimaryKeyValue()); $this->errorIfExists(true); $err = parent::Execute(); if ($err != NULL) { // change the default error message $useSavedData = false; if (in_array($this->tNG->transactionType, array('_delete', '_multipleDelete'))) { $useSavedData = true; } $this->errorMsg = KT_DynamicData($this->errorMsg, $this->tNG, '', $useSavedData); // set only user message $err = new tNG_error('TRIGGER_MESSAGE__CHECK_DETAIL_RECORD', array(), array()); $err->addDetails('%s', array($this->errorMsg), array('')); } return $err; }