/** * Set the stg_title column value. * * @param string $v new value * @return void */ public function setStgTitle($v) { if ($this->getStgUid() == "") { throw new Exception("Error in setStgTitle, the setStgUid() can't be blank"); } $v = isset($v) ? (string) $v : ''; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; if ($this->stg_title !== $v || $v === "") { $this->stg_title = $v; $res = Content::addContent('STG_TITLE', '', $this->getStgUid(), $lang, $this->stg_title); return $res; } return 0; }
/** * Set the evn_description column value. * * @param string $v new value * @return void */ public function setEvnDescription($v) { if ($this->getEvnUid() == "") { throw new Exception("Error in setEvnDescription, the setEvnUid() can't be blank"); } $v = isset($v) ? (string) $v : ''; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; if ($this->evn_description !== $v || $v === "") { $this->evn_description = $v; $res = Content::addContent('EVN_DESCRIPTION', '', $this->getEvnUid(), $lang, $this->evn_description); return $res; } return 0; }
function addContent($data, $fields) { $obj = new Content(); $ConCategory = $fields['CON_CATEGORY']; $ConParent = $fields['CON_PARENT']; $ConId = $fields['CON_ID']; $ConLang = $fields['CON_LANG']; $ConValue = $fields['CON_VALUE']; try { $res = $obj->addContent($ConCategory, $ConParent, $ConId, $ConLang, $ConValue); } catch (Exception $e) { return $e; } return $res; }
/** * Set the [grp_title] column value. * * @param string $v new value * @return void */ public function setGrpTitle($v) { if ($this->getGrpUid() == '') { throw new Exception("Error in setGrpTitle, the GRP_UID can't be blank"); } // Since the native PHP type for this column is string, // we will cast the input to a string (if it is not). if ($v !== null && !is_string($v)) { $v = (string) $v; } if ($this->grp_title !== $v || $v === '') { $this->grp_title = $v; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; $res = Content::addContent('GRP_TITLE', '', $this->getGrpUid(), $lang, $this->grp_title); } }
/** * Put SubProcess in Process * @var string $pro_uid. Uid for Process * @var string $spr_uid. Uid for SubProcess * @var array $spr_data. Data for SubProcess * * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia * * @return array */ public function putSubprocesss($pro_uid, $tas_uid, $spr_data) { $pro_uid = $this->validateProUid($pro_uid); $tas_uid = $this->validateTasUid($tas_uid); if (empty($spr_data)) { throw new \Exception("The request data is empty."); } if (isset($spr_data['spr_pro'])) { $spr_data['spr_pro'] = $this->validateProUid($spr_data['spr_pro']); } if (isset($spr_data['spr_tas'])) { $spr_data['spr_tas'] = $this->validateTasUid($spr_data['spr_tas']); } $dataTemp = $this->getSubprocesss($pro_uid, $tas_uid); $spr_data = array_merge($dataTemp, $spr_data); $spr_data['spr_variables_in'] = isset($spr_data['spr_variables_in']) ? $spr_data['spr_variables_in'] : array(); $oSubProcess = new \SubProcess(); $aData = array('SP_UID' => $spr_data['spr_uid'], 'PRO_UID' => $spr_data['spr_pro'], 'TAS_UID' => $spr_data['spr_tas'], 'PRO_PARENT' => $pro_uid, 'TAS_PARENT' => $tas_uid, 'SP_TYPE' => 'SIMPLE', 'SP_SYNCHRONOUS' => (int) $spr_data['spr_synchronous'], 'SP_SYNCHRONOUS_TYPE' => 'ALL', 'SP_SYNCHRONOUS_WAIT' => 0, 'SP_VARIABLES_OUT' => serialize($spr_data['spr_variables_out']), 'SP_VARIABLES_IN' => serialize($spr_data['spr_variables_in']), 'SP_GRID_IN' => ''); $oSubProcess->update($aData); $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; \Content::addContent('TAS_TITLE', '', $tas_uid, $lang, $spr_data['spr_name']); }
$_POST['port'] = 'none'; } $aData = array('DBS_UID' => $_POST['dbs_uid'], 'PRO_UID' => $_SESSION['PROCESS'], 'DBS_TYPE' => $_POST['type'], 'DBS_SERVER' => $_POST['server'], 'DBS_DATABASE_NAME' => $_POST['db_name'], 'DBS_USERNAME' => $_POST['user'], 'DBS_PASSWORD' => ($_POST['passwd'] == 'none' ? "" : G::encrypt($_POST['passwd'], $_POST['db_name'])) . "_2NnV3ujj3w", 'DBS_PORT' => $_POST['port'] == 'none' ? "" : $_POST['port'], 'DBS_ENCODE' => $_POST['enc']); $oDBSource->update($aData); $oContent->addContent('DBS_DESCRIPTION', '', $_POST['dbs_uid'], SYS_LANG, $_POST['desc']); break; case 'saveConnection': $oDBSource = new DbSource(); $oContent = new Content(); if (strpos($_POST['server'], "\\")) { $_POST['port'] = 'none'; } $aData = array('PRO_UID' => $_SESSION['PROCESS'], 'DBS_TYPE' => $_POST['type'], 'DBS_SERVER' => $_POST['server'], 'DBS_DATABASE_NAME' => $_POST['db_name'], 'DBS_USERNAME' => $_POST['user'], 'DBS_PASSWORD' => ($_POST['passwd'] == 'none' ? "" : G::encrypt($_POST['passwd'], $_POST['db_name'])) . "_2NnV3ujj3w", 'DBS_PORT' => $_POST['port'] == 'none' ? "" : $_POST['port'], 'DBS_ENCODE' => $_POST['enc']); $newid = $oDBSource->create($aData); $sDelimiter = DBAdapter::getStringDelimiter(); $oContent->addContent('DBS_DESCRIPTION', '', $newid, SYS_LANG, $_POST['desc']); break; case 'deleteDbConnection': try { $oDBSource = new DbSource(); $oContent = new Content(); $DBS_UID = $_POST['dbs_uid']; $PRO_UID = $_SESSION['PROCESS']; $oDBSource->remove($DBS_UID, $PRO_UID); $oContent->removeContent('DBS_DESCRIPTION', "", $DBS_UID); $result->success = true; $result->msg = G::LoadTranslation('ID_DBCONNECTION_REMOVED'); } catch (Exception $e) { $result->success = false; $result->msg = $e->getMessage(); }
/** * Create DB Connections rows from an array of data * * @param array $aConnections * @return void */ public function createDBConnectionsRows ($aConnections) { foreach ($aConnections as $sKey => $aRow) { $oConnection = new DbSource(); if ($oConnection->Exists( $aRow['DBS_UID'], $aRow['PRO_UID'] )) { $oConnection->remove( $aRow['DBS_UID'], $aRow['PRO_UID'] ); } $oConnection->create( $aRow ); // Update information in the table of contents $oContent = new Content(); $ConCategory = 'DBS_DESCRIPTION'; $ConParent = ''; $ConId = $aRow['DBS_UID']; $ConLang = SYS_LANG; if ($oContent->Exists( $ConCategory, $ConParent, $ConId, $ConLang )) { $oContent->removeContent( $ConCategory, $ConParent, $ConId ); } $oContent->addContent( $ConCategory, $ConParent, $ConId, $ConLang, $aRow['DBS_DESCRIPTION'] ); } } #@!neyek
/** * Set the [inp_doc_comment] column value. * * @param string $sValue new value * @return void */ public function setInpDocDescription($sValue) { if ($sValue !== null && !is_string($sValue)) { $sValue = (string) $sValue; } if ($this->inp_doc_description !== $sValue || $sValue === '') { try { $this->inp_doc_description = $sValue; $iResult = Content::addContent('INP_DOC_DESCRIPTION', '', $this->getInpDocUid(), defined('SYS_LANG') ? SYS_LANG : 'en', $this->inp_doc_description); } catch (Exception $oError) { $this->inp_doc_description = ''; throw $oError; } } }
/** * Update WebEntry-Event * * @param string $webEntryEventUid Unique id of WebEntry-Event * @param string $userUidUpdater Unique id of updater User * @param array $arrayData Data * * return array Return data of the WebEntry-Event updated */ public function update($webEntryEventUid, $userUidUpdater, array $arrayData) { try { //Verify data $process = new \ProcessMaker\BusinessModel\Process(); $validator = new \ProcessMaker\BusinessModel\Validator(); $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData"); $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData"); //Set data $arrayData = array_change_key_case($arrayData, CASE_UPPER); $arrayDataBackup = $arrayData; unset($arrayData["WEE_UID"]); unset($arrayData["PRJ_UID"]); unset($arrayData["WEE_WE_UID"]); unset($arrayData["WEE_WE_TAS_UID"]); //Set variables $arrayWebEntryEventData = $this->getWebEntryEvent($webEntryEventUid, true); $arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData); //Verify data $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]); $this->throwExceptionIfDataIsInvalid($webEntryEventUid, $arrayWebEntryEventData["PRJ_UID"], $arrayData); //Update $cnn = \Propel::getConnection("workflow"); $this->webEntryEventWebEntryUid = ""; $this->webEntryEventWebEntryTaskUid = ""; try { //WebEntry $option = "UPDATE"; if (isset($arrayData["WEE_STATUS"])) { if ($arrayData["WEE_STATUS"] == "ENABLED") { if ($arrayWebEntryEventData["WEE_STATUS"] == "DISABLED") { $option = "INSERT"; } } else { if ($arrayWebEntryEventData["WEE_STATUS"] == "ENABLED") { $option = "DELETE"; } } } switch ($option) { case "INSERT": $this->createWebEntry($arrayFinalData["PRJ_UID"], $arrayFinalData["EVN_UID"], $arrayFinalData["ACT_UID"], $arrayFinalData["DYN_UID"], $arrayFinalData["USR_UID"], $arrayFinalData["WEE_TITLE"], $arrayFinalData["WEE_DESCRIPTION"], $userUidUpdater); $arrayData["WEE_WE_UID"] = $this->webEntryEventWebEntryUid; $arrayData["WEE_WE_TAS_UID"] = $this->webEntryEventWebEntryTaskUid; break; case "UPDATE": if ($arrayWebEntryEventData["WEE_WE_UID"] != "") { $task = new \Tasks(); //Task - Step if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] != $arrayWebEntryEventData["DYN_UID"]) { //Delete $step = new \Step(); $criteria = new \Criteria("workflow"); $criteria->add(\StepPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]); $rsCriteria = \StepPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $result = $step->remove($row["STEP_UID"]); } //Add $step = new \Step(); $stepUid = $step->create(array("PRO_UID" => $arrayWebEntryEventData["PRJ_UID"], "TAS_UID" => $arrayWebEntryEventData["WEE_WE_TAS_UID"])); $result = $step->update(array("STEP_UID" => $stepUid, "STEP_TYPE_OBJ" => "DYNAFORM", "STEP_UID_OBJ" => $arrayData["DYN_UID"], "STEP_POSITION" => 1, "STEP_MODE" => "EDIT")); } //Task - User if (isset($arrayData["USR_UID"]) && $arrayData["USR_UID"] != $arrayWebEntryEventData["USR_UID"]) { //Unassign $taskUser = new \TaskUser(); $criteria = new \Criteria("workflow"); $criteria->add(\TaskUserPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]); $rsCriteria = \TaskUserPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $result = $taskUser->remove($row["TAS_UID"], $row["USR_UID"], $row["TU_TYPE"], $row["TU_RELATION"]); } //Assign $result = $task->assignUser($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["USR_UID"], 1); } //Route if (isset($arrayData["ACT_UID"]) && $arrayData["ACT_UID"] != $arrayWebEntryEventData["ACT_UID"]) { //Delete $result = $task->deleteAllRoutesOfTask($arrayWebEntryEventData["PRJ_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"], true); //Add $workflow = \ProcessMaker\Project\Workflow::load($arrayWebEntryEventData["PRJ_UID"]); $result = $workflow->addRoute($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["ACT_UID"], "SEQUENTIAL"); } //WebEntry $arrayDataAux = array(); if (isset($arrayData["DYN_UID"])) { $arrayDataAux["DYN_UID"] = $arrayData["DYN_UID"]; } if (isset($arrayData["USR_UID"])) { $arrayDataAux["USR_UID"] = $arrayData["USR_UID"]; } if (isset($arrayData["WEE_TITLE"])) { $arrayDataAux["WE_TITLE"] = $arrayData["WEE_TITLE"]; } if (isset($arrayData["WEE_DESCRIPTION"])) { $arrayDataAux["WE_DESCRIPTION"] = $arrayData["WEE_DESCRIPTION"]; } if (count($arrayDataAux) > 0) { $arrayDataAux = $this->webEntry->update($arrayWebEntryEventData["WEE_WE_UID"], $userUidUpdater, $arrayDataAux); } } break; case "DELETE": $this->deleteWebEntry($arrayWebEntryEventData["WEE_WE_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"]); $arrayData["WEE_WE_UID"] = ""; $arrayData["WEE_WE_TAS_UID"] = ""; break; } //WebEntry-Event $webEntryEvent = \WebEntryEventPeer::retrieveByPK($webEntryEventUid); $webEntryEvent->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); if ($webEntryEvent->validate()) { $cnn->begin(); $result = $webEntryEvent->save(); $cnn->commit(); //Set WEE_TITLE if (isset($arrayData["WEE_TITLE"])) { $result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_TITLE"]); } //Set WEE_DESCRIPTION if (isset($arrayData["WEE_DESCRIPTION"])) { $result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_DESCRIPTION"]); } //Return $arrayData = $arrayDataBackup; if (!$this->formatFieldNameInUppercase) { $arrayData = array_change_key_case($arrayData, CASE_LOWER); } return $arrayData; } else { $msg = ""; foreach ($webEntryEvent->getValidationFailures() as $validationFailure) { $msg = $msg . ($msg != "" ? "\n" : "") . $validationFailure->getMessage(); } throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . ($msg != "" ? "\n" . $msg : "")); } } catch (\Exception $e) { $cnn->rollback(); $this->deleteWebEntry($this->webEntryEventWebEntryUid, $this->webEntryEventWebEntryTaskUid); throw $e; } } catch (\Exception $e) { throw $e; } }
/** * * @param string $name */ public function setPermissionName($name) { if ($this->getPerUid() == '') { throw new Exception("Error in setPerTitle, the PER_UID can't be blank"); } if ($name !== null && !is_string($name)) { $name = (string) $name; } if ($this->permission_name !== $name || $name === '') { $this->permission_name = $name; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; $res = Content::addContent('PER_NAME', '', $this->getPerUid(), $lang, $this->permission_name); } }
/** * Set the [app_doc_filename] column value. * * @param string $sValue new value * @return void */ public function setAppDocFilename ($sValue) { if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } if ($this->app_doc_filename !== $sValue || $sValue === '') { try { $this->app_doc_filename = $sValue; $iResult = Content::addContent( 'APP_DOC_FILENAME', $this->getDocVersion(), $this->getAppDocUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en'), $this->app_doc_filename ); } catch (Exception $oError) { $this->app_doc_filename = ''; throw ($oError); } } }
/** * Update Web Entry * * @param string $webEntryUid Unique id of Web Entry * @param string $userUidUpdater Unique id of updater User * @param array $arrayData Data * * return array Return data of the Web Entry updated */ public function update($webEntryUid, $userUidUpdater, array $arrayData) { try { //Verify data $process = new \ProcessMaker\BusinessModel\Process(); $validator = new \ProcessMaker\BusinessModel\Validator(); $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData"); $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData"); //Set data $arrayData = array_change_key_case($arrayData, CASE_UPPER); //Set variables $arrayWebEntryData = $this->getWebEntry($webEntryUid, true); //Verify data $this->throwExceptionIfNotExistsWebEntry($webEntryUid, $this->arrayFieldNameForException["webEntryUid"]); $this->throwExceptionIfDataIsInvalid($webEntryUid, $arrayWebEntryData["PRO_UID"], $arrayData); //Update $cnn = \Propel::getConnection("workflow"); try { $webEntry = \WebEntryPeer::retrieveByPK($webEntryUid); $webEntry->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); $webEntry->setWeUpdateUsrUid($userUidUpdater); $webEntry->setWeUpdateDate("now"); if ($webEntry->validate()) { $cnn->begin(); $result = $webEntry->save(); $cnn->commit(); //Set WE_TITLE if (isset($arrayData["WE_TITLE"])) { $result = \Content::addContent("WE_TITLE", "", $webEntryUid, SYS_LANG, $arrayData["WE_TITLE"]); } if (isset($arrayData["WE_DESCRIPTION"])) { $result = \Content::addContent("WE_DESCRIPTION", "", $webEntryUid, SYS_LANG, $arrayData["WE_DESCRIPTION"]); } //Set WE_DATA $this->setWeData($webEntryUid); //Return if (!$this->formatFieldNameInUppercase) { $arrayData = array_change_key_case($arrayData, CASE_LOWER); } return $arrayData; } else { $msg = ""; foreach ($webEntry->getValidationFailures() as $validationFailure) { $msg = $msg . ($msg != "" ? "\n" : "") . $validationFailure->getMessage(); } throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . ($msg != "" ? "\n" . $msg : "")); } } catch (\Exception $e) { $cnn->rollback(); throw $e; } } catch (\Exception $e) { throw $e; } }
/** * Set the tas_def_subject_message column value. * * @param string $v new value * @return void */ public function setTasDefSubjectMessage($v) { if ($this->getTasUid() == "") { throw new Exception("Error in setTasDefSubjectMessage, the getTasUid() can't be blank"); } $v = isset($v) ? (string) $v : ''; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; if ($this->tas_def_subject_message !== $v || $v === "") { $this->tas_def_subject_message = $v; $res = Content::addContent('TAS_DEF_SUBJECT_MESSAGE', '', $this->getTasUid(), $lang, $v); return $res; } return 0; }
$out = array(); for ($i = 1; $i <= count($_POST['form']['grid1']); $i++) { $out[$_POST['form']['grid1'][$i]['VAR_OUT1']] = $_POST['form']['grid1'][$i]['VAR_OUT2']; } $in = array(); for ($j = 1; $j <= count($_POST['form']['grid2']); $j++) { $in[$_POST['form']['grid2'][$j]['VAR_IN1']] = $_POST['form']['grid2'][$j]['VAR_IN2']; } require_once 'classes/model/Task.php'; $oTask = new Task(); //$aTask=$oTask->load($_POST['form']['TASKS']); //$aTask=$oTask->load($_POST['form']['PRO_UID']); $aTask = $_POST['form']['TASKS'] != 0 ? $oTask->load($_POST['form']['TASKS']) : 0; //$aTask['PRO_UID']=0; if (isset($_POST['form']['SP_SYNCHRONOUS']) && $_POST['form']['SP_SYNCHRONOUS'] == '') { $_POST['form']['SP_SYNCHRONOUS'] = '0'; } if (!isset($_POST['form']['SP_SYNCHRONOUS'])) { $_POST['form']['SP_SYNCHRONOUS'] = '0'; } require_once 'classes/model/SubProcess.php'; $oOP = new SubProcess(); $aData = array('SP_UID' => $_POST['form']['SP_UID'], 'PRO_UID' => isset($aTask['PRO_UID']) ? $aTask['PRO_UID'] : '', 'TAS_UID' => $_POST['form']['TASKS'], 'PRO_PARENT' => $_POST['form']['PRO_PARENT'], 'TAS_PARENT' => $_POST['form']['TAS_PARENT'], 'SP_TYPE' => 'SIMPLE', 'SP_SYNCHRONOUS' => $_POST['form']['SP_SYNCHRONOUS'], 'SP_SYNCHRONOUS_TYPE' => 'ALL', 'SP_SYNCHRONOUS_WAIT' => 0, 'SP_VARIABLES_OUT' => serialize($out), 'SP_VARIABLES_IN' => serialize($in), 'SP_GRID_IN' => ''); $oOP->update($aData); require_once 'classes/model/Content.php'; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; //$cont = Content::addContent( 'SP_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] ); $cont = Content::addContent('TAS_TITLE', '', $_POST['form']['TAS_PARENT'], $lang, $_POST['form']['SPROCESS_NAME']); //$cont = Content::addContent( 'TAS_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] ); //G::header('location: processes_Map?PRO_UID='. $_POST['form']['PRO_UID']); die;
/** * Set the [out_doc_template] column value. * * @param string $sValue new value * @return void */ public function setOutDocTemplate($sValue) { if ($sValue !== null && !is_string($sValue)) { $sValue = (string) $sValue; } if ($this->out_doc_template !== $sValue || $sValue === '') { try { $this->out_doc_template = $sValue; $iResult = Content::addContent('OUT_DOC_TEMPLATE', '', $this->getOutDocUid(), defined('SYS_LANG') ? SYS_LANG : 'en', $this->out_doc_template); } catch (Exception $oError) { $this->out_doc_template = ''; throw $oError; } } }
/** * Save Data for DataBaseConnection * @var string $pro_uid. Uid for Process * @var string $dataDataBaseConnection. Data for DataBaseConnection * @var string $create. Create o Update DataBaseConnection * @var string $sDataBaseConnectionUid. Uid for DataBaseConnection * * @author Brayan Pereyra (Cochalo) <*****@*****.**> * @copyright Colosa - Bolivia * * @return array */ public function saveDataBaseConnection($pro_uid = '', $dataDBConnection = array(), $create = false) { $pro_uid = $this->validateProUid($pro_uid); if (!$create) { $dbs_uid = $dataDBConnection['dbs_uid']; $dbs_uid = $this->validateDbsUid($dbs_uid, $pro_uid); } G::LoadClass('dbConnections'); $oDBSource = new DbSource(); $oContent = new \Content(); $dataDBConnection = array_change_key_case($dataDBConnection, CASE_UPPER); $flagTns = $dataDBConnection["DBS_TYPE"] == "oracle" && $dataDBConnection["DBS_CONNECTION_TYPE"] == "TNS" ? 1 : 0; $dataDBConnection['PRO_UID'] = $pro_uid; if (isset($dataDBConnection['DBS_TYPE'])) { $typesExists = array(); $dbServices = $this->getDbEngines(); foreach ($dbServices as $value) { $typesExists[] = $value['id']; } if (!in_array($dataDBConnection['DBS_TYPE'], $typesExists)) { throw new \Exception(\G::LoadTranslation("ID_DBC_TYPE_INVALID", array($dataDBConnection['DBS_TYPE']))); } } if (isset($dataDBConnection["DBS_SERVER"]) && $dataDBConnection["DBS_SERVER"] == "" && $flagTns == 0) { throw new \Exception(\G::LoadTranslation("ID_DBC_SERVER_INVALID", array($dataDBConnection['DBS_SERVER']))); } if (isset($dataDBConnection["DBS_DATABASE_NAME"]) && $dataDBConnection["DBS_DATABASE_NAME"] == "" && $flagTns == 0) { throw new \Exception(\G::LoadTranslation("ID_DBC_DBNAME_INVALID", array($dataDBConnection['DBS_DATABASE_NAME']))); } if (isset($dataDBConnection['DBS_PORT']) && ($dataDBConnection['DBS_PORT'] == '' || $dataDBConnection['DBS_PORT'] == 0)) { if ($flagTns == 0) { throw new \Exception(\G::LoadTranslation("ID_DBC_PORT_INVALID", array($dataDBConnection["DBS_PORT"]))); } } if (isset($dataDBConnection["DBS_TNS"]) && $dataDBConnection["DBS_TNS"] == "" && $flagTns == 1) { throw new \Exception(\G::LoadTranslation("ID_DBC_TNS_NOT_EXIST", array($dataDBConnection["DBS_TNS"]))); } if (isset($dataDBConnection['DBS_ENCODE'])) { $encodesExists = array(); $dbs = new dbConnections(); $dbEncodes = $dbs->getEncondeList($dataDBConnection['DBS_TYPE']); foreach ($dbEncodes as $value) { $encodesExists[] = $value['0']; } if (!in_array($dataDBConnection['DBS_ENCODE'], $encodesExists)) { throw new \Exception(\G::LoadTranslation("ID_DBC_ENCODE_INVALID", array($dataDBConnection['DBS_ENCODE']))); } } $passOrigin = ''; if (isset($dataDBConnection['DBS_PASSWORD'])) { $passOrigin = $dataDBConnection['DBS_PASSWORD']; if ($dataDBConnection['DBS_PASSWORD'] == 'none') { $dataDBConnection['DBS_PASSWORD'] = ''; } else { if ($flagTns == 0) { $pass = \G::encrypt($dataDBConnection["DBS_PASSWORD"], $dataDBConnection["DBS_DATABASE_NAME"]) . "_2NnV3ujj3w"; } else { $pass = \G::encrypt($dataDBConnection["DBS_PASSWORD"], $dataDBConnection["DBS_TNS"]) . "_2NnV3ujj3w"; } $dataDBConnection['DBS_PASSWORD'] = $pass; } } if ($flagTns == 0) { $dataDBConnection["DBS_CONNECTION_TYPE"] = "NORMAL"; $dataDBConnection["DBS_TNS"] = ""; } else { $dataDBConnection["DBS_SERVER"] = ""; $dataDBConnection["DBS_DATABASE_NAME"] = ""; $dataDBConnection["DBS_PORT"] = 0; } if ($create) { unset($dataDBConnection['DBS_UID']); // TEST CONNECTION $dataTest = array_merge($dataDBConnection, array('DBS_PASSWORD' => $passOrigin)); $resTest = $this->testConnection($dataTest); if (!$resTest['resp']) { throw new \Exception($resTest['message']); } $newDBConnectionUid = $oDBSource->create($dataDBConnection); $oContent->addContent('DBS_DESCRIPTION', '', $newDBConnectionUid, SYS_LANG, $dataDBConnection['DBS_DESCRIPTION']); $newDataDBConnection = $this->getDataBaseConnection($pro_uid, $newDBConnectionUid); $newDataDBConnection = array_change_key_case($newDataDBConnection, CASE_LOWER); return $newDataDBConnection; } else { // TEST CONNECTION $allData = $this->getDataBaseConnection($pro_uid, $dataDBConnection['DBS_UID']); $dataTest = array_merge($allData, $dataDBConnection, array('DBS_PASSWORD' => $passOrigin)); $resTest = $this->testConnection($dataTest); if (!$resTest['resp']) { throw new \Exception($resTest['message']); } $oDBSource->update($dataDBConnection); if (isset($dataDBConnection['DBS_DESCRIPTION'])) { $oContent->addContent('DBS_DESCRIPTION', '', $dataDBConnection['DBS_UID'], SYS_LANG, $dataDBConnection['DBS_DESCRIPTION']); } } return array(); }
function addContent($ConCategory, $ConParent, $ConId, $ConLang, $ConValue) { try { if ($ConLang != 'en') { $baseLangContent = ContentPeer::retrieveByPk($ConCategory, $ConParent, $ConId, 'en'); if ($baseLangContent === null) { Content::addContent($ConCategory, $ConParent, $ConId, 'en', $ConValue); } } $con = ContentPeer::retrieveByPK($ConCategory, $ConParent, $ConId, $ConLang); if (is_null($con)) { $con = new Content(); } else { if ($con->getConParent() == $ConParent && $con->getConCategory() == $ConCategory && $con->getConValue() == $ConValue && $con->getConLang() == $ConLang && $con->getConId() == $ConId) { return true; } } $con->setConCategory($ConCategory); if ($con->getConParent() != $ConParent) { $con->setConParent($ConParent); } $con->setConId($ConId); $con->setConLang($ConLang); $con->setConValue($ConValue); if ($con->validate()) { $res = $con->save(); return $res; } else { $e = new Exception("Error in addcontent, the row {$ConCategory}, {$ConParent}, {$ConId}, {$ConLang} is not Valid"); throw $e; } } catch (Exception $e) { throw $e; } }
public function setRolName($v) { if ($this->getRolUid() == '') { throw (new Exception("Error in setProTitle, the PRO_UID can't be blank")); } // Since the native PHP type for this column is string, // we will cast the input to a string (if it is not). if ($v !== null && ! is_string($v)) { $v = (string)$v; } if ($this->rol_name !== $v || $v === '') { $this->rol_name = $v; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; $res = Content::addContent('ROL_NAME', '', $this->getRolUid(), $lang, $this->rol_name); } }
/** * Set the [Dyn_description] column value. * * @param string $v new value * @return void */ public function setDynDescription($v) { if ($this->getDynUid() == '') { throw new Exception("Error in setDynDescription, the DYN_UID can't be blank"); } // Since the native PHP type for this column is string, // we will cast the input to a string (if it is not). if ($v !== null && !is_string($v)) { $v = (string) $v; } if ($this->dyn_description !== $v || $v === '') { $this->dyn_description = $v; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; $res = Content::addContent('DYN_DESCRIPTION', '', $this->getDynUid(), $lang, $this->dyn_description); } }
/** * Set the [swi_text] column value. * * @param string $sValue new value * @return void */ public function setSwiEleText($sValue) { if ($sValue !== null && !is_string($sValue)) { $sValue = (string) $sValue; } if ($this->swi_text !== $sValue || $sValue === '') { try { $this->swi_text = $sValue; $iResult = Content::addContent('SWI_TEXT', '', $this->getSwiUid(), defined('SYS_LANG') ? SYS_LANG : 'en', $this->swi_text); } catch (Exception $oError) { $this->swi_text = ''; throw $oError; } } }