From 7e3dc8aae322512dcad70067effe2674271270e9 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Thu, 4 Dec 2014 11:40:52 -0400 Subject: [PATCH 01/30] PM-937 "Add Gateway to Gateway support" SOLVED Issue: Add Gateway to Gateway support Cause: Nueva solicitud de funciones Solution: - Se ha implementado esta nueva funcionalidad "Gateway to Gateway" de un BPMN-Project a un ProcessMaker-Project - Se ha agregado un nuevo tipo de Task (GATEWAYTOGATEWAY) que sirve de puente para conectar un Gateway con otro Gateway --- workflow/engine/classes/class.derivation.php | 247 ++++++++++-------- .../classes/model/map/TaskMapBuilder.php | 2 +- workflow/engine/config/schema.xml | 2 +- .../Project/Adapter/BpmnWorkflow.php | 186 +++++++------ .../src/ProcessMaker/Project/Workflow.php | 28 ++ 5 files changed, 278 insertions(+), 187 deletions(-) diff --git a/workflow/engine/classes/class.derivation.php b/workflow/engine/classes/class.derivation.php index b3e19e1f9..3a922e9a3 100755 --- a/workflow/engine/classes/class.derivation.php +++ b/workflow/engine/classes/class.derivation.php @@ -50,75 +50,73 @@ class Derivation var $case; /** - * prepareInformationTaskDerivation + * prepareInformationTask * - * @param array $arrayDerivation Derivation + * @param array $arrayTaskData Task data (derivation) * * return array Return array */ - public function prepareInformationTaskDerivation(array $arrayDerivation) + public function prepareInformationTask(array $arrayTaskData) { try { $task = new Task(); - $taskFields = $task->load($arrayDerivation["TAS_UID"]); + $arrayTaskData = G::array_merges($arrayTaskData, $task->load($arrayTaskData["TAS_UID"])); - $arrayDerivation = G::array_merges($arrayDerivation, $taskFields); + //2. If next case is an special case + if ((int)($arrayTaskData["ROU_NEXT_TASK"]) < 0) { + $arrayTaskData["NEXT_TASK"]["TAS_UID"] = (int)($arrayTaskData["ROU_NEXT_TASK"]); + $arrayTaskData["NEXT_TASK"]["TAS_ASSIGN_TYPE"] = "nobody"; + $arrayTaskData["NEXT_TASK"]["TAS_PRIORITY_VARIABLE"] = ""; + $arrayTaskData["NEXT_TASK"]["TAS_DEF_PROC_CODE"] = ""; + $arrayTaskData["NEXT_TASK"]["TAS_PARENT"] = ""; + $arrayTaskData["NEXT_TASK"]["TAS_TRANSFER_FLY"] = ""; - //2. if next case is an special case - if ((int)($arrayDerivation["ROU_NEXT_TASK"]) < 0) { - $arrayDerivation["NEXT_TASK"]["TAS_UID"] = (int)($arrayDerivation["ROU_NEXT_TASK"]); - $arrayDerivation["NEXT_TASK"]["TAS_ASSIGN_TYPE"] = "nobody"; - $arrayDerivation["NEXT_TASK"]["TAS_PRIORITY_VARIABLE"] = ""; - $arrayDerivation["NEXT_TASK"]["TAS_DEF_PROC_CODE"] = ""; - $arrayDerivation["NEXT_TASK"]["TAS_PARENT"] = ""; - $arrayDerivation["NEXT_TASK"]["TAS_TRANSFER_FLY"] = ""; - - switch ($arrayDerivation["ROU_NEXT_TASK"]) { + switch ($arrayTaskData["ROU_NEXT_TASK"]) { case -1: - $arrayDerivation["NEXT_TASK"]["TAS_TITLE"] = G::LoadTranslation("ID_END_OF_PROCESS"); + $arrayTaskData["NEXT_TASK"]["TAS_TITLE"] = G::LoadTranslation("ID_END_OF_PROCESS"); break; case -2: - $arrayDerivation["NEXT_TASK"]["TAS_TITLE"] = G::LoadTranslation("ID_TAREA_COLGANTE"); + $arrayTaskData["NEXT_TASK"]["TAS_TITLE"] = G::LoadTranslation("ID_TAREA_COLGANTE"); break; } - $arrayDerivation["NEXT_TASK"]["USR_UID"] = ""; - $arrayDerivation["NEXT_TASK"]["USER_ASSIGNED"] = array("USR_UID" => ""); + $arrayTaskData["NEXT_TASK"]["USR_UID"] = ""; + $arrayTaskData["NEXT_TASK"]["USER_ASSIGNED"] = array("USR_UID" => ""); } else { - //3. load the task information of normal NEXT_TASK - $arrayDerivation["NEXT_TASK"] = $task->load($arrayDerivation["ROU_NEXT_TASK"]); //print $arrayDerivation["ROU_NEXT_TASK"]." **** ".$arrayDerivation["NEXT_TASK"]["TAS_TYPE"]."
"; + //3. Load the task information of normal NEXT_TASK + $arrayTaskData["NEXT_TASK"] = $task->load($arrayTaskData["ROU_NEXT_TASK"]); //print $arrayTaskData["ROU_NEXT_TASK"]." **** ".$arrayTaskData["NEXT_TASK"]["TAS_TYPE"]."
"; - if ($arrayDerivation["NEXT_TASK"]["TAS_TYPE"] == "SUBPROCESS") { - $sTaskParent = $arrayDerivation["NEXT_TASK"]["TAS_UID"]; + if ($arrayTaskData["NEXT_TASK"]["TAS_TYPE"] == "SUBPROCESS") { + $taskParent = $arrayTaskData["NEXT_TASK"]["TAS_UID"]; $criteria = new Criteria("workflow"); - $criteria->add(SubProcessPeer::PRO_PARENT, $arrayDerivation["PRO_UID"]); - $criteria->add(SubProcessPeer::TAS_PARENT, $arrayDerivation["NEXT_TASK"]["TAS_UID"]); + $criteria->add(SubProcessPeer::PRO_PARENT, $arrayTaskData["PRO_UID"]); + $criteria->add(SubProcessPeer::TAS_PARENT, $arrayTaskData["NEXT_TASK"]["TAS_UID"]); $rsCriteria = SubProcessPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); $row = $rsCriteria->getRow(); - $arrayDerivation["ROU_NEXT_TASK"] = $row["TAS_UID"]; //print "
Life is just a lonely highway"; - $arrayDerivation["NEXT_TASK"] = $task->load($arrayDerivation["ROU_NEXT_TASK"]); //print "
Life is just a lonely highway";print"
"; + $arrayTaskData["ROU_NEXT_TASK"] = $row["TAS_UID"]; //print "
Life is just a lonely highway"; + $arrayTaskData["NEXT_TASK"] = $task->load($arrayTaskData["ROU_NEXT_TASK"]); //print "
Life is just a lonely highway";print"
"; $process = new Process(); $row = $process->load($row["PRO_UID"]); - $arrayDerivation["NEXT_TASK"]["TAS_TITLE"] .= " (" . $row["PRO_TITLE"] . ")"; - $arrayDerivation["NEXT_TASK"]["TAS_PARENT"] = $sTaskParent; + $arrayTaskData["NEXT_TASK"]["TAS_TITLE"] .= " (" . $row["PRO_TITLE"] . ")"; + $arrayTaskData["NEXT_TASK"]["TAS_PARENT"] = $taskParent; - //unset($task, $process, $row, $sTaskParent); + //unset($task, $process, $row, $taskParent); } else { - $arrayDerivation["NEXT_TASK"]["TAS_PARENT"] = ""; + $arrayTaskData["NEXT_TASK"]["TAS_PARENT"] = ""; } - $arrayDerivation["NEXT_TASK"]["USER_ASSIGNED"] = $this->getNextAssignedUser($arrayDerivation); + $arrayTaskData["NEXT_TASK"]["USER_ASSIGNED"] = ($arrayTaskData["NEXT_TASK"]["TAS_TYPE"] != "GATEWAYTOGATEWAY")? $this->getNextAssignedUser($arrayTaskData) : array("USR_UID" => ""); } //Return - return $arrayDerivation; + return $arrayTaskData; } catch (Exception $e) { throw $e; } @@ -127,92 +125,129 @@ class Derivation /** * prepareInformation * - * @param array $aData - * @return $taskInfo + * @param array $arrayData Data + * @param string $taskUid Unique id of Task + * + * return array Return array */ - function prepareInformation ($aData) + public function prepareInformation(array $arrayData, $taskUid = "") { - $oTask = new Task(); - //SELECT * - //FROM APP_DELEGATION AS A - //LEFT JOIN TASK AS T ON(T.TAS_UID = A.TAS_UID) - //LEFT JOIN ROUTE AS R ON(R.TAS_UID = A.TAS_UID) - //WHERE - //APP_UID = '$aData['APP_UID']' - //AND DEL_INDEX = '$aData['DEL_INDEX']' - $c = new Criteria( 'workflow' ); - $c->clearSelectColumns(); - $c->addSelectColumn(AppDelegationPeer::TAS_UID); - $c->addSelectColumn(RoutePeer::ROU_NEXT_TASK); - $c->addSelectColumn(RoutePeer::ROU_TYPE); - $c->addSelectColumn(RoutePeer::ROU_DEFAULT); - $c->addSelectColumn(RoutePeer::ROU_CONDITION); - $c->addJoin( AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN ); - $c->addJoin( AppDelegationPeer::TAS_UID, RoutePeer::TAS_UID, Criteria::LEFT_JOIN ); - $c->add( AppDelegationPeer::APP_UID, $aData['APP_UID'] ); - $c->add( AppDelegationPeer::DEL_INDEX, $aData['DEL_INDEX'] ); - $c->addAscendingOrderByColumn( RoutePeer::ROU_CASE ); - $rs = AppDelegationPeer::doSelectRs( $c ); - $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $rs->next(); - $aDerivation = $rs->getRow(); - $i = 0; - $taskInfo = array(); - $arrayDerivationDefault = array(); - - $oUser = new Users(); - if (!class_exists('Cases')) { - G::LoadClass('case'); - } - $this->case = new Cases(); - // 1. there is no rule - if (is_null( $aDerivation['ROU_NEXT_TASK'] )) { - throw (new Exception( G::LoadTranslation( 'ID_NO_DERIVATION_RULE' ) )); - } - - while (is_array( $aDerivation )) { - $aDerivation = G::array_merges($aDerivation, $aData); - - if ((int)($aDerivation["ROU_DEFAULT"]) == 1) { - $arrayDerivationDefault = $aDerivation; + try { + if (!class_exists("Cases")) { + G::LoadClass("case"); } - $bContinue = true; + $this->case = new Cases(); + $task = new Task(); - //evaluate the condition if there are conditions defined. - if (isset( $aDerivation['ROU_CONDITION'] ) && trim( $aDerivation['ROU_CONDITION'] ) != '' && ($aDerivation['ROU_TYPE'] != 'SELECT' || $aDerivation['ROU_TYPE'] == 'PARALLEL-BY-EVALUATION')) { - $AppFields = $this->case->loadCase( $aData['APP_UID'] ); - G::LoadClass( 'pmScript' ); - $oPMScript = new PMScript(); - $oPMScript->setFields( $AppFields['APP_DATA'] ); - $oPMScript->setScript( $aDerivation['ROU_CONDITION'] ); - $bContinue = $oPMScript->evaluate(); + $arrayNextTask = array(); + $arrayNextTaskDefault = array(); + $i = 0; + + //SELECT * + //FROM APP_DELEGATION AS A + //LEFT JOIN TASK AS T ON(T.TAS_UID = A.TAS_UID) + //LEFT JOIN ROUTE AS R ON(R.TAS_UID = A.TAS_UID) + //WHERE + //APP_UID = '$arrayData["APP_UID"]' + //AND DEL_INDEX = '$arrayData["DEL_INDEX"]' + + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(RoutePeer::TAS_UID); + $criteria->addSelectColumn(RoutePeer::ROU_NEXT_TASK); + $criteria->addSelectColumn(RoutePeer::ROU_TYPE); + $criteria->addSelectColumn(RoutePeer::ROU_DEFAULT); + $criteria->addSelectColumn(RoutePeer::ROU_CONDITION); + + if ($taskUid != "") { + $criteria->add(RoutePeer::TAS_UID, $taskUid, Criteria::EQUAL); + $criteria->addAscendingOrderByColumn(RoutePeer::ROU_CASE); + + $rsCriteria = RoutePeer::doSelectRS($criteria); + } else { + $criteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN); + $criteria->addJoin(AppDelegationPeer::TAS_UID, RoutePeer::TAS_UID, Criteria::LEFT_JOIN); + $criteria->add(AppDelegationPeer::APP_UID, $arrayData["APP_UID"], Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_INDEX, $arrayData["DEL_INDEX"], Criteria::EQUAL); + $criteria->addAscendingOrderByColumn(RoutePeer::ROU_CASE); + + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); } - if ($aDerivation['ROU_TYPE'] == 'EVALUATE') { - if (count( $taskInfo ) >= 1) { - $bContinue = false; + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $arrayRouteData = G::array_merges($rsCriteria->getRow(), $arrayData); + + if ((int)($arrayRouteData["ROU_DEFAULT"]) == 1) { + $arrayNextTaskDefault = $arrayRouteData; + } + + $flagContinue = true; + + //Evaluate the condition if there are conditions defined + if (isset($arrayRouteData["ROU_CONDITION"]) && trim($arrayRouteData["ROU_CONDITION"]) != "" && ($arrayRouteData["ROU_TYPE"] != "SELECT" || $arrayRouteData["ROU_TYPE"] == "PARALLEL-BY-EVALUATION")) { + G::LoadClass("pmScript"); + + $arrayApplicationData = $this->case->loadCase($arrayData["APP_UID"]); + + $pmScript = new PMScript(); + $pmScript->setFields($arrayApplicationData["APP_DATA"]); + $pmScript->setScript($arrayRouteData["ROU_CONDITION"]); + $flagContinue = $pmScript->evaluate(); + } + + if (isset($arrayRouteData["ROU_CONDITION"]) && trim($arrayRouteData["ROU_CONDITION"]) == "" && $arrayRouteData["ROU_NEXT_TASK"] != "-1") { + $arrayTaskData = $task->load($arrayRouteData["ROU_NEXT_TASK"]); + + if ($arrayTaskData["TAS_TYPE"] == "GATEWAYTOGATEWAY") { + $flagContinue = false; + } + } + + if ($arrayRouteData["ROU_TYPE"] == "EVALUATE" && count($arrayNextTask) > 0) { + $flagContinue = false; + } + + if ($flagContinue) { + $arrayNextTask[++$i] = $this->prepareInformationTask($arrayRouteData); } } - if ($bContinue) { - $i++; - - $taskInfo[$i] = $this->prepareInformationTaskDerivation($aDerivation); + if (count($arrayNextTask) == 0 && count($arrayNextTaskDefault) > 0) { + $arrayNextTask[++$i] = $this->prepareInformationTask($arrayNextTaskDefault); } - $rs->next(); - $aDerivation = $rs->getRow(); + //Check Task GATEWAYTOGATEWAY + $arrayNextTaskBk = $arrayNextTask; + $arrayNextTask = array(); + $i = 0; + + foreach ($arrayNextTaskBk as $value) { + $arrayNextTaskData = $value; + + if ($arrayNextTaskData["NEXT_TASK"]["TAS_UID"] != "-1" && $arrayNextTaskData["NEXT_TASK"]["TAS_TYPE"] == "GATEWAYTOGATEWAY") { + $arrayAux = $this->prepareInformation($arrayData, $arrayNextTaskData["NEXT_TASK"]["TAS_UID"]); + + foreach ($arrayAux as $value2) { + $arrayNextTask[++$i] = $value2; + } + } else { + $arrayNextTask[++$i] = $arrayNextTaskData; + } + } + + //1. There is no rule + if (count($arrayNextTask) == 0) { + throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_RULE")); + } + + //Return + return $arrayNextTask; + } catch (Exception $e) { + throw $e; } - - if (count($taskInfo) == 0 && count($arrayDerivationDefault) > 0) { - $i++; - - $taskInfo[$i] = $this->prepareInformationTaskDerivation($arrayDerivationDefault); - } - - //Return - return $taskInfo; } /** diff --git a/workflow/engine/classes/model/map/TaskMapBuilder.php b/workflow/engine/classes/model/map/TaskMapBuilder.php index a3ed5c8a4..b48972412 100755 --- a/workflow/engine/classes/model/map/TaskMapBuilder.php +++ b/workflow/engine/classes/model/map/TaskMapBuilder.php @@ -159,7 +159,7 @@ class TaskMapBuilder /*----------------------------------********---------------------------------*/ $tMap->addColumn('TAS_SELFSERVICE_EXECUTION', 'TasSelfserviceExecution', 'string', CreoleTypes::VARCHAR, false, 15); /*----------------------------------********---------------------------------*/ - $tMap->addValidator('TAS_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'NORMAL|ADHOC|SUBPROCESS|HIDDEN', 'Please select a valid value for TAS_TYPE.'); + $tMap->addValidator('TAS_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'NORMAL|ADHOC|SUBPROCESS|HIDDEN|GATEWAYTOGATEWAY', 'Please enter a valid value for TAS_TYPE'); $tMap->addValidator('TAS_TIMEUNIT', 'validValues', 'propel.validator.ValidValuesValidator', 'MINUTES|HOURS|DAYS|WEEKS|MONTHS', 'Please select a valid value for TAS_TIMEUNIT.'); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index d6cb61027..c19f8ba8d 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -1248,7 +1248,7 @@ - + diff --git a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php index 813f0f168..d1c19fbb2 100644 --- a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php @@ -436,104 +436,132 @@ class BpmnWorkflow extends Project\Bpmn } } + public function mapBpmnGatewayToWorkflowRoutes($activityUid, $gatewayUid) + { + try { + $arrayGatewayData = \BpmnGateway::findOneBy(\BpmnGatewayPeer::GAT_UID, $gatewayUid)->toArray(); + + switch ($arrayGatewayData["GAT_TYPE"]) { + //case "SELECTION": + case self::BPMN_GATEWAY_COMPLEX: + $routeType = "SELECT"; + break; + //case "EVALUATION": + case self::BPMN_GATEWAY_EXCLUSIVE: + $routeType = "EVALUATE"; + break; + //case "PARALLEL": + case self::BPMN_GATEWAY_PARALLEL: + if ($arrayGatewayData["GAT_DIRECTION"] == "DIVERGING") { + $routeType = "PARALLEL"; + } else { + if ($arrayGatewayData["GAT_DIRECTION"] == "CONVERGING") { + $routeType = "SEC-JOIN"; + } else { + throw new \LogicException( + "Invalid Gateway direction, accepted values: [DIVERGING|CONVERGING], given: " . $arrayGatewayData["GAT_DIRECTION"] + ); + } + } + break; + //case "PARALLEL_EVALUATION": + case self::BPMN_GATEWAY_INCLUSIVE: + if ($arrayGatewayData["GAT_DIRECTION"] == "DIVERGING") { + $routeType = "PARALLEL-BY-EVALUATION"; + } else { + if ($arrayGatewayData["GAT_DIRECTION"] == "CONVERGING") { + $routeType = "SEC-JOIN"; + } else { + throw new \LogicException( + "Invalid Gateway direction, accepted values: [DIVERGING|CONVERGING], given: " . $arrayGatewayData["GAT_DIRECTION"] + ); + } + } + break; + default: + throw new \LogicException("Unsupported Gateway type: " . $arrayGatewayData["GAT_TYPE"]); + break; + } + + $arrayGatewayFlowData = \BpmnFlow::findAllBy(array( + \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $gatewayUid, + \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnGateway" + )); + + if ($arrayGatewayFlowData > 0) { + $this->wp->resetTaskRoutes($activityUid); + } + + foreach ($arrayGatewayFlowData as $value) { + $arrayFlowData = $value->toArray(); + + $routeDefault = (array_key_exists("FLO_TYPE", $arrayFlowData) && $arrayFlowData["FLO_TYPE"] == "DEFAULT")? 1 : 0; + $routeCondition = (array_key_exists("FLO_CONDITION", $arrayFlowData))? $arrayFlowData["FLO_CONDITION"] : ""; + + switch ($arrayFlowData["FLO_ELEMENT_DEST_TYPE"]) { + case "bpmnActivity": + case "bpmnEvent": + //Gateway ----> Activity + //Gateway ----> Event + if ($arrayFlowData["FLO_ELEMENT_DEST_TYPE"] == "bpmnEvent") { + $event = \BpmnEventPeer::retrieveByPK($arrayFlowData["FLO_ELEMENT_DEST"]); + + if ($event->getEvnType() == "END") { + $result = $this->wp->addRoute($activityUid, -1, $routeType, $routeCondition, $routeDefault); + } + } else { + $result = $this->wp->addRoute($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"], $routeType, $routeCondition, $routeDefault); + } + break; + case "bpmnGateway": + //Gateway ----> Gateway + $taskUid = $this->wp->addTask(array( + "TAS_TYPE" => "GATEWAYTOGATEWAY", + "TAS_TITLE" => "GATEWAYTOGATEWAY", + "TAS_POSX" => (int)($arrayFlowData["FLO_X1"]), + "TAS_POSY" => (int)($arrayFlowData["FLO_Y1"]) + )); + + $result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault); + + $this->mapBpmnGatewayToWorkflowRoutes($taskUid, $arrayFlowData["FLO_ELEMENT_DEST"]); + break; + default: + //For processmaker is only allowed flows between: "gateway -> activity", "gateway -> gateway" + //any another flow is considered invalid + throw new \LogicException( + "For ProcessMaker is only allowed flows between: \"gateway -> activity\", \"gateway -> gateway\" " . PHP_EOL . + "Given: bpmnGateway -> " . $arrayFlowData["FLO_ELEMENT_DEST_TYPE"] + ); + } + } + } catch (\Exception $e) { + throw $e; + } + } + public function mapBpmnFlowsToWorkflowRoutes() { + $this->wp->deleteTaskGatewayToGateway($this->wp->getUid()); + $activities = $this->getActivities(); foreach ($activities as $activity) { - $flows = \BpmnFlow::findAllBy(array( \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $activity["ACT_UID"], \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnActivity" )); - // foreach ($flows as $flow) { switch ($flow->getFloElementDestType()) { case "bpmnActivity": // (activity -> activity) $this->wp->addRoute($activity["ACT_UID"], $flow->getFloElementDest(), "SEQUENTIAL"); break; - case "bpmnGateway": // (activity -> gateway) // we must find the related flows: gateway -> - $gatUid = $flow->getFloElementDest(); - $gatewayFlows = \BpmnFlow::findAllBy(array( - \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $gatUid, - \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnGateway" - )); - - if ($gatewayFlows > 0) { - $this->wp->resetTaskRoutes($activity["ACT_UID"]); - } - - foreach ($gatewayFlows as $gatewayFlow) { - $gatewayFlow = $gatewayFlow->toArray(); - - switch ($gatewayFlow['FLO_ELEMENT_DEST_TYPE']) { - case 'bpmnEvent': - case 'bpmnActivity': - // (gateway -> activity) - $gateway = \BpmnGateway::findOneBy(\BpmnGatewayPeer::GAT_UID, $gatUid)->toArray(); - switch ($gateway["GAT_TYPE"]) { - //case 'SELECTION': - case self::BPMN_GATEWAY_COMPLEX: - $routeType = "SELECT"; - break; - //case 'EVALUATION': - case self::BPMN_GATEWAY_EXCLUSIVE: - $routeType = "EVALUATE"; - break; - //case 'PARALLEL': - case self::BPMN_GATEWAY_PARALLEL: - if ($gateway["GAT_DIRECTION"] == "DIVERGING") { - $routeType = "PARALLEL"; - } elseif ($gateway["GAT_DIRECTION"] == "CONVERGING") { - $routeType = "SEC-JOIN"; - } else { - throw new \LogicException(sprintf( - "Invalid Gateway direction, accepted values: [%s|%s], given: %s.", - "DIVERGING", "CONVERGING", $gateway["GAT_DIRECTION"] - )); - } - break; - //case 'PARALLEL_EVALUATION': - case self::BPMN_GATEWAY_INCLUSIVE: - if ($gateway["GAT_DIRECTION"] == "DIVERGING") { - $routeType = "PARALLEL-BY-EVALUATION"; - } elseif ($gateway["GAT_DIRECTION"] == "CONVERGING") { - $routeType = "SEC-JOIN"; - } else { - throw new \LogicException(sprintf( - "Invalid Gateway direction, accepted values: [%s|%s], given: %s.", - "DIVERGING", "CONVERGING", $gateway["GAT_DIRECTION"] - )); - } - break; - default: - throw new \LogicException(sprintf("Unsupported Gateway type: %s", $gateway['GAT_TYPE'])); - } - $condition = array_key_exists('FLO_CONDITION', $gatewayFlow) ? $gatewayFlow["FLO_CONDITION"] : ''; - - if ($gatewayFlow['FLO_ELEMENT_DEST_TYPE'] == 'bpmnEvent') { - $event = \BpmnEventPeer::retrieveByPK($gatewayFlow['FLO_ELEMENT_DEST']); - if ($event->getEvnType() == "END") { - $this->wp->addRoute($activity["ACT_UID"], -1, $routeType, $condition); - } - } else { - $this->wp->addRoute($activity["ACT_UID"], $gatewayFlow["FLO_ELEMENT_DEST"], $routeType, $condition, ($gatewayFlow["FLO_TYPE"] == "DEFAULT")? 1 : 0); - } - break; - default: - // for processmaker is only allowed flows between "gateway -> activity" - // any another flow is considered invalid - throw new \LogicException(sprintf( - "For ProcessMaker is only allowed flows between \"gateway -> activity\" " . PHP_EOL . - "Given: bpmnGateway -> " . $gatewayFlow['FLO_ELEMENT_DEST_TYPE'] - )); - } - } + $this->mapBpmnGatewayToWorkflowRoutes($activity["ACT_UID"], $flow->getFloElementDest()); break; } } diff --git a/workflow/engine/src/ProcessMaker/Project/Workflow.php b/workflow/engine/src/ProcessMaker/Project/Workflow.php index cfe469619..2cd8698a2 100644 --- a/workflow/engine/src/ProcessMaker/Project/Workflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Workflow.php @@ -1161,5 +1161,33 @@ class Workflow extends Handler throw $e; } } + + public function deleteTaskGatewayToGateway($processUid) + { + try { + $task = new \Tasks(); + + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\TaskPeer::TAS_UID); + $criteria->add(\TaskPeer::PRO_UID, $processUid, \Criteria::EQUAL); + $criteria->add(\TaskPeer::TAS_TYPE, "GATEWAYTOGATEWAY", \Criteria::EQUAL); + + $rsCriteria = \TaskPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $taskUid = $row["TAS_UID"]; + + $task->deleteTask($taskUid); + } + } catch (\Exception $e) { + self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString()); + + throw $e; + } + } } From 3692b2cc79e3d87f827733ace7bfe5c14b7d68f8 Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Mon, 8 Dec 2014 17:15:40 -0400 Subject: [PATCH 02/30] Add MESSAGE bpmn 2.0 functionality end points --- workflow/engine/classes/model/Message.php | 19 + .../engine/classes/model/MessageDetail.php | 19 + .../classes/model/MessageDetailPeer.php | 23 + workflow/engine/classes/model/MessagePeer.php | 23 + .../model/map/MessageDetailMapBuilder.php | 78 ++ .../classes/model/map/MessageMapBuilder.php | 78 ++ .../engine/classes/model/om/BaseMessage.php | 684 ++++++++++++++++++ .../classes/model/om/BaseMessageDetail.php | 684 ++++++++++++++++++ .../model/om/BaseMessageDetailPeer.php | 582 +++++++++++++++ .../classes/model/om/BaseMessagePeer.php | 582 +++++++++++++++ workflow/engine/config/schema.xml | 12 + workflow/engine/data/mysql/schema.sql | 37 +- .../ProcessMaker/BusinessModel/Message.php | 415 +++++++++++ .../engine/src/ProcessMaker/Services/api.ini | 1 + 14 files changed, 3233 insertions(+), 4 deletions(-) create mode 100644 workflow/engine/classes/model/Message.php create mode 100644 workflow/engine/classes/model/MessageDetail.php create mode 100644 workflow/engine/classes/model/MessageDetailPeer.php create mode 100644 workflow/engine/classes/model/MessagePeer.php create mode 100644 workflow/engine/classes/model/map/MessageDetailMapBuilder.php create mode 100644 workflow/engine/classes/model/map/MessageMapBuilder.php create mode 100644 workflow/engine/classes/model/om/BaseMessage.php create mode 100644 workflow/engine/classes/model/om/BaseMessageDetail.php create mode 100644 workflow/engine/classes/model/om/BaseMessageDetailPeer.php create mode 100644 workflow/engine/classes/model/om/BaseMessagePeer.php create mode 100644 workflow/engine/src/ProcessMaker/BusinessModel/Message.php diff --git a/workflow/engine/classes/model/Message.php b/workflow/engine/classes/model/Message.php new file mode 100644 index 000000000..dade974a9 --- /dev/null +++ b/workflow/engine/classes/model/Message.php @@ -0,0 +1,19 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('MESSAGE_DETAIL'); + $tMap->setPhpName('MessageDetail'); + + $tMap->setUseIdGenerator(false); + + $tMap->addPrimaryKey('MD_UID', 'MdUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('MES_UID', 'MesUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('MD_TYPE', 'MdType', 'string', CreoleTypes::VARCHAR, false, 32); + + $tMap->addColumn('MD_NAME', 'MdName', 'string', CreoleTypes::VARCHAR, false, 255); + + } // doBuild() + +} // MessageDetailMapBuilder diff --git a/workflow/engine/classes/model/map/MessageMapBuilder.php b/workflow/engine/classes/model/map/MessageMapBuilder.php new file mode 100644 index 000000000..99d19ca16 --- /dev/null +++ b/workflow/engine/classes/model/map/MessageMapBuilder.php @@ -0,0 +1,78 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('MESSAGE'); + $tMap->setPhpName('Message'); + + $tMap->setUseIdGenerator(false); + + $tMap->addPrimaryKey('MES_UID', 'MesUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('PRJ_UID', 'PrjUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('MES_NAME', 'MesName', 'string', CreoleTypes::VARCHAR, false, 255); + + $tMap->addColumn('MES_CONDITION', 'MesCondition', 'string', CreoleTypes::VARCHAR, false, 255); + + } // doBuild() + +} // MessageMapBuilder diff --git a/workflow/engine/classes/model/om/BaseMessage.php b/workflow/engine/classes/model/om/BaseMessage.php new file mode 100644 index 000000000..67195e2f1 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessage.php @@ -0,0 +1,684 @@ +mes_uid; + } + + /** + * Get the [prj_uid] column value. + * + * @return string + */ + public function getPrjUid() + { + + return $this->prj_uid; + } + + /** + * Get the [mes_name] column value. + * + * @return string + */ + public function getMesName() + { + + return $this->mes_name; + } + + /** + * Get the [mes_condition] column value. + * + * @return string + */ + public function getMesCondition() + { + + return $this->mes_condition; + } + + /** + * Set the value of [mes_uid] column. + * + * @param string $v new value + * @return void + */ + public function setMesUid($v) + { + + // 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->mes_uid !== $v) { + $this->mes_uid = $v; + $this->modifiedColumns[] = MessagePeer::MES_UID; + } + + } // setMesUid() + + /** + * Set the value of [prj_uid] column. + * + * @param string $v new value + * @return void + */ + public function setPrjUid($v) + { + + // 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->prj_uid !== $v) { + $this->prj_uid = $v; + $this->modifiedColumns[] = MessagePeer::PRJ_UID; + } + + } // setPrjUid() + + /** + * Set the value of [mes_name] column. + * + * @param string $v new value + * @return void + */ + public function setMesName($v) + { + + // 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->mes_name !== $v || $v === '') { + $this->mes_name = $v; + $this->modifiedColumns[] = MessagePeer::MES_NAME; + } + + } // setMesName() + + /** + * Set the value of [mes_condition] column. + * + * @param string $v new value + * @return void + */ + public function setMesCondition($v) + { + + // 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->mes_condition !== $v || $v === '') { + $this->mes_condition = $v; + $this->modifiedColumns[] = MessagePeer::MES_CONDITION; + } + + } // setMesCondition() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->mes_uid = $rs->getString($startcol + 0); + + $this->prj_uid = $rs->getString($startcol + 1); + + $this->mes_name = $rs->getString($startcol + 2); + + $this->mes_condition = $rs->getString($startcol + 3); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = MessagePeer::NUM_COLUMNS - MessagePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating Message object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessagePeer::DATABASE_NAME); + } + + try { + $con->begin(); + MessagePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessagePeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = MessagePeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += MessagePeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = MessagePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessagePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getMesUid(); + break; + case 1: + return $this->getPrjUid(); + break; + case 2: + return $this->getMesName(); + break; + case 3: + return $this->getMesCondition(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessagePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getMesUid(), + $keys[1] => $this->getPrjUid(), + $keys[2] => $this->getMesName(), + $keys[3] => $this->getMesCondition(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessagePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setMesUid($value); + break; + case 1: + $this->setPrjUid($value); + break; + case 2: + $this->setMesName($value); + break; + case 3: + $this->setMesCondition($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessagePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setMesUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setPrjUid($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setMesName($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setMesCondition($arr[$keys[3]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(MessagePeer::DATABASE_NAME); + + if ($this->isColumnModified(MessagePeer::MES_UID)) { + $criteria->add(MessagePeer::MES_UID, $this->mes_uid); + } + + if ($this->isColumnModified(MessagePeer::PRJ_UID)) { + $criteria->add(MessagePeer::PRJ_UID, $this->prj_uid); + } + + if ($this->isColumnModified(MessagePeer::MES_NAME)) { + $criteria->add(MessagePeer::MES_NAME, $this->mes_name); + } + + if ($this->isColumnModified(MessagePeer::MES_CONDITION)) { + $criteria->add(MessagePeer::MES_CONDITION, $this->mes_condition); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(MessagePeer::DATABASE_NAME); + + $criteria->add(MessagePeer::MES_UID, $this->mes_uid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getMesUid(); + } + + /** + * Generic method to set the primary key (mes_uid column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setMesUid($key); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of Message (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setPrjUid($this->prj_uid); + + $copyObj->setMesName($this->mes_name); + + $copyObj->setMesCondition($this->mes_condition); + + + $copyObj->setNew(true); + + $copyObj->setMesUid(NULL); // this is a pkey column, so set to default value + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return Message Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return MessagePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new MessagePeer(); + } + return self::$peer; + } +} + diff --git a/workflow/engine/classes/model/om/BaseMessageDetail.php b/workflow/engine/classes/model/om/BaseMessageDetail.php new file mode 100644 index 000000000..e8cc7c83d --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessageDetail.php @@ -0,0 +1,684 @@ +md_uid; + } + + /** + * Get the [mes_uid] column value. + * + * @return string + */ + public function getMesUid() + { + + return $this->mes_uid; + } + + /** + * Get the [md_type] column value. + * + * @return string + */ + public function getMdType() + { + + return $this->md_type; + } + + /** + * Get the [md_name] column value. + * + * @return string + */ + public function getMdName() + { + + return $this->md_name; + } + + /** + * Set the value of [md_uid] column. + * + * @param string $v new value + * @return void + */ + public function setMdUid($v) + { + + // 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->md_uid !== $v) { + $this->md_uid = $v; + $this->modifiedColumns[] = MessageDetailPeer::MD_UID; + } + + } // setMdUid() + + /** + * Set the value of [mes_uid] column. + * + * @param string $v new value + * @return void + */ + public function setMesUid($v) + { + + // 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->mes_uid !== $v) { + $this->mes_uid = $v; + $this->modifiedColumns[] = MessageDetailPeer::MES_UID; + } + + } // setMesUid() + + /** + * Set the value of [md_type] column. + * + * @param string $v new value + * @return void + */ + public function setMdType($v) + { + + // 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->md_type !== $v || $v === '') { + $this->md_type = $v; + $this->modifiedColumns[] = MessageDetailPeer::MD_TYPE; + } + + } // setMdType() + + /** + * Set the value of [md_name] column. + * + * @param string $v new value + * @return void + */ + public function setMdName($v) + { + + // 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->md_name !== $v || $v === '') { + $this->md_name = $v; + $this->modifiedColumns[] = MessageDetailPeer::MD_NAME; + } + + } // setMdName() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->md_uid = $rs->getString($startcol + 0); + + $this->mes_uid = $rs->getString($startcol + 1); + + $this->md_type = $rs->getString($startcol + 2); + + $this->md_name = $rs->getString($startcol + 3); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 4; // 4 = MessageDetailPeer::NUM_COLUMNS - MessageDetailPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating MessageDetail object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessageDetailPeer::DATABASE_NAME); + } + + try { + $con->begin(); + MessageDetailPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(MessageDetailPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = MessageDetailPeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += MessageDetailPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = MessageDetailPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessageDetailPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getMdUid(); + break; + case 1: + return $this->getMesUid(); + break; + case 2: + return $this->getMdType(); + break; + case 3: + return $this->getMdName(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessageDetailPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getMdUid(), + $keys[1] => $this->getMesUid(), + $keys[2] => $this->getMdType(), + $keys[3] => $this->getMdName(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = MessageDetailPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setMdUid($value); + break; + case 1: + $this->setMesUid($value); + break; + case 2: + $this->setMdType($value); + break; + case 3: + $this->setMdName($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = MessageDetailPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setMdUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setMesUid($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setMdType($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setMdName($arr[$keys[3]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(MessageDetailPeer::DATABASE_NAME); + + if ($this->isColumnModified(MessageDetailPeer::MD_UID)) { + $criteria->add(MessageDetailPeer::MD_UID, $this->md_uid); + } + + if ($this->isColumnModified(MessageDetailPeer::MES_UID)) { + $criteria->add(MessageDetailPeer::MES_UID, $this->mes_uid); + } + + if ($this->isColumnModified(MessageDetailPeer::MD_TYPE)) { + $criteria->add(MessageDetailPeer::MD_TYPE, $this->md_type); + } + + if ($this->isColumnModified(MessageDetailPeer::MD_NAME)) { + $criteria->add(MessageDetailPeer::MD_NAME, $this->md_name); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(MessageDetailPeer::DATABASE_NAME); + + $criteria->add(MessageDetailPeer::MD_UID, $this->md_uid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getMdUid(); + } + + /** + * Generic method to set the primary key (md_uid column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setMdUid($key); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of MessageDetail (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setMesUid($this->mes_uid); + + $copyObj->setMdType($this->md_type); + + $copyObj->setMdName($this->md_name); + + + $copyObj->setNew(true); + + $copyObj->setMdUid(NULL); // this is a pkey column, so set to default value + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return MessageDetail Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return MessageDetailPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new MessageDetailPeer(); + } + return self::$peer; + } +} + diff --git a/workflow/engine/classes/model/om/BaseMessageDetailPeer.php b/workflow/engine/classes/model/om/BaseMessageDetailPeer.php new file mode 100644 index 000000000..26505a39c --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessageDetailPeer.php @@ -0,0 +1,582 @@ + array ('MdUid', 'MesUid', 'MdType', 'MdName', ), + BasePeer::TYPE_COLNAME => array (MessageDetailPeer::MD_UID, MessageDetailPeer::MES_UID, MessageDetailPeer::MD_TYPE, MessageDetailPeer::MD_NAME, ), + BasePeer::TYPE_FIELDNAME => array ('MD_UID', 'MES_UID', 'MD_TYPE', 'MD_NAME', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('MdUid' => 0, 'MesUid' => 1, 'MdType' => 2, 'MdName' => 3, ), + BasePeer::TYPE_COLNAME => array (MessageDetailPeer::MD_UID => 0, MessageDetailPeer::MES_UID => 1, MessageDetailPeer::MD_TYPE => 2, MessageDetailPeer::MD_NAME => 3, ), + BasePeer::TYPE_FIELDNAME => array ('MD_UID' => 0, 'MES_UID' => 1, 'MD_TYPE' => 2, 'MD_NAME' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/MessageDetailMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.MessageDetailMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = MessageDetailPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. MessageDetailPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(MessageDetailPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(MessageDetailPeer::MD_UID); + + $criteria->addSelectColumn(MessageDetailPeer::MES_UID); + + $criteria->addSelectColumn(MessageDetailPeer::MD_TYPE); + + $criteria->addSelectColumn(MessageDetailPeer::MD_NAME); + + } + + const COUNT = 'COUNT(MESSAGE_DETAIL.MD_UID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE_DETAIL.MD_UID)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(MessageDetailPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(MessageDetailPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = MessageDetailPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return MessageDetail + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = MessageDetailPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return MessageDetailPeer::populateObjects(MessageDetailPeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + MessageDetailPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = MessageDetailPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return MessageDetailPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a MessageDetail or Criteria object. + * + * @param mixed $values Criteria or MessageDetail object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from MessageDetail object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a MessageDetail or Criteria object. + * + * @param mixed $values Criteria or MessageDetail object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(MessageDetailPeer::MD_UID); + $selectCriteria->add(MessageDetailPeer::MD_UID, $criteria->remove(MessageDetailPeer::MD_UID), $comparison); + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the MESSAGE_DETAIL table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(MessageDetailPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a MessageDetail or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or MessageDetail object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(MessageDetailPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof MessageDetail) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(MessageDetailPeer::MD_UID, (array) $values, Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given MessageDetail object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param MessageDetail $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(MessageDetail $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(MessageDetailPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(MessageDetailPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(MessageDetailPeer::DATABASE_NAME, MessageDetailPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param mixed $pk the primary key. + * @param Connection $con the connection to use + * @return MessageDetail + */ + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(MessageDetailPeer::DATABASE_NAME); + + $criteria->add(MessageDetailPeer::MD_UID, $pk); + + + $v = MessageDetailPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(MessageDetailPeer::MD_UID, $pks, Criteria::IN); + $objs = MessageDetailPeer::doSelect($criteria, $con); + } + return $objs; + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseMessageDetailPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/MessageDetailMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.MessageDetailMapBuilder'); +} + diff --git a/workflow/engine/classes/model/om/BaseMessagePeer.php b/workflow/engine/classes/model/om/BaseMessagePeer.php new file mode 100644 index 000000000..270117300 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseMessagePeer.php @@ -0,0 +1,582 @@ + array ('MesUid', 'PrjUid', 'MesName', 'MesCondition', ), + BasePeer::TYPE_COLNAME => array (MessagePeer::MES_UID, MessagePeer::PRJ_UID, MessagePeer::MES_NAME, MessagePeer::MES_CONDITION, ), + BasePeer::TYPE_FIELDNAME => array ('MES_UID', 'PRJ_UID', 'MES_NAME', 'MES_CONDITION', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('MesUid' => 0, 'PrjUid' => 1, 'MesName' => 2, 'MesCondition' => 3, ), + BasePeer::TYPE_COLNAME => array (MessagePeer::MES_UID => 0, MessagePeer::PRJ_UID => 1, MessagePeer::MES_NAME => 2, MessagePeer::MES_CONDITION => 3, ), + BasePeer::TYPE_FIELDNAME => array ('MES_UID' => 0, 'PRJ_UID' => 1, 'MES_NAME' => 2, 'MES_CONDITION' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/MessageMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.MessageMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = MessagePeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. MessagePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(MessagePeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(MessagePeer::MES_UID); + + $criteria->addSelectColumn(MessagePeer::PRJ_UID); + + $criteria->addSelectColumn(MessagePeer::MES_NAME); + + $criteria->addSelectColumn(MessagePeer::MES_CONDITION); + + } + + const COUNT = 'COUNT(MESSAGE.MES_UID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE.MES_UID)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(MessagePeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(MessagePeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = MessagePeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return Message + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = MessagePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return MessagePeer::populateObjects(MessagePeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + MessagePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = MessagePeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return MessagePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a Message or Criteria object. + * + * @param mixed $values Criteria or Message object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from Message object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a Message or Criteria object. + * + * @param mixed $values Criteria or Message object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(MessagePeer::MES_UID); + $selectCriteria->add(MessagePeer::MES_UID, $criteria->remove(MessagePeer::MES_UID), $comparison); + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the MESSAGE table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(MessagePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a Message or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or Message object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(MessagePeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof Message) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(MessagePeer::MES_UID, (array) $values, Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given Message object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param Message $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(Message $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(MessagePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(MessagePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(MessagePeer::DATABASE_NAME, MessagePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param mixed $pk the primary key. + * @param Connection $con the connection to use + * @return Message + */ + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(MessagePeer::DATABASE_NAME); + + $criteria->add(MessagePeer::MES_UID, $pk); + + + $v = MessagePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(MessagePeer::MES_UID, $pks, Criteria::IN); + $objs = MessagePeer::doSelect($criteria, $con); + } + return $objs; + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseMessagePeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/MessageMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.MessageMapBuilder'); +} + diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index d6cb61027..7a4b8a282 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4176,5 +4176,17 @@ + + + + + +
+ + + + + +
diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 96f6c3314..e0f68af1d 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -486,10 +486,10 @@ CREATE TABLE `ROUTE` `ROU_PARENT` VARCHAR(32) default '0' NOT NULL, `PRO_UID` VARCHAR(32) default '' NOT NULL, `TAS_UID` VARCHAR(32) default '' NOT NULL, - `ROU_NEXT_TASK` VARCHAR(32) default '0' NOT NULL, +`ROU_NEXT_TASK` VARCHAR(32) default '0' NOT NULL, `ROU_CASE` INTEGER default 0 NOT NULL, `ROU_TYPE` VARCHAR(25) default 'SEQUENTIAL' NOT NULL, - `ROU_DEFAULT` INTEGER default 0 NOT NULL, + `ROU_DEFAULT` INTEGER default 0 NOT NULL, `ROU_CONDITION` VARCHAR(512) default '' NOT NULL, `ROU_TO_LAST_USER` VARCHAR(20) default 'FALSE' NOT NULL, `ROU_OPTIONAL` VARCHAR(20) default 'FALSE' NOT NULL, @@ -1207,7 +1207,7 @@ CREATE TABLE `APP_HISTORY` `PRO_UID` VARCHAR(32) default '' NOT NULL, `TAS_UID` VARCHAR(32) default '' NOT NULL, `DYN_UID` VARCHAR(32) default '' NOT NULL, - `OBJ_TYPE` VARCHAR(20) default 'DYNAFORM' NOT NULL, + `OBJ_TYPE` VARCHAR(20) default 'DYNAFORM' NOT NULL, `USR_UID` VARCHAR(32) default '' NOT NULL, `APP_STATUS` VARCHAR(100) default '' NOT NULL, `HISTORY_DATE` DATETIME, @@ -2380,6 +2380,35 @@ CREATE TABLE `LIST_UNASSIGNED_GROUP` `TYP_UID` VARCHAR(32) default '' NOT NULL, PRIMARY KEY (`UNA_UID`,`USR_UID`,`TYPE`) )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Unassiged list'; +#----------------------------------------------------------------------------- +#-- MESSAGE +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `MESSAGE`; + + +CREATE TABLE `MESSAGE` +( + `MES_UID` VARCHAR(32) NOT NULL, + `PRJ_UID` VARCHAR(32) NOT NULL, + `MES_NAME` VARCHAR(255) default '', + `MES_CONDITION` VARCHAR(255) default '', + PRIMARY KEY (`MES_UID`) +)ENGINE=InnoDB ; +#----------------------------------------------------------------------------- +#-- MESSAGE_DETAIL +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `MESSAGE_DETAIL`; + + +CREATE TABLE `MESSAGE_DETAIL` +( + `MD_UID` VARCHAR(32) NOT NULL, + `MES_UID` VARCHAR(32) NOT NULL, + `MD_TYPE` VARCHAR(32) default '', + `MD_NAME` VARCHAR(255) default '', + PRIMARY KEY (`MD_UID`) +)ENGINE=InnoDB ; # This restores the fkey checks, after having unset them earlier SET FOREIGN_KEY_CHECKS = 1; - diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Message.php b/workflow/engine/src/ProcessMaker/BusinessModel/Message.php new file mode 100644 index 000000000..fbef2d874 --- /dev/null +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Message.php @@ -0,0 +1,415 @@ +existsName($processUid, $arrayData["MES_NAME"]); + + $this->throwExceptionFieldDefinition($arrayData); + + //Create + $cnn = \Propel::getConnection("workflow"); + try { + $message = new \Message(); + + $sPkMessage = \ProcessMaker\Util\Common::generateUID(); + + $message->setMesUid($sPkMessage); + $message->setPrjUid($processUid); + + if ($message->validate()) { + $cnn->begin(); + + if (isset($arrayData["MES_NAME"])) { + $message->setMesName($arrayData["MES_NAME"]); + } else { + throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$mes_name' ))); + } + if (isset($arrayData["MES_DETAIL"])) { + + foreach ($arrayData["MES_DETAIL"] as $i => $type) { + $messageDetail = new \MessageDetail(); + + $sPkMessageDetail = \ProcessMaker\Util\Common::generateUID(); + + $messageDetail->setMdUid($sPkMessageDetail); + $messageDetail->setMdType($type["md_type"]); + $messageDetail->setMdName($type["md_name"]); + $messageDetail->setMesUid($sPkMessage); + $messageDetail->save(); + } + } + + $message->save(); + $cnn->commit(); + } else { + + $msg = ""; + + foreach ($message->getValidationFailures() as $validationFailure) { + $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); + } + + throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg); + } + + } catch (\Exception $e) { + $cnn->rollback(); + + throw $e; + } + + //Return + $message = $this->getMessage($processUid, $sPkMessage); + + return $message; + + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Update Message + * + * @param string $processUid Unique id of Process + * @param string $messageUid Unique id of Message + * @param array $arrayData Data + * + * return array Return data of the Message updated + */ + public function update($processUid, $messageUid, $arrayData) + { + try { + //Verify data + Validator::proUid($processUid, '$prj_uid'); + $arrayData = array_change_key_case($arrayData, CASE_UPPER); + + $this->throwExceptionFieldDefinition($arrayData); + + //Update + $cnn = \Propel::getConnection("workflow"); + try { + $message = \MessagePeer::retrieveByPK($messageUid); + + if (is_null($message)) { + throw new \Exception('mes_uid: '.$messageUid. ' '.\G::LoadTranslation("ID_DOES_NOT_EXIST")); + } else { + $cnn->begin(); + if (isset($arrayData["MES_NAME"])) { + $this->existsName($processUid, $arrayData["MES_NAME"]); + $message->setMesName($arrayData["MES_NAME"]); + } + if (isset($arrayData["MES_DETAIL"])) { + + foreach ($arrayData["MES_DETAIL"] as $i => $type) { + + $messageDetail = \MessageDetailPeer::retrieveByPK($type["md_uid"]); + if (is_null($messageDetail)) { + throw new \Exception('md_uid: '.$type["md_uid"]. ' '.\G::LoadTranslation("ID_DOES_NOT_EXIST")); + } else { + $messageDetail->setMdType($type["md_type"]); + $messageDetail->setMdName($type["md_name"]); + + $messageDetail->save(); + } + } + } + $message->save(); + $cnn->commit(); + } + + } catch (\Exception $e) { + $cnn->rollback(); + + throw $e; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Delete Message + * + * @param string $processUid Unique id of Process + * @param string $messageUid Unique id of Message + * + * return void + */ + public function delete($processUid, $messageUid) + { + try { + //Verify data + Validator::proUid($processUid, '$prj_uid'); + + $this->throwExceptionIfNotExistsMessage($messageUid); + + //Delete + $criteria = new \Criteria("workflow"); + + $criteria->add(\MessagePeer::MES_UID, $messageUid); + + \MessagePeer::doDelete($criteria); + + //Delete Detail + $criteriaDetail = new \Criteria("workflow"); + + $criteriaDetail->add(\MessageDetailPeer::MES_UID, $messageUid); + + \MessageDetailPeer::doDelete($criteriaDetail); + + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Message + * @param string $processUid Unique id of Process + * @param string $messageUid Unique id of Message + * + * return array Return an array with data of a Message + */ + public function getMessage($processUid, $messageUid) + { + try { + //Verify data + Validator::proUid($processUid, '$prj_uid'); + + $this->throwExceptionIfNotExistsMessage($messageUid); + + //Get data + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\MessagePeer::MES_UID); + $criteria->addSelectColumn(\MessagePeer::MES_NAME); + $criteria->addSelectColumn(\MessagePeer::PRJ_UID); + + $criteria->add(\MessagePeer::PRJ_UID, $processUid, \Criteria::EQUAL); + $criteria->add(\MessagePeer::MES_UID, $messageUid, \Criteria::EQUAL); + + $rsCriteria = \MessagePeer::doSelectRS($criteria); + + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + $rsCriteria->next(); + $arrayMessage = array(); + + while ($aRow = $rsCriteria->getRow()) { + $oCriteriaU = new \Criteria('workflow'); + $oCriteriaU->setDistinct(); + $oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_UID); + $oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_NAME); + $oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_TYPE); + $oCriteriaU->add(\MessageDetailPeer::MES_UID, $aRow['MES_UID']); + $oDatasetU = \MessageDetailPeer::doSelectRS($oCriteriaU); + $oDatasetU->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $aType = array(); + while ($oDatasetU->next()) { + $aRowU = $oDatasetU->getRow(); + $aType[] = array('md_uid' => $aRowU['MD_UID'], + 'md_name' => $aRowU['MD_NAME'], + 'md_type' => $aRowU['MD_TYPE']); + + } + $arrayMessage = array('mes_uid' => $aRow['MES_UID'], + 'prj_uid' => $aRow['PRJ_UID'], + 'mes_name' => $aRow['MES_NAME'], + 'mes_detail' => $aType); + $rsCriteria->next(); + } + //Return + return $arrayMessage; + + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of Message + * + * @param string $processUid Unique id of Message + * + * return array Return an array with data of a Message + */ + public function getMessages($processUid) + { + try { + //Verify data + Validator::proUid($processUid, '$prj_uid'); + + //Get data + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\MessagePeer::MES_UID); + $criteria->addSelectColumn(\MessagePeer::MES_NAME); + $criteria->addSelectColumn(\MessagePeer::PRJ_UID); + + $criteria->add(\MessagePeer::PRJ_UID, $processUid, \Criteria::EQUAL); + + $rsCriteria = \MessagePeer::doSelectRS($criteria); + + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + $rsCriteria->next(); + $arrayMessages = array(); + + while ($aRow = $rsCriteria->getRow()) { + $oCriteriaU = new \Criteria('workflow'); + $oCriteriaU->setDistinct(); + $oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_UID); + $oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_NAME); + $oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_TYPE); + $oCriteriaU->add(\MessageDetailPeer::MES_UID, $aRow['MES_UID']); + $oDatasetU = \MessageDetailPeer::doSelectRS($oCriteriaU); + $oDatasetU->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $aType = array(); + while ($oDatasetU->next()) { + $aRowU = $oDatasetU->getRow(); + $aType[] = array('md_uid' => $aRowU['MD_UID'], + 'md_name' => $aRowU['MD_NAME'], + 'mes_type' => $aRowU['MD_TYPE']); + + } + $arrayMessages[] = array('mes_uid' => $aRow['MES_UID'], + 'prj_uid' => $aRow['PRJ_UID'], + 'mes_name' => $aRow['MES_NAME'], + 'mes_detail' => $aType); + $rsCriteria->next(); + } + //Return + return $arrayMessages; + + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify field definition + * + * @param array $aData Unique id of Message to exclude + * + */ + public function throwExceptionFieldDefinition($aData) + { + try { + if (isset($aData["MES_NAME"])) { + Validator::isString($aData['MES_NAME'], '$mes_name'); + Validator::isNotEmpty($aData['MES_NAME'], '$mes_name'); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if exists the name of a message + * + * @param string $processUid Unique id of Process + * @param string $messageName Name + * + */ + public function existsName($processUid, $messageName) + { + try { + $criteria = new \Criteria("workflow"); + $criteria->addSelectColumn(\MessagePeer::MES_UID); + $criteria->add(\MessagePeer::MES_NAME, $messageName, \Criteria::EQUAL); + $criteria->add(\MessagePeer::PRJ_UID, $processUid, \Criteria::EQUAL); + $rsCriteria = \MessagePeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria->next(); + if ($rsCriteria->getRow()) { + throw new \Exception(\G::LoadTranslation("DYNAFIELD_ALREADY_EXIST")); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get required variables in the SQL + * + * @param string $sql SQL + * + * return array Return an array with required variables in the SQL + */ + public function sqlGetRequiredVariables($sql) + { + try { + $arrayVariableRequired = array(); + + preg_match_all("/@[@%#\?\x24\=]([A-Za-z_]\w*)/", $sql, $arrayMatch, PREG_SET_ORDER); + + foreach ($arrayMatch as $value) { + $arrayVariableRequired[] = $value[1]; + } + + return $arrayVariableRequired; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if some required variable in the SQL is missing in the variables + * + * @param string $variableName Variable name + * @param string $variableSql SQL + * @param array $arrayVariable The variables + * + * return void Throw exception if some required variable in the SQL is missing in the variables + */ + public function throwExceptionIfSomeRequiredVariableSqlIsMissingInVariables($variableName, $variableSql, array $arrayVariable) + { + try { + $arrayResult = array_diff(array_unique($this->sqlGetRequiredVariables($variableSql)), array_keys($arrayVariable)); + + if (count($arrayResult) > 0) { + throw new \Exception(\G::LoadTranslation("ID_PROCESS_VARIABLE_REQUIRED_VARIABLES_FOR_QUERY", array($variableName, implode(", ", $arrayResult)))); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if does not exist the message in table MESSAGE + * + * @param string $messageUid Unique id of variable + * + * return void Throw exception if does not exist the message in table MESSAGE + */ + public function throwExceptionIfNotExistsMessage($messageUid) + { + try { + $obj = \MessagePeer::retrieveByPK($messageUid); + + if (is_null($obj)) { + throw new \Exception('mes_uid: '.$messageUid. ' '.\G::LoadTranslation("ID_DOES_NOT_EXIST")); + } + } catch (\Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/Services/api.ini b/workflow/engine/src/ProcessMaker/Services/api.ini index a4cf14240..1ce9bea0e 100644 --- a/workflow/engine/src/ProcessMaker/Services/api.ini +++ b/workflow/engine/src/ProcessMaker/Services/api.ini @@ -37,6 +37,7 @@ debug = 1 trigger-wizard = "ProcessMaker\Services\Api\Project\TriggerWizard" category = "ProcessMaker\Services\Api\ProcessCategory" process-variable = "ProcessMaker\Services\Api\Project\Variable" + message = "ProcessMaker\Services\Api\Project\Message" [alias: projects] project = "ProcessMaker\Services\Api\Project" From 6e6a899acf27752ab2f1703bf5d412909bbdd38a Mon Sep 17 00:00:00 2001 From: veronicaaruquipa Date: Tue, 9 Dec 2014 10:43:39 -0400 Subject: [PATCH 03/30] Some adjustments were added in order to resolve the input data in features related to database connections. --- behat.yml.dist | 4 +- ...n_tests_database_connections_mysql.feature | 36 +++++++++-------- ...sts_database_connections_sqlserver.feature | 35 +++++++++-------- ...egative_tests_database_connections.feature | 4 +- features/bootstrap/RestContext.php | 39 ++++++++++++++++++- 5 files changed, 78 insertions(+), 40 deletions(-) diff --git a/behat.yml.dist b/behat.yml.dist index 3c42f2ff9..f70f887da 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -8,9 +8,9 @@ default: client_secret: 179ad45c6ce2cb97cf1029e212046e81 #uploadFilesFolder: /opt/uploadfiles #cd5cff9b2e3ebabf49e276e47e977fab5988c00e - login_url: http://processmaker-ip-or-domaint/sys[workspace]/en/neoclassic/login/login + login_url: http://processmaker-ip-or-domain/sys[workspace]/en/neoclassic/login/login authentication_url: http://processmaker-ip-or-domain/sys[workspace]/en/neoclassic/login/authentication.php - oauth_app_url: http://processmaker-ip-or-domaint/sys[workspace]/en/neoclassic/oauth2/clientSetupAjax + oauth_app_url: http://processmaker-ip-or-domain/sys[workspace]/en/neoclassic/oauth2/clientSetupAjax oauth_authorization_url: http://processmaker-ip-or-domain/[workspace]/oauth2/authorize user_name: user_password: diff --git a/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature b/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature index e1a016a65..992dc54f1 100644 --- a/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature +++ b/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature @@ -5,11 +5,13 @@ Feature: DataBase Connections Main Tests Mysql and workspace with the project 87648819953a85c0abc01d3080475981 ("testExecutionOfDerivationScreen") already loaded there are zero Database Connections in the processes. + # MySQL is tagged like 1 Background: Given that I have a valid access_token + And database tagged like 1 -# GET /api/1.0/{workspace}/project//database-connections + # GET /api/1.0/{workspace}/project//database-connections # Get list DataBase| dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | Connections Scenario Outline: Get the DataBase Connections List when there are exactly zero DataBase Connections Given I request "project//database-connections" @@ -19,8 +21,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | project | record | - | 106912358530c9b14ac15d3001790900 | 0 | - | 1265557095225ff5c688f46031700471 | 0 | + | 74737540052e1641ab88249082085472 | 0 | + | 87648819953a85c0abc01d3080475981 | 0 | # POST /api/1.0/{workspace}/project//database-connection/test @@ -48,8 +50,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # POST /api/1.0/{workspace}/project//database-connection @@ -79,8 +81,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # GET /api/1.0/{workspace}/project//database-connection @@ -94,8 +96,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | project | record | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 1 | 1 | - | 1265557095225ff5c688f46031700471 | 1 | 2 | + | 74737540052e1641ab88249082085472 | 1 | 1 | + | 87648819953a85c0abc01d3080475981 | 1 | 2 | # PUT /api/1.0/{workspace}/project//database-connection @@ -124,8 +126,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # GET /api/1.0/{workspace}/project//database-connection @@ -149,8 +151,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # DELETE /api/1.0/{workspace}/project//database-connection @@ -165,8 +167,8 @@ Feature: DataBase Connections Main Tests Mysql Examples: | project | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 1 | - | 1265557095225ff5c688f46031700471 | 2 | + | 74737540052e1641ab88249082085472 | 1 | + | 87648819953a85c0abc01d3080475981 | 2 | # GET /api/1.0/{workspace}/project//database-connection @@ -180,5 +182,5 @@ Feature: DataBase Connections Main Tests Mysql Examples: | project | record | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 0 | 1 | - | 1265557095225ff5c688f46031700471 | 0 | 2 | \ No newline at end of file + | 74737540052e1641ab88249082085472 | 0 | 1 | + | 87648819953a85c0abc01d3080475981 | 0 | 2 | \ No newline at end of file diff --git a/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature b/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature index 2fb272877..4b69b9d90 100644 --- a/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature +++ b/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature @@ -5,9 +5,10 @@ Feature: DataBase Connections Main Tests SQL Server and workspace with the project 87648819953a85c0abc01d3080475981 ("testExecutionOfDerivationScreen") already loaded there are zero Database Connections in the processes. + # Microsoft SQL Server is tagged like 2 Background: Given that I have a valid access_token - + And database tagged like 2 # GET /api/1.0/{workspace}/project//database-connections # Get list DataBase Connections @@ -19,8 +20,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | project | record | - | 106912358530c9b14ac15d3001790900 | 0 | - | 1265557095225ff5c688f46031700471 | 0 | + | 74737540052e1641ab88249082085472 | 0 | + | 87648819953a85c0abc01d3080475981 | 0 | # POST /api/1.0/{workspace}/project//database-connection/test @@ -48,8 +49,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # POST /api/1.0/{workspace}/project//database-connection @@ -79,8 +80,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # GET /api/1.0/{workspace}/project//database-connection @@ -94,8 +95,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | project | record | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 1 | 1 | - | 1265557095225ff5c688f46031700471 | 1 | 2 | + | 74737540052e1641ab88249082085472 | 1 | 1 | + | 87648819953a85c0abc01d3080475981 | 1 | 2 | # PUT /api/1.0/{workspace}/project//database-connection @@ -124,8 +125,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # GET /api/1.0/{workspace}/project//database-connection @@ -149,8 +150,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | dbs_uid_number | project | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | 1 | 106912358530c9b14ac15d3001790900 | | | | | | | | | - | 2 | 1265557095225ff5c688f46031700471 | | | | | | | | | + | 1 | 74737540052e1641ab88249082085472 | | | | | | | | | + | 2 | 87648819953a85c0abc01d3080475981 | | | | | | | | | # DELETE /api/1.0/{workspace}/project//database-connection @@ -165,8 +166,8 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | project | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 1 | - | 1265557095225ff5c688f46031700471 | 2 | + | 74737540052e1641ab88249082085472 | 1 | + | 87648819953a85c0abc01d3080475981 | 2 | # GET /api/1.0/{workspace}/project//database-connection @@ -180,5 +181,5 @@ Feature: DataBase Connections Main Tests SQL Server Examples: | project | record | dbs_uid_number | - | 106912358530c9b14ac15d3001790900 | 0 | 1 | - | 1265557095225ff5c688f46031700471 | 0 | 2 | \ No newline at end of file + | 74737540052e1641ab88249082085472 | 0 | 1 | + | 87648819953a85c0abc01d3080475981 | 0 | 2 | \ No newline at end of file diff --git a/features/backend/projects/database_connections/negative_tests_database_connections.feature b/features/backend/projects/database_connections/negative_tests_database_connections.feature index fe76867bd..e4beb0773 100644 --- a/features/backend/projects/database_connections/negative_tests_database_connections.feature +++ b/features/backend/projects/database_connections/negative_tests_database_connections.feature @@ -51,5 +51,5 @@ Feature: DataBase Connections Negative Tests Examples: | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | - | | | | | | | | | - | | | | | | | | | \ No newline at end of file + | | | | | | 33O6 | | | + | | | | | | 33O6 | | | \ No newline at end of file diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 4c4407f52..c81f12b34 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -87,6 +87,42 @@ class RestContext extends BehatContext } } + /** + * @BeforeScenario @DbConnection + */ + public function verifyAllRequiredDataToConnectDB($db_type) + { + $db_parameters = null; + if ($db_type === 1){ + $db_parameters = array( + 'mys_db_type', + 'mys_db_server', + 'mys_db_name', + 'mys_db_username', + 'mys_db_password', + 'mys_db_port', + 'mys_db_encode', + 'mys_db_description'); + }elseif($db_type === 2){ + $db_parameters = array( + 'sqlsrv_db_type', + 'sqlsrv_db_server', + 'sqlsrv_db_name', + 'sqlsrv_db_username', + 'sqlsrv_db_password', + 'sqlsrv_db_port', + 'sqlsrv_db_encode', + 'sqlsrv_db_description'); + } + + foreach ($db_parameters as $value) { + $param = $this->getParameter($value); + if (!isset($param)){ + throw new PendingException("Parameter ".$value." is not defined or is empty, please review behat.yml file!"); + } + } + } + /** * @BeforeScenario @MysqlDbConnection */ @@ -1725,7 +1761,7 @@ class RestContext extends BehatContext /** * @Given /^that "([^"]*)" property in object "([^"]*)" equals "([^"]*)"$/ */ - public function thatPropertyInObjectEquals($propertyName, $propertyParent, $value) + public function thatPropertyInObjectEquals($propertyName, $propertyParent, $propertyValue) { $data = $this->_data; if (empty($data)) { @@ -1899,7 +1935,6 @@ class RestContext extends BehatContext $sessionData = new StdClass(); } - $sessionData = new StdClass(); if(!$sessionData->dbconnectionStatus->$dbConnectionId){ throw new PendingException("Skip inactive dbconnection: $dbConnectionId"); } From da7f546adeff31eaa12c36335f33fa70fc8b96bd Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Tue, 9 Dec 2014 10:50:14 -0400 Subject: [PATCH 04/30] PM-1099 "El archivo plugin.singleton se reescribe muchas..." SOLVED Issue: El archivo plugin.singleton se reescribe muchas veces para un solo request Cause: Al instanciar un objeto de la clase "pmLicenseManager" se hace una llamada al metodo "activateFeatures", y este proceso ocasiona que cuando un usuario haga un request a un determinado modulo de ProcessMaker se hagan varias llamadas al metodo "activateFeatures" Solution: Se ha agregado un parametro al contructor de la clase "pmLicenseManager" el cual evita la ejecucion del metodo "activateFeatures" --- workflow/engine/classes/class.licensedFeatures.php | 3 ++- workflow/engine/classes/class.pmLicenseManager.php | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/workflow/engine/classes/class.licensedFeatures.php b/workflow/engine/classes/class.licensedFeatures.php index a7baf8d45..2136ec33c 100644 --- a/workflow/engine/classes/class.licensedFeatures.php +++ b/workflow/engine/classes/class.licensedFeatures.php @@ -68,7 +68,8 @@ class PMLicensedFeatures if (!class_exists("pmLicenseManager")) { require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php"); } - $licenseManager = pmLicenseManager::getSingleton(); + + $licenseManager = pmLicenseManager::getSingleton(false); $_SESSION['__sw__'] = true; $padl = new padl(); diff --git a/workflow/engine/classes/class.pmLicenseManager.php b/workflow/engine/classes/class.pmLicenseManager.php index e2b2dd7a4..4e95560e2 100644 --- a/workflow/engine/classes/class.pmLicenseManager.php +++ b/workflow/engine/classes/class.pmLicenseManager.php @@ -10,7 +10,7 @@ class pmLicenseManager private static $instance = null; - public function __construct() + public function __construct($flagActivatePlugins = true) { G::LoadClass('serverConfiguration'); $oServerConf = &serverConf::getSingleton(); @@ -109,13 +109,15 @@ class pmLicenseManager $oServerConf->setProperty ( 'LICENSE_INFO', $licInfoA ); } - $this->activateFeatures (); + if ($flagActivatePlugins) { + $this->activateFeatures(); + } } - public static function getSingleton() + public static function getSingleton($flagActivatePlugins = true) { if (self::$instance == null) { - self::$instance = new pmLicenseManager(); + self::$instance = new pmLicenseManager($flagActivatePlugins); } return self::$instance; } From d50cbb97bfe6eaee715b4b1b12d648512490acfb Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Tue, 9 Dec 2014 13:43:39 -0400 Subject: [PATCH 05/30] Add MESSAGE bpmn 2.0 functionality end points. Add Message.php --- .../Services/Api/Project/Message.php | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 workflow/engine/src/ProcessMaker/Services/Api/Project/Message.php diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/Message.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/Message.php new file mode 100644 index 000000000..5c7d100b5 --- /dev/null +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/Message.php @@ -0,0 +1,111 @@ +getMessages($prj_uid); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url GET /:prj_uid/message/:mes_uid + * + * @param string $mes_uid {@min 32}{@max 32} + * @param string $prj_uid {@min 32}{@max 32} + */ + public function doGetMessage($mes_uid, $prj_uid) + { + try { + $message = new \ProcessMaker\BusinessModel\Message(); + + $response = $message->getMessage($prj_uid, $mes_uid); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url POST /:prj_uid/message + * + * @param string $prj_uid {@min 32}{@max 32} + * @param array $request_data + * + * @status 201 + */ + public function doPostMessage($prj_uid, $request_data) + { + try { + $request_data = (array)($request_data); + $message = new \ProcessMaker\BusinessModel\Message(); + + $arrayData = $message->create($prj_uid, $request_data); + + $response = $arrayData; + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url PUT /:prj_uid/message/:mes_uid + * + * @param string $prj_uid {@min 32}{@max 32} + * @param string $mes_uid {@min 32}{@max 32} + * @param array $request_data + */ + public function doPutMessage($prj_uid, $mes_uid, array $request_data) + { + try { + $request_data = (array)($request_data); + $message = new \ProcessMaker\BusinessModel\Message(); + + $message->update($prj_uid, $mes_uid, $request_data); + + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url DELETE /:prj_uid/message/:mes_uid + * + * @param string $prj_uid {@min 32}{@max 32} + * @param string $mes_uid {@min 32}{@max 32} + */ + public function doDeleteMessage($prj_uid, $mes_uid) + { + try { + $message = new \ProcessMaker\BusinessModel\Message(); + + $message->delete($prj_uid, $mes_uid); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } +} + From 3fa986b4fe3478aa05a52db8047a6886da389954 Mon Sep 17 00:00:00 2001 From: veronicaaruquipa Date: Tue, 9 Dec 2014 14:16:50 -0400 Subject: [PATCH 06/30] Remove undefined steps and were corrected some input data. --- ...n_tests_database_connections_mysql.feature | 1 - ...sts_database_connections_sqlserver.feature | 2 +- ...egative_tests_database_connections.feature | 4 +- features/bootstrap/RestContext.php | 38 +------------------ 4 files changed, 4 insertions(+), 41 deletions(-) diff --git a/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature b/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature index 992dc54f1..0ff969058 100644 --- a/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature +++ b/features/backend/projects/database_connections/main_tests_database_connections_mysql.feature @@ -8,7 +8,6 @@ Feature: DataBase Connections Main Tests Mysql # MySQL is tagged like 1 Background: Given that I have a valid access_token - And database tagged like 1 # GET /api/1.0/{workspace}/project//database-connections diff --git a/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature b/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature index 4b69b9d90..ec3c2530d 100644 --- a/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature +++ b/features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature @@ -8,7 +8,7 @@ Feature: DataBase Connections Main Tests SQL Server # Microsoft SQL Server is tagged like 2 Background: Given that I have a valid access_token - And database tagged like 2 + # GET /api/1.0/{workspace}/project//database-connections # Get list DataBase Connections diff --git a/features/backend/projects/database_connections/negative_tests_database_connections.feature b/features/backend/projects/database_connections/negative_tests_database_connections.feature index e4beb0773..d32e9733e 100644 --- a/features/backend/projects/database_connections/negative_tests_database_connections.feature +++ b/features/backend/projects/database_connections/negative_tests_database_connections.feature @@ -47,9 +47,9 @@ Feature: DataBase Connections Negative Tests """ And I request "project/74737540052e1641ab88249082085472/database-connection" Then the response status code should be 400 - And the response status message should have the following text "port" + And the response status message should have the following text "Error" Examples: | dbs_type | dbs_server | dbs_database_name | dbs_username | dbs_password | dbs_port | dbs_encode | dbs_description | | | | | | | 33O6 | | | - | | | | | | 33O6 | | | \ No newline at end of file + | | | | | | 33o6 | | | \ No newline at end of file diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index c81f12b34..87c1d4f43 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -87,42 +87,6 @@ class RestContext extends BehatContext } } - /** - * @BeforeScenario @DbConnection - */ - public function verifyAllRequiredDataToConnectDB($db_type) - { - $db_parameters = null; - if ($db_type === 1){ - $db_parameters = array( - 'mys_db_type', - 'mys_db_server', - 'mys_db_name', - 'mys_db_username', - 'mys_db_password', - 'mys_db_port', - 'mys_db_encode', - 'mys_db_description'); - }elseif($db_type === 2){ - $db_parameters = array( - 'sqlsrv_db_type', - 'sqlsrv_db_server', - 'sqlsrv_db_name', - 'sqlsrv_db_username', - 'sqlsrv_db_password', - 'sqlsrv_db_port', - 'sqlsrv_db_encode', - 'sqlsrv_db_description'); - } - - foreach ($db_parameters as $value) { - $param = $this->getParameter($value); - if (!isset($param)){ - throw new PendingException("Parameter ".$value." is not defined or is empty, please review behat.yml file!"); - } - } - } - /** * @BeforeScenario @MysqlDbConnection */ @@ -1929,7 +1893,7 @@ class RestContext extends BehatContext */ public function databaseConnectionWithIdIsActive($dbConnectionId) { - if (file_exists("session.data")) { + if (file_exists("session.data")) { $sessionData = json_decode(file_get_contents("session.data")); } else { $sessionData = new StdClass(); From d52bfc974c999b75a9e5975695a050d7c63d62cb Mon Sep 17 00:00:00 2001 From: veronicaaruquipa Date: Tue, 9 Dec 2014 15:39:39 -0400 Subject: [PATCH 07/30] Change the http status code inside features when a process is imported. --- .../main_tests_project_export_import.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/backend/projects/project_export_import/main_tests_project_export_import.feature b/features/backend/projects/project_export_import/main_tests_project_export_import.feature index af0f471f3..374cf5678 100644 --- a/features/backend/projects/project_export_import/main_tests_project_export_import.feature +++ b/features/backend/projects/project_export_import/main_tests_project_export_import.feature @@ -152,7 +152,7 @@ Scenario: Delete a Project created previously in this script Scenario Outline: Import a process Given POST upload a project file "" to "project/import?option=&option_group=merge" - Then the response status code should be 201 + Then the response status code should be 200 And the response charset is "UTF-8" And the content type is "application/json" And the type is "object" @@ -426,7 +426,7 @@ Scenario: Get a list of projects Scenario Outline: Import a process Given POST upload a project file "" to "project/import?option=" - Then the response status code should be 201 + Then the response status code should be 200 And the response charset is "UTF-8" And the content type is "application/json" And the type is "object" @@ -455,7 +455,7 @@ Scenario: Delete a Project created previously in this script "Export process emp Scenario: Import a process "Export process empty" Given POST upload a project file "Export_process_empty.pmx" to "project/import?option=create" - Then the response status code should be 201 + Then the response status code should be 200 And the response charset is "UTF-8" And the content type is "application/json" And the type is "object" From 8e84d98a326ee32931bd514c5ceb1ddc12031670 Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Tue, 9 Dec 2014 15:42:11 -0400 Subject: [PATCH 08/30] PM-1030 "2 dynaforms with same name" SOLVED --- workflow/engine/classes/model/Dynaform.php | 9 ++++-- .../js/dynaformEditor/core/dynaformEditor.js | 7 +++++ .../methods/dynaforms/dynaforms_Ajax.php | 5 ++++ .../dynaforms/dynaforms_Properties.xml | 28 ++++++++++++++++++- 4 files changed, 45 insertions(+), 4 deletions(-) mode change 100644 => 100755 workflow/engine/js/dynaformEditor/core/dynaformEditor.js diff --git a/workflow/engine/classes/model/Dynaform.php b/workflow/engine/classes/model/Dynaform.php index dcbb584ea..35a0a651a 100755 --- a/workflow/engine/classes/model/Dynaform.php +++ b/workflow/engine/classes/model/Dynaform.php @@ -517,13 +517,14 @@ class Dynaform extends BaseDynaform return $G_FORM->fields; } - public function verifyExistingName ($sName, $sProUid) + public function verifyExistingName ($sName, $sProUid, $sDynUid) { $sNameDyanform = urldecode( $sName ); $sProUid = urldecode( $sProUid ); $oCriteria = new Criteria( 'workflow' ); $oCriteria->addSelectColumn( DynaformPeer::DYN_UID ); $oCriteria->add( DynaformPeer::PRO_UID, $sProUid ); + $oCriteria->add( DynaformPeer::DYN_UID, $sDynUid ); $oDataset = DynaformPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $flag = true; @@ -532,14 +533,16 @@ class Dynaform extends BaseDynaform $oCriteria1 = new Criteria( 'workflow' ); $oCriteria1->addSelectColumn( 'COUNT(*) AS DYNAFORMS' ); $oCriteria1->add( ContentPeer::CON_CATEGORY, 'DYN_TITLE' ); - $oCriteria1->add( ContentPeer::CON_ID, $aRow['DYN_UID'] ); + $oCriteria1->add( ContentPeer::CON_ID, $sDynUid, Criteria::NOT_EQUAL); $oCriteria1->add( ContentPeer::CON_VALUE, $sNameDyanform ); $oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG ); + $oCriteria1->add( DynaformPeer::PRO_UID, $sProUid); + $oCriteria1->addJoin( ContentPeer::CON_ID, DynaformPeer::DYN_UID, Criteria::INNER_JOIN ); $oDataset1 = ContentPeer::doSelectRS( $oCriteria1 ); $oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset1->next(); $aRow1 = $oDataset1->getRow(); - if ($aRow1['DYNAFORMS']) { + if ($aRow1['DYNAFORMS'] == 1) { $flag = false; break; } diff --git a/workflow/engine/js/dynaformEditor/core/dynaformEditor.js b/workflow/engine/js/dynaformEditor/core/dynaformEditor.js old mode 100644 new mode 100755 index 3323e41ed..b25401c9b --- a/workflow/engine/js/dynaformEditor/core/dynaformEditor.js +++ b/workflow/engine/js/dynaformEditor/core/dynaformEditor.js @@ -856,6 +856,13 @@ var dynaformEditor={ /*getField("ENABLETEMPLATE","dynaforms_Properties").checked=(prop.ENABLETEMPLATE=="1");*/ getField("MODE","dynaforms_Properties").value=prop.MODE; }, + refreshPropertiesDynTitle:function() + { + var form=this.views["properties"].getElementsByTagName("form")[0]; + var prop=this.ajax.get_properties(this.A,this.dynUid); + getField("A","dynaforms_Properties").value=prop.A; + getField("DYN_TITLE","dynaforms_Properties").value=prop.DYN_TITLE; + }, // Internal functions runScripts:function(scripts) { diff --git a/workflow/engine/methods/dynaforms/dynaforms_Ajax.php b/workflow/engine/methods/dynaforms/dynaforms_Ajax.php index 6ba97be6b..5d21861c2 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Ajax.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Ajax.php @@ -26,6 +26,11 @@ * * @author David Callizaya */ +if (isset($_POST['dynaformName'])) { + $dynaForm = new Dynaform(); + $res = $dynaForm->verifyExistingName($_POST['dynaformName'], $_POST['proUid'], $_POST['dynaformUid']); + print ($res) ? 1 : 0; +} global $_DBArray; if (! isset( $_DBArray )) { $_DBArray = array (); diff --git a/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml b/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml index 503644db5..15b117c1a 100755 --- a/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml +++ b/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml @@ -73,8 +73,34 @@ - Date: Tue, 9 Dec 2014 15:46:42 -0400 Subject: [PATCH 09/30] Update number of results that have were defined inside features and which get the corresponding service. --- .../case_scheduler/main_tests_case_scheduler.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature b/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature index c02c9ddff..6ff008da0 100644 --- a/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature +++ b/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature @@ -20,7 +20,7 @@ Scenario Outline: Get the case schedulers list when there are exactly case sched | test_description | project | record | | Get case scheduler of process Test Michelangelo | 1265557095225ff5c688f46031700471 | 0 | - | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 1 | + | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 2 | Scenario Outline: Create any case scheduler for a project @@ -110,7 +110,7 @@ Scenario: Create a new case scheduler with same name And the response status message should have the following text "Duplicate" -Scenario Outline: Get the case schedulers list when there are exactly 16 case schedulers in each process +Scenario Outline: Get the case schedulers list when there are exactly 16 after 18 case schedulers in each process Given I request "project//case-schedulers" Then the response status code should be 200 And the response charset is "UTF-8" @@ -122,7 +122,7 @@ Scenario Outline: Get the case schedulers list when there are exactly 16 case sc | test_description | project | record | | Get case scheduler of process Test Michelangelo | 1265557095225ff5c688f46031700471 | 16 | - | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 17 | + | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 18 | Scenario Outline: Update the case schedulers for a project and then check if the values had changed From f06834074540610b0829bda2d1c4bf98445685c9 Mon Sep 17 00:00:00 2001 From: veronicaaruquipa Date: Tue, 9 Dec 2014 15:52:09 -0400 Subject: [PATCH 10/30] Was changed input data in order to create new C LIENT_ID and CLIENT_SECRET. --- .../backend/oauth/main_tests_authorization_code.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/backend/oauth/main_tests_authorization_code.feature b/features/backend/oauth/main_tests_authorization_code.feature index 05ea8a957..859e7605d 100644 --- a/features/backend/oauth/main_tests_authorization_code.feature +++ b/features/backend/oauth/main_tests_authorization_code.feature @@ -17,9 +17,9 @@ Scenario Outline: Create new CLIENT_ID and CLIENT_SECRET """ Examples: - | Description | application_number | application_name | application_description | application_website | application_redirectUri | - | Create token normal | 1 | Demo3 | Demo3 desc | http://www.demowendy3.com | www.demowendy3.com/auth | - | Create token normal | 2 | Demo4 | Demo4 desc | http://www.demowendy4.com | http://www.processmaker.com | + | Description | application_number | application_name | application_description | application_website | application_redirectUri | + | Create token normal | 1 | Demo3 | Demo3 desc | http://www.processmaker.com | http://michelangelo-be.colosa.net/sysmichelangelo/en/neoclassic/oauth2/grant | + | Create token normal | 2 | Demo4 | Demo4 desc | http://www.processmaker.com | http://michelangelo-be.colosa.net/sysmichelangelo/en/neoclassic/oauth2/grant | #Endpoint para verificar el correcto funcionamiento del token generado en este script From 9be15f6c2cd62ca5e9bea4cc228594365e1dd37d Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Tue, 9 Dec 2014 16:22:39 -0400 Subject: [PATCH 11/30] Add MESSAGE bpmn 2.0 functionality end points. ORACLE and MSSQL --- workflow/engine/data/mssql/schema.sql | 79 ++++++++++++++++++++++++++ workflow/engine/data/oracle/schema.sql | 39 +++++++++++++ 2 files changed, 118 insertions(+) diff --git a/workflow/engine/data/mssql/schema.sql b/workflow/engine/data/mssql/schema.sql index ce41277de..669421f6b 100755 --- a/workflow/engine/data/mssql/schema.sql +++ b/workflow/engine/data/mssql/schema.sql @@ -3278,3 +3278,82 @@ CREATE TABLE APP_ASSIGN_SELF_SERVICE_VALUE GRP_UID VARCHAR(32) DEFAULT '' NOT NULL ); +/* ---------------------------------------------------------------------- */ +/* MESSAGE */ +/* ---------------------------------------------------------------------- */ + + +IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'MESSAGE') +BEGIN + DECLARE @reftable_108 nvarchar(60), @constraintname_108 nvarchar(60) + DECLARE refcursor CURSOR FOR + select reftables.name tablename, cons.name constraintname + from sysobjects tables, + sysobjects reftables, + sysobjects cons, + sysreferences ref + where tables.id = ref.rkeyid + and cons.id = ref.constid + and reftables.id = ref.fkeyid + and tables.name = 'MESSAGE' + OPEN refcursor + FETCH NEXT from refcursor into @reftable_108, @constraintname_108 + while @@FETCH_STATUS = 0 + BEGIN + exec ('alter table '+@reftable_108+' drop constraint '+@constraintname_108) + FETCH NEXT from refcursor into @reftable_108, @constraintname_108 + END + CLOSE refcursor + DEALLOCATE refcursor + DROP TABLE [MESSAGE] +END + + +CREATE TABLE [MESSAGE] +( + [MES_UID] VARCHAR(32) NOT NULL, + [PRJ_UID] VARCHAR(32) NOT NULL, + [MES_NAME] VARCHAR(255) default '' NULL, + [MES_CONDITION] VARCHAR(255) default '' NULL, + CONSTRAINT MESSAGE_PK PRIMARY KEY ([MES_UID]) +); + +/* ---------------------------------------------------------------------- */ +/* MESSAGE_DETAIL */ +/* ---------------------------------------------------------------------- */ + + +IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'MESSAGE_DETAIL') +BEGIN + DECLARE @reftable_109 nvarchar(60), @constraintname_109 nvarchar(60) + DECLARE refcursor CURSOR FOR + select reftables.name tablename, cons.name constraintname + from sysobjects tables, + sysobjects reftables, + sysobjects cons, + sysreferences ref + where tables.id = ref.rkeyid + and cons.id = ref.constid + and reftables.id = ref.fkeyid + and tables.name = 'MESSAGE_DETAIL' + OPEN refcursor + FETCH NEXT from refcursor into @reftable_109, @constraintname_109 + while @@FETCH_STATUS = 0 + BEGIN + exec ('alter table '+@reftable_109+' drop constraint '+@constraintname_109) + FETCH NEXT from refcursor into @reftable_109, @constraintname_109 + END + CLOSE refcursor + DEALLOCATE refcursor + DROP TABLE [MESSAGE_DETAIL] +END + + +CREATE TABLE [MESSAGE_DETAIL] +( + [MD_UID] VARCHAR(32) NOT NULL, + [MES_UID] VARCHAR(32) NOT NULL, + [MD_TYPE] VARCHAR(32) default '' NULL, + [MD_NAME] VARCHAR(255) default '' NULL, + CONSTRAINT MESSAGE_DETAIL_PK PRIMARY KEY ([MD_UID]) +); \ No newline at end of file diff --git a/workflow/engine/data/oracle/schema.sql b/workflow/engine/data/oracle/schema.sql index 3f4af465e..b565ade06 100755 --- a/workflow/engine/data/oracle/schema.sql +++ b/workflow/engine/data/oracle/schema.sql @@ -1850,3 +1850,42 @@ CREATE TABLE APP_ASSIGN_SELF_SERVICE_VALUE GRP_UID VARCHAR2(32) DEFAULT '' NOT NULL ); + +/* ----------------------------------------------------------------------- + MESSAGE + ----------------------------------------------------------------------- */ + +DROP TABLE "MESSAGE" CASCADE CONSTRAINTS; + + +CREATE TABLE "MESSAGE" +( + "MES_UID" VARCHAR2(32) NOT NULL, + "PRJ_UID" VARCHAR2(32) NOT NULL, + "MES_NAME" VARCHAR2(255) default '', + "MES_CONDITION" VARCHAR2(255) default '' +); + + ALTER TABLE "MESSAGE" + ADD CONSTRAINT "MESSAGE_PK" + PRIMARY KEY ("MES_UID"); + + +/* ----------------------------------------------------------------------- + MESSAGE_DETAIL + ----------------------------------------------------------------------- */ + +DROP TABLE "MESSAGE_DETAIL" CASCADE CONSTRAINTS; + + +CREATE TABLE "MESSAGE_DETAIL" +( + "MD_UID" VARCHAR2(32) NOT NULL, + "MES_UID" VARCHAR2(32) NOT NULL, + "MD_TYPE" VARCHAR2(32) default '', + "MD_NAME" VARCHAR2(255) default '' +); + + ALTER TABLE "MESSAGE_DETAIL" + ADD CONSTRAINT "MESSAGE_DETAIL_PK" + PRIMARY KEY ("MD_UID"); From a1be8644ae376a08077bc9dcd05a7028f328df82 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Tue, 9 Dec 2014 17:08:50 -0400 Subject: [PATCH 12/30] PM-1105 "Al actualizar ProcessMaker de la version 2.5.2 a..." SOLVED Issue: Al actualizar ProcessMaker de la version 2.5.2 a la version 2.8 se pierden los dashboard configurados con el advanced dashboard Cause: Este problema es debido a que se ha modificado un dashlet que el sistema a creado, y el sistema restaura justamente esos registros en cada upgrade Solution: Se esta quitando los DASHLET_INSTANCE del archivo "check.data" para que no los actualize en cada upgrade --- workflow/engine/data/check.data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/data/check.data b/workflow/engine/data/check.data index 3cc35a488..48e6e2e09 100644 --- a/workflow/engine/data/check.data +++ b/workflow/engine/data/check.data @@ -1 +1 @@ -a:8:{i:0;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:7:"DASHLET";s:4:"keys";a:1:{i:0;s:7:"DAS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000001";}i:1;a:3:{s:5:"field";s:9:"DAS_CLASS";s:4:"type";s:4:"text";s:5:"value";s:22:"dashletOpenVSCompleted";}i:2;a:3:{s:5:"field";s:9:"DAS_TITLE";s:4:"type";s:4:"text";s:5:"value";s:29:"Open Cases VS Completed Cases";}i:3;a:3:{s:5:"field";s:15:"DAS_DESCRIPTION";s:4:"type";s:4:"text";s:5:"value";s:29:"Open Cases VS Completed Cases";}i:4;a:3:{s:5:"field";s:11:"DAS_VERSION";s:4:"type";s:4:"text";s:5:"value";s:3:"1.0";}i:5;a:3:{s:5:"field";s:15:"DAS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:20:" 2011-10-28 00:00:00";}i:6;a:3:{s:5:"field";s:15:"DAS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:20:" 2011-10-28 00:00:00";}i:7;a:3:{s:5:"field";s:10:"DAS_STATUS";s:4:"type";s:3:"int";s:5:"value";i:1;}}s:6:"action";i:4;}i:1;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:7:"DASHLET";s:4:"keys";a:1:{i:0;s:7:"DAS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000002";}i:1;a:3:{s:5:"field";s:9:"DAS_CLASS";s:4:"type";s:4:"text";s:5:"value";s:28:"dashletProcessMakerCommunity";}i:2;a:3:{s:5:"field";s:9:"DAS_TITLE";s:4:"type";s:4:"text";s:5:"value";s:22:"ProcessMaker Community";}i:3;a:3:{s:5:"field";s:15:"DAS_DESCRIPTION";s:4:"type";s:4:"text";s:5:"value";s:44:"ProcessMaker Community Links and Information";}i:4;a:3:{s:5:"field";s:11:"DAS_VERSION";s:4:"type";s:4:"text";s:5:"value";s:3:"1.0";}i:5;a:3:{s:5:"field";s:15:"DAS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2011-12-01 00:00:00";}i:6;a:3:{s:5:"field";s:15:"DAS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2011-12-01 00:00:00";}i:7;a:3:{s:5:"field";s:10:"DAS_STATUS";s:4:"type";s:3:"int";s:5:"value";s:1:"1";}}s:6:"action";i:4;}i:2;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:7:"DASHLET";s:4:"keys";a:1:{i:0;s:7:"DAS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000003";}i:1;a:3:{s:5:"field";s:9:"DAS_CLASS";s:4:"type";s:4:"text";s:5:"value";s:29:"dashletProcessMakerEnterprise";}i:2;a:3:{s:5:"field";s:9:"DAS_TITLE";s:4:"type";s:4:"text";s:5:"value";s:42:"ProcessMaker Enterprise Plugins and Addons";}i:3;a:3:{s:5:"field";s:15:"DAS_DESCRIPTION";s:4:"type";s:4:"text";s:5:"value";s:147:"The following list of Enterprise plug-ins includes features and functionality that extend and enhance ProcessMaker's performance and functionality.";}i:4;a:3:{s:5:"field";s:11:"DAS_VERSION";s:4:"type";s:4:"text";s:5:"value";s:3:"1.0";}i:5;a:3:{s:5:"field";s:15:"DAS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:10:"2011-12-05";}i:6;a:3:{s:5:"field";s:15:"DAS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:10:"2011-12-05";}i:7;a:3:{s:5:"field";s:10:"DAS_STATUS";s:4:"type";s:3:"int";s:5:"value";i:1;}}s:6:"action";i:4;}i:3;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:7:"DASHLET";s:4:"keys";a:1:{i:0;s:7:"DAS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000004";}i:1;a:3:{s:5:"field";s:9:"DAS_CLASS";s:4:"type";s:4:"text";s:5:"value";s:16:"dashletRssReader";}i:2;a:3:{s:5:"field";s:9:"DAS_TITLE";s:4:"type";s:4:"text";s:5:"value";s:17:"Simple RSS reader";}i:3;a:3:{s:5:"field";s:15:"DAS_DESCRIPTION";s:4:"type";s:4:"text";s:5:"value";s:34:"Simple RSS reader for ProcessMaker";}i:4;a:3:{s:5:"field";s:11:"DAS_VERSION";s:4:"type";s:4:"text";s:5:"value";s:3:"1.0";}i:5;a:3:{s:5:"field";s:15:"DAS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:20:" 2012-04-16 00:00:00";}i:6;a:3:{s:5:"field";s:15:"DAS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:20:" 2012-04-16 00:00:00";}i:7;a:3:{s:5:"field";s:10:"DAS_STATUS";s:4:"type";s:3:"int";s:5:"value";i:1;}}s:6:"action";i:4;}i:4;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:16:"DASHLET_INSTANCE";s:4:"keys";a:1:{i:0;s:11:"DAS_INS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:11:"DAS_INS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000001";}i:1;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000001";}i:2;a:3:{s:5:"field";s:18:"DAS_INS_OWNER_TYPE";s:4:"type";s:4:"text";s:5:"value";s:9:"EVERYBODY";}i:3;a:3:{s:5:"field";s:17:"DAS_INS_OWNER_UID";s:4:"type";s:4:"text";s:5:"value";s:0:"";}i:4;a:3:{s:5:"field";s:29:"DAS_INS_ADDITIONAL_PROPERTIES";s:4:"type";s:4:"text";s:5:"value";s:224:"a:7:{s:20:"DAS_INS_CONTEXT_TIME";s:5:"TODAY";s:12:"DAS_RED_FROM";s:1:"0";s:10:"DAS_RED_TO";s:2:"30";s:15:"DAS_YELLOW_FROM";s:2:"30";s:13:"DAS_YELLOW_TO";s:2:"50";s:14:"DAS_GREEN_FROM";s:2:"50";s:12:"DAS_GREEN_TO";s:3:"100";}";}i:5;a:3:{s:5:"field";s:19:"DAS_INS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2011-12-02 00:00:00";}i:6;a:3:{s:5:"field";s:19:"DAS_INS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2011-12-02 00:00:00";}i:7;a:3:{s:5:"field";s:14:"DAS_INS_STATUS";s:4:"type";s:3:"int";s:5:"value";i:1;}}s:6:"action";i:4;}i:5;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:16:"DASHLET_INSTANCE";s:4:"keys";a:1:{i:0;s:11:"DAS_INS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:11:"DAS_INS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000002";}i:1;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000002";}i:2;a:3:{s:5:"field";s:18:"DAS_INS_OWNER_TYPE";s:4:"type";s:4:"text";s:5:"value";s:9:"EVERYBODY";}i:3;a:3:{s:5:"field";s:17:"DAS_INS_OWNER_UID";s:4:"type";s:4:"text";s:5:"value";s:0:"";}i:4;a:3:{s:5:"field";s:29:"DAS_INS_ADDITIONAL_PROPERTIES";s:4:"type";s:4:"text";s:5:"value";s:0:"";}i:5;a:3:{s:5:"field";s:19:"DAS_INS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2011-12-02 00:00:00";}i:6;a:3:{s:5:"field";s:19:"DAS_INS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2011-12-02 00:00:00";}i:7;a:3:{s:5:"field";s:14:"DAS_INS_STATUS";s:4:"type";s:3:"int";s:5:"value";i:1;}}s:6:"action";i:4;}i:6;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:16:"DASHLET_INSTANCE";s:4:"keys";a:1:{i:0;s:11:"DAS_INS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:11:"DAS_INS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000003";}i:1;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000003";}i:2;a:3:{s:5:"field";s:18:"DAS_INS_OWNER_TYPE";s:4:"type";s:4:"text";s:5:"value";s:9:"EVERYBODY";}i:3;a:3:{s:5:"field";s:17:"DAS_INS_OWNER_UID";s:4:"type";s:4:"text";s:5:"value";s:0:"";}i:4;a:3:{s:5:"field";s:29:"DAS_INS_ADDITIONAL_PROPERTIES";s:4:"type";s:4:"text";s:5:"value";s:0:"";}i:5;a:3:{s:5:"field";s:19:"DAS_INS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2011-12-05 00:00:00";}i:6;a:3:{s:5:"field";s:19:"DAS_INS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2011-12-05 00:00:00";}i:7;a:3:{s:5:"field";s:14:"DAS_INS_STATUS";s:4:"type";s:3:"int";s:5:"value";i:1;}}s:6:"action";i:4;}i:7;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:16:"DASHLET_INSTANCE";s:4:"keys";a:1:{i:0;s:11:"DAS_INS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:11:"DAS_INS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000004";}i:1;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000004";}i:2;a:3:{s:5:"field";s:18:"DAS_INS_OWNER_TYPE";s:4:"type";s:4:"text";s:5:"value";s:9:"EVERYBODY";}i:3;a:3:{s:5:"field";s:17:"DAS_INS_OWNER_UID";s:4:"type";s:4:"text";s:5:"value";s:0:"";}i:4;a:3:{s:5:"field";s:29:"DAS_INS_ADDITIONAL_PROPERTIES";s:4:"type";s:4:"text";s:5:"value";s:143:"a:2:{s:13:"DAS_INS_TITLE";s:15:"PM Plugins News";s:7:"DAS_URL";s:71:"http://license.processmaker.com/syspmLicenseSrv/en/green/services/rssAP";}";}i:5;a:3:{s:5:"field";s:19:"DAS_INS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2012-04-16 00:00:00";}i:6;a:3:{s:5:"field";s:19:"DAS_INS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2012-04-16 00:00:00";}i:7;a:3:{s:5:"field";s:14:"DAS_INS_STATUS";s:4:"type";s:3:"int";s:5:"value";i:1;}}s:6:"action";i:4;}} \ No newline at end of file +a:4:{i:0;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:7:"DASHLET";s:4:"keys";a:1:{i:0;s:7:"DAS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000001";}i:1;a:3:{s:5:"field";s:9:"DAS_CLASS";s:4:"type";s:4:"text";s:5:"value";s:22:"dashletOpenVSCompleted";}i:2;a:3:{s:5:"field";s:9:"DAS_TITLE";s:4:"type";s:4:"text";s:5:"value";s:29:"Open Cases VS Completed Cases";}i:3;a:3:{s:5:"field";s:15:"DAS_DESCRIPTION";s:4:"type";s:4:"text";s:5:"value";s:29:"Open Cases VS Completed Cases";}i:4;a:3:{s:5:"field";s:11:"DAS_VERSION";s:4:"type";s:4:"text";s:5:"value";s:3:"1.0";}i:5;a:3:{s:5:"field";s:15:"DAS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:20:" 2011-10-28 00:00:00";}i:6;a:3:{s:5:"field";s:15:"DAS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:20:" 2011-10-28 00:00:00";}i:7;a:3:{s:5:"field";s:10:"DAS_STATUS";s:4:"type";s:3:"int";s:5:"value";i:1;}}s:6:"action";i:4;}i:1;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:7:"DASHLET";s:4:"keys";a:1:{i:0;s:7:"DAS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000002";}i:1;a:3:{s:5:"field";s:9:"DAS_CLASS";s:4:"type";s:4:"text";s:5:"value";s:28:"dashletProcessMakerCommunity";}i:2;a:3:{s:5:"field";s:9:"DAS_TITLE";s:4:"type";s:4:"text";s:5:"value";s:22:"ProcessMaker Community";}i:3;a:3:{s:5:"field";s:15:"DAS_DESCRIPTION";s:4:"type";s:4:"text";s:5:"value";s:44:"ProcessMaker Community Links and Information";}i:4;a:3:{s:5:"field";s:11:"DAS_VERSION";s:4:"type";s:4:"text";s:5:"value";s:3:"1.0";}i:5;a:3:{s:5:"field";s:15:"DAS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2011-12-01 00:00:00";}i:6;a:3:{s:5:"field";s:15:"DAS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:19:"2011-12-01 00:00:00";}i:7;a:3:{s:5:"field";s:10:"DAS_STATUS";s:4:"type";s:3:"int";s:5:"value";s:1:"1";}}s:6:"action";i:4;}i:2;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:7:"DASHLET";s:4:"keys";a:1:{i:0;s:7:"DAS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000003";}i:1;a:3:{s:5:"field";s:9:"DAS_CLASS";s:4:"type";s:4:"text";s:5:"value";s:29:"dashletProcessMakerEnterprise";}i:2;a:3:{s:5:"field";s:9:"DAS_TITLE";s:4:"type";s:4:"text";s:5:"value";s:42:"ProcessMaker Enterprise Plugins and Addons";}i:3;a:3:{s:5:"field";s:15:"DAS_DESCRIPTION";s:4:"type";s:4:"text";s:5:"value";s:147:"The following list of Enterprise plug-ins includes features and functionality that extend and enhance ProcessMaker's performance and functionality.";}i:4;a:3:{s:5:"field";s:11:"DAS_VERSION";s:4:"type";s:4:"text";s:5:"value";s:3:"1.0";}i:5;a:3:{s:5:"field";s:15:"DAS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:10:"2011-12-05";}i:6;a:3:{s:5:"field";s:15:"DAS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:10:"2011-12-05";}i:7;a:3:{s:5:"field";s:10:"DAS_STATUS";s:4:"type";s:3:"int";s:5:"value";i:1;}}s:6:"action";i:4;}i:3;a:5:{s:2:"db";s:2:"wf";s:5:"table";s:7:"DASHLET";s:4:"keys";a:1:{i:0;s:7:"DAS_UID";}s:4:"data";a:8:{i:0;a:3:{s:5:"field";s:7:"DAS_UID";s:4:"type";s:4:"text";s:5:"value";s:32:"00000000000000000000000000000004";}i:1;a:3:{s:5:"field";s:9:"DAS_CLASS";s:4:"type";s:4:"text";s:5:"value";s:16:"dashletRssReader";}i:2;a:3:{s:5:"field";s:9:"DAS_TITLE";s:4:"type";s:4:"text";s:5:"value";s:17:"Simple RSS reader";}i:3;a:3:{s:5:"field";s:15:"DAS_DESCRIPTION";s:4:"type";s:4:"text";s:5:"value";s:34:"Simple RSS reader for ProcessMaker";}i:4;a:3:{s:5:"field";s:11:"DAS_VERSION";s:4:"type";s:4:"text";s:5:"value";s:3:"1.0";}i:5;a:3:{s:5:"field";s:15:"DAS_CREATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:20:" 2012-04-16 00:00:00";}i:6;a:3:{s:5:"field";s:15:"DAS_UPDATE_DATE";s:4:"type";s:4:"date";s:5:"value";s:20:" 2012-04-16 00:00:00";}i:7;a:3:{s:5:"field";s:10:"DAS_STATUS";s:4:"type";s:3:"int";s:5:"value";i:1;}}s:6:"action";i:4;}} \ No newline at end of file From 018c963d60ba319da36129d6d1f7ac5b5aa2b477 Mon Sep 17 00:00:00 2001 From: Luis Fernando Saisa Lopez Date: Tue, 9 Dec 2014 17:25:39 -0400 Subject: [PATCH 13/30] PM 940 "ProcessMaker-MA "Email Server (endpoints)"" SOLVED > ProcessMaker-MA "Email Server (endpoints)" - Se han implementado los siguientes Endpoints: GET /api/1.0/{workspace}/email/paged?filter={filter}&start={start}&limit={limit} GET /api/1.0/{workspace}/emails?filter={filter}&start={start}&limit={limit} GET /api/1.0/{workspace}/email/{mess_uid} POST /api/1.0/{workspace}/email POST /api/1.0/{workspace}/email/test-connection PUT /api/1.0/{workspace}/email/{mess_uid} DELETE /api/1.0/{workspace}/email/{mess_uid} - Se esta creando un 1er registro en la tabla EMAIL_SERVER, esto al ejecutar el comando "./processmaker upgrade". - El metodo "System::getEmailConfiguration()" recupera el EMAIL_SERVER por default, caso contrario trabajara como lo hacia anteriormente. --- workflow/engine/bin/tasks/cliWorkspaces.php | 35 + workflow/engine/classes/class.system.php | 36 +- workflow/engine/classes/model/EmailServer.php | 5 + .../engine/classes/model/EmailServerPeer.php | 5 + .../model/map/EmailServerMapBuilder.php | 96 ++ .../classes/model/om/BaseEmailServer.php | 1206 +++++++++++++++++ .../classes/model/om/BaseEmailServerPeer.php | 627 +++++++++ workflow/engine/config/schema.xml | 28 + workflow/engine/data/mysql/schema.sql | 23 + .../BusinessModel/EmailServer.php | 1114 +++++++++++++++ .../ProcessMaker/Services/Api/EmailServer.php | 158 +++ .../engine/src/ProcessMaker/Services/api.ini | 8 +- 12 files changed, 3336 insertions(+), 5 deletions(-) create mode 100644 workflow/engine/classes/model/EmailServer.php create mode 100644 workflow/engine/classes/model/EmailServerPeer.php create mode 100644 workflow/engine/classes/model/map/EmailServerMapBuilder.php create mode 100644 workflow/engine/classes/model/om/BaseEmailServer.php create mode 100644 workflow/engine/classes/model/om/BaseEmailServerPeer.php create mode 100644 workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php create mode 100644 workflow/engine/src/ProcessMaker/Services/Api/EmailServer.php diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index 1b1bc3106..cfb4ff39d 100755 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -311,6 +311,41 @@ function database_upgrade($command, $args) { echo "> Error: ".CLI::error($e->getMessage()) . "\n"; } } + + //There records in table "EMAIL_SERVER" + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(EmailServerPeer::MESS_UID); + $criteria->setOffset(0); + $criteria->setLimit(1); + + $rsCriteria = EmailServerPeer::doSelectRS($criteria); + + if (!$rsCriteria->next()) { + //Insert the first record + $emailConfiguration = System::getEmailConfiguration(); + + if (count($emailConfiguration) > 0) { + $arrayData = array(); + + $arrayData["MESS_ENGINE"] = $emailConfiguration["MESS_ENGINE"]; + $arrayData["MESS_SERVER"] = $emailConfiguration["MESS_SERVER"]; + $arrayData["MESS_PORT"] = (int)($emailConfiguration["MESS_PORT"]); + $arrayData["MESS_RAUTH"] = (int)($emailConfiguration["MESS_RAUTH"]); + $arrayData["MESS_ACCOUNT"] = $emailConfiguration["MESS_ACCOUNT"]; + $arrayData["MESS_PASSWORD"] = $emailConfiguration["MESS_PASSWORD"]; + $arrayData["MESS_FROM_MAIL"] = $emailConfiguration["MESS_FROM_MAIL"]; + $arrayData["MESS_FROM_NAME"] = $emailConfiguration["MESS_FROM_NAME"]; + $arrayData["SMTPSECURE"] = $emailConfiguration["SMTPSecure"]; + $arrayData["MESS_TRY_SEND_INMEDIATLY"] = (int)($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]); + $arrayData["MAIL_TO"] = $emailConfiguration["MAIL_TO"]; + $arrayData["MESS_DEFAULT"] = (isset($emailConfiguration["MESS_ENABLED"]) && $emailConfiguration["MESS_ENABLED"] . "" == "1")? 1 : 0; + + $emailSever = new ProcessMaker\BusinessModel\EmailServer(); + + $emailSever->create($arrayData); + } + } } function delete_app_from_table($con, $tableName, $appUid, $col="APP_UID") { diff --git a/workflow/engine/classes/class.system.php b/workflow/engine/classes/class.system.php index 4df172100..9306710ec 100755 --- a/workflow/engine/classes/class.system.php +++ b/workflow/engine/classes/class.system.php @@ -968,11 +968,39 @@ class System public function getEmailConfiguration () { - G::LoadClass( 'configuration' ); - $conf = new Configurations(); - $config = $conf->load( 'Emails' ); + $emailServer = new ProcessMaker\BusinessModel\EmailServer(); - return $config; + $arrayEmailServerDefault = $emailServer->getEmailServerDefault(); + + if (count($arrayEmailServerDefault) > 0) { + //Return + return $arrayDataEmailServerConfig = array( + "MESS_ENGINE" => $arrayEmailServerDefault["MESS_ENGINE"], + "MESS_SERVER" => $arrayEmailServerDefault["MESS_SERVER"], + "MESS_PORT" => (int)($arrayEmailServerDefault["MESS_PORT"]), + "MESS_RAUTH" => (int)($arrayEmailServerDefault["MESS_RAUTH"]), + "MESS_ACCOUNT" => $arrayEmailServerDefault["MESS_ACCOUNT"], + "MESS_PASSWORD" => $arrayEmailServerDefault["MESS_PASSWORD"], + "MESS_FROM_MAIL" => $arrayEmailServerDefault["MESS_FROM_MAIL"], + "MESS_FROM_NAME" => $arrayEmailServerDefault["MESS_FROM_NAME"], + "SMTPSecure" => $arrayEmailServerDefault["SMTPSECURE"], + "MESS_TRY_SEND_INMEDIATLY" => (int)($arrayEmailServerDefault["MESS_TRY_SEND_INMEDIATLY"]), + "MAIL_TO" => $arrayEmailServerDefault["MAIL_TO"], + "MESS_DEFAULT" => (int)($arrayEmailServerDefault["MESS_DEFAULT"]), + "MESS_ENABLED" => 1, + "MESS_BACKGROUND" => "", + "MESS_PASSWORD_HIDDEN" => "", + "MESS_EXECUTE_EVERY" => "", + "MESS_SEND_MAX" => "" + ); + } else { + G::LoadClass("configuration"); + + $conf = new Configurations(); + $config = $conf->load("Emails"); + + return $config; + } } public function getSkingList () diff --git a/workflow/engine/classes/model/EmailServer.php b/workflow/engine/classes/model/EmailServer.php new file mode 100644 index 000000000..f961d4f1a --- /dev/null +++ b/workflow/engine/classes/model/EmailServer.php @@ -0,0 +1,5 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('EMAIL_SERVER'); + $tMap->setPhpName('EmailServer'); + + $tMap->setUseIdGenerator(false); + + $tMap->addPrimaryKey('MESS_UID', 'MessUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('MESS_ENGINE', 'MessEngine', 'string', CreoleTypes::VARCHAR, true, 256); + + $tMap->addColumn('MESS_SERVER', 'MessServer', 'string', CreoleTypes::VARCHAR, true, 256); + + $tMap->addColumn('MESS_PORT', 'MessPort', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addColumn('MESS_RAUTH', 'MessRauth', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addColumn('MESS_ACCOUNT', 'MessAccount', 'string', CreoleTypes::VARCHAR, true, 256); + + $tMap->addColumn('MESS_PASSWORD', 'MessPassword', 'string', CreoleTypes::VARCHAR, true, 256); + + $tMap->addColumn('MESS_FROM_MAIL', 'MessFromMail', 'string', CreoleTypes::VARCHAR, true, 256); + + $tMap->addColumn('MESS_FROM_NAME', 'MessFromName', 'string', CreoleTypes::VARCHAR, true, 256); + + $tMap->addColumn('SMTPSECURE', 'Smtpsecure', 'string', CreoleTypes::VARCHAR, true, 3); + + $tMap->addColumn('MESS_TRY_SEND_INMEDIATLY', 'MessTrySendInmediatly', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addColumn('MAIL_TO', 'MailTo', 'string', CreoleTypes::VARCHAR, true, 256); + + $tMap->addColumn('MESS_DEFAULT', 'MessDefault', 'int', CreoleTypes::INTEGER, true, null); + + } // doBuild() + +} // EmailServerMapBuilder diff --git a/workflow/engine/classes/model/om/BaseEmailServer.php b/workflow/engine/classes/model/om/BaseEmailServer.php new file mode 100644 index 000000000..4239ebbd0 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseEmailServer.php @@ -0,0 +1,1206 @@ +mess_uid; + } + + /** + * Get the [mess_engine] column value. + * + * @return string + */ + public function getMessEngine() + { + + return $this->mess_engine; + } + + /** + * Get the [mess_server] column value. + * + * @return string + */ + public function getMessServer() + { + + return $this->mess_server; + } + + /** + * Get the [mess_port] column value. + * + * @return int + */ + public function getMessPort() + { + + return $this->mess_port; + } + + /** + * Get the [mess_rauth] column value. + * + * @return int + */ + public function getMessRauth() + { + + return $this->mess_rauth; + } + + /** + * Get the [mess_account] column value. + * + * @return string + */ + public function getMessAccount() + { + + return $this->mess_account; + } + + /** + * Get the [mess_password] column value. + * + * @return string + */ + public function getMessPassword() + { + + return $this->mess_password; + } + + /** + * Get the [mess_from_mail] column value. + * + * @return string + */ + public function getMessFromMail() + { + + return $this->mess_from_mail; + } + + /** + * Get the [mess_from_name] column value. + * + * @return string + */ + public function getMessFromName() + { + + return $this->mess_from_name; + } + + /** + * Get the [smtpsecure] column value. + * + * @return string + */ + public function getSmtpsecure() + { + + return $this->smtpsecure; + } + + /** + * Get the [mess_try_send_inmediatly] column value. + * + * @return int + */ + public function getMessTrySendInmediatly() + { + + return $this->mess_try_send_inmediatly; + } + + /** + * Get the [mail_to] column value. + * + * @return string + */ + public function getMailTo() + { + + return $this->mail_to; + } + + /** + * Get the [mess_default] column value. + * + * @return int + */ + public function getMessDefault() + { + + return $this->mess_default; + } + + /** + * Set the value of [mess_uid] column. + * + * @param string $v new value + * @return void + */ + public function setMessUid($v) + { + + // 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->mess_uid !== $v || $v === '') { + $this->mess_uid = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_UID; + } + + } // setMessUid() + + /** + * Set the value of [mess_engine] column. + * + * @param string $v new value + * @return void + */ + public function setMessEngine($v) + { + + // 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->mess_engine !== $v || $v === '') { + $this->mess_engine = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_ENGINE; + } + + } // setMessEngine() + + /** + * Set the value of [mess_server] column. + * + * @param string $v new value + * @return void + */ + public function setMessServer($v) + { + + // 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->mess_server !== $v || $v === '') { + $this->mess_server = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_SERVER; + } + + } // setMessServer() + + /** + * Set the value of [mess_port] column. + * + * @param int $v new value + * @return void + */ + public function setMessPort($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->mess_port !== $v || $v === 0) { + $this->mess_port = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_PORT; + } + + } // setMessPort() + + /** + * Set the value of [mess_rauth] column. + * + * @param int $v new value + * @return void + */ + public function setMessRauth($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->mess_rauth !== $v || $v === 0) { + $this->mess_rauth = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_RAUTH; + } + + } // setMessRauth() + + /** + * Set the value of [mess_account] column. + * + * @param string $v new value + * @return void + */ + public function setMessAccount($v) + { + + // 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->mess_account !== $v || $v === '') { + $this->mess_account = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_ACCOUNT; + } + + } // setMessAccount() + + /** + * Set the value of [mess_password] column. + * + * @param string $v new value + * @return void + */ + public function setMessPassword($v) + { + + // 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->mess_password !== $v || $v === '') { + $this->mess_password = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_PASSWORD; + } + + } // setMessPassword() + + /** + * Set the value of [mess_from_mail] column. + * + * @param string $v new value + * @return void + */ + public function setMessFromMail($v) + { + + // 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->mess_from_mail !== $v || $v === '') { + $this->mess_from_mail = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_FROM_MAIL; + } + + } // setMessFromMail() + + /** + * Set the value of [mess_from_name] column. + * + * @param string $v new value + * @return void + */ + public function setMessFromName($v) + { + + // 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->mess_from_name !== $v || $v === '') { + $this->mess_from_name = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_FROM_NAME; + } + + } // setMessFromName() + + /** + * Set the value of [smtpsecure] column. + * + * @param string $v new value + * @return void + */ + public function setSmtpsecure($v) + { + + // 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->smtpsecure !== $v || $v === '') { + $this->smtpsecure = $v; + $this->modifiedColumns[] = EmailServerPeer::SMTPSECURE; + } + + } // setSmtpsecure() + + /** + * Set the value of [mess_try_send_inmediatly] column. + * + * @param int $v new value + * @return void + */ + public function setMessTrySendInmediatly($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->mess_try_send_inmediatly !== $v || $v === 0) { + $this->mess_try_send_inmediatly = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_TRY_SEND_INMEDIATLY; + } + + } // setMessTrySendInmediatly() + + /** + * Set the value of [mail_to] column. + * + * @param string $v new value + * @return void + */ + public function setMailTo($v) + { + + // 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->mail_to !== $v || $v === '') { + $this->mail_to = $v; + $this->modifiedColumns[] = EmailServerPeer::MAIL_TO; + } + + } // setMailTo() + + /** + * Set the value of [mess_default] column. + * + * @param int $v new value + * @return void + */ + public function setMessDefault($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->mess_default !== $v || $v === 0) { + $this->mess_default = $v; + $this->modifiedColumns[] = EmailServerPeer::MESS_DEFAULT; + } + + } // setMessDefault() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->mess_uid = $rs->getString($startcol + 0); + + $this->mess_engine = $rs->getString($startcol + 1); + + $this->mess_server = $rs->getString($startcol + 2); + + $this->mess_port = $rs->getInt($startcol + 3); + + $this->mess_rauth = $rs->getInt($startcol + 4); + + $this->mess_account = $rs->getString($startcol + 5); + + $this->mess_password = $rs->getString($startcol + 6); + + $this->mess_from_mail = $rs->getString($startcol + 7); + + $this->mess_from_name = $rs->getString($startcol + 8); + + $this->smtpsecure = $rs->getString($startcol + 9); + + $this->mess_try_send_inmediatly = $rs->getInt($startcol + 10); + + $this->mail_to = $rs->getString($startcol + 11); + + $this->mess_default = $rs->getInt($startcol + 12); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 13; // 13 = EmailServerPeer::NUM_COLUMNS - EmailServerPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating EmailServer object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(EmailServerPeer::DATABASE_NAME); + } + + try { + $con->begin(); + EmailServerPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(EmailServerPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = EmailServerPeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += EmailServerPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = EmailServerPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = EmailServerPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getMessUid(); + break; + case 1: + return $this->getMessEngine(); + break; + case 2: + return $this->getMessServer(); + break; + case 3: + return $this->getMessPort(); + break; + case 4: + return $this->getMessRauth(); + break; + case 5: + return $this->getMessAccount(); + break; + case 6: + return $this->getMessPassword(); + break; + case 7: + return $this->getMessFromMail(); + break; + case 8: + return $this->getMessFromName(); + break; + case 9: + return $this->getSmtpsecure(); + break; + case 10: + return $this->getMessTrySendInmediatly(); + break; + case 11: + return $this->getMailTo(); + break; + case 12: + return $this->getMessDefault(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = EmailServerPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getMessUid(), + $keys[1] => $this->getMessEngine(), + $keys[2] => $this->getMessServer(), + $keys[3] => $this->getMessPort(), + $keys[4] => $this->getMessRauth(), + $keys[5] => $this->getMessAccount(), + $keys[6] => $this->getMessPassword(), + $keys[7] => $this->getMessFromMail(), + $keys[8] => $this->getMessFromName(), + $keys[9] => $this->getSmtpsecure(), + $keys[10] => $this->getMessTrySendInmediatly(), + $keys[11] => $this->getMailTo(), + $keys[12] => $this->getMessDefault(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = EmailServerPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setMessUid($value); + break; + case 1: + $this->setMessEngine($value); + break; + case 2: + $this->setMessServer($value); + break; + case 3: + $this->setMessPort($value); + break; + case 4: + $this->setMessRauth($value); + break; + case 5: + $this->setMessAccount($value); + break; + case 6: + $this->setMessPassword($value); + break; + case 7: + $this->setMessFromMail($value); + break; + case 8: + $this->setMessFromName($value); + break; + case 9: + $this->setSmtpsecure($value); + break; + case 10: + $this->setMessTrySendInmediatly($value); + break; + case 11: + $this->setMailTo($value); + break; + case 12: + $this->setMessDefault($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = EmailServerPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setMessUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setMessEngine($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setMessServer($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setMessPort($arr[$keys[3]]); + } + + if (array_key_exists($keys[4], $arr)) { + $this->setMessRauth($arr[$keys[4]]); + } + + if (array_key_exists($keys[5], $arr)) { + $this->setMessAccount($arr[$keys[5]]); + } + + if (array_key_exists($keys[6], $arr)) { + $this->setMessPassword($arr[$keys[6]]); + } + + if (array_key_exists($keys[7], $arr)) { + $this->setMessFromMail($arr[$keys[7]]); + } + + if (array_key_exists($keys[8], $arr)) { + $this->setMessFromName($arr[$keys[8]]); + } + + if (array_key_exists($keys[9], $arr)) { + $this->setSmtpsecure($arr[$keys[9]]); + } + + if (array_key_exists($keys[10], $arr)) { + $this->setMessTrySendInmediatly($arr[$keys[10]]); + } + + if (array_key_exists($keys[11], $arr)) { + $this->setMailTo($arr[$keys[11]]); + } + + if (array_key_exists($keys[12], $arr)) { + $this->setMessDefault($arr[$keys[12]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(EmailServerPeer::DATABASE_NAME); + + if ($this->isColumnModified(EmailServerPeer::MESS_UID)) { + $criteria->add(EmailServerPeer::MESS_UID, $this->mess_uid); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_ENGINE)) { + $criteria->add(EmailServerPeer::MESS_ENGINE, $this->mess_engine); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_SERVER)) { + $criteria->add(EmailServerPeer::MESS_SERVER, $this->mess_server); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_PORT)) { + $criteria->add(EmailServerPeer::MESS_PORT, $this->mess_port); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_RAUTH)) { + $criteria->add(EmailServerPeer::MESS_RAUTH, $this->mess_rauth); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_ACCOUNT)) { + $criteria->add(EmailServerPeer::MESS_ACCOUNT, $this->mess_account); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_PASSWORD)) { + $criteria->add(EmailServerPeer::MESS_PASSWORD, $this->mess_password); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_FROM_MAIL)) { + $criteria->add(EmailServerPeer::MESS_FROM_MAIL, $this->mess_from_mail); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_FROM_NAME)) { + $criteria->add(EmailServerPeer::MESS_FROM_NAME, $this->mess_from_name); + } + + if ($this->isColumnModified(EmailServerPeer::SMTPSECURE)) { + $criteria->add(EmailServerPeer::SMTPSECURE, $this->smtpsecure); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_TRY_SEND_INMEDIATLY)) { + $criteria->add(EmailServerPeer::MESS_TRY_SEND_INMEDIATLY, $this->mess_try_send_inmediatly); + } + + if ($this->isColumnModified(EmailServerPeer::MAIL_TO)) { + $criteria->add(EmailServerPeer::MAIL_TO, $this->mail_to); + } + + if ($this->isColumnModified(EmailServerPeer::MESS_DEFAULT)) { + $criteria->add(EmailServerPeer::MESS_DEFAULT, $this->mess_default); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(EmailServerPeer::DATABASE_NAME); + + $criteria->add(EmailServerPeer::MESS_UID, $this->mess_uid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getMessUid(); + } + + /** + * Generic method to set the primary key (mess_uid column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setMessUid($key); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of EmailServer (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setMessEngine($this->mess_engine); + + $copyObj->setMessServer($this->mess_server); + + $copyObj->setMessPort($this->mess_port); + + $copyObj->setMessRauth($this->mess_rauth); + + $copyObj->setMessAccount($this->mess_account); + + $copyObj->setMessPassword($this->mess_password); + + $copyObj->setMessFromMail($this->mess_from_mail); + + $copyObj->setMessFromName($this->mess_from_name); + + $copyObj->setSmtpsecure($this->smtpsecure); + + $copyObj->setMessTrySendInmediatly($this->mess_try_send_inmediatly); + + $copyObj->setMailTo($this->mail_to); + + $copyObj->setMessDefault($this->mess_default); + + + $copyObj->setNew(true); + + $copyObj->setMessUid(''); // this is a pkey column, so set to default value + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return EmailServer Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return EmailServerPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new EmailServerPeer(); + } + return self::$peer; + } +} + diff --git a/workflow/engine/classes/model/om/BaseEmailServerPeer.php b/workflow/engine/classes/model/om/BaseEmailServerPeer.php new file mode 100644 index 000000000..c78d96808 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseEmailServerPeer.php @@ -0,0 +1,627 @@ + array ('MessUid', 'MessEngine', 'MessServer', 'MessPort', 'MessRauth', 'MessAccount', 'MessPassword', 'MessFromMail', 'MessFromName', 'Smtpsecure', 'MessTrySendInmediatly', 'MailTo', 'MessDefault', ), + BasePeer::TYPE_COLNAME => array (EmailServerPeer::MESS_UID, EmailServerPeer::MESS_ENGINE, EmailServerPeer::MESS_SERVER, EmailServerPeer::MESS_PORT, EmailServerPeer::MESS_RAUTH, EmailServerPeer::MESS_ACCOUNT, EmailServerPeer::MESS_PASSWORD, EmailServerPeer::MESS_FROM_MAIL, EmailServerPeer::MESS_FROM_NAME, EmailServerPeer::SMTPSECURE, EmailServerPeer::MESS_TRY_SEND_INMEDIATLY, EmailServerPeer::MAIL_TO, EmailServerPeer::MESS_DEFAULT, ), + BasePeer::TYPE_FIELDNAME => array ('MESS_UID', 'MESS_ENGINE', 'MESS_SERVER', 'MESS_PORT', 'MESS_RAUTH', 'MESS_ACCOUNT', 'MESS_PASSWORD', 'MESS_FROM_MAIL', 'MESS_FROM_NAME', 'SMTPSECURE', 'MESS_TRY_SEND_INMEDIATLY', 'MAIL_TO', 'MESS_DEFAULT', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('MessUid' => 0, 'MessEngine' => 1, 'MessServer' => 2, 'MessPort' => 3, 'MessRauth' => 4, 'MessAccount' => 5, 'MessPassword' => 6, 'MessFromMail' => 7, 'MessFromName' => 8, 'Smtpsecure' => 9, 'MessTrySendInmediatly' => 10, 'MailTo' => 11, 'MessDefault' => 12, ), + BasePeer::TYPE_COLNAME => array (EmailServerPeer::MESS_UID => 0, EmailServerPeer::MESS_ENGINE => 1, EmailServerPeer::MESS_SERVER => 2, EmailServerPeer::MESS_PORT => 3, EmailServerPeer::MESS_RAUTH => 4, EmailServerPeer::MESS_ACCOUNT => 5, EmailServerPeer::MESS_PASSWORD => 6, EmailServerPeer::MESS_FROM_MAIL => 7, EmailServerPeer::MESS_FROM_NAME => 8, EmailServerPeer::SMTPSECURE => 9, EmailServerPeer::MESS_TRY_SEND_INMEDIATLY => 10, EmailServerPeer::MAIL_TO => 11, EmailServerPeer::MESS_DEFAULT => 12, ), + BasePeer::TYPE_FIELDNAME => array ('MESS_UID' => 0, 'MESS_ENGINE' => 1, 'MESS_SERVER' => 2, 'MESS_PORT' => 3, 'MESS_RAUTH' => 4, 'MESS_ACCOUNT' => 5, 'MESS_PASSWORD' => 6, 'MESS_FROM_MAIL' => 7, 'MESS_FROM_NAME' => 8, 'SMTPSECURE' => 9, 'MESS_TRY_SEND_INMEDIATLY' => 10, 'MAIL_TO' => 11, 'MESS_DEFAULT' => 12, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/EmailServerMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.EmailServerMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = EmailServerPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. EmailServerPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(EmailServerPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(EmailServerPeer::MESS_UID); + + $criteria->addSelectColumn(EmailServerPeer::MESS_ENGINE); + + $criteria->addSelectColumn(EmailServerPeer::MESS_SERVER); + + $criteria->addSelectColumn(EmailServerPeer::MESS_PORT); + + $criteria->addSelectColumn(EmailServerPeer::MESS_RAUTH); + + $criteria->addSelectColumn(EmailServerPeer::MESS_ACCOUNT); + + $criteria->addSelectColumn(EmailServerPeer::MESS_PASSWORD); + + $criteria->addSelectColumn(EmailServerPeer::MESS_FROM_MAIL); + + $criteria->addSelectColumn(EmailServerPeer::MESS_FROM_NAME); + + $criteria->addSelectColumn(EmailServerPeer::SMTPSECURE); + + $criteria->addSelectColumn(EmailServerPeer::MESS_TRY_SEND_INMEDIATLY); + + $criteria->addSelectColumn(EmailServerPeer::MAIL_TO); + + $criteria->addSelectColumn(EmailServerPeer::MESS_DEFAULT); + + } + + const COUNT = 'COUNT(EMAIL_SERVER.MESS_UID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT EMAIL_SERVER.MESS_UID)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(EmailServerPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(EmailServerPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = EmailServerPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return EmailServer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = EmailServerPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return EmailServerPeer::populateObjects(EmailServerPeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + EmailServerPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = EmailServerPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return EmailServerPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a EmailServer or Criteria object. + * + * @param mixed $values Criteria or EmailServer object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from EmailServer object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a EmailServer or Criteria object. + * + * @param mixed $values Criteria or EmailServer object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(EmailServerPeer::MESS_UID); + $selectCriteria->add(EmailServerPeer::MESS_UID, $criteria->remove(EmailServerPeer::MESS_UID), $comparison); + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the EMAIL_SERVER table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(EmailServerPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a EmailServer or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or EmailServer object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(EmailServerPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof EmailServer) { + + $criteria = $values->buildPkeyCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(EmailServerPeer::MESS_UID, (array) $values, Criteria::IN); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given EmailServer object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param EmailServer $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(EmailServer $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(EmailServerPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(EmailServerPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(EmailServerPeer::DATABASE_NAME, EmailServerPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param mixed $pk the primary key. + * @param Connection $con the connection to use + * @return EmailServer + */ + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(EmailServerPeer::DATABASE_NAME); + + $criteria->add(EmailServerPeer::MESS_UID, $pk); + + + $v = EmailServerPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(EmailServerPeer::MESS_UID, $pks, Criteria::IN); + $objs = EmailServerPeer::doSelect($criteria, $con); + } + return $objs; + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseEmailServerPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/EmailServerMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.EmailServerMapBuilder'); +} + diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index c19f8ba8d..5e5a94a26 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4176,5 +4176,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 96f6c3314..bad2c1239 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2383,3 +2383,26 @@ CREATE TABLE `LIST_UNASSIGNED_GROUP` # This restores the fkey checks, after having unset them earlier SET FOREIGN_KEY_CHECKS = 1; +#----------------------------------------------------------------------------- +#-- TABLE: EMAIL_SERVER +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `EMAIL_SERVER`; +CREATE TABLE `EMAIL_SERVER` +( + `MESS_UID` VARCHAR(32) default '' NOT NULL, + `MESS_ENGINE` VARCHAR(256) default '' NOT NULL, + `MESS_SERVER` VARCHAR(256) default '' NOT NULL, + `MESS_PORT` INTEGER default 0 NOT NULL, + `MESS_RAUTH` INTEGER default 0 NOT NULL, + `MESS_ACCOUNT` VARCHAR(256) default '' NOT NULL, + `MESS_PASSWORD` VARCHAR(256) default '' NOT NULL, + `MESS_FROM_MAIL` VARCHAR(256) default '' NOT NULL, + `MESS_FROM_NAME` VARCHAR(256) default '' NOT NULL, + `SMTPSECURE` VARCHAR(3) default 'NO' NOT NULL, + `MESS_TRY_SEND_INMEDIATLY` INTEGER default 0 NOT NULL, + `MAIL_TO` VARCHAR(256) default '' NOT NULL, + `MESS_DEFAULT` INTEGER default 0 NOT NULL, + PRIMARY KEY (`MESS_UID`) +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; + diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php new file mode 100644 index 000000000..0a6689359 --- /dev/null +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php @@ -0,0 +1,1114 @@ + array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "emailServerUid"), + + "MESS_ENGINE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("PHPMAILER", "MAIL"), "fieldNameAux" => "emailServerEngine"), + "MESS_SERVER" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerServer"), + "MESS_PORT" => array("type" => "int", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerPort"), + + "MESS_RAUTH" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "emailServerRauth"), + + "MESS_ACCOUNT" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerUserName"), + "MESS_PASSWORD" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerPassword"), + "MESS_FROM_MAIL" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerFromMail"), + "MESS_FROM_NAME" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerFromName"), + "SMTPSECURE" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array("No", "tls", "ssl"), "fieldNameAux" => "emailServerSecureConnection"), + + "MESS_TRY_SEND_INMEDIATLY" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "emailServerSendTestMail"), + + "MAIL_TO" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerMailTo"), + "MESS_DEFAULT" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "emailServerDefault") + ); + + private $formatFieldNameInUppercase = true; + + private $arrayFieldNameForException = array( + "start" => "START", + "limit" => "LIMIT" + ); + + /** + * Constructor of the class + * + * return void + */ + public function __construct() + { + try { + foreach ($this->arrayFieldDefinition as $key => $value) { + $this->arrayFieldNameForException[$value["fieldNameAux"]] = $key; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set the format of the fields name (uppercase, lowercase) + * + * @param bool $flag Value that set the format + * + * return void + */ + public function setFormatFieldNameInUppercase($flag) + { + try { + $this->formatFieldNameInUppercase = $flag; + + $this->setArrayFieldNameForException($this->arrayFieldNameForException); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set exception messages for fields + * + * @param array $arrayData Data with the fields + * + * return void + */ + public function setArrayFieldNameForException(array $arrayData) + { + try { + foreach ($arrayData as $key => $value) { + $this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get the name of the field according to the format + * + * @param string $fieldName Field name + * + * return string Return the field name according the format + */ + public function getFieldNameByFormatFieldName($fieldName) + { + try { + return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Send a test email + * + * @param array $arrayData Data + * + * return array Return array with result of send test mail + */ + public function sendTestMail(array $arrayData) + { + try { + \G::LoadClass("system"); + \G::LoadClass("spool"); + + $aConfiguration = array( + "MESS_ENGINE" => $arrayData["MESS_ENGINE"], + "MESS_SERVER" => $arrayData["MESS_SERVER"], + "MESS_PORT" => (int)($arrayData["MESS_PORT"]), + "MESS_ACCOUNT" => $arrayData["MESS_ACCOUNT"], + "MESS_PASSWORD" => $arrayData["MESS_PASSWORD"], + "MESS_FROM_NAME" => $arrayData["FROM_NAME"], + "MESS_FROM_MAIL" => $arrayData["FROM_EMAIL"], + "MESS_RAUTH" => (int)($arrayData["MESS_RAUTH"]), + "SMTPSecure" => (isset($arrayData["SMTPSecure"]))? $arrayData["SMTPSecure"] : "none" + ); + + $sFrom = \G::buildFrom($aConfiguration); + + $sSubject = \G::LoadTranslation("ID_MESS_TEST_SUBJECT"); + $msg = \G::LoadTranslation("ID_MESS_TEST_BODY"); + + switch ($arrayData["MESS_ENGINE"]) { + case "MAIL": + $engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_1"); + break; + case "PHPMAILER": + $engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_2"); + break; + case "OPENMAIL": + $engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_3"); + break; + } + + $sBodyPre = new \TemplatePower(PATH_TPL . "admin" . PATH_SEP . "email.tpl"); + + $sBodyPre->prepare(); + $sBodyPre->assign("server", $_SERVER["SERVER_NAME"]); + $sBodyPre->assign("date", date("H:i:s")); + $sBodyPre->assign("ver", \System::getVersion()); + $sBodyPre->assign("engine", $engine); + $sBodyPre->assign("msg", $msg); + $sBody = $sBodyPre->getOutputContent(); + + $oSpool = new \spoolRun(); + + $oSpool->setConfig($aConfiguration); + + $oSpool->create( + array( + "msg_uid" => "", + "app_uid" => "", + "del_index" => 0, + "app_msg_type" => "TEST", + "app_msg_subject" => $sSubject, + "app_msg_from" => $sFrom, + "app_msg_to" => $arrayData["TO"], + "app_msg_body" => $sBody, + "app_msg_cc" => "", + "app_msg_bcc" => "", + "app_msg_attach" => "", + "app_msg_template" => "", + "app_msg_status" => "pending", + "app_msg_attach" => "" + ) + ); + + $oSpool->sendMail(); + + //Return + $arrayTestMailResult = array(); + + if ($oSpool->status == "sent") { + $arrayTestMailResult["status"] = true; + $arrayTestMailResult["success"] = true; + $arrayTestMailResult["msg"] = \G::LoadTranslation("ID_MAIL_TEST_SUCCESS"); + } else { + $arrayTestMailResult["status"] = false; + $arrayTestMailResult["success"] = false; + $arrayTestMailResult["msg"] = $oSpool->error; + } + + return $arrayTestMailResult; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Test connection by step + * + * @param array $arrayData Data + * @param int $step Step + * + * return array Return array with result of test connection by step + */ + public function testConnectionByStep(array $arrayData, $step = 0) + { + try { + \G::LoadClass("net"); + \G::LoadThirdParty("phpmailer", "class.smtp"); + + //MAIL + if ($arrayData["MESS_ENGINE"] == "MAIL") { + + $arrayDataMail = array(); + + $eregMail = "/^[0-9a-zA-Z]+(?:[._][0-9a-zA-Z]+)*@[0-9a-zA-Z]+(?:[._-][0-9a-zA-Z]+)*\.[0-9a-zA-Z]{2,3}$/"; + + $arrayDataMail["FROM_EMAIL"] = ($arrayData["MESS_FROM_MAIL"] != "" && preg_match($eregMail, $arrayData["MESS_FROM_MAIL"]))? $arrayData["MESS_FROM_MAIL"] : ""; + $arrayDataMail["FROM_NAME"] = ($arrayData["MESS_FROM_NAME"] != "")? $arrayData["MESS_FROM_NAME"] : \G::LoadTranslation("ID_MESS_TEST_BODY"); + $arrayDataMail["MESS_ENGINE"] = "MAIL"; + $arrayDataMail["MESS_SERVER"] = "localhost"; + $arrayDataMail["MESS_PORT"] = 25; + $arrayDataMail["MESS_ACCOUNT"] = $arrayData["MAIL_TO"]; + $arrayDataMail["MESS_PASSWORD"] = ""; + $arrayDataMail["TO"] = $arrayData["MAIL_TO"]; + $arrayDataMail["MESS_RAUTH"] = true; + + $arrayTestMailResult = array(); + + try { + $arrayTestMailResult = $this->sendTestMail($arrayDataMail); + } catch (Exception $error) { + $arrayTestMailResult["status"] = false; + $arrayTestMailResult["message"] = $e->getMessage(); + + } + + $arrayResult = array( + "result" => $arrayTestMailResult["status"], + "message" => "" + ); + + if ($arrayTestMailResult["status"] == false) { + $arrayResult["message"] = \G::LoadTranslation("ID_SENDMAIL_NOT_INSTALLED"); + } + + //Return + return $arrayResult; + } + + //PHPMAILER + $server = $arrayData["MESS_SERVER"]; + $user = $arrayData["MESS_ACCOUNT"]; + $passwd = $arrayData["MESS_PASSWORD"]; + $fromMail = $arrayData["MESS_FROM_MAIL"]; + $passwdHide = $arrayData["MESS_PASSWORD"]; + + if (trim($passwdHide) != "") { + $passwd = $passwdHide; + $passwdHide = ""; + } + + $passwdDec = \G::decrypt($passwd,"EMAILENCRYPT"); + $auxPass = explode("hash:", $passwdDec); + + if (count($auxPass) > 1) { + if (count($auxPass) == 2) { + $passwd = $auxPass[1]; + } else { + array_shift($auxPass); + $passwd = implode("", $auxPass); + } + } + + $arrayData["MESS_PASSWORD"] = $passwd; + + $port = (int)($arrayData["MESS_PORT"]); + $auth_required = (int)($arrayData["MESS_RAUTH"]); + $useSecureCon = $arrayData["SMTPSECURE"]; + $sendTestMail = (int)($arrayData["MESS_TRY_SEND_INMEDIATLY"]); + $mailTo = $arrayData["MAIL_TO"]; + $smtpSecure = $arrayData["SMTPSECURE"]; + + $serverNet = new \NET($server); + $smtp = new \SMTP(); + + $timeout = 10; + $hostinfo = array(); + $srv = $arrayData["MESS_SERVER"]; + + $arrayResult = array(); + + switch ($step) { + case 1: + $arrayResult["result"] = $serverNet->getErrno() == 0; + $arrayResult["message"] = $serverNet->error; + break; + case 2: + $serverNet->scannPort($port); + + $arrayResult["result"] = $serverNet->getErrno() == 0; + $arrayResult["message"] = $serverNet->error; + break; + case 3: + //Try to connect to host + if (preg_match("/^(.+):([0-9]+)$/", $srv, $hostinfo)) { + $server = $hostinfo[1]; + $port = $hostinfo[2]; + } else { + $host = $srv; + } + + $tls = (strtoupper($smtpSecure) == "tls"); + $ssl = (strtoupper($smtpSecure) == "ssl"); + + $arrayResult["result"] = $smtp->Connect(($ssl ? "ssl://" : "") . $server, $port, $timeout); + $arrayResult["message"] = $serverNet->error; + break; + case 4: + //Try login to host + if ($auth_required == 1) { + try { + if (preg_match("/^(.+):([0-9]+)$/", $srv, $hostinfo)) { + $server = $hostinfo[1]; + $port = $hostinfo[2]; + } else { + $server = $srv; + } + if (strtoupper($useSecureCon)=="TLS") { + $tls = "tls"; + } + + if (strtoupper($useSecureCon)=="SSL") { + $tls = "ssl"; + } + + $tls = (strtoupper($useSecureCon) == "tls"); + $ssl = (strtoupper($useSecureCon) == "ssl"); + + $server = $arrayData["MESS_SERVER"]; + + if (strtoupper($useSecureCon) == "SSL") { + $resp = $smtp->Connect(("ssl://") . $server, $port, $timeout); + } else { + $resp = $smtp->Connect($server, $port, $timeout); + } + + if ($resp) { + $hello = $_SERVER["SERVER_NAME"]; + $smtp->Hello($hello); + + if (strtoupper($useSecureCon) == "TLS") { + $smtp->Hello($hello); + } + + if ($smtp->Authenticate($user, $passwd) ) { + $arrayResult["result"] = true; + } else { + if (strtoupper($useSecureCon) == "TLS") { + $arrayResult["result"] = true; + } else { + $arrayResult["result"] = false; + $smtpError = $smtp->getError(); + $arrayResult["message"] = $smtpError["error"]; + } + } + } else { + $arrayResult["result"] = false; + $smtpError = $smtp->getError(); + $arrayResult["message"] = $smtpError["error"]; + } + } catch (Exception $e) { + $arrayResult["result"] = false; + $arrayResult["message"] = $e->getMessage(); + } + } else { + $arrayResult["result"] = true; + $arrayResult["message"] = "No authentication required!"; + } + break; + case 5: + if ($sendTestMail == 1) { + try { + $arrayDataPhpMailer = array(); + + $eregMail = "/^[0-9a-zA-Z]+(?:[._][0-9a-zA-Z]+)*@[0-9a-zA-Z]+(?:[._-][0-9a-zA-Z]+)*\.[0-9a-zA-Z]{2,3}$/"; + + $arrayDataPhpMailer["FROM_EMAIL"] = ($fromMail != "" && preg_match($eregMail, $fromMail))? $fromMail : ""; + $arrayDataPhpMailer["FROM_NAME"] = $arrayData["MESS_FROM_NAME"] != "" ? $arrayData["MESS_FROM_NAME"] : \G::LoadTranslation("ID_MESS_TEST_BODY"); + $arrayDataPhpMailer["MESS_ENGINE"] = "PHPMAILER"; + $arrayDataPhpMailer["MESS_SERVER"] = $server; + $arrayDataPhpMailer["MESS_PORT"] = $port; + $arrayDataPhpMailer["MESS_ACCOUNT"] = $user; + $arrayDataPhpMailer["MESS_PASSWORD"] = $passwd; + $arrayDataPhpMailer["TO"] = $mailTo; + + if ($auth_required == 1) { + $arrayDataPhpMailer["MESS_RAUTH"] = true; + } else { + $arrayDataPhpMailer["MESS_RAUTH"] = false; + } + if (strtolower($arrayData["SMTPSECURE"]) != "no") { + $arrayDataPhpMailer["SMTPSecure"] = $arrayData["SMTPSECURE"]; + } + + $arrayTestMailResult = $this->sendTestMail($arrayDataPhpMailer); + + if ($arrayTestMailResult["status"] . "" == "1") { + $arrayResult["result"] = true; + } else { + $arrayResult["result"] = false; + $smtpError = $smtp->getError(); + $arrayResult["message"] = $smtpError["error"]; + } + } catch (Exception $e) { + $arrayResult["result"] = false; + $arrayResult["message"] = $e->getMessage(); + } + } else { + $arrayResult["result"] = true; + $arrayResult["message"] = "Jump this step"; + } + break; + } + + if (!isset($arrayResult["message"])) { + $arrayResult["message"] = ""; + } + + //Return + return $arrayResult; + } catch (\Exception $e) { + $arrayResult = array(); + + $arrayResult["result"] = false; + $arrayResult["message"] = $e->getMessage(); + + //Return + return $arrayResult; + } + } + + /** + * Test connection + * + * @param array $arrayData Data + * + * return array Return array with result of test connection + */ + public function testConnection(array $arrayData) + { + try { + $arrayData = array_change_key_case($arrayData, CASE_UPPER); + + $arrayMailTestName = array( + 1 => "verifying_mail", + 2 => "sending_email" + ); + + $arrayPhpMailerTestName = array( + 1 => "resolving_name", + 2 => "check_port", + 3 => "establishing_connection_host", + 4 => "login", + 5 => "sending_email" + ); + + $arrayResult = array(); + + switch ($arrayData["MESS_ENGINE"]) { + case "MAIL": + $arrayDataAux = $arrayData; + + $arrayDataAux["MESS_TRY_SEND_INMEDIATLY"] = 1; + $arrayDataAux["MAIL_TO"] = "admin@processmaker.com"; + + $arrayResult[$arrayMailTestName[1]] = $this->testConnectionByStep($arrayDataAux); + $arrayResult[$arrayMailTestName[1]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_VERIFYING_MAIL"); + + if ((int)($arrayData["MESS_TRY_SEND_INMEDIATLY"]) == 1) { + $arrayResult[$arrayMailTestName[2]] = $this->testConnectionByStep($arrayData); + $arrayResult[$arrayMailTestName[2]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_SENDING_EMAIL", array($arrayData["MAIL_TO"])); + } + break; + case "PHPMAILER": + for ($step = 1; $step <= 5; $step++) { + $arrayResult[$arrayPhpMailerTestName[$step]] = $this->testConnectionByStep($arrayData, $step); + + switch ($step) { + case 1: + $arrayResult[$arrayPhpMailerTestName[$step]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_RESOLVING_NAME", array($arrayData["MESS_SERVER"])); + break; + case 2: + $arrayResult[$arrayPhpMailerTestName[$step]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_CHECK_PORT", array($arrayData["MESS_PORT"])); + break; + case 3: + $arrayResult[$arrayPhpMailerTestName[$step]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_ESTABLISHING_CON_HOST", array($arrayData["MESS_SERVER"] . ":" . $arrayData["MESS_PORT"])); + break; + case 4: + $arrayResult[$arrayPhpMailerTestName[$step]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_LOGIN", array($arrayData["MESS_ACCOUNT"], $arrayData["MESS_SERVER"])); + break; + case 5: + $arrayResult[$arrayPhpMailerTestName[$step]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_SENDING_EMAIL", array($arrayData["MAIL_TO"])); + break; + } + } + break; + } + + //Result + return $arrayResult; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Check if is default Email Server + * + * @param string $emailServerUid Unique id of Email Server + * + * return bool Return true if is default Email Server, false otherwise + */ + public function checkIfIsDefault($emailServerUid) + { + try { + $criteria = $this->getEmailServerCriteria(); + + $criteria->add(\EmailServerPeer::MESS_UID, $emailServerUid, \Criteria::EQUAL); + $criteria->add(\EmailServerPeer::MESS_DEFAULT, 1, \Criteria::EQUAL); + + $rsCriteria = \EmailServerPeer::doSelectRS($criteria); + + if ($rsCriteria->next()) { + return true; + } else { + return false; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Validate the data if they are invalid (INSERT and UPDATE) + * + * @param string $emailServerUid Unique id of Email Server + * @param array $arrayData Data + * + * return void Throw exception if data has an invalid value + */ + public function throwExceptionIfDataIsInvalid($emailServerUid, array $arrayData) + { + try { + //Set variables + $arrayEmailServerData = ($emailServerUid == "")? array() : $this->getEmailServer($emailServerUid, true); + $flagInsert = ($emailServerUid == "")? true : false; + + $arrayFinalData = array_merge($arrayEmailServerData, $arrayData); + + //Verify data + $process = new \ProcessMaker\BusinessModel\Process(); + + $arrayFieldDefinition = $this->arrayFieldDefinition; + + switch ($arrayFinalData["MESS_ENGINE"]) { + case "PHPMAILER": + $arrayFieldDefinition["MESS_SERVER"]["required"] = true; + $arrayFieldDefinition["MESS_SERVER"]["empty"] = false; + + $arrayFieldDefinition["MESS_PORT"]["required"] = true; + $arrayFieldDefinition["MESS_PORT"]["empty"] = false; + + $arrayFieldDefinition["MESS_ACCOUNT"]["required"] = true; + $arrayFieldDefinition["MESS_ACCOUNT"]["empty"] = false; + + $arrayFieldDefinition["SMTPSECURE"]["required"] = true; + $arrayFieldDefinition["SMTPSECURE"]["empty"] = false; + + if ((int)($arrayFinalData["MESS_RAUTH"]) == 1) { + $arrayFieldDefinition["MESS_PASSWORD"]["required"] = true; + $arrayFieldDefinition["MESS_PASSWORD"]["empty"] = false; + } + break; + case "MAIL": + $arrayFieldDefinition["SMTPSECURE"]["empty"] = true; + $arrayFieldDefinition["SMTPSECURE"]["defaultValues"] = array(); + break; + } + + if ((int)($arrayFinalData["MESS_TRY_SEND_INMEDIATLY"]) == 1) { + $arrayFieldDefinition["MAIL_TO"]["required"] = true; + $arrayFieldDefinition["MAIL_TO"]["empty"] = false; + } + + $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert); + + if ($flagInsert == false) { + //Update + $process->throwExceptionIfDataNotMetFieldDefinition($arrayFinalData, $arrayFieldDefinition, $this->arrayFieldNameForException, true); + } + + //Verify data Test Connection + if (isset($_SERVER["SERVER_NAME"])) { + $arrayTestConnectionResult = $this->testConnection($arrayFinalData); + + $msg = ""; + + foreach ($arrayTestConnectionResult as $key => $value) { + $arrayTest = $value; + + if (!$arrayTest["result"]) { + $msg = $msg . (($msg != "")? ", " : "") . $arrayTest["title"] . " (Error: " . $arrayTest["message"] . ")"; + } + } + + if ($msg != "") { + throw new \Exception($msg); + } + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Verify if does not exist the Email Server in table EMAIL_SERVER + * + * @param string $emailServerUid Unique id of Email Server + * @param string $fieldNameForException Field name for the exception + * + * return void Throw exception if does not exist the Email Server in table EMAIL_SERVER + */ + public function throwExceptionIfNotExistsEmailServer($emailServerUid, $fieldNameForException) + { + try { + $obj = \EmailServerPeer::retrieveByPK($emailServerUid); + + if (is_null($obj)) { + throw new \Exception(\G::LoadTranslation("ID_EMAIL_SERVER_DOES_NOT_EXIST", array($fieldNameForException, $emailServerUid))); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Check if is default Email Server + * + * @param string $emailServerUid Unique id of Email Server + * @param string $fieldNameForException Field name for the exception + * + * return void Throw exception if is default Email Server + */ + public function throwExceptionIfIsDefault($emailServerUid, $fieldNameForException) + { + try { + if ($this->checkIfIsDefault($emailServerUid)) { + throw new \Exception(\G::LoadTranslation("ID_EMAIL_SERVER_IS_DEFAULT", array($fieldNameForException, $emailServerUid))); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set default Email Server by Unique id of Email Server + * + * @param string $emailServerUid Unique id of Email Server + * + * return void + */ + public function setEmailServerDefaultByUid($emailServerUid) + { + try { + + $arrayEmailServerData = $this->getEmailServer($emailServerUid, true); + + //Update + //Update - WHERE + $criteriaWhere = new \Criteria("workflow"); + $criteriaWhere->add(\EmailServerPeer::MESS_UID, $emailServerUid, \Criteria::NOT_EQUAL); + + //Update + $criteriaSet = new \Criteria("workflow"); + $criteriaSet->add(\EmailServerPeer::MESS_DEFAULT, 0); + + \BasePeer::doUpdate($criteriaWhere, $criteriaSet, \Propel::getConnection("workflow")); + + if ((int)($arrayEmailServerData["MESS_DEFAULT"]) == 0) { + //Update + //Update - WHERE + $criteriaWhere = new \Criteria("workflow"); + $criteriaWhere->add(\EmailServerPeer::MESS_UID, $emailServerUid, \Criteria::NOT_EQUAL); + + //Update + $criteriaSet = new \Criteria("workflow"); + $criteriaSet->add(\EmailServerPeer::MESS_DEFAULT, 1); + + \BasePeer::doUpdate($criteriaWhere, $criteriaSet, \Propel::getConnection("workflow")); + } + } catch (Exception $e) { + throw $e; + } + } + + /** + * Create Email Server + * + * @param array $arrayData Data + * + * return array Return data of the new Email Server created + */ + public function create(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); + + unset($arrayData["MESS_UID"]); + + $this->throwExceptionIfDataIsInvalid("", $arrayData); + + //Create + $cnn = \Propel::getConnection("workflow"); + + try { + $emailServer = new \EmailServer(); + + $emailServer->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); + + $emailServerUid = \ProcessMaker\Util\Common::generateUID(); + + $emailServer->setMessUid($emailServerUid); + + if ($emailServer->validate()) { + $cnn->begin(); + + $result = $emailServer->save(); + + $cnn->commit(); + + if (isset($arrayData["MESS_DEFAULT"]) && (int)($arrayData["MESS_DEFAULT"]) == 1) { + $this->setEmailServerDefaultByUid($emailServerUid); + } + + //Return + return $this->getEmailServer($emailServerUid); + } else { + $msg = ""; + + foreach ($emailServer->getValidationFailures() as $validationFailure) { + $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); + } + + throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : "")); + } + } catch (\Exception $e) { + $cnn->rollback(); + + throw $e; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Update Email Server + * + * @param string $emailServerUid Unique id of Group + * @param array $arrayData Data + * + * return array Return data of the Email Server updated + */ + public function update($emailServerUid, $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); + + //Verify data + $this->throwExceptionIfNotExistsEmailServer($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]); + + $this->throwExceptionIfDataIsInvalid($emailServerUid, $arrayData); + + //Update + $cnn = \Propel::getConnection("workflow"); + + try { + $emailServer = \EmailServerPeer::retrieveByPK($emailServerUid); + $emailServer->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); + + if ($emailServer->validate()) { + $cnn->begin(); + + $result = $emailServer->save(); + + $cnn->commit(); + + if (isset($arrayData["MESS_DEFAULT"]) && (int)($arrayData["MESS_DEFAULT"]) == 1) { + $this->setEmailServerDefaultByUid($emailServerUid); + } + + //Return + if (!$this->formatFieldNameInUppercase) { + $arrayData = array_change_key_case($arrayData, CASE_LOWER); + } + + return $arrayData; + } else { + $msg = ""; + + foreach ($emailServer->getValidationFailures() as $validationFailure) { + $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); + } + + throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : "")); + } + } catch (\Exception $e) { + $cnn->rollback(); + + throw $e; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Delete Email Server + * + * @param string $emailServerUid Unique id of Email Server + * + * return void + */ + public function delete($emailServerUid) + { + try { + //Verify data + $this->throwExceptionIfNotExistsEmailServer($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]); + + $this->throwExceptionIfIsDefault($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]); + + $criteria = $this->getEmailServerCriteria(); + + $criteria->add(\EmailServerPeer::MESS_UID, $emailServerUid, \Criteria::EQUAL); + + \EmailServerPeer::doDelete($criteria); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get criteria for Email Server + * + * return object + */ + public function getEmailServerCriteria() + { + try { + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\EmailServerPeer::MESS_UID); + $criteria->addSelectColumn(\EmailServerPeer::MESS_ENGINE); + $criteria->addSelectColumn(\EmailServerPeer::MESS_SERVER); + $criteria->addSelectColumn(\EmailServerPeer::MESS_PORT); + $criteria->addSelectColumn(\EmailServerPeer::MESS_RAUTH); + $criteria->addSelectColumn(\EmailServerPeer::MESS_ACCOUNT); + $criteria->addSelectColumn(\EmailServerPeer::MESS_PASSWORD); + $criteria->addSelectColumn(\EmailServerPeer::MESS_FROM_MAIL); + $criteria->addSelectColumn(\EmailServerPeer::MESS_FROM_NAME); + $criteria->addSelectColumn(\EmailServerPeer::SMTPSECURE); + $criteria->addSelectColumn(\EmailServerPeer::MESS_TRY_SEND_INMEDIATLY); + $criteria->addSelectColumn(\EmailServerPeer::MAIL_TO); + $criteria->addSelectColumn(\EmailServerPeer::MESS_DEFAULT); + + return $criteria; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a from a record + * + * @param array $record Record + * + * return array Return an array with data Email Server + */ + public function getEmailServerDataFromRecord(array $record) + { + try { + return array( + $this->getFieldNameByFormatFieldName("MESS_UID") => $record["MESS_UID"], + $this->getFieldNameByFormatFieldName("MESS_ENGINE") => $record["MESS_ENGINE"], + $this->getFieldNameByFormatFieldName("MESS_SERVER") => $record["MESS_SERVER"], + $this->getFieldNameByFormatFieldName("MESS_PORT") => $record["MESS_PORT"], + $this->getFieldNameByFormatFieldName("MESS_RAUTH") => $record["MESS_RAUTH"], + $this->getFieldNameByFormatFieldName("MESS_ACCOUNT") => $record["MESS_ACCOUNT"], + $this->getFieldNameByFormatFieldName("MESS_PASSWORD") => $record["MESS_PASSWORD"], + $this->getFieldNameByFormatFieldName("MESS_FROM_MAIL") => $record["MESS_FROM_MAIL"], + $this->getFieldNameByFormatFieldName("MESS_FROM_NAME") => $record["MESS_FROM_NAME"], + $this->getFieldNameByFormatFieldName("SMTPSECURE") => $record["SMTPSECURE"], + $this->getFieldNameByFormatFieldName("MESS_TRY_SEND_INMEDIATLY") => $record["MESS_TRY_SEND_INMEDIATLY"], + $this->getFieldNameByFormatFieldName("MAIL_TO") => $record["MAIL_TO"], + $this->getFieldNameByFormatFieldName("MESS_DEFAULT") => $record["MESS_DEFAULT"] + ); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get Default Email Server + * + * return array Return an array with Email Server default + */ + public function getEmailServerDefault() + { + try { + $arrayData = array(); + + //SQL + $criteria = $this->getEmailServerCriteria(); + + $criteria->add(EmailServerPeer::MESS_DEFAULT, 1, Criteria::EQUAL); + + //QUERY + $rsCriteria = EmailServerPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $arrayData["MESS_ENGINE"] = $row["MESS_ENGINE"]; + $arrayData["MESS_SERVER"] = $row["MESS_SERVER"]; + $arrayData["MESS_PORT"] = (int)($row["MESS_PORT"]); + $arrayData["MESS_RAUTH"] = (int)($row["MESS_RAUTH"]); + $arrayData["MESS_ACCOUNT"] = $row["MESS_ACCOUNT"]; + $arrayData["MESS_PASSWORD"] = $row["MESS_PASSWORD"]; + $arrayData["MESS_FROM_MAIL"] = $row["MESS_FROM_MAIL"]; + $arrayData["MESS_FROM_NAME"] = $row["MESS_FROM_NAME"]; + $arrayData["SMTPSECURE"] = $row["SMTPSECURE"]; + $arrayData["MESS_TRY_SEND_INMEDIATLY"] = (int)($row["MESS_TRY_SEND_INMEDIATLY"]); + $arrayData["MAIL_TO"] = $row["MAIL_TO"]; + $arrayData["MESS_DEFAULT"] = (int)($row["MESS_DEFAULT"]); + } + + //Return + return $arrayData; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get all Email Servers + * + * @param array $arrayFilterData Data of the filters + * @param string $sortField Field name to sort + * @param string $sortDir Direction of sorting (ASC, DESC) + * @param int $start Start + * @param int $limit Limit + * + * return array Return an array with all Email Servers + */ + public function getEmailServers($arrayFilterData = null, $sortField = null, $sortDir = null, $start = null, $limit = null) + { + try { + $arrayEmailServer = array(); + + //Verify data + $process = new \ProcessMaker\BusinessModel\Process(); + + $process->throwExceptionIfDataNotMetPagerVarDefinition(array("start" => $start, "limit" => $limit), $this->arrayFieldNameForException); + + //Get data + if (!is_null($limit) && $limit . "" == "0") { + return $arrayEmailServer; + } + + //SQL + $criteria = $this->getEmailServerCriteria(); + + if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]) && trim($arrayFilterData["filter"]) != "") { + $criteria->add( + $criteria->getNewCriterion(\EmailServerPeer::MESS_ENGINE, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)->addOr( + $criteria->getNewCriterion(\EmailServerPeer::MESS_SERVER, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr( + $criteria->getNewCriterion(\EmailServerPeer::MESS_ACCOUNT, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr( + $criteria->getNewCriterion(\EmailServerPeer::MESS_FROM_NAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr( + $criteria->getNewCriterion(\EmailServerPeer::SMTPSECURE, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)) + ); + } + + //Number records total + $criteriaCount = clone $criteria; + + $criteriaCount->clearSelectColumns(); + $criteriaCount->addSelectColumn("COUNT(" . \EmailServerPeer::MESS_UID . ") AS NUM_REC"); + + $rsCriteriaCount = \EmailServerPeer::doSelectRS($criteriaCount); + $rsCriteriaCount->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + $rsCriteriaCount->next(); + $row = $rsCriteriaCount->getRow(); + + $numRecTotal = $row["NUM_REC"]; + + //SQL + if (!is_null($sortField) && trim($sortField) != "") { + $sortField = strtoupper($sortField); + + if (in_array($sortField, array("MESS_ENGINE", "MESS_SERVER", "MESS_ACCOUNT", "MESS_FROM_NAME", "SMTPSECURE"))) { + $sortField = \EmailServerPeer::TABLE_NAME . "." . $sortField; + } else { + $sortField = \EmailServerPeer::MESS_ENGINE; + } + } else { + $sortField = \EmailServerPeer::MESS_ENGINE; + } + + if (!is_null($sortDir) && trim($sortDir) != "" && strtoupper($sortDir) == "DESC") { + $criteria->addDescendingOrderByColumn($sortField); + } else { + $criteria->addAscendingOrderByColumn($sortField); + } + + if (!is_null($start)) { + $criteria->setOffset((int)($start)); + } + + if (!is_null($limit)) { + $criteria->setLimit((int)($limit)); + } + + $rsCriteria = \EmailServerPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $arrayEmailServer[] = $this->getEmailServerDataFromRecord($row); + } + + //Return + return array( + "total" => $numRecTotal, + "start" => (int)((!is_null($start))? $start : 0), + "limit" => (int)((!is_null($limit))? $limit : 0), + "filter" => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]))? $arrayFilterData["filter"] : "", + "data" => $arrayEmailServer + ); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Email Server + * + * @param string $emailServerUid Unique id of Email Server + * @param bool $flagGetRecord Value that set the getting + * + * return array Return an array with data of a Email Server + */ + public function getEmailServer($emailServerUid, $flagGetRecord = false) + { + try { + //Verify data + $this->throwExceptionIfNotExistsEmailServer($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]); + + //Get data + //SQL + $criteria = $this->getEmailServerCriteria(); + + $criteria->add(\EmailServerPeer::MESS_UID, $emailServerUid, \Criteria::EQUAL); + + $rsCriteria = \EmailServerPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + $rsCriteria->next(); + + $row = $rsCriteria->getRow(); + + $row["MESS_PORT"] = (int)($row["MESS_PORT"]); + $row["MESS_RAUTH"] = (int)($row["MESS_RAUTH"]); + $row["MESS_TRY_SEND_INMEDIATLY"] = (int)($row["MESS_TRY_SEND_INMEDIATLY"]); + $row["MESS_DEFAULT"] = (int)($row["MESS_DEFAULT"]); + + //Return + return (!$flagGetRecord)? $this->getEmailServerDataFromRecord($row) : $row; + } catch (\Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/Services/Api/EmailServer.php b/workflow/engine/src/ProcessMaker/Services/Api/EmailServer.php new file mode 100644 index 000000000..3e401eb1c --- /dev/null +++ b/workflow/engine/src/ProcessMaker/Services/Api/EmailServer.php @@ -0,0 +1,158 @@ +emailServer = new \ProcessMaker\BusinessModel\EmailServer(); + + $this->emailServer->setFormatFieldNameInUppercase(false); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url GET + * + * @param string $filter + * @param int $start + * @param int $limit + * + */ + public function index($filter = null, $start = null, $limit = null) + { + try { + $arrayAux = $this->emailServer->getEmailServers(array("filter" => $filter), null, null, $start, $limit); + + $response = $arrayAux["data"]; + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url GET /:mess_uid + * + * @param string $mess_uid {@min 32}{@max 32} + */ + public function doGet($mess_uid) + { + try { + $response = $this->emailServer->getEmailServer($mess_uid); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url GET /paged + * + * @param string $filter + * @param int $start + * @param int $limit + */ + public function doGetPaged($filter = null, $start = null, $limit = null) + { + try { + $response = $this->emailServer->getEmailServers(array("filter" => $filter), null, null, $start, $limit); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url POST /test-connection + * + * @param array $request_data + */ + public function doPostTestConnection(array $request_data) + { + try { + $arrayData = $this->emailServer->testConnection($request_data); + + $response = $arrayData; + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url POST + * + * @param array $request_data + * + * @status 201 + */ + public function doPost(array $request_data) + { + try { + $arrayData = $this->emailServer->create($request_data); + + $response = $arrayData; + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url PUT /:mess_uid + * + * @param string $mess_uid {@min 32}{@max 32} + * @param array $request_data + * + * @status 200 + */ + public function doPut($mess_uid, array $request_data) + { + try { + $arrayData = $this->emailServer->update($mess_uid, $request_data); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url DELETE /:mess_uid + * + * @param string $mess_uid {@min 32}{@max 32} + * + * @status 200 + */ + public function doDelete($mess_uid) + { + try { + $this->emailServer->delete($mess_uid); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/Services/api.ini b/workflow/engine/src/ProcessMaker/Services/api.ini index a4cf14240..54225a990 100644 --- a/workflow/engine/src/ProcessMaker/Services/api.ini +++ b/workflow/engine/src/ProcessMaker/Services/api.ini @@ -86,4 +86,10 @@ debug = 1 file = "ProcessMaker\Services\Api\File" [alias: files] - file = "ProcessMaker\Services\Api\Files" \ No newline at end of file + file = "ProcessMaker\Services\Api\Files" + +[alias: email] + email = "ProcessMaker\Services\Api\EmailServer" + +[alias: emails] + email = "ProcessMaker\Services\Api\EmailServer" \ No newline at end of file From 5e9c22d6cb0116b63b5e296996a95f822fcd8160 Mon Sep 17 00:00:00 2001 From: veronicaaruquipa Date: Tue, 9 Dec 2014 17:32:21 -0400 Subject: [PATCH 14/30] Update number of results that we have were defined inside features and which get the corresponding service. --- .../case_scheduler/main_tests_case_scheduler.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature b/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature index 6ff008da0..bee8dfa2b 100644 --- a/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature +++ b/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature @@ -20,7 +20,7 @@ Scenario Outline: Get the case schedulers list when there are exactly case sched | test_description | project | record | | Get case scheduler of process Test Michelangelo | 1265557095225ff5c688f46031700471 | 0 | - | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 2 | + | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 1 | Scenario Outline: Create any case scheduler for a project @@ -110,7 +110,7 @@ Scenario: Create a new case scheduler with same name And the response status message should have the following text "Duplicate" -Scenario Outline: Get the case schedulers list when there are exactly 16 after 18 case schedulers in each process +Scenario Outline: Get the case schedulers list when there are exactly 16 after 17 case schedulers in each process Given I request "project//case-schedulers" Then the response status code should be 200 And the response charset is "UTF-8" @@ -122,7 +122,7 @@ Scenario Outline: Get the case schedulers list when there are exactly 16 after 1 | test_description | project | record | | Get case scheduler of process Test Michelangelo | 1265557095225ff5c688f46031700471 | 16 | - | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 18 | + | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 17 | Scenario Outline: Update the case schedulers for a project and then check if the values had changed From 56804520591ca0ed1086e01579c0ace601110049 Mon Sep 17 00:00:00 2001 From: veronicaaruquipa Date: Tue, 9 Dec 2014 17:34:10 -0400 Subject: [PATCH 15/30] It was changed the http status code from 200 to 201 in order to import a process correctly. --- .../main_tests_project_export_import.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/backend/projects/project_export_import/main_tests_project_export_import.feature b/features/backend/projects/project_export_import/main_tests_project_export_import.feature index 374cf5678..af0f471f3 100644 --- a/features/backend/projects/project_export_import/main_tests_project_export_import.feature +++ b/features/backend/projects/project_export_import/main_tests_project_export_import.feature @@ -152,7 +152,7 @@ Scenario: Delete a Project created previously in this script Scenario Outline: Import a process Given POST upload a project file "" to "project/import?option=&option_group=merge" - Then the response status code should be 200 + Then the response status code should be 201 And the response charset is "UTF-8" And the content type is "application/json" And the type is "object" @@ -426,7 +426,7 @@ Scenario: Get a list of projects Scenario Outline: Import a process Given POST upload a project file "" to "project/import?option=" - Then the response status code should be 200 + Then the response status code should be 201 And the response charset is "UTF-8" And the content type is "application/json" And the type is "object" @@ -455,7 +455,7 @@ Scenario: Delete a Project created previously in this script "Export process emp Scenario: Import a process "Export process empty" Given POST upload a project file "Export_process_empty.pmx" to "project/import?option=create" - Then the response status code should be 200 + Then the response status code should be 201 And the response charset is "UTF-8" And the content type is "application/json" And the type is "object" From 8e11d8f9583792f55fd390382ceb724cbd966735 Mon Sep 17 00:00:00 2001 From: norahmollo Date: Wed, 10 Dec 2014 11:40:53 -0400 Subject: [PATCH 16/30] PM-16288 PM falla al crear grilla como tabla de PM sobre oracle Se quito la opcion REPORT y solo se listan las conexiones de tipo MySQL. --- workflow/engine/classes/class.dbConnections.php | 3 ++- workflow/engine/controllers/pmTablesProxy.php | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/workflow/engine/classes/class.dbConnections.php b/workflow/engine/classes/class.dbConnections.php index 2a027c125..3e3d709a7 100755 --- a/workflow/engine/classes/class.dbConnections.php +++ b/workflow/engine/classes/class.dbConnections.php @@ -154,8 +154,9 @@ class dbConnections $result = DbSourcePeer::doSelectRS( $c ); $result->next(); $row = $result->getRow(); + while ($row = $result->getRow()) { - if (trim( $pProUid ) == trim( $row[1] )) { + if ((trim( $pProUid ) == trim( $row[1] )) && ($row[2] == 'mysql')) { $connections[] = Array ('DBS_UID' => $row[0],'DBS_NAME' => '[' . $row[3] . '] ' . $row[2] . ': ' . $row[4] ); } diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index 6554fc2a0..33bd8f047 100755 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -116,10 +116,7 @@ class pmTablesProxy extends HttpProxyController $proUid = $_POST['PRO_UID']; $dbConn = new DbConnections(); $dbConnections = $dbConn->getConnectionsProUid( $proUid ); - $defaultConnections = array (array ('DBS_UID' => 'workflow','DBS_NAME' => 'Workflow' - ),array ('DBS_UID' => 'rp','DBS_NAME' => 'REPORT' - ) - ); + $defaultConnections = array (array ('DBS_UID' => 'workflow','DBS_NAME' => 'Workflow')); $dbConnections = array_merge( $defaultConnections, $dbConnections ); From a9f2a8ea910f1e05cdddaadd70729185ca72ca9f Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Wed, 10 Dec 2014 16:32:31 -0400 Subject: [PATCH 17/30] Correccion al editar un pmtable se eliminan los registros --- .../thirdparty/phing/system/io/FileSystem.php | 2 +- .../phing/system/io/UnixFileSystem.php | 2 +- workflow/engine/classes/class.pmTable.php | 26 +++++++++++++++++-- workflow/engine/controllers/pmTablesProxy.php | 6 +---- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/gulliver/thirdparty/phing/system/io/FileSystem.php b/gulliver/thirdparty/phing/system/io/FileSystem.php index 71133779f..af6fb0abe 100755 --- a/gulliver/thirdparty/phing/system/io/FileSystem.php +++ b/gulliver/thirdparty/phing/system/io/FileSystem.php @@ -149,7 +149,7 @@ abstract class FileSystem { * by the given abstract pathname, or zero if it does not exist or some * other I/O error occurs. */ - function getBooleanAttributes($f) { + function getBooleanAttributes(&$f = null) { throw new Exception("SYSTEM ERROR method getBooleanAttributes() not implemented by fs driver"); } diff --git a/gulliver/thirdparty/phing/system/io/UnixFileSystem.php b/gulliver/thirdparty/phing/system/io/UnixFileSystem.php index 449b4e6eb..85f467d0e 100755 --- a/gulliver/thirdparty/phing/system/io/UnixFileSystem.php +++ b/gulliver/thirdparty/phing/system/io/UnixFileSystem.php @@ -191,7 +191,7 @@ class UnixFileSystem extends FileSystem { /* -- most of the following is mapped to the php natives wrapped by FileSystem */ /* -- Attribute accessors -- */ - function getBooleanAttributes(&$f) { + function getBooleanAttributes(&$f = null) { //$rv = getBooleanAttributes0($f); $name = $f->getName(); $hidden = (strlen($name) > 0) && ($name{0} == '.'); diff --git a/workflow/engine/classes/class.pmTable.php b/workflow/engine/classes/class.pmTable.php index 0d1748964..005a7a3ac 100755 --- a/workflow/engine/classes/class.pmTable.php +++ b/workflow/engine/classes/class.pmTable.php @@ -40,6 +40,7 @@ class PmTable private $schemaFile = ''; private $tableName; private $columns; + private $primaryKey= array(); private $baseDir = ''; private $targetDir = ''; private $configDir = ''; @@ -182,7 +183,7 @@ class PmTable * Build the pmTable with all dependencies */ public function build () - { + { $this->prepare(); $this->preparePropelIniFile(); $this->buildSchema(); @@ -400,7 +401,7 @@ class PmTable * Save the xml schema for propel */ public function saveSchema () - { + { $this->dom->save( $this->configDir . $this->schemaFilename ); } @@ -671,8 +672,29 @@ class PmTable $sql = "SELECT * FROM $tableBackup"; $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); + // array the primary keys + foreach($this->columns as $value) { + if ($value->field_key == 1) { + $this->primaryKey[] = $value->field_name; + } + } + + $flagPrimaryKey = 1; while ($rs->next()) { $row = $rs->getRow(); + if ($flagPrimaryKey) { + // verify row has all primary keys + $keys = 0; + foreach ($row as $colName => $value) { + if (in_array($colName,$this->primaryKey)){ + $keys++; + } + } + if ($keys != count($this->primaryKey)) { + return $stmt->executeQuery(str_replace($table, $tableBackup, $queryStack["drop"])); + } + $flagPrimaryKey = 0; + } $oTable = new $tableFileName(); $oTable->fromArray($row, BasePeer::TYPE_FIELDNAME); diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index 6554fc2a0..d4505fcc6 100755 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -208,13 +208,11 @@ class pmTablesProxy extends HttpProxyController $result = new StdClass(); try { - $result = new stdClass(); ob_start(); $data = (array) $httpData; $data['PRO_UID'] = trim( $data['PRO_UID'] ); $data['columns'] = G::json_decode( stripslashes( $httpData->columns ) ); //decofing data columns - $isReportTable = $data['PRO_UID'] != '' ? true : false; $oAdditionalTables = new AdditionalTables(); $oFields = new Fields(); @@ -252,7 +250,6 @@ class pmTablesProxy extends HttpProxyController ) ) )); } } - //backward compatility foreach ($columns as $i => $column) { if (in_array( strtoupper( $columns[$i]->field_name ), $reservedWordsSql ) || in_array( strtolower( $columns[$i]->field_name ), $reservedWordsPhp )) { @@ -318,7 +315,6 @@ class pmTablesProxy extends HttpProxyController $oCriteria->add( FieldsPeer::ADD_TAB_UID, $data['REP_TAB_UID'] ); FieldsPeer::doDelete( $oCriteria ); } - // Updating pmtable fields foreach ($columns as $i => $column) { $field = array ( @@ -747,7 +743,7 @@ class pmTablesProxy extends HttpProxyController */ public function exportCSV ($httpData) { - + $result = new StdClass(); try { $link = ''; From 9f33fbaaae7e4d5a06f49c6e25eec705250d2227 Mon Sep 17 00:00:00 2001 From: norahmollo Date: Thu, 11 Dec 2014 16:25:25 -0400 Subject: [PATCH 18/30] PM-16288 PM falla al crear grilla como tabla de PM sobre oracle Se quito la opcion REPORT cuando el workspace tiene una sola BD y solo se listan las conexiones de tipo MySQL. --- workflow/engine/controllers/pmTablesProxy.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index 33bd8f047..13f67a577 100755 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -116,10 +116,19 @@ class pmTablesProxy extends HttpProxyController $proUid = $_POST['PRO_UID']; $dbConn = new DbConnections(); $dbConnections = $dbConn->getConnectionsProUid( $proUid ); - $defaultConnections = array (array ('DBS_UID' => 'workflow','DBS_NAME' => 'Workflow')); + + $workSpace = new workspaceTools(SYS_SYS); + $workspaceDB = $workSpace->getDBInfo(); + if ($workspaceDB['DB_NAME'] == $workspaceDB['DB_RBAC_NAME']) { + $defaultConnections = array (array ('DBS_UID' => 'workflow','DBS_NAME' => 'Workflow')); + } else { + $defaultConnections = array (array ('DBS_UID' => 'workflow','DBS_NAME' => 'Workflow'), + array ('DBS_UID' => 'rp','DBS_NAME' => 'REPORT')); + } + $dbConnections = array_merge( $defaultConnections, $dbConnections ); - + return $dbConnections; } From 0f235c776fcf1622f620a6a60845b5c0e4fe43f8 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Thu, 11 Dec 2014 16:38:59 -0400 Subject: [PATCH 19/30] PM-1111 "16332: Grids with same name" SOLVED Issue: 16332: Grids with same name Cause: No se valida si existe un Grid con el mismo nombre Solution: Al "Copy/Import DynaForm" si este tiene incrustado un Grid y el titulo del mismo ya existe en el proceso; al titulo del Grid se le concatena entre parentesis el titulo del nuevo DynaForm --- workflow/engine/methods/dynaforms/dynaforms_Save.php | 6 +++--- .../engine/src/ProcessMaker/BusinessModel/DynaForm.php | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/workflow/engine/methods/dynaforms/dynaforms_Save.php b/workflow/engine/methods/dynaforms/dynaforms_Save.php index 43789e86e..8a64a7774 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Save.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Save.php @@ -158,13 +158,13 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameDynaform') { $copyDynGrdDescription = $row["CON_VALUE"]; //Create grid - $aDataAux = $aData; + $dynaformGrid = new dynaform(); + $aDataAux = $aData; $aDataAux["DYN_TYPE"] = "grid"; - $aDataAux["DYN_TITLE"] = $copyDynGrdTitle; + $aDataAux["DYN_TITLE"] = $copyDynGrdTitle . ((!$dynaformGrid->verifyExistingName($copyDynGrdTitle, $dynaform->getProUid()))? " (" . $dynaform->getDynTitle() . ")" : ""); $aDataAux["DYN_DESCRIPTION"] = $copyDynGrdDescription; - $dynaformGrid = new dynaform(); $aFields = $dynaformGrid->create($aDataAux); $dynaformGridUid = $dynaformGrid->getDynUid(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php index bfcc6bf10..08827276a 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php @@ -602,15 +602,15 @@ class DynaForm $dynGrdDescriptionCopyImport = $row["CON_VALUE"]; //Create Grid + $dynaFormGrid = new \Dynaform(); + $arrayDataAux = array( "PRO_UID" => $processUid, - "DYN_TITLE" => $dynGrdTitleCopyImport, + "DYN_TITLE" => $dynGrdTitleCopyImport . (($this->existsTitle($processUid, $dynGrdTitleCopyImport))? " (" . $arrayData["DYN_TITLE"] . ")" : ""), "DYN_DESCRIPTION" => $dynGrdDescriptionCopyImport, "DYN_TYPE" => "grid" ); - $dynaFormGrid = new \Dynaform(); - $dynaFormGridUid = $dynaFormGrid->create($arrayDataAux); //Copy files of the DynaForm Grid @@ -1124,6 +1124,5 @@ class DynaForm throw $e; } } - } From a4c9e1e9798d86ee4ed9f35883f4e319d0c6703d Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Thu, 11 Dec 2014 14:14:57 -0400 Subject: [PATCH 20/30] PM-1044 El USR_UID llega con NULL SOLVED --- workflow/engine/classes/class.case.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 004b44c38..17dcab0ff 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -986,11 +986,13 @@ class Cases unset($Fields['APP_DESCRIPTION']); } if (isset($Fields["APP_STATUS"]) && $Fields["APP_STATUS"] == "COMPLETED") { - $Fields['USR_UID'] = $Fields['CURRENT_USER_UID']; - $listCompleted = new ListCompleted(); - $listCompleted->create($Fields); - $listMyInbox = new ListMyInbox(); - $listMyInbox->refresh($Fields); + if (isset($Fields['CURRENT_USER_UID'])) { + $Fields['USR_UID'] = $Fields['CURRENT_USER_UID']; + $listCompleted = new ListCompleted(); + $listCompleted->create($Fields); + $listMyInbox = new ListMyInbox(); + $listMyInbox->refresh($Fields); + } } $oApp->update($Fields); From fa11372e5e9768055b27586781f3324561f57a09 Mon Sep 17 00:00:00 2001 From: jennylee Date: Fri, 12 Dec 2014 16:42:09 -0400 Subject: [PATCH 21/30] Fixing the Codemirror PHP hints to include PMFunctions --- gulliver/js/codemirror/addon/hint/php-hint.js | 1086 ++++------------- 1 file changed, 259 insertions(+), 827 deletions(-) diff --git a/gulliver/js/codemirror/addon/hint/php-hint.js b/gulliver/js/codemirror/addon/hint/php-hint.js index 4986fa7ce..d882dbe47 100644 --- a/gulliver/js/codemirror/addon/hint/php-hint.js +++ b/gulliver/js/codemirror/addon/hint/php-hint.js @@ -1,835 +1,267 @@ (function () { - - function forEach(arr, f) { - for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); - } + var Pos = CodeMirror.Pos; + + function forEach(arr, f) { + for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); + } - function arrayContains(arr, item) { - if (!Array.prototype.indexOf) { - var i = arr.length; - while (i--) { - if (arr[i] === item) { - return true; - } - } - return false; + function arrayContains(arr, item) { + if (!Array.prototype.indexOf) { + var i = arr.length; + while (i--) { + if (arr[i] === item) { + return true; } - return arr.indexOf(item) != -1; + } + return false; + } + return arr.indexOf(item) != -1; + } + + function scriptHint(editor, keywords, getToken, options) { + // Find the token at the cursor + var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; + var sToken = token.string.trim(); + + if ( sToken == "(") { + token = tprop = getToken(editor, Pos(cur.line, tprop.start)); + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start), + to: Pos(cur.line, token.end + 1)}; + } + if ( sToken == "=") { + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start + 1), + to: Pos(cur.line, token.end)}; + } + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start), + to: Pos(cur.line, token.end)}; + } + + CodeMirror.phpHint = function(editor, options) { + return scriptHint(editor, phpPMFunctions, function (e, cur) {return e.getTokenAt(cur);}, options); + }; + + var SPACE = " "; + var arrayFunctions = []; + + var formatDate = "formatDate"; + var formatDateFunction = [formatDate+"($date,$format,$language);",formatDate+"($date,$format);"]; + arrayFunctions[formatDate] = formatDateFunction; + + var getCurrentDate = "getCurrentDate"; + var getCurrentDateFunction = [getCurrentDate+"()"]; + arrayFunctions[getCurrentDate] = getCurrentDateFunction; + + var getCurrentTime = "getCurrentTime"; + var getCurrentTimeFunction = [getCurrentTime+"()"]; + arrayFunctions[getCurrentTime] = getCurrentTimeFunction; + + var literalDate = "literalDate"; + var literalDateFunction = [literalDate+"($date,$Language)",literalDate+"($date)"]; + arrayFunctions[literalDate] = literalDateFunction; + + var capitalize = "capitalize"; + var capitalizeFunction = [capitalize+"($textToConvert)"]; + arrayFunctions[capitalize] = capitalizeFunction; + + var lowerCase = "lowerCase"; + var lowerCaseFunction = [lowerCase+"($textToConvert)"]; + arrayFunctions[lowerCase] = lowerCaseFunction; + + var upperCase = "upperCase"; + var upperCaseFunction = [upperCase+"($textToConvert)"]; + arrayFunctions[upperCase] = upperCaseFunction; + + var userInfo = "userInfo"; + var userInfoFunction = [userInfo+"($USER_ID)"]; + arrayFunctions[userInfo] = userInfoFunction; + + var executeQuery = "executeQuery"; + var executeQueryFunction = [executeQuery+"($sqlStatement,$DBConnectionUID)",executeQuery+"($sqlStatement)"]; + arrayFunctions[executeQuery] = executeQueryFunction; + + var orderGrid = "orderGrid"; + var orderGridFunction = ("orderGrid($gridName,$field,$criteria) orderGrid($gridName,$field)").split(SPACE); + arrayFunctions[orderGrid] = orderGridFunction; + + var evaluateFunction = "evaluateFunction"; + var evaluateFunctionFunction = [evaluateFunction+"($gridName,$Expression)"]; + arrayFunctions[evaluateFunction] = evaluateFunctionFunction; + + var PMFTaskCase = "PMFTaskCase"; + var PMFTaskCaseFunction = [PMFTaskCase+"($caseId)"]; + arrayFunctions[PMFTaskCase] = PMFTaskCaseFunction; + + var PMFTaskList = "PMFTaskList"; + var PMFTaskListFunction = [PMFTaskList+"($userId)"]; + arrayFunctions[PMFTaskList] = PMFTaskListFunction; + + var PMFUserList = "PMFUserList"; + var PMFUserListFunction = [PMFUserList+"()"]; + arrayFunctions[PMFUserList] = PMFUserListFunction; + + var PMFGroupList = "PMFGroupList"; + var PMFGroupListFunction = [PMFGroupList+"()"]; + arrayFunctions[PMFGroupList] = PMFGroupListFunction; + + var PMFRoleList = "PMFRoleList"; + var PMFRoleListFunction = [PMFRoleList+"()"]; + arrayFunctions[PMFRoleList] = PMFRoleListFunction; + + var PMFCaseList = "PMFCaseList"; + var PMFCaseListFunction = [PMFCaseList+"($userId)",PMFCaseList+"()"]; + arrayFunctions[PMFCaseList] = PMFCaseListFunction; + + var PMFProcessList = "PMFProcessList"; + var PMFProcessListFunction = [PMFProcessList+"()"]; + arrayFunctions[PMFProcessList] = PMFProcessListFunction; + + var PMFSendVariables = "PMFSendVariables"; + var PMFSendVariablesFunction = [PMFSendVariables+"($caseId,$variables)"]; + arrayFunctions[PMFSendVariables] = PMFSendVariablesFunction; + + var PMFDerivateCase = "PMFDerivateCase"; + var PMFDerivateCaseFunction = [PMFDerivateCase+"($caseId,$delegation,$executeTriggersBeforeAssigment)",PMFDerivateCase+"($caseId,$delegation)"]; + arrayFunctions[PMFDerivateCase] = PMFDerivateCaseFunction; + + var PMFNewCaseImpersonate = "PMFNewCaseImpersonate"; + var PMFNewCaseImpersonateFunction = [PMFNewCaseImpersonate+"($processId,$userId,$variables)"]; + arrayFunctions[PMFNewCaseImpersonate] = PMFNewCaseImpersonateFunction; + + var PMFNewCase = "PMFNewCase"; + var PMFNewCaseFunction = [PMFNewCase+"($processId,$userId,$taskId,$variables)"]; + arrayFunctions[PMFNewCase] = PMFNewCaseFunction; + + var PMFPauseCase = "PMFPauseCase"; + var PMFPauseCaseFunction = [PMFPauseCase+"($caseUid,$delIndex,$userUid,$unpauseDate)",PMFPauseCase+"($caseUid,$delIndex,$userUid)"]; + arrayFunctions[PMFPauseCase] = PMFPauseCaseFunction; + + var PMFAssignUserToGroup = "PMFAssignUserToGroup"; + var PMFAssignUserToGroupFunction = [PMFAssignUserToGroup+"($userId,$groupId)"]; + arrayFunctions[PMFAssignUserToGroup] = PMFAssignUserToGroupFunction; + + var PMFCreateUser = "PMFCreateUser"; + var PMFCreateUserFunction = [PMFCreateUser+"($userId,$password,$firstname,$lastname,$email,$role)"]; + arrayFunctions[PMFCreateUser] = PMFCreateUserFunction; + + var PMFUpdateUser = "PMFUpdateUser"; + var PMFUpdateUserFunction = [PMFUpdateUser+"($userUid,$userName,$firstName,$lastName,$email,$dueDate,$status,$role,$password)"]; + arrayFunctions[PMFUpdateUser] = PMFUpdateUserFunction; + + var PMFInformationUser = "PMFInformationUser"; + var PMFInformationUserFunction = [PMFInformationUser+"($userUid)"]; + arrayFunctions[PMFInformationUser] = PMFInformationUserFunction; + + var generateCode = "generateCode"; + var generateCodeFunction = [generateCode+"($size,$type)"]; + arrayFunctions[generateCode] = generateCodeFunction; + + var setCaseTrackerCode = "setCaseTrackerCode"; + var setCaseTrackerCodeFunction = [setCaseTrackerCode+"($caseId,$code,$pin)"]; + arrayFunctions[setCaseTrackerCode] = setCaseTrackerCodeFunction; + + var jumping = "jumping"; + var jumpingFunction = [jumping+"($caseId,$delegation)"]; + arrayFunctions[jumping] = jumpingFunction; + + var PMFRedirectToStep = "PMFRedirectToStep"; + var PMFRedirectToStepFunction = [PMFRedirectToStep+"($caseId,$delegation,$stepType,$stepId)"]; + arrayFunctions[PMFRedirectToStep] = PMFRedirectToStepFunction; + + var pauseCase = "pauseCase"; + var pauseCaseFunction = [pauseCase+"($caseId,$delegation,$userId,$unpauseDate)",pauseCase+"($caseId,$delegation,$userId)"]; + arrayFunctions[pauseCase] = pauseCaseFunction; + + var PMFUnpauseCase = "PMFUnpauseCase"; + var PMFUnpauseCaseFunction = [PMFUnpauseCase+"($caseId,$delegation,$userId,$unpauseDate)",PMFUnpauseCase+"($caseId,$delegation,$userId)"]; + arrayFunctions[PMFUnpauseCase] = PMFUnpauseCaseFunction; + + var PMFSendMessage = "PMFSendMessage"; + var PMFSendMessageFunction = [PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields,$attachments)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template)"]; + arrayFunctions[PMFSendMessage] = PMFSendMessageFunction; + + var PMFgetLabelOption = "PMFgetLabelOption"; + var PMFgetLabelOptionFunction = [PMFgetLabelOption+"($processId,$dynaformId,$fieldName,$optionId)"]; + arrayFunctions[PMFgetLabelOption] = PMFgetLabelOptionFunction; + + var PMFGenerateOutputDocument = "PMFGenerateOutputDocument"; + var PMFGenerateOutputDocumentFunction = [PMFGenerateOutputDocument+"($outputID)"]; + arrayFunctions[PMFGenerateOutputDocument] = PMFGenerateOutputDocumentFunction; + + var PMFGetUserEmailAddress = "PMFGetUserEmailAddress"; + var PMFGetUserEmailAddressFunction = [PMFGetUserEmailAddress+"($id,$APP_UID,$prefix)",PMFGetUserEmailAddress+"($id,$APP_UID)",PMFGetUserEmailAddress+"($id)"]; + arrayFunctions[PMFGetUserEmailAddress] = PMFGetUserEmailAddressFunction; + + var PMFGetNextAssignedUser = "PMFGetNextAssignedUser"; + var PMFGetNextAssignedUserFunction = (PMFGetNextAssignedUser+"($application,$task)").split(SPACE); + arrayFunctions[PMFGetNextAssignedUser] = PMFGetNextAssignedUserFunction; + + var PMFDeleteCase = "PMFDeleteCase"; + var PMFDeleteCaseFunction = ("PMFDeleteCase($caseId)").split(SPACE); + arrayFunctions[PMFDeleteCase] = PMFDeleteCaseFunction; + + var PMFCancelCase = "PMFCancelCase"; + var PMFCancelCaseFunction = [PMFCancelCase+"($caseUid,$delIndex,$userUid)"]; + arrayFunctions[PMFCancelCase] = PMFCancelCaseFunction; + + var PMFAddInputDocument = "PMFAddInputDocument"; + var PMFAddInputDocumentFunction = [PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option,$file)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid)"]; + arrayFunctions[PMFAddInputDocument] = PMFAddInputDocumentFunction; + + var PMFAddCaseNote = "PMFAddCaseNote"; + var PMFAddCaseNoteFunction = [PMFAddCaseNote+"($caseUid,$processUid,$taskUid,$userUid,$note,$sendMail)"]; + arrayFunctions[PMFAddCaseNote] = PMFAddCaseNoteFunction; + + var PMFGetCaseNotes = "PMFGetCaseNotes"; + var PMFGetCaseNotesFunction = [PMFGetCaseNotes+"($applicationID,$type,$userUid);",PMFGetCaseNotes+"($applicationID,$type)",PMFGetCaseNotes+"($applicationID)"]; + arrayFunctions[PMFGetCaseNotes] = PMFGetCaseNotesFunction; + + var phpPMFunctions = [formatDate,getCurrentDate,getCurrentTime,literalDate,capitalize,lowerCase,upperCase,userInfo,executeQuery,orderGrid, + evaluateFunction,PMFTaskCase,PMFTaskList,PMFUserList,PMFGroupList,PMFRoleList,PMFCaseList,PMFProcessList,PMFSendVariables,PMFDerivateCase, + PMFNewCaseImpersonate,PMFNewCase,PMFPauseCase,PMFUnpauseCase,PMFAssignUserToGroup,PMFCreateUser,PMFUpdateUser,PMFInformationUser, + generateCode,setCaseTrackerCode,jumping,PMFRedirectToStep,pauseCase,PMFSendMessage,PMFgetLabelOption,PMFGenerateOutputDocument, + PMFGetUserEmailAddress,PMFGetNextAssignedUser,PMFDeleteCase,PMFCancelCase,PMFAddInputDocument,PMFAddCaseNote,PMFGetCaseNotes]; + + var phpKeywords = ("break case catch continue default do else false for function " + + "if new return switch throw true try var while").split(SPACE); + + function getCompletions(functionName, keywords, options) { + + var found = []; + + function maybeAdd(str) {// for keywords ? + if ( str.indexOf(functionName) == 0 && !arrayContains(found, str)) { + found.push(str); + } } - function scriptHint(editor, keywords, getToken) { - // Find the token at the cursor - var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; - // If it's not a 'word-style' token, ignore the token. - if (!/^[\w$_]*$/.test(token.string)) { - token = tprop = { - start: cur.ch, - end: cur.ch, - string: "", - state: token.state, - className: token.string == "." ? "property" : null - }; - } - // If it is a property, find out what it is a property of. - while (tprop.className == "property") { - tprop = getToken(editor, { - line: cur.line, - ch: tprop.start - }); - if (tprop.string != ".") return; - tprop = getToken(editor, { - line: cur.line, - ch: tprop.start - }); - if (tprop.string == ')') { - var level = 1; - do { - tprop = getToken(editor, { - line: cur.line, - ch: tprop.start - }); - switch (tprop.string) { - case ')': - level++; - break; - case '(': - level--; - break; - default: - break; - } - } while (level > 0) - tprop = getToken(editor, { - line: cur.line, - ch: tprop.start - }); - if (tprop.className == 'variable') - tprop.className = 'function'; - else return; // no clue - } - if (!context) var context = []; - context.push(tprop); - } - return { - list: getCompletions(token, context, keywords), - from: { - line: cur.line, - ch: token.start - }, - to: { - line: cur.line, - ch: token.end - } - }; + function yesAdd(str) { + if ( !arrayContains(found, str)) { + found.push(str); + } } - - CodeMirror.phpHint = function(editor) { - return scriptHint(editor, phpKeywords, - function (e, cur) { - return e.getTokenAt(cur); - }); + arrayFunction = arrayFunctions[functionName]; + + if (arrayFunction != undefined) { + forEach( arrayFunction, yesAdd); + } else { + if (functionName.trim() == "") { + forEach (phpKeywords, yesAdd); + forEach (keywords, yesAdd); + } else if (functionName == "=") { + forEach (phpPMFunctions, yesAdd); + } else { + for (index = 0; index < phpKeywords.length; index++) { + if ( phpKeywords[index].indexOf(functionName) == 0 ) { + found.push(phpKeywords[index]); + } + } + forEach(keywords, maybeAdd); + } } - CodeMirror.registerHelper("hint", "php", CodeMirror.phpHint); - - var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search").split(" "); - var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ").split(" "); - var funcProps = ("_() __() __checked_selected_helper() __construct() __destruct() __get_option() " + - "__ngettext() __ngettext_noop() __set() __tostring() _add_themes_utility_last() _added() " + - "_admin_notice_multisite_activate_plugins_page() _admin_notice_post_locked() _admin_search_query() _block() _blockheader() _c() " + - "_changed() _check() _check_timeout() _checkcode() _close_comments_for_old_post() _close_comments_for_old_posts() " + - "_compareseq() _connect() _context() _createresponder() _crop_image_resource() _css_href() " + - "_custom_background_cb() _data_close() _data_prepare() _data_read() _data_write() _data_write_block() " + - "_deep_replace() _default() _default_wp_die_handler() _delete_attachment_theme_mod() _deleted() _descendants() " + - "_destroycache() _diag() _disconnect() _draft_or_post_title() _e() _each() " + - "_encode() _encodearray() _endblock() _enddiff() _escape() _ex() " + - "_exec() _expandlinks() _fetch_remote_file() _fetch_with_format() _fill_empty_link_category() _fill_many_users() " + - "_fill_single_user() _fill_user() _fix_attachment_links() _fix_attachment_links_replace_cb() _flip_image_resource() _future_post_hook() " + - "_get_cron_array() _get_current_taxonomy() _get_custom_object_labels() _get_display_callback() _get_dropins() _get_form_callback() " + - "_get_meta_table() _get_page_link() _get_plugin_data_markup_translate() _get_post_ancestors() _get_template_edit_filename() _get_term_children() " + - "_get_term_hierarchy() _get_update_callback() _get_widget_id_base() _getcmd() _getlines() _getmatches() " + - "_getoptions() _getplink() _gettempdir() _gettransport() _hash_hmac() _http_build_query() " + - "_httprequest() _httpsrequest() _image_get_preview_ratio() _init() _init_caps() _insert_into_post_button() " + - "_insert_replace_helper() _intutf() _json_decode_object_helper() _lcspos() _lines() _links_add_base() " + - "_links_add_target() _list() _list_meta_row() _logmsg() _make_cat_compat() _make_email_clickable_cb() " + - "_make_url_clickable_cb() _make_web_ftp_clickable_cb() _map() _maybe_update_core() _maybe_update_plugins() _maybe_update_themes() " + - "_mb_substr() _media_button() _mime_types() _multisite_getusersblogs() _n() _n_noop() " + - "_nav_menu_item_id_use_once() _nc() _nx() _nx_noop() _p() _pad_term_counts() " + - "_page_rows() _page_traverse_name() _parse_json() _parse_xml() _post_row() _post_states() " + - "_posttransport() _prepare_post_body() _preview_theme_stylesheet_filter() _preview_theme_template_filter() _print_scripts() _publish_post_hook() " + - "_quit() _readbool() _readmsg() _readnull() _readnumber() _readstring() " + - "_real_escape() _register() _register_one() _register_widget_form_callback() _register_widget_update_callback() _register_widgets() " + - "_relatedtarget() _relocate_children() _response_to_rss() _rotate_image_resource() _save_post_hook() _search_plugins_filter_callback() " + - "_set() _set_cron_array() _set_preview() _settimeout() _settype() _shiftboundaries() " + - "_show_post_preview() _sort_nav_menu_items() _splitonwords() _startblock() _startdiff() _strip_newlines() " + - "_stripform() _striplinks() _striptext() _tag_row() _term_rows() _transition_post_status() " + - "_unhtmlentities() _unzip_file_pclzip() _unzip_file_ziparchive() _update_post_term_count() _upgrade_cron_array() _usort_terms_by_id() " + - "_usort_terms_by_name() _utfutf() _walk_bookmarks() _weak_escape() _wp_ajax_add_hierarchical_term() _wp_ajax_delete_comment_response() " + - "_wp_ajax_menu_quick_search() _wp_auto_add_pages_to_menu() _wp_call_all_hook() _wp_comment_row() _wp_dashboard_control_callback() _wp_dashboard_recent_comments_row() " + - "_wp_delete_orphaned_draft_menu_items() _wp_delete_post_menu_item() _wp_delete_tax_menu_item() _wp_dependency() _wp_filter_build_unique_id() _wp_filter_taxonomy_base() " + - "_wp_get_comment_list() _wp_get_post_autosave_hack() _wp_get_user_contactmethods() _wp_http_get_object() _wp_kses_decode_entities_chr() _wp_kses_decode_entities_chr_hexdec() " + - "_wp_menu_item_classes_by_context() _wp_menu_output() _wp_nav_menu_meta_box_object() _wp_oembed_get_object() _wp_post_revision_fields() _wp_post_thumbnail_class_filter() " + - "_wp_post_thumbnail_class_filter_add() _wp_post_thumbnail_class_filter_remove() _wp_post_thumbnail_html() _wp_put_post_revision() _wp_relative_upload_path() _wp_specialchars() " + - "_wp_translate_postdata() _wptexturize_pushpop_element() _x() abort() absolutize() absolutize_url() " + - "abspath() accept_encoding() activate_plugin() activate_plugins() activate_sitewide_plugin() activatehandlers() " + - "add() add_action() add_blog_option() add_callback() add_cap() add_clean_index() " + - "add_comment_meta() add_comment_to_entry() add_comments_page() add_contextual_help() add_cssclass() add_custom_background() " + - "add_custom_image_header() add_dashboard_page() add_data() add_editor_style() add_enclosure_if_new() add_endpoint() " + - "add_entry() add_existing_user_to_blog() add_external_rule() add_feed() add_filter() add_global_groups() " + - "add_image_size() add_js() add_link() add_links_page() add_magic_quotes() add_management_page() " + - "add_media_page() add_menu_classes() add_menu_page() add_meta() add_meta_box() add_metadata() " + - "add_new_user_to_blog() add_object_page() add_option() add_option_update_handler() add_option_whitelist() add_options_page() " + - "add_pages_page() add_permastruct() add_ping() add_plugins_page() add_post_meta() add_post_type_support() " + - "add_posts_page() add_query_arg() add_query_var() add_rewrite_endpoint() add_rewrite_rule() add_rewrite_tag() " + - "add_role() add_rule() add_settings_error() add_settings_field() add_settings_section() add_shortcode() " + - "add_strings() add_submenu_page() add_theme_page() add_theme_support() add_thickbox() add_to_blinklist() " + - "add_to_blogmarks() add_to_delicious() add_to_digg() add_to_furl() add_to_magnolia() add_to_myweb() " + - "add_to_newsvine() add_to_reddit() add_to_segnalo() add_to_service() add_to_simpy() add_to_spurl() " + - "add_to_wists() add_user() add_user_meta() add_user_to_blog() add_users_page() add_utility_page() " + - "addaddress() addarray() addattachment() addbcc() addcall() addcallback() " + - "addcc() addclassestolist() addcustomheader() addedline() addembeddedimage() addmethods() " + - "addrappend() addreplyto() addrformat() addselectvalue() addslashes_gpc() addstringattachment() " + - "addtext() addtocache() addtwonumbers() adjacent_image_link() adjacent_post_link() adjacent_posts_rel_link() " + - "adjacent_posts_rel_link_wp_head() adjust() admin_color_scheme_picker() admin_created_user_email() admin_created_user_subject() admin_load() " + - "admin_notice_feed() admin_page() admin_url() after() akismet_admin_init() akismet_admin_warnings() " + - "akismet_auto_check_comment() akismet_caught() akismet_check_db_comment() akismet_check_for_spam_button() akismet_check_server_connectivity() akismet_conf() " + - "akismet_config_page() akismet_counter() akismet_delete_old() akismet_get_host() akismet_get_key() akismet_get_server_connectivity() " + - "akismet_get_user_roles() akismet_http_post() akismet_init() akismet_kill_proxy_check() akismet_manage_page() akismet_nonce_field() " + - "akismet_recheck_button() akismet_recheck_queue() akismet_result_spam() akismet_rightnow() akismet_server_connectivity_ok() akismet_set_comment_status() " + - "akismet_spam_comments() akismet_spam_count() akismet_spam_totals() akismet_spamtoham() akismet_stats() akismet_stats_display() " + - "akismet_stats_page() akismet_stats_script() akismet_submit_nonspam_comment() akismet_submit_spam_comment() akismet_transition_comment_status() akismet_verify_key() " + - "akismet_warning() all() all_deps() allow_subdirectory_install() allow_subdomain_install() allowed_tags() " + - "anchorposition_getpageoffsetleft() anchorposition_getpageoffsettop() anchorposition_getwindowoffsetleft() anchorposition_getwindowoffsettop() animatestart() animateto() " + - "animmode() antispambot() any() apop() append() append_content() " + - "append_editor() apply() apply_filters() apply_filters_ref_array() areamousedown() areamousemove() " + - "argumentnames() array_unique_noempty() aspectratioxy() aspectratioyx() atime() atom__construct_type() " + - "atom__construct_type() atom__content_construct_type() atom_enclosure() atomparser() atomserver() attach_uploads() " + - "attachall() attachwhendone() attribute_escape() auth_redirect() auth_required() authenticate() " + - "authentication() authentication_header() author_can() autodiscovery() autoembed() autoembed_callback() " + - "automatic_feed_links() autosave_disable_buttons() autosave_enable_buttons() autosave_loading() autosave_parse_response() autosave_saved() " + - "autosave_saved_new() autosave_update_slug() avoid_blog_page_permalink_collision() background_color() background_image() backslashit() " + - "bad_request() bail() balancetags() baseencodewrapmb() before() before_last_bar() " + - "before_version_name() bind() bindaseventlistener() blank() block_request() blogger_deletepost() " + - "blogger_editpost() blogger_getpost() blogger_getrecentposts() blogger_gettemplate() blogger_getuserinfo() blogger_getusersblogs() " + - "blogger_newpost() blogger_settemplate() bloginfo() bloginfo_rss() blurry() body() " + - "body_class() bool_from_yn() build_query() build_query_string() buildcookieheader() bulk_edit_posts() " + - "bulk_footer() bulk_header() bulk_upgrade() bulk_upgrader_skin() bump_request_timeout() cache_javascript_headers() " + - "cache_oembed() cache_users() calculatetype() calendar_week_mod() call() callback() " + - "camelize() cancel_comment_reply_link() cancelcrop() cancelselection() cancelupload() capital_p_dangit() " + - "capitalize() cat_is_ancestor_of() category_description() category_exists() cb() cdata() " + - "cdup() change_encoding() changedtype() changefinalcolor() check_admin_referer() check_ajax_referer() " + - "check_and_publish_future_post() check_cache() check_column() check_comment() check_comment_flood_db() check_database_version() " + - "check_import_new_users() check_pass_strength() check_server_timer() check_upload_mimes() check_upload_size() checkcache() " + - "checkdeficiency() checked() checkipv() checkpassword() checkreadystate() checkwords() " + - "choose_primary_blog() chunktransferdecode() clean_attachment_cache() clean_bookmark_cache() clean_category_cache() clean_comment_cache() " + - "clean_object_term_cache() clean_page_cache() clean_post_cache() clean_pre() clean_term_cache() clean_url() " + - "clean_user_cache() clear() clear_global_post_cache() clearaddresses() clearallrecipients() clearattachments() " + - "clearbccs() clearccs() clearcustomheaders() clearreplytos() clickhandler() client_error() " + - "clone() close() closefullscreen() cmpr_strlen() codepoint_to_utf() codepress_footer_js() " + - "codepress_get_lang() collect() colname() colorpicker() colorpicker_highlightcolor() colorpicker_pickcolor() " + - "colorpicker_select() colorpicker_show() colorpicker_writediv() comment_author() comment_author_email() comment_author_email_link() " + - "comment_author_ip() comment_author_link() comment_author_rss() comment_author_url() comment_author_url_link() comment_block() " + - "comment_class() comment_date() comment_excerpt() comment_exists() comment_footer_die() comment_form() " + - "comment_form_title() comment_guid() comment_id() comment_id_fields() comment_link() comment_reply_link() " + - "comment_text() comment_text_rss() comment_time() comment_type() comments_link() comments_link_feed() " + - "comments_number() comments_open() comments_popup_link() comments_popup_script() comments_rss() comments_rss_link() " + - "comments_template() compatible_gzinflate() compress() compress_parse_url() compression_test() compute_string_distance() " + - "computecolor() concat() confirm_another_blog_signup() confirm_blog_signup() confirm_delete_users() confirm_user_signup() " + - "connect() connected() consume() consume_range() content_encoding() content_url() " + - "contextline() convert_chars() convert_smilies() convert_to_screen() convertentities() converthextorgb() " + - "convertrgbtohex() convertversionstring() copy_dir() core_update_footer() core_upgrade_preamble() count_imported_posts() " + - "count_many_users_posts() count_user_posts() count_users() countaddedlines() countdeletedlines() create() " + - "create_attachment() create_empty_blog() create_initial_post_types() create_initial_taxonomies() create_post() create_user() " + - "createbody() created() createdragger() createhandles() createheader() createmover() " + - "crypt_private() css_includes() cssclass() current_after() current_before() current_filter() " + - "current_theme_info() current_theme_supports() current_time() current_user_can() current_user_can_for_blog() curry() " + - "custom_background() custom_image_header() cwd() d() dashboard_quota() dashboardtotals() " + - "dasherize() data() datahtml() date_asctime() date_in() date_rfc() " + - "date_rfc() date_strtotime() date_wcdtf() db_connect() db_version() dbdelta() " + - "deactivate_plugin_before_upgrade() deactivate_plugins() deactivate_sitewide_plugin() debug() debug_fclose() debug_fopen() " + - "debug_fwrite() decode() decompress() default_password_nag() default_password_nag_edit_user() default_password_nag_handler() " + - "default_topic_count_scale() default_topic_count_text() defer() delay() delayed_autosave() delete() " + - "delete_all_user_settings() delete_attachment() delete_blog_option() delete_comment_meta() delete_get_calendar_cache() delete_meta() " + - "delete_metadata() delete_oembed_caches() delete_old_plugin() delete_old_theme() delete_option() delete_plugins() " + - "delete_post() delete_post_meta() delete_post_meta_by_key() delete_theme() delete_transient() delete_user_meta() " + - "delete_user_option() delete_user_setting() delete_usermeta() deletebyindex() deletedline() deleteerror() " + - "deletesuccess() deleteusersetting() dequeue() deslash() destroy() detect() " + - "did_action() diff() difference() dirlist() disablecrop() disabled() " + - "disablehandles() discover() discover_pingback_server_uri() dismiss_core_update() dismissed_updates() dispatch() " + - "display_cached_file() display_callback() display_element() display_header() display_page_row() display_plugins_table() " + - "display_setup_form() display_space_usage() display_theme() display_themes() displayitems() div() " + - "do_action() do_action_ref_array() do_activate_header() do_all_pings() do_core_upgrade() do_dismiss_core_update() " + - "do_enclose() do_feed() do_feed_atom() do_feed_rdf() do_feed_rss() do_feed_rss() " + - "do_footer_items() do_head_items() do_item() do_items() do_meta_boxes() do_paging() " + - "do_robots() do_settings_fields() do_settings_sections() do_shortcode() do_shortcode_tag() do_signup_header() " + - "do_strip_htmltags() do_trackbacks() do_undismiss_core_update() docmouseup() documentation_link() dolly_css() " + - "domain_exists() domove() done() doneselect() donudge() doparentsubmit() " + - "doresize() doupdate() download_package() download_url() drag_drop_help() dragdiv() " + - "dragmodehandler() drop_index() dropdown_categories() dropdown_cats() dropdown_link_categories() duplicate() " + - "dvortr() dynamic_sidebar() eachslice() echo_entry() edaddtag() edbutton() " + - "edcheckopentags() edclosealltags() edinsertcontent() edinsertimage() edinsertlink() edinserttag() " + - "edit_bookmark_link() edit_comment() edit_comment_link() edit_link() edit_post() edit_post_link() " + - "edit_tag_link() edit_user() edlink() edquicklink() edremovetag() edshowbutton() " + - "edshowlinks() edspell() edtoolbar() element() element_implode() email_exists() " + - "embed() embed_flash() embed_flv() embed_odeo() embed_quicktime() embed_wmedia() " + - "empty() emptyline() enable_cache() enable_order_by_date() enable_xml_dump() enablecrop() " + - "enablehandles() encode() encode() encode_instead_of_strip() encodefile() encodeheader() " + - "encodeq() encodeq_callback() encodeqp() encodestring() encodeunsafe() encoding() " + - "encoding_equals() encoding_name() encoding_value() end_el() end_element() end_lvl() " + - "end_ns() endboundary() endelement() endswith() enqueue() enqueue_comment_hotkeys_js() " + - "entncr() entities_decode() entity() error() error_handler() errorcode() " + - "errorinfo() errorname() esc_attr() esc_attr__() esc_attr_e() esc_attr_x() " + - "esc_html() esc_html__() esc_html_e() esc_html_x() esc_js() esc_sql() " + - "esc_url() esc_url_raw() escape() escape_by_ref() escapehtml() evaljson() " + - "evalscripts() evx() evy() exists() expand() export() " + - "export_entries() export_entry() export_headers() export_original() export_to_file() export_translations() " + - "export_wp() extend() extendelementwith() extension() extract_from_markers() extractbyindex() " + - "extractscripts() f() fallback() fatal() favorite_actions() features() " + - "feed_cdata() feed_content_type() feed_end_element() feed_links() feed_links_extra() feed_or_html() " + - "feed_start_element() feedback() fetch() fetch_feed() fetch_rss() fetchform() " + - "fetchlinks() fetchtext() fget() file_is_displayable_image() file_is_valid_image() file_name() " + - "file_upload_upgrader() filedialogcomplete() filedialogstart() filequeued() filequeueerror() fileupload() " + - "fill_query_vars() filter_ssl() find() find_base_dir() find_core_update() find_folder() " + - "find_posts_div() findall() finddomclass() findelement() finished() fire() " + - "firecontentloadedevent() first() fix_import_form_size() fix_phpmailer_messageid() fix_protocol() fixeol() " + - "flatten() flipcoords() fliptab() floated_admin_avatar() flush_output() flush_rewrite_rules() " + - "flush_rules() flush_widget_cache() footer() for_blog() forbidden() force_balance_tags() " + - "force_feed() force_fsockopen() force_ssl_content() form() form_callback() form_option() " + - "format_code_lang() format_to_edit() format_to_post() fput() fs_connect() ftp() " + - "ftp_base() funky_javascript_callback() funky_javascript_fix() g() gallery_shortcode() gd_edit_image_support() " + - "generate_random_password() generate_rewrite_rule() generate_rewrite_rules() generatenamedcolors() generatepicker() generatepreview() " + - "generatewebcolors() generic_ping() generic_strings() gensalt_blowfish() gensalt_extended() gensalt_private() " + - "get() get__template() get_accepted_content_type() get_active_blog_for_user() get_adjacent_post() get_adjacent_post_rel_link() " + - "get_admin_page_parent() get_admin_page_title() get_admin_url() get_admin_users_for_domain() get_all_category_ids() get_all_discovered_feeds() " + - "get_all_page_ids() get_all_user_settings() get_alloptions() get_alloptions_() get_allowed_mime_types() get_allowed_themes() " + - "get_approved_comments() get_archive_template() get_archives() get_archives_link() get_attached_file() get_attachment() " + - "get_attachment_fields_to_edit() get_attachment_icon() get_attachment_icon_src() get_attachment_innerhtml() get_attachment_link() get_attachment_taxonomies() " + - "get_attachment_template() get_attachments() get_attachments_url() get_attribution() get_author() get_author_feed_link() " + - "get_author_link() get_author_name() get_author_permastruct() get_author_posts_url() get_author_rss_link() get_author_template() " + - "get_author_user_ids() get_authority() get_authors() get_autotoggle() get_available_languages() get_available_post_mime_types() " + - "get_available_post_statuses() get_avatar() get_background_color() get_background_image() get_base() get_base_dir() " + - "get_bitrate() get_blog_count() get_blog_details() get_blog_id_from_url() get_blog_list() get_blog_option() " + - "get_blog_permalink() get_blog_post() get_blog_prefix() get_blog_status() get_blogaddress_by_domain() get_blogaddress_by_id() " + - "get_blogaddress_by_name() get_bloginfo() get_bloginfo_rss() get_blogs_of_user() get_body_class() get_bookmark() " + - "get_bookmark_field() get_bookmarks() get_boundary_post() get_boundary_post_rel_link() get_broken_themes() get_byteorder() " + - "get_calendar() get_caller() get_cancel_comment_reply_link() get_caption() get_captions() get_cat_id() " + - "get_cat_name() get_categories() get_categories_url() get_categories_xml() get_category() get_category_by_path() " + - "get_category_by_slug() get_category_children() get_category_feed_link() get_category_link() get_category_parents() get_category_permastruct() " + - "get_category_rss_link() get_category_template() get_category_to_edit() get_catname() get_channel_tags() get_channels() " + - "get_children() get_clean_basedomain() get_cli_args() get_col() get_col_info() get_column_headers() " + - "get_comment() get_comment_author() get_comment_author_email() get_comment_author_email_link() get_comment_author_ip() get_comment_author_link() " + - "get_comment_author_rss() get_comment_author_url() get_comment_author_url_link() get_comment_class() get_comment_count() get_comment_date() " + - "get_comment_excerpt() get_comment_feed_permastruct() get_comment_guid() get_comment_id() get_comment_id_fields() get_comment_link() " + - "get_comment_meta() get_comment_pages_count() get_comment_reply_link() get_comment_statuses() get_comment_text() get_comment_time() " + - "get_comment_to_edit() get_comment_type() get_commentdata() get_comments() get_comments_link() get_comments_number() " + - "get_comments_pagenum_link() get_comments_popup_template() get_content() get_contents() get_contents_array() get_contributor() " + - "get_contributors() get_copyright() get_core_updates() get_credit() get_credits() get_curl_version() " + - "get_current_byte() get_current_column() get_current_line() get_current_site() get_current_site_name() get_current_theme() " + - "get_current_user_id() get_currentuserinfo() get_custom_fields() get_dashboard_blog() get_data() get_date() " + - "get_date_from_gmt() get_date_permastruct() get_date_template() get_day_link() get_day_permastruct() get_default_feed() " + - "get_default_link_to_edit() get_default_page_to_edit() get_default_post_to_edit() get_delete_post_link() get_description() get_dirsize() " + - "get_dropins() get_duration() get_edit_bookmark_link() get_edit_comment_link() get_edit_post_link() get_edit_tag_link() " + - "get_editable_authors() get_editable_roles() get_editable_user_ids() get_element() get_email() get_enclosed() " + - "get_enclosure() get_enclosures() get_encoding() get_endtime() get_entries_url() get_entry() " + - "get_entry_url() get_error_code() get_error_codes() get_error_data() get_error_message() get_error_messages() " + - "get_error_string() get_expression() get_extended() get_extension() get_extra_permastruct() get_favicon() " + - "get_feed() get_feed_link() get_feed_permastruct() get_feed_tags() get_field_id() get_field_name() " + - "get_file() get_file_description() get_filesystem_method() get_footer() get_fragment() get_framerate() " + - "get_front_page_template() get_gmt_from_date() get_handler() get_hash() get_hashes() get_header() " + - "get_header_image() get_header_textcolor() get_height() get_hidden_columns() get_hidden_meta_boxes() get_home_path() " + - "get_home_template() get_home_url() get_host() get_html() get_id() get_id_from_blogname() " + - "get_image_height() get_image_link() get_image_send_to_editor() get_image_tag() get_image_tags() get_image_title() " + - "get_image_url() get_image_width() get_images_from_uri() get_imported_comments() get_imported_posts() get_importers() " + - "get_index_rel_link() get_index_template() get_inline_data() get_intermediate_image_sizes() get_iri() get_item() " + - "get_item_quantity() get_item_tags() get_items() get_keyword() get_keywords() get_label() " + - "get_language() get_last_updated() get_lastcommentmodified() get_lastpostdate() get_lastpostmodified() get_latitude() " + - "get_length() get_lines() get_link() get_link_to_edit() get_linkcatname() get_linkobjects() " + - "get_linkobjectsbyname() get_linkrating() get_links() get_links_list() get_links_withrating() get_linksbyname() " + - "get_linksbyname_withrating() get_local_date() get_locale() get_locale_stylesheet_uri() get_longitude() get_manifest() " + - "get_media_item() get_media_items() get_media_url() get_medium() get_meridiem() get_meta_keys() " + - "get_metadata() get_month() get_month_abbrev() get_month_link() get_month_permastruct() get_most_active_blogs() " + - "get_most_recent_post_of_user() get_mu_plugins() get_name() get_names() get_nav_menu_locations() get_next_comments_link() " + - "get_next_post() get_next_posts_link() get_next_posts_page_link() get_nonauthor_user_ids() get_num_queries() get_number_of_root_elements() " + - "get_object_taxonomies() get_object_term_cache() get_objects_in_term() get_option() get_others_drafts() get_others_pending() " + - "get_others_unpublished_posts() get_page() get_page_by_path() get_page_by_title() get_page_children() get_page_hierarchy() " + - "get_page_link() get_page_of_comment() get_page_permastruct() get_page_statuses() get_page_template() get_page_templates() " + - "get_page_uri() get_paged_template() get_pagenum_link() get_pages() get_parent_post_rel_link() get_path() " + - "get_pending_comments_num() get_permalink() get_player() get_plugin_data() get_plugin_files() get_plugin_page_hook() " + - "get_plugin_page_hookname() get_plugin_updates() get_plugins() get_plural_forms_count() get_port() get_post() " + - "get_post_ancestors() get_post_class() get_post_comments_feed_link() get_post_custom() get_post_custom_keys() get_post_custom_values() " + - "get_post_field() get_post_meta() get_post_meta_by_id() get_post_mime_type() get_post_mime_types() get_post_modified_time() " + - "get_post_permalink() get_post_reply_link() get_post_stati() get_post_status() get_post_status_object() get_post_statuses() " + - "get_post_taxonomies() get_post_thumbnail_id() get_post_time() get_post_to_edit() get_post_type() get_post_type_capabilities() " + - "get_post_type_labels() get_post_type_object() get_post_types() get_postdata() get_posts() get_posts_by_author_sql() " + - "get_posts_nav_link() get_preferred_from_update_core() get_previous_comments_link() get_previous_post() get_previous_posts_link() get_previous_posts_page_link() " + - "get_private_posts_cap_sql() get_profile() get_publish_time() get_pung() get_queried_object() get_queried_object_id() " + - "get_query() get_query_template() get_query_var() get_random_bytes() get_rating() get_ratings() " + - "get_real_file_to_edit() get_real_type() get_registered_nav_menus() get_relationship() get_restriction() get_restrictions() " + - "get_results() get_role() get_role_caps() get_row() get_rss() get_sample_permalink() " + - "get_sample_permalink_html() get_sampling_rate() get_scheme() get_search_comments_feed_link() get_search_feed_link() get_search_form() " + - "get_search_link() get_search_permastruct() get_search_query() get_search_template() get_service() get_service_url() " + - "get_settings() get_settings_errors() get_shortcode_regex() get_shortcut_link() get_sidebar() get_single_template() " + - "get_site_allowed_themes() get_site_url() get_sitestats() get_size() get_source() get_source_tags() " + - "get_space_allowed() get_starttime() get_status_header_desc() get_stylesheet() get_stylesheet_directory() get_stylesheet_directory_uri() " + - "get_stylesheet_uri() get_super_admins() get_tag() get_tag_feed_link() get_tag_link() get_tag_permastruct() " + - "get_tag_template() get_tags() get_tags_to_edit() get_taxonomies() get_taxonomy() get_taxonomy_labels() " + - "get_taxonomy_template() get_temp_dir() get_template() get_template_directory() get_template_directory_uri() get_template_part() " + - "get_term() get_term_by() get_term_children() get_term_feed_link() get_term_field() get_term_link() " + - "get_term_to_edit() get_terms() get_terms_to_edit() get_text() get_the_attachment_link() get_the_author() " + - "get_the_author_aim() get_the_author_description() get_the_author_email() get_the_author_firstname() get_the_author_icq() get_the_author_id() " + - "get_the_author_lastname() get_the_author_link() get_the_author_login() get_the_author_meta() get_the_author_msn() get_the_author_nickname() " + - "get_the_author_posts() get_the_author_url() get_the_author_yim() get_the_category() get_the_category_by_id() get_the_category_list() " + - "get_the_category_rss() get_the_content() get_the_content_feed() get_the_date() get_the_excerpt() get_the_generator() " + - "get_the_guid() get_the_id() get_the_modified_author() get_the_modified_date() get_the_modified_time() get_the_password_form() " + - "get_the_post_thumbnail() get_the_tag_list() get_the_tags() get_the_taxonomies() get_the_term_list() get_the_terms() " + - "get_the_time() get_the_title() get_the_title_rss() get_theme() get_theme_data() get_theme_mod() " + - "get_theme_root() get_theme_root_uri() get_theme_roots() get_theme_updates() get_themes() get_thumbnail() " + - "get_thumbnails() get_title() get_to_ping() get_trackback_url() get_transient() get_translations_for_domain() " + - "get_type() get_udims() get_upload_iframe_src() get_upload_space_available() get_url() get_user_by() " + - "get_user_by_email() get_user_count() get_user_details() get_user_id_from_string() get_user_meta() get_user_metavalues() " + - "get_user_option() get_user_setting() get_user_to_edit() get_userdata() get_userdatabylogin() get_userinfo() " + - "get_usermeta() get_usernumposts() get_users_drafts() get_users_of_blog() get_value() get_var() " + - "get_weekday() get_weekday_abbrev() get_weekday_initial() get_weekstartend() get_width() get_wp_title_rss() " + - "get_year_link() get_year_permastruct() getallusersettings() getanchorposition() getanchorwindowposition() getattr() " + - "getbool() getboundary() getbrowserhtml() getcapabilities() getchmod() getcolor() " + - "getcolorpickerhtml() getcorner() getcount() getcsssize() getcurrentresult() getdelim() " + - "getdiff() getelementswithclassname() geterrorcode() geterrormessage() getfile() getfilename() " + - "getfinal() getfixed() getformat() getfullheader() gethchmod() getheadervalue() " + - "getint() getiso() getlength() getlevel() getlocation() getlogger() " + - "getmailmime() getmaxfiles() getmaxsize() getmedialisthtml() getnumchmodfromh() getoffset() " + - "getoriginal() getparams() getpath() getpos() getrect() getrequestparam() " + - "getresponse() getrgb() getrootelement() getselection() getselectvalue() getstr() " + - "getstyle() getsuggestions() gettext_select_plural_form() gettimestamp() gettoken() gettokenname() " + - "getupdate() getusersetting() getvalue() getxml() glob_pattern_match() glob_regexp() " + - "global_terms() gonext() goprev() got_mod_rewrite() graceful_fail() grant_super_admin() " + - "grep() group() gsub() gzip_compression() handle_() handle_content_type() " + - "handle_request() handle_upload() has_action() has_cap() has_data() has_excerpt() " + - "has_filter() has_meta() has_nav_menu() has_post_thumbnail() has_tag() hash_hmac() " + - "hashpassword() hasmethod() hasmultibytes() have_comments() have_posts() head() " + - "header_image() header_text() header_textcolor() headerline() hello() hello_dolly() " + - "hello_dolly_get_lyric() help() hide() hide_errors() home_url() host() " + - "html_type_rss() htmlentities() htmlspecialchars_decode() http_version() human_time_diff() iframe_footer() " + - "iframe_header() iis_add_rewrite_rule() iis_delete_rewrite_rule() iis_rewrite_rule_exists() iis_save_url_rewrite_rules() iis_supports_permalinks() " + - "iis_url_rewrite_rules() image() image_add_caption() image_align_input_fields() image_attachment_fields_to_edit() image_attachment_fields_to_save() " + - "image_constrain_size_for_editor() image_downsize() image_edit_apply_changes() image_get_intermediate_size() image_hwstring() image_link_input_fields() " + - "image_make_intermediate_size() image_media_send_to_editor() image_resize() image_resize_dimensions() image_selector() image_size_input_fields() " + - "img_caption_shortcode() imgload() imgmousedown() import_from_file() import_from_reader() in_category() " + - "in_default_dir() in_the_loop() include() includes_url() index() index_rel_link() " + - "indexof() info() ingroupsof() init() init_query_flags() initialise_blog_option_info() " + - "initialize() initialmenumaxdepth() inject() inline_edit_row() inline_edit_term_row() inlineimageexists() " + - "insert() insert_blog() insert_editor() insert_plain_editor() insert_with_markers() insertaction() " + - "insertborder() insertchar() insertdragbar() inserthandle() inserthelpiframe() insertmedia() " + - "inspect() install() install_blog() install_blog_defaults() install_dashboard() install_featured() " + - "install_global_terms() install_network() install_new() install_package() install_plugin_information() install_plugin_install_status() " + - "install_plugins_upload() install_popular() install_popular_tags() install_search() install_search_form() install_strings() " + - "install_theme_information() install_theme_search() install_theme_search_form() install_themes_dashboard() install_themes_feature_list() install_themes_featured() " + - "install_themes_new() install_themes_updated() install_themes_upload() install_updated() interfaceupdate() interleave_changed_lines() " + - "internal_error() interpolate() intersect() invalid_media() invoke() is_() " + - "is_active_sidebar() is_active_widget() is_admin() is_archive() is_archived() is_atom() " + - "is_attachment() is_author() is_available() is_binary() is_blog_installed() is_blog_user() " + - "is_category() is_child_theme() is_client_error() is_comment_feed() is_comments_popup() is_date() " + - "is_day() is_declared_content_ns() is_dynamic_sidebar() is_email() is_email_address_unsafe() is_enabled() " + - "is_error() is_exists() is_feed() is_front_page() is_home() is_info() " + - "is_isegment_nz_nc() is_lighttpd_before_() is_linear_whitespace() is_local_attachment() is_main_blog() is_month() " + - "is_multisite() is_nav_menu() is_nav_menu_item() is_network_only_plugin() is_new_day() is_object_in_taxonomy() " + - "is_object_in_term() is_ok() is_page() is_page_template() is_paged() is_plugin_active() " + - "is_plugin_active_for_network() is_plugin_page() is_post_type_hierarchical() is_preview() is_redirect() is_robots() " + - "is_role() is_rss() is_rtl() is_search() is_serialized() is_serialized_string() " + - "is_server_error() is_single() is_singular() is_site_admin() is_sticky() is_subdomain_install() " + - "is_success() is_super_admin() is_tag() is_tax() is_taxonomy() is_taxonomy_hierarchical() " + - "is_term() is_textdomain_loaded() is_time() is_trackback() is_uninstallable_plugin() is_upload_space_available() " + - "is_user_logged_in() is_user_member_of_blog() is_user_option_local() is_user_over_quota() is_user_spammy() is_valid() " + - "is_wp_error() is_wpmu_sitewide_plugin() is_year() isarray() isdebugenabled() iselement() " + - "isempty() iserror() iserrorenabled() isfatalenabled() isfunction() ishash() " + - "ishtml() isinfoenabled() isjson() isleftclick() ismail() ismiddleclick() " + - "isnumber() iso_timezone_to_offset() iso_to_datetime() isqmail() isrightclick() issendmail() " + - "issmtp() isstring() isstruct() isundefined() isvisible() iswarnenabled() " + - "itemajaxerror() iter() ixr_base() ixr_client() ixr_clientmulticall() ixr_date() " + - "ixr_error() ixr_introspectionserver() ixr_message() ixr_request() ixr_server() ixr_value() " + - "js() js_() js_() js_escape() js_includes() jsencode() " + - "json_decode() json_encode() keys() klass() kses_init() kses_init_filters() " + - "kses_remove_filters() lang() language_attributes() last() lastindexof() lcs() " + - "length() length_required() level_reduction() like_escape() linear_whitespace() link_advanced_meta_box() " + - "link_cat_row() link_categories_meta_box() link_pages() link_submit_meta_box() link_target_meta_box() link_xfn_meta_box() " + - "links_add_base_url() links_add_target() links_popup_script() list_authors() list_cats() list_core_update() " + - "list_files() list_meta() list_plugin_updates() list_theme_updates() listcontent() listmethods() " + - "load() load_child_theme_textdomain() load_default_textdomain() load_image_to_edit() load_muplugin_textdomain() load_plugin_textdomain() " + - "load_template() load_textdomain() load_theme_textdomain() locale_stylesheet() localize() locate_template() " + - "log_app() login() login_header() login_pass_ok() logio() loopback() " + - "lowercase_octets() magpierss() mailsend() main() maintenance_mode() maintenance_nag() " + - "make_clickable() make_db_current() make_db_current_silent() make_entry() make_headers() make_plural_form_function() " + - "make_site_theme() make_site_theme_from_default() make_site_theme_from_oldschool() make_url_footnote() makeobj() manage_columns_prefs() " + - "map_attrs() map_meta_cap() maybe_add_column() maybe_add_existing_user_to_blog() maybe_create_table() maybe_disable_automattic_widgets() " + - "maybe_drop_column() maybe_make_link() maybe_redirect_() maybe_run_ajax_cache() maybe_serialize() maybe_unserialize() " + - "mce_escape() mce_put_file() mctabs() mdel() mdtm() media_buttons() " + - "media_handle_sideload() media_handle_upload() media_post_single_attachment_fields_to_edit() media_send_to_editor() media_sideload_image() media_single_attachment_fields_to_edit() " + - "media_upload_audio() media_upload_bypass_url() media_upload_file() media_upload_flash_bypass() media_upload_form() media_upload_form_handler() " + - "media_upload_gallery() media_upload_gallery_form() media_upload_header() media_upload_html_bypass() media_upload_image() media_upload_library() " + - "media_upload_library_form() media_upload_tabs() media_upload_type_form() media_upload_type_url_form() media_upload_use_flash() media_upload_video() " + - "menu_page_url() merge() merge_items() merge_with() meta_box_prefs() meta_form() " + - "methodhelp() methodize() methodsignature() mget() min_whitespace() mmkdir() " + - "mod_rewrite_rules() mouseabs() move() movecontent() movehandles() moveoffset() " + - "moveto() movingmousemove() moxiecode_json() moxiecode_jsonreader() moxiecode_logger() mput() " + - "ms_cookie_constants() ms_deprecated_blogs_file() ms_file_constants() ms_not_installed() ms_site_check() ms_subdomain_constants() " + - "ms_upload_constants() msghtml() mt_getcategorylist() mt_getpostcategories() mt_getrecentposttitles() mt_gettrackbackpings() " + - "mt_publishpost() mt_setpostcategories() mt_supportedmethods() mt_supportedtextfilters() mtime() mu_dropdown_languages() " + - "mu_options() multicall() mw_editpost() mw_getcategories() mw_getpost() mw_getrecentposts() " + - "mw_newmediaobject() mw_newpost() mycursor() mysqldate() name_value() native_embed() " + - "network_admin_url() network_domain_check() network_home_url() network_site_url() network_step() network_step() " + - "new_line() new_user_email_admin_notice() newblog_notify_siteadmin() newselection() newtracker() newuser_notify_siteadmin() " + - "next_comment() next_comments_link() next_image_link() next_post() next_post_link() next_post_rel_link() " + - "next_posts() next_posts_link() next_widget_id_number() nextpage() nextresult() nfinal() " + - "nlist() no_content() no_update_actions() nocache_headers() noindex() noop() " + - "norig() normalize() normalize_url() normalize_whitespace() not_allowed() not_found() " + - "nplurals_and_expression_from_header() ns_to_prefix() number_format_in() observe() ok() onblur() " + - "oncatchange() onendcrop() onloadinit() openbrowser() opplockcorner() option_update_filter() " + - "output() output_javascript() owner() page_attributes_meta_box() page_links() page_rewrite_rules() " + - "page_rows() page_template_dropdown() page_uri_index() paged_walk() paginate_comments_links() paginate_links() " + - "parent_dropdown() parent_post_rel_link() parenthesize_plural_exression() parentscroll() parse() parse_banner() " + - "parse_date() parse_iri() parse_mime() parse_query() parse_query_vars() parse_request() " + - "parse_wcdtf() parsecolor() parsecontextdiff() parseiso() parsekey() parselisting() " + - "parsetimestamp() parsetxt() parseunifieddiff() partition() pass() pass_cache_data() " + - "pass_file_data() passive() password() passwordhash() passwordstrength() patchcallback() " + - "path_is_absolute() path_join() pathinfo() pclzip() pclziputilcopyblock() pclziputiloptiontext() " + - "pclziputilpathinclusion() pclziputilpathreduction() pclziputilrename() pclziputiltranslatewinpath() pct() peek() " + - "percent_encoding_normalization() permalink_anchor() permalink_link() permalink_single_rss() pick() pickcolor() " + - "pingback() pingback_extensions_getpingbacks() pingback_ping() pings_open() pluck() plugin_basename() " + - "plugin_dir_path() plugin_dir_url() plugin_info() plugin_installer_skin() plugin_sandbox_scrape() plugin_upgrader_skin() " + - "plugins_api() plugins_search_help() plugins_url() poify() pointer() pointerx() " + - "pointery() polldoscroll() pomo_cachedfilereader() pomo_cachedintfilereader() pomo_filereader() pomo_reader() " + - "pomo_stringreader() pop() pop_list() poperror() popstat() populate_network() " + - "populate_options() populate_roles() populate_roles_() populate_roles_() populate_roles_() populate_roles_() " + - "populate_roles_() populate_roles_() populate_roles_() populate_roles_() popuplinks() popupwindow() " + - "popupwindow_attachlistener() popupwindow_autohide() popupwindow_getxyposition() popupwindow_hideifnotclicked() popupwindow_hidepopup() popupwindow_hidepopupwindows() " + - "popupwindow_isclicked() popupwindow_populate() popupwindow_refresh() popupwindow_setsize() popupwindow_seturl() popupwindow_setwindowproperties() " + - "popupwindow_showpopup() port() pos() post() post_author_meta_box() post_categories_meta_box() " + - "post_class() post_comment_meta_box() post_comment_meta_box_thead() post_comment_status_meta_box() post_comments_feed_link() post_custom() " + - "post_custom_meta_box() post_excerpt_meta_box() post_exists() post_password_required() post_permalink() post_preview() " + - "post_reply_link() post_revisions_meta_box() post_rows() post_slug_meta_box() post_submit_meta_box() post_tags_meta_box() " + - "post_thumbnail_meta_box() post_trackback_meta_box() post_type_exists() post_type_supports() postbox_classes() posts_nav_link() " + - "pre_schema_upgrade() preg_index() prep_atom_text_construct() prepare() prepare_query() prepare_simplepie_object_for_cache() " + - "prepare_vars_for_template_usage() preparemediaitem() preparemediaiteminit() preparereplacement() prepend_attachment() prepend_each_line() " + - "presize() press_it() prev_post_rel_link() preview_theme() preview_theme_ob_filter() preview_theme_ob_filter_callback() " + - "previewchar() previous_comments_link() previous_image_link() previous_post() previous_post_link() previous_posts() " + - "previous_posts_link() prevresult() print_admin_styles() print_column_headers() print_error() print_footer_scripts() " + - "print_head_scripts() print_plugin_actions() print_plugins_table() print_scripts() print_scripts_ln() privacy_ping_filter() " + - "privadd() privaddfile() privaddfilelist() privaddfileusingtempfile() privaddlist() privcalculatestoredfilename() " + - "privcheckfileheaders() privcheckformat() privclosefd() privconvertheaderfileinfo() privcreate() privdeletebyrule() " + - "privdircheck() privdisablemagicquotes() privduplicate() priverrorlog() priverrorreset() privextractbyrule() " + - "privextractfile() privextractfileasstring() privextractfileinoutput() privextractfileusingtempfile() privfiledescrexpand() privfiledescrparseatt() " + - "privlist() privmerge() privopenfd() privoptiondefaultthreshold() privparseoptions() privreadcentralfileheader() " + - "privreadendcentraldir() privreadfileheader() privswapbackmagicquotes() privwritecentralfileheader() privwritecentralheader() privwritefileheader() " + - "process_conditionals() process_default_headers() processheaders() processkey() processresponse() properties() " + - "pusherror() put() put_attachment() put_contents() put_file() put_post() " + - "pwd() px() query() query_posts() quit() quote() " + - "quote_char() quote_escaped() rawlist() read() read_all() read_entry() " + - "read_line() readaway() readint() readintarray() readtoken() readvalue() " + - "reason() rebound() recent_comments_style() recipient() recurse_dirsize() redirect() " + - "redirect_canonical() redirect_guess__permalink() redirect_mu_dashboard() redirect_post() redirect_this_site() redirect_user_to_blog() " + - "reduce_string() refresh() refresh_blog_details() refresh_user_details() register() register_activation_hook() " + - "register_admin_color_schemes() register_column_headers() register_deactivation_hook() register_default_headers() register_globals() register_handler() " + - "register_importer() register_nav_menu() register_nav_menus() register_new_user() register_post_status() register_post_type() " + - "register_setting() register_sidebar() register_sidebar_widget() register_sidebars() register_taxonomy() register_taxonomy_for_object_type() " + - "register_theme_directory() register_uninstall_hook() register_widget() register_widget_control() reject() rel_canonical() " + - "release() remove() remove_accents() remove_action() remove_all_actions() remove_all_caps() " + - "remove_all_filters() remove_all_shortcodes() remove_cap() remove_div() remove_dot_segments() remove_filter() " + - "remove_meta_box() remove_option_update_handler() remove_option_whitelist() remove_post_type_support() remove_query_arg() remove_rfc_comments() " + - "remove_role() remove_shortcode() remove_theme_mod() remove_theme_mods() remove_theme_support() remove_user_from_blog() " + - "removenetmaskspec() render() rendercharmaphtml() replace() replace_invalid_with_pct_encoding() replace_urls() " + - "request() request_filesystem_credentials() require_if_theme_supports() reset_password() resetposition() resize() " + - "resizeiframe() resizeiframeinit() resizeinputs() restore() restore_current_blog() results_are_paged() " + - "retrieve_password() retrieve_widgets() reverse() revoke_super_admin() rewind_comments() rewind_posts() " + - "rewrite_rules() rfc_strtime() rfcdate() rich_edit_exists() rsd_link() rss_enclosure() " + - "rsscache() run() run_command() run_shortcode() s() sack() " + - "safecss_filter_attr() sanitize() sanitize_bookmark() sanitize_bookmark_field() sanitize_category() sanitize_category_field() " + - "sanitize_comment_cookies() sanitize_email() sanitize_file_name() sanitize_html_class() sanitize_key() sanitize_option() " + - "sanitize_post() sanitize_post_field() sanitize_sql_orderby() sanitize_term() sanitize_term_field() sanitize_text_field() " + - "sanitize_title() sanitize_title_with_dashes() sanitize_url() sanitize_user() sanitize_user_field() sanitize_user_object() " + - "save() save_mod_rewrite_rules() save_settings() savecontent() savedomdocument() sayhello() " + - "scan() screen_icon() screen_layout() screen_meta() screen_options() script_concat_settings() " + - "search_for_folder() search_technorati() search_theme_directories() secret_salt_warning() secureheader() seekto() " + - "seems_utf() select() select_plural_form() selectbyvalue() selectcurrentresult() selectdrag() " + - "selected() selectingmousemove() self_link() selx() sely() send() " + - "send_cmd() send_confirmation_on_profile_email() send_headers() send_through_proxy() send_to_editor() sendandmail() " + - "sendhello() sendmailsend() sendmsg() sendormail() separate_comments() serializeparameters() " + - "serve() serve_request() serverhostname() servervar() services_json() services_json_error() " + - "set() set_() set_author_class() set_authority() set_autodiscovery_cache_duration() set_autodiscovery_level() " + - "set_blog() set_blog_id() set_cache_class() set_cache_duration() set_cache_location() set_cache_name_function() " + - "set_caption_class() set_category_base() set_category_class() set_content_type_sniffer_class() set_copyright_class() set_credit_class() " + - "set_current_entry() set_current_screen() set_current_user() set_custom_fields() set_editor() set_enclosure_class() " + - "set_favicon_handler() set_feed_url() set_file() set_file_class() set_fragment() set_group() " + - "set_header() set_headers() set_host() set_image_handler() set_input_encoding() set_item_class() " + - "set_item_limit() set_javascript() set_locator_class() set_max_checked_feeds() set_output_encoding() set_parser_class() " + - "set_path() set_permalink_structure() set_port() set_post_thumbnail_size() set_post_type() set_prefix() " + - "set_query() set_query_var() set_rating_class() set_raw_data() set_restriction_class() set_result() " + - "set_role() set_sanitize_class() set_scheme() set_screen_options() set_source_class() set_stupidly_fast() " + - "set_submit_multipart() set_submit_normal() set_tag_base() set_theme_mod() set_timeout() set_transient() " + - "set_upgrader() set_url_replacements() set_user() set_user_setting() set_useragent() set_userinfo() " + - "setbool() setbrowserdisabled() setcallbacks() setcapabilities() setcol() setcookies() " + - "setcurrent() setcursor() setendian() seterror() setfilename() setformat() " + - "setlanguage() setlevel() setmaxfiles() setmaxsize() setmessagetype() setoptions() " + - "setoptionsnew() setpath() setpressed() setselect() setselection() setselectraw() " + - "setserver() setstr() settimeout() settings_errors() settings_fields() setumask() " + - "setup_photo_actions() setup_postdata() setup_userdata() setusersetting() setwordwrap() setwrap() " + - "shake() shortcode() shortcode_atts() shortcode_parse_atts() shortcode_unautop() should_decode() " + - "show() show_blog_form() show_default_header_selector() show_errors() show_message() show_post_thumbnail_warning() " + - "show_user_form() showcolor() showhandles() shutdown_action_hook() sign() signup_another_blog() " + - "signup_blog() signup_nonce_check() signup_nonce_fields() signup_user() signuppageheaders() simplepie() " + - "simplepie_author() simplepie_cache() simplepie_cache_file() simplepie_cache_mysql() simplepie_caption() simplepie_category() " + - "simplepie_content_type_sniffer() simplepie_copyright() simplepie_credit() simplepie_decode_html_entities() simplepie_enclosure() simplepie_file() " + - "simplepie_gzdecode() simplepie_http_parser() simplepie_iri() simplepie_item() simplepie_locator() simplepie_parse_date() " + - "simplepie_rating() simplepie_restriction() simplepie_source() simplepie_xml_declaration_parser() single_cat_title() single_month_title() " + - "single_post_title() single_tag_title() site() site_admin_notice() site_url() size() " + - "size_format() skip() skip_whitespace() smtp() smtpclose() smtpconnect() " + - "smtpsend() sort_items() sort_menu() sortby() space_seperated_tokens() spawn_cron() " + - "spellchecker() split_ns() splitv() standalone_equals() standalone_name() standalone_value() " + - "start_el() start_element() start_lvl() start_ns() start_post_rel_link() start_wp() " + - "startdragmode() startelement() startselection() startswith() stats() status() " + - "status_header() step() step_() step_() step_() stick_post() " + - "sticky_class() stop() stop_the_insanity() stopobserving() str() stream_preview_image() " + - "strip() strip_attributes() strip_clf() strip_comments() strip_htmltags() strip_shortcodes() " + - "stripalpha() stripscripts() stripslashes_deep() striptags() strlen() styleoptions() " + - "sub() subclass() submit() submithandler() submitlinks() submittext() " + - "subscribe_aol() subscribe_bloglines() subscribe_eskobo() subscribe_feed() subscribe_feedfeeds() subscribe_feedster() " + - "subscribe_google() subscribe_gritwire() subscribe_itunes() subscribe_msn() subscribe_netvibes() subscribe_newsburst() " + - "subscribe_newsgator() subscribe_odeo() subscribe_outlook() subscribe_podcast() subscribe_podnova() subscribe_rojo() " + - "subscribe_service() subscribe_url() subscribe_yahoo() succ() suggest() supports_collation() " + - "suppress_errors() swfuploadloadfailed() swfuploadpreload() switch_theme() switch_to_blog() switchtype() " + - "switchuploader() sync_category_tag_slugs() systype() tables() tag_close() tag_description() " + - "tag_escape() tag_exists() tag_open() tag_rows() take_action() taxonomy_exists() " + - "tb_click() tb_close() tb_detectmacxff() tb_getpagesize() tb_init() tb_parsequery() " + - "tb_position() tb_remove() tb_show() tb_showiframe() tellscaled() tellselect() " + - "term_description() term_exists() test() text_diff() text_diff_op_add() text_diff_op_change() " + - "text_diff_op_copy() text_diff_op_delete() text_diff_renderer() text_diff_renderer_table() text_mappeddiff() text_or_binary() " + - "textline() the_attachment_link() the_attachment_links() the_attachments_url() the_author() the_author_aim() " + - "the_author_description() the_author_email() the_author_firstname() the_author_icq() the_author_id() the_author_lastname() " + - "the_author_link() the_author_login() the_author_meta() the_author_msn() the_author_nickname() the_author_posts() " + - "the_author_posts_link() the_author_url() the_author_yim() the_categories_url() the_category() the_category_head() " + - "the_category_id() the_category_rss() the_comment() the_content() the_content_feed() the_content_rss() " + - "the_date() the_date_xml() the_editor() the_entries_url() the_entry_url() the_excerpt() " + - "the_excerpt_rss() the_feed_link() the_generator() the_guid() the_id() the_media_upload_tabs() " + - "the_media_url() the_meta() the_modified_author() the_modified_date() the_modified_time() the_permalink() " + - "the_permalink_rss() the_post() the_post_password() the_post_thumbnail() the_search_query() the_shortlink() " + - "the_tags() the_taxonomies() the_terms() the_time() the_title() the_title_attribute() " + - "the_title_rss() the_weekday() the_weekday_date() the_widget() theme_info() theme_installer_skin() " + - "theme_update_available() theme_upgrader_skin() themes_api() throwerror() time_hms() timer_start() " + - "timer_stop() times() tinymce_include() toarray() toback() tocolorpart() " + - "tofront() toggle_text() togglewordwrap() tohtml() tojson() toobject() " + - "toospath() top() topaddedstring() toquerypair() toqueryparams() toquerystring() " + - "touch_time() toxml() trackback() trackback_rdf() trackback_response() trackback_url() " + - "trackback_url_list() trackmove() trackup() trailingslashit() translate() translate_entry() " + - "translate_level_to_cap() translate_level_to_role() translate_plural() translate_smiley() translate_user_role() translate_with_context() " + - "translate_with_gettext_context() translation_entry() trim_quotes() trimnewlines() trimsize() truncate() " + - "turn() twentyten_admin_header_style() twentyten_auto_excerpt_more() twentyten_comment() twentyten_continue_reading_link() twentyten_custom_excerpt_more() " + - "twentyten_excerpt_length() twentyten_page_menu_args() twentyten_posted_in() twentyten_posted_on() twentyten_remove_gallery_css() twentyten_remove_recent_comments_style() " + - "twentyten_setup() twentyten_widgets_init() type_url_form_audio() type_url_form_file() type_url_form_image() type_url_form_video() " + - "uidl() uncomment_rfc() uncompress() unconsume() underscore() undismiss_core_update() " + - "unescapehtml() unfilterjson() uninstall_plugin() uniq() unknown() unload_textdomain() " + - "unloadhandler() unpack_package() unpoify() unregister() unregister_default_headers() unregister_handler() " + - "unregister_nav_menu() unregister_setting() unregister_sidebar() unregister_sidebar_widget() unregister_widget() unregister_widget_control() " + - "unscale() unset() unset_children() unstick_post() untrailingslashit() unzip_file() " + - "update() update_archived() update_attached_file() update_blog_details() update_blog_option() update_blog_public() " + - "update_blog_status() update_callback() update_category_cache() update_comment_cache() update_comment_meta() update_core() " + - "update_gallery_tab() update_home_siteurl() update_meta() update_meta_cache() update_metadata() update_nag() " + - "update_object_term_cache() update_option() update_option_new_admin_email() update_page_cache() update_post_cache() update_post_caches() " + - "update_post_meta() update_postmeta_cache() update_posts_count() update_recently_edited() update_right_now_message() update_term_cache() " + - "update_timer() update_user_caches() update_user_level_from_caps() update_user_meta() update_user_option() update_user_status() " + - "update_usermeta() updatecolor() updatecount() updatecurrentdepth() updatelight() updatemediaform() " + - "updatemenumaxdepth() updatepreview() updatesharedvars() updatetext() updatevisibility() updatevisible() " + - "upgrade() upgrade_() upgrade_() upgrade_() upgrade_() upgrade_() " + - "upgrade_() upgrade_() upgrade__old_tables() upgrade__options_table() upgrade_() upgrade_() " + - "upgrade_() upgrade_() upgrade_() upgrade_() upgrade_() upgrade_all() " + - "upgrade_network() upgrade_old_slugs() upgrade_strings() upit() upload_is_file_too_big() upload_is_user_over_quota() " + - "upload_size_limit_filter() upload_space_setting() uploadcomplete() uploaderror() uploadprogress() uploadstart() " + - "uploadsuccess() url_shorten() url_to_postid() urlencode_deep() use_authentication() use_codepress() " + - "use_ssl_preference() user() user_can_access_admin_page() user_can_create_draft() user_can_create_post() user_can_delete_post() " + - "user_can_delete_post_comments() user_can_edit_post() user_can_edit_post_comments() user_can_edit_post_date() user_can_edit_user() user_can_richedit() " + - "user_can_set_post_date() user_pass_ok() user_row() user_trailingslashit() username() username_exists() " + - "users_can_register_signup_filter() using_index_permalinks() using_mod_rewrite_permalinks() using_permalinks() utfutf() utfutf() " + - "utf_bad_replace() utf_uri_encode() utfcharboundary() valid_unicode() validate_active_plugins() validate_another_blog_signup() " + - "validate_blog_form() validate_blog_signup() validate_current_theme() validate_email() validate_file_to_edit() validate_plugin() " + - "validate_user_form() validate_user_signup() validate_username() value() value_char() values() " + - "verify() version_equals() version_name() version_value() viewx() viewy() " + - "wa_posts_where_include_drafts_filter() walk() walk_category_dropdown_tree() walk_category_tree() walk_nav_menu_tree() walk_page_dropdown_tree() " + - "walk_page_tree() warn() watchkeys() weblog_ping() welcome_user_msg_filter() widget() " + - "widget_akismet() widget_akismet_control() widget_akismet_register() widget_akismet_style() win_is_writable() windows__to_utf() " + - "without() wlwmanifest_link() wordpressmu_wp_mail_from() wp() wp_add_dashboard_widget() wp_add_post_tags() " + - "wp_admin_css() wp_admin_css_color() wp_admin_css_uri() wp_ajax_response() wp_allow_comment() wp_attachment_is_image() " + - "wp_attempt_focus() wp_authenticate() wp_authenticate_cookie() wp_authenticate_username_password() wp_blacklist_check() wp_cache_add() " + - "wp_cache_add_global_groups() wp_cache_add_non_persistent_groups() wp_cache_close() wp_cache_delete() wp_cache_flush() wp_cache_get() " + - "wp_cache_init() wp_cache_replace() wp_cache_reset() wp_cache_set() wp_category_checklist() wp_check_filetype() " + - "wp_check_filetype_and_ext() wp_check_for_changed_slugs() wp_check_invalid_utf() wp_check_mysql_version() wp_check_password() wp_check_php_mysql_versions() " + - "wp_check_post_lock() wp_clear_auth_cookie() wp_clear_scheduled_hook() wp_clearcookie() wp_clone() wp_comment_form_unfiltered_html_nonce() " + - "wp_comment_reply() wp_comment_trashnotice() wp_constrain_dimensions() wp_content_dir() wp_convert_bytes_to_hr() wp_convert_hr_to_bytes() " + - "wp_convert_widget_settings() wp_cookie_constants() wp_count_attachments() wp_count_comments() wp_count_posts() wp_count_terms() " + - "wp_create_categories() wp_create_category() wp_create_nav_menu() wp_create_nonce() wp_create_post_autosave() wp_create_tag() " + - "wp_create_term() wp_create_thumbnail() wp_create_user() wp_cron() wp_crop_image() wp_dashboard() " + - "wp_dashboard_cached_rss_widget() wp_dashboard_empty() wp_dashboard_incoming_links() wp_dashboard_incoming_links_control() wp_dashboard_incoming_links_output() wp_dashboard_plugins() " + - "wp_dashboard_plugins_output() wp_dashboard_primary() wp_dashboard_primary_control() wp_dashboard_quick_press() wp_dashboard_quick_press_output() wp_dashboard_recent_comments() " + - "wp_dashboard_recent_comments_control() wp_dashboard_recent_drafts() wp_dashboard_right_now() wp_dashboard_rss_control() wp_dashboard_rss_output() wp_dashboard_secondary() " + - "wp_dashboard_secondary_control() wp_dashboard_secondary_output() wp_dashboard_setup() wp_dashboard_trigger_widget_control() wp_debug_mode() wp_default_editor() " + - "wp_default_scripts() wp_default_styles() wp_defer_comment_counting() wp_defer_term_counting() wp_delete_attachment() wp_delete_category() " + - "wp_delete_comment() wp_delete_link() wp_delete_nav_menu() wp_delete_object_term_relationships() wp_delete_post() wp_delete_post_revision() " + - "wp_delete_term() wp_delete_user() wp_deletecategory() wp_deletecomment() wp_deletepage() wp_dependencies() " + - "wp_deregister_script() wp_deregister_style() wp_die() wp_doc_link_parse() wp_dropdown_categories() wp_dropdown_cats() " + - "wp_dropdown_pages() wp_dropdown_roles() wp_dropdown_users() wp_edit_attachments_query() wp_edit_posts_query() wp_editcomment() " + - "wp_editpage() wp_embed() wp_embed_defaults() wp_embed_handler_googlevideo() wp_embed_register_handler() wp_embed_unregister_handler() " + - "wp_enqueue_script() wp_enqueue_scripts() wp_enqueue_style() wp_error() wp_exif_datets() wp_exif_fracdec() " + - "wp_expand_dimensions() wp_explain_nonce() wp_exttype() wp_favicon_request() wp_feed_cache() wp_feed_cache_transient() " + - "wp_filesystem() wp_filesystem_direct() wp_filesystem_ftpext() wp_filesystem_ftpsockets() wp_filesystem_ssh() wp_filter_comment() " + - "wp_filter_kses() wp_filter_nohtml_kses() wp_filter_post_kses() wp_fix_server_vars() wp_footer() wp_functionality_constants() " + - "wp_generate_attachment_metadata() wp_generate_auth_cookie() wp_generate_password() wp_generate_tag_cloud() wp_generator() wp_get_active_and_valid_plugins() " + - "wp_get_archives() wp_get_associated_nav_menu_items() wp_get_attachment_image() wp_get_attachment_image_src() wp_get_attachment_link() wp_get_attachment_metadata() " + - "wp_get_attachment_thumb_file() wp_get_attachment_thumb_url() wp_get_attachment_url() wp_get_comment_status() wp_get_cookie_login() wp_get_current_commenter() " + - "wp_get_current_user() wp_get_http() wp_get_http_headers() wp_get_link_cats() wp_get_links() wp_get_linksbyname() " + - "wp_get_mu_plugins() wp_get_nav_menu_items() wp_get_nav_menu_object() wp_get_nav_menu_to_edit() wp_get_nav_menus() wp_get_nocache_headers() " + - "wp_get_object_terms() wp_get_original_referer() wp_get_post_autosave() wp_get_post_categories() wp_get_post_cats() wp_get_post_revision() " + - "wp_get_post_revisions() wp_get_post_tags() wp_get_post_terms() wp_get_recent_posts() wp_get_referer() wp_get_schedule() " + - "wp_get_schedules() wp_get_shortlink() wp_get_sidebars_widgets() wp_get_single_post() wp_get_widget_defaults() wp_getauthors() " + - "wp_getcomment() wp_getcommentcount() wp_getcomments() wp_getcommentstatuslist() wp_getoptions() wp_getpage() " + - "wp_getpagelist() wp_getpages() wp_getpagestatuslist() wp_getpagetemplates() wp_getpoststatuslist() wp_gettags() " + - "wp_getusersblogs() wp_guess_url() wp_handle_sideload() wp_handle_upload() wp_handle_upload_error() wp_hash() " + - "wp_hash_password() wp_head() wp_html_excerpt() wp_htmledit_pre() wp_http() wp_http_cookie() " + - "wp_iframe() wp_image_editor() wp_imagecreatetruecolor() wp_import_cleanup() wp_import_handle_upload() wp_import_upload_form() " + - "wp_importer() wp_initial_constants() wp_initial_nav_menu_meta_boxes() wp_insert_attachment() wp_insert_category() wp_insert_comment() " + - "wp_insert_link() wp_insert_post() wp_insert_term() wp_insert_user() wp_install() wp_install_defaults() " + - "wp_is_post_autosave() wp_is_post_revision() wp_iso_descrambler() wp_just_in_time_script_localization() wp_kses() wp_kses_array_lc() " + - "wp_kses_attr() wp_kses_bad_protocol() wp_kses_bad_protocol_once() wp_kses_bad_protocol_once() wp_kses_check_attr_val() wp_kses_data() " + - "wp_kses_decode_entities() wp_kses_hair() wp_kses_hook() wp_kses_html_error() wp_kses_js_entities() wp_kses_named_entities() " + - "wp_kses_no_null() wp_kses_normalize_entities() wp_kses_normalize_entities() wp_kses_normalize_entities() wp_kses_post() wp_kses_split() " + - "wp_kses_split() wp_kses_stripslashes() wp_kses_version() wp_link_category_checklist() wp_link_pages() wp_list_authors() " + - "wp_list_bookmarks() wp_list_categories() wp_list_cats() wp_list_comments() wp_list_pages() wp_list_post_revisions() " + - "wp_list_widget_controls() wp_list_widget_controls_dynamic_sidebar() wp_list_widgets() wp_load_alloptions() wp_load_core_site_options() wp_load_image() " + - "wp_locale() wp_localize_script() wp_login() wp_login_form() wp_login_url() wp_loginout() " + - "wp_logout() wp_logout_url() wp_lostpassword_url() wp_magic_quotes() wp_mail() wp_maintenance() " + - "wp_make_link_relative() wp_manage_media_columns() wp_manage_pages_columns() wp_manage_posts_columns() wp_match_mime_types() wp_matchesmapregex() " + - "wp_max_upload_size() wp_menu_unfold() wp_meta() wp_mime_type_icon() wp_mkdir_p() wp_nav_menu() " + - "wp_nav_menu_item_link_meta_box() wp_nav_menu_item_post_type_meta_box() wp_nav_menu_item_taxonomy_meta_box() wp_nav_menu_locations_meta_box() wp_nav_menu_manage_columns() wp_nav_menu_max_depth() " + - "wp_nav_menu_post_type_meta_boxes() wp_nav_menu_setup() wp_nav_menu_taxonomy_meta_boxes() wp_nav_menu_widget() wp_new_blog_notification() wp_new_comment() " + - "wp_new_user_notification() wp_newcategory() wp_newcomment() wp_newpage() wp_next_scheduled() wp_nonce_ays() " + - "wp_nonce_field() wp_nonce_tick() wp_nonce_url() wp_not_installed() wp_notify_moderator() wp_notify_postauthor() " + - "wp_object_cache() wp_oembed() wp_oembed_add_provider() wp_oembed_get() wp_old_slug_redirect() wp_original_referer_field() " + - "wp_page_menu() wp_parse_auth_cookie() wp_parse_str() wp_password_change_notification() wp_plugin_directory_constants() wp_plugin_update_row() " + - "wp_plugin_update_rows() wp_plugins_dir() wp_popular_terms_checklist() wp_post_mime_type_where() wp_post_revision_title() wp_pre_kses_less_than() " + - "wp_pre_kses_less_than_callback() wp_print_footer_scripts() wp_print_head_scripts() wp_print_scripts() wp_print_styles() wp_protect_special_option() " + - "wp_prototype_before_jquery() wp_publish_post() wp_query() wp_rand() wp_read_image_metadata() wp_redirect() " + - "wp_referer_field() wp_register() wp_register_script() wp_register_sidebar_widget() wp_register_style() wp_register_widget_control() " + - "wp_rel_nofollow() wp_rel_nofollow_callback() wp_remote_fopen() wp_remote_get() wp_remote_head() wp_remote_post() " + - "wp_remote_request() wp_remote_retrieve_body() wp_remote_retrieve_header() wp_remote_retrieve_headers() wp_remote_retrieve_response_code() wp_remote_retrieve_response_message() " + - "wp_reschedule_event() wp_reset_postdata() wp_reset_query() wp_reset_vars() wp_restore_image() wp_restore_post_revision() " + - "wp_revoke_user() wp_rewrite() wp_rewrite_rules() wp_richedit_pre() wp_role() wp_roles() " + - "wp_rss() wp_safe_redirect() wp_salt() wp_sanitize_redirect() wp_save_image() wp_save_image_file() " + - "wp_save_nav_menu_items() wp_save_post_revision() wp_schedule_event() wp_schedule_single_event() wp_script_is() wp_set_all_user_settings() " + - "wp_set_auth_cookie() wp_set_comment_status() wp_set_current_user() wp_set_internal_encoding() wp_set_lang_dir() wp_set_link_cats() " + - "wp_set_object_terms() wp_set_password() wp_set_post_categories() wp_set_post_cats() wp_set_post_lock() wp_set_post_tags() " + - "wp_set_post_terms() wp_set_sidebars_widgets() wp_set_wpdb_vars() wp_setcookie() wp_setoptions() wp_setup_nav_menu_item() " + - "wp_shake_js() wp_shortlink_header() wp_shortlink_wp_head() wp_shrink_dimensions() wp_sidebar_description() wp_signon() " + - "wp_simplepie_file() wp_spam_comment() wp_specialchars() wp_specialchars_decode() wp_sprintf() wp_sprintf_l() " + - "wp_ssl_constants() wp_start_object_cache() wp_stream_image() wp_strip_all_tags() wp_style_is() wp_style_loader_src() " + - "wp_suggestcategories() wp_tag_cloud() wp_templating_constants() wp_tempnam() wp_terms_checklist() wp_text_diff() " + - "wp_themes_dir() wp_throttle_comment_flood() wp_tiny_mce() wp_title() wp_title_rss() wp_transition_comment_status() " + - "wp_transition_post_status() wp_trash_comment() wp_trash_post() wp_trash_post_comments() wp_trim_excerpt() wp_unique_filename() " + - "wp_unique_post_slug() wp_unique_term_slug() wp_unregister_globals() wp_unregister_sidebar_widget() wp_unregister_widget_control() wp_unschedule_event() " + - "wp_unspam_comment() wp_untrash_comment() wp_untrash_post() wp_untrash_post_comments() wp_update_attachment_metadata() wp_update_category() " + - "wp_update_comment() wp_update_comment_count() wp_update_comment_count_now() wp_update_core() wp_update_link() wp_update_nav_menu_item() " + - "wp_update_nav_menu_object() wp_update_plugin() wp_update_plugins() wp_update_post() wp_update_term() wp_update_term_count() " + - "wp_update_term_count_now() wp_update_theme() wp_update_themes() wp_update_user() wp_upgrade() wp_upgrader() " + - "wp_upgrader_skin() wp_upload_bits() wp_upload_dir() wp_user() wp_user_search() wp_user_settings() " + - "wp_validate_auth_cookie() wp_validate_redirect() wp_verify_nonce() wp_version_check() wp_widget() wp_widget_archives() " + - "wp_widget_calendar() wp_widget_categories() wp_widget_control() wp_widget_description() wp_widget_factory() wp_widget_links() " + - "wp_widget_meta() wp_widget_pages() wp_widget_recent_comments() wp_widget_recent_posts() wp_widget_rss() wp_widget_rss_form() " + - "wp_widget_rss_output() wp_widget_rss_process() wp_widget_search() wp_widget_tag_cloud() wp_widget_text() wp_widgets_init() " + - "wp_write_post() wp_xmlrpc_server() wpautop() wpdb() wpfileerror() wpmu_activate_signup() " + - "wpmu_activate_stylesheet() wpmu_admin_do_redirect() wpmu_admin_redirect_add_updated_param() wpmu_checkavailablespace() wpmu_create_blog() wpmu_create_user() " + - "wpmu_current_site() wpmu_delete_blog() wpmu_delete_user() wpmu_get_blog_allowedthemes() wpmu_log_new_registrations() wpmu_menu() " + - "wpmu_signup_blog() wpmu_signup_blog_notification() wpmu_signup_stylesheet() wpmu_signup_user() wpmu_signup_user_notification() wpmu_update_blogs_date() " + - "wpmu_validate_blog_signup() wpmu_validate_user_signup() wpmu_welcome_notification() wpmu_welcome_user_notification() wpqueueerror() wpsetasthumbnail() " + - "wptexturize() wrap() wraptext() write_post() writeembed() writeflash() " + - "writequicktime() writerealmedia() writeshockwave() writewindowsmedia() wxr_cat_name() wxr_category_description() " + - "wxr_cdata() wxr_missing_parents() wxr_post_taxonomy() wxr_site_url() wxr_tag_description() wxr_tag_name() " + - "wxr_term_description() wxr_term_name() xfn_check() xml_encoding() xml_escape() xmlrpc_getpostcategory() " + - "xmlrpc_getposttitle() xmlrpc_removepostdata() zeroise() zip() " + - "PHPfunctionsusedonthesite abs() addcslashes() addslashes() array_change_key_case() " + - "array_diff() array_fill() array_filter() array_flip() array_intersect() array_key_exists() " + - "array_keys() array_map() array_merge() array_merge_recursive() array_pop() array_push() " + - "array_rand() array_reduce() array_reverse() array_search() array_shift() array_slice() " + - "array_splice() array_sum() array_unique() array_unshift() array_values() array_walk() " + - "arsort() asort() assert() atan() base_decode() base_encode() " + - "base_convert() basename() binhex() call_user_func() call_user_func_array() ceil() " + - "chdir() chgrp() chmod() chown() chr() chunk_split() " + - "class_exists() clearstatcache() closedir() compact() constant() copy() " + - "cos() count() count_chars() create_function() crypt() curl_close() " + - "curl_errno() curl_error() curl_exec() curl_getinfo() curl_init() curl_setopt() " + - "curl_version() current() date() debug_backtrace() dechex() decoct() " + - "define() defined() dirname() dl() each() end() " + - "ereg() ereg_replace() eregi() error_log() error_reporting() escapeshellarg() " + - "escapeshellcmd() exec() exif_read_data() exp() explode() extension_loaded() " + - "extract() fclose() feof() fflush() fgets() file() " + - "file_exists() file_get_contents() file_put_contents() fileatime() filegroup() filemtime() " + - "fileowner() fileperms() filesize() floatval() floor() flush() " + - "fread() fseek() fsockopen() ftell() ftp_chdir() ftp_chmod() " + - "ftp_close() ftp_connect() ftp_delete() ftp_fget() ftp_fput() ftp_get_option() " + - "ftp_login() ftp_mdtm() ftp_mkdir() ftp_nlist() ftp_pasv() ftp_pwd() " + - "ftp_rawlist() ftp_rename() ftp_rmdir() ftp_set_option() ftp_site() ftp_size() " + - "ftp_ssl_connect() ftp_systype() func_get_arg() func_get_args() func_num_args() function_exists() " + - "fwrite() get_class() get_class_methods() get_defined_constants() get_html_translation_table() get_magic_quotes_gpc() " + - "get_magic_quotes_runtime() get_object_vars() get_parent_class() getcwd() getdate() getenv() " + - "gethostbyaddr() gethostbyname() gethostbynamel() getimagesize() getmyuid() gettext() " + - "gettype() glob() gmdate() gmmktime() gzdeflate() gzencode() " + - "gzinflate() gzopen() gzuncompress() header() headers_sent() hexdec() " + - "html_entity_decode() htmlentities() htmlspecialchars() http_build_query() iconv_mime_decode() ignore_user_abort() " + - "imagealphablending() imageantialias() imagecolorstotal() imagecopy() imagecopyresampled() imagecreatefromgif() " + - "imagecreatefromjpeg() imagecreatefrompng() imagecreatefromstring() imagecreatetruecolor() imagedestroy() imagegif() " + - "imageistruecolor() imagejpeg() imagepng() imagerotate() imagesavealpha() imagesx() " + - "imagesy() imagetruecolortopalette() imagetypes() implode() in_array() ini_get() " + - "ini_set() intval() iplong() iptcparse() is_a() is_array() " + - "is_bool() is_callable() is_dir() is_executable() is_file() is_float() " + - "is_link() is_long() is_null() is_numeric() is_object() is_readable() " + - "is_resource() is_scalar() is_string() is_subclass_of() is_uploaded_file() is_writable() " + - "key() ksort() link() localtime() log() log() " + - "longip() ltrim() mail() max() mb_convert_encoding() mb_detect_encoding() " + - "mb_internal_encoding() mb_strlen() mb_strtolower() mb_substr() method_exists() microtime() " + - "mime_content_type() min() mkdir() mktime() move_uploaded_file() mt_rand() " + - "mysql_affected_rows() mysql_connect() mysql_error() mysql_fetch_field() mysql_fetch_object() mysql_fetch_row() " + - "mysql_free_result() mysql_get_server_info() mysql_insert_id() mysql_num_fields() mysql_num_rows() mysql_query() " + - "mysql_real_escape_string() mysql_select_db() mysql_unbuffered_query() name() natcasesort() next() " + - "nlbr() number_format() ob_end_clean() ob_end_flush() ob_get_clean() ob_get_contents() " + - "ob_get_flush() ob_get_length() ob_start() opendir() openssl_error_string() openssl_pkcs_sign() " + - "ord() pack() parse_str() parse_url() pathinfo() pclose() " + - "php_sapi_name() php_uname() phpversion() popen() posix_getgrgid() posix_getpwuid() " + - "pow() preg_match() preg_match_all() preg_quote() preg_replace() preg_replace_callback() " + - "preg_split() prev() print_r() pspell_check() pspell_config_create() pspell_new() " + - "pspell_new_config() pspell_suggest() quoted_printable_decode() rand() range() rawurldecode() " + - "rawurlencode() readfile() realpath() register_shutdown_function() rename() reset() " + - "restore_error_handler() rewind() rmdir() round() rtrim() serialize() " + - "set_error_handler() set_magic_quotes_runtime() set_time_limit() setcookie() settype() sha() " + - "shell_exec() shuffle() simplexml_load_string() sin() sleep() socket_accept() " + - "socket_bind() socket_close() socket_connect() socket_create() socket_getsockname() socket_last_error() " + - "socket_listen() socket_read() socket_set_option() socket_strerror() socket_write() sort() " + - "split() sqrt() srand() sscanf() str_pad() str_repeat() " + - "str_replace() str_split() strcasecmp() strcmp() strcspn() stream_context_create() " + - "stream_get_contents() stream_get_meta_data() stream_set_blocking() stream_set_timeout() strftime() strip_tags() " + - "stripcslashes() stripos() stripslashes() stristr() strnatcasecmp() strncmp() " + - "strpos() strrchr() strrev() strrpos() strspn() strstr() " + - "strtolower() strtotime() strtoupper() strtr() strval() substr() " + - "substr_count() substr_replace() tempnam() time() token_get_all() touch() " + - "trigger_error() trim() uasort() ucfirst() ucwords() uksort() " + - "umask() uniqid() unlink() unpack() unserialize() urldecode() " + - "urlencode() usort() utf_encode() var_export() version_compare() vsprintf() " + - "wordwrap() xml_error_string() xml_get_current_byte_index() xml_get_current_column_number() xml_get_current_line_number() xml_get_error_code() " + - "xml_parse() xml_parse_into_struct() xml_parser_create() xml_parser_create_ns() xml_parser_free() xml_parser_set_option() " + - "xml_set_character_data_handler() xml_set_default_handler() xml_set_element_handler() xml_set_end_namespace_decl_handler() xml_set_object() xml_set_start_namespace_decl_handler() " + - "zend_version() ").split(" "); - var phpKeywords = ("and or xor __FILE__ exception" + - "__LINE__ array() as break case" + - "class const continue declare default" + - "die do echo else elseif" + - "empty() enddeclare endfor endforeach endif" + - "endswitch endwhile eval() exit() extends" + - "for foreach function global if" + - "include() include_once() isset() list() new" + - "print() require() require_once() return() static" + - "switch unset() use var while" + - "__FUNCTION__ __CLASS__ __METHOD__ final php_user_filter" + - "interface implements instanceof public private" + - "protected abstract clone try catch" + - "throw this final __NAMESPACE__ namespace __DIR__").split(" "); - - function getCompletions(token, context) { - var found = [], start = token.string; - function maybeAdd(str) { - if (str.indexOf(start) == 0) found.push(str); - } - function gatherCompletions(obj) { - if (typeof obj == "string") forEach(stringProps, maybeAdd); - else if (obj instanceof Array) forEach(arrayProps, maybeAdd); - else if (obj instanceof Function) forEach(funcProps, maybeAdd); - for (var name in obj) maybeAdd(name); - } - - if (context) { - // If this is a property, see if it belongs to some object we can - // find in the current environment. - var obj = context.pop(), base; - if (obj.className == "cm-variable") - base = window[obj.string]; - else if (obj.className == "cm-string") - base = ""; - else if (obj.className == "cm-atom") - base = 1; - while (base != null && context.length) - base = base[context.pop().string]; - if (base != null) gatherCompletions(base); - } - else { - // If not, just look in the window object and any local scope - // (reading into JS mode internals to get at the local variables) - for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name); - forEach(funcProps, maybeAdd); - forEach(phpKeywords, maybeAdd); - } - return found; - } - - -})(); \ No newline at end of file + return found; + } +})(); From 1429ca37410d1c43c4d6a59db165a534e5ded847 Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Fri, 12 Dec 2014 15:49:06 -0400 Subject: [PATCH 22/30] PM-1113 Arreglar labels para PM3 - SOLVED --- workflow/engine/classes/class.pmFunctions.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index d587e29e3..b4b0229df 100755 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -821,17 +821,17 @@ function getEmailConfiguration () * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFSendMessage.28.29 * * @param string(32) | $caseId | UID for case | The UID (unique identification) for a case, which is a string of 32 hexadecimal characters to identify the case. - * @param string(32) | $sFrom | Email address | The email address of the person who sends out the email. - * @param string(100) | $sTo | Email receptor | The email address(es) to whom the email is sent. If multiple recipients, separate each email address with a comma. - * @param string(100) | $sCc = '' | Email address for copies | The email address(es) of people who will receive carbon copies of the email. - * @param string(100) | $sBcc = ''| Email address for copies hidden | The email address(es) of people who will receive blind carbon copies of the email. + * @param string(32) | $sFrom | Sender | The email address of the person who sends out the email. + * @param string(100) | $sTo | Recipient | The email address(es) to whom the email is sent. If multiple recipients, separate each email address with a comma. + * @param string(100) | $sCc = '' | Carbon copy recipient | The email address(es) of people who will receive carbon copies of the email. + * @param string(100) | $sBcc = ''| Carbon copy recipient | The email address(es) of people who will receive blind carbon copies of the email. * @param string(50) | $sSubject | Subject of the email | The subject (title) of the email. * @param string(50) | $sTemplate | Name of the template | The name of the template file in plain text or HTML format which will produce the body of the email. - * @param array | $aFields = array() | An optional associative array | Optional parameter. An associative array where the keys are the variable names and the values are the variables' values. + * @param array | $aFields = array() | Variables for email template | Optional parameter. An associative array where the keys are the variable names and the values are the variables' values. * @param array | $aAttachment = array() | Attachment | An Optional arrray. An array of files (full paths) to be attached to the email. - * @param boolean | $showMessage = true | Show message | Optional parameter. + * @param boolean | $showMessage = true | Show message | Optional parameter. Set to TRUE to show the message in the case's message history. * @param int | $delIndex = 0 | Delegation index of the case | Optional parameter. The delegation index of the current task in the case. - * @param array | $config = array() | Alternative Email Settings | An optional array: An array of parameters to be used in the Email sent (MESS_ENGINE, MESS_SERVER, MESS_PORT, MESS_FROM_MAIL, MESS_RAUTH, MESS_ACCOUNT, MESS_PASSWORD, and SMTPSecure). + * @param array | $config = array() | Email server configuration | An optional array: An array of parameters to be used in the Email sent (MESS_ENGINE, MESS_SERVER, MESS_PORT, MESS_FROM_MAIL, MESS_RAUTH, MESS_ACCOUNT, MESS_PASSWORD, and SMTPSecure). * @return int | | result | Result of sending email * */ From 9531d78fe190385bfdb30663ef8fc8f1a7c67ee5 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Fri, 12 Dec 2014 17:33:13 -0400 Subject: [PATCH 23/30] PM-1115 "16306: Date Field not showing next date after 1969" SOLVED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: 16306: Date Field not showing next date after 1969 Cause: Esto se debe a la funcion "mktime" de PHP para Windows el cual tiene una limitante en el rango de fechas (rango valido entre 1901 y 2038). Para mas detalles visite el sgte link ----> http://php.net/manual/en/function.mktime.php Solution: Se ha mejorado el metodo "calculateBeforeFormat" de la clase "XmlForm_Field_Date" el cual verifica el total de aƱde la fecha que se obtiene con "mktime"; esto solo para servidores Windows --- gulliver/system/class.xmlform.php | 127 +++++++++++++++++++----------- 1 file changed, 80 insertions(+), 47 deletions(-) diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 7911fec92..492e8081a 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -738,53 +738,53 @@ class XmlForm_Field $aValues = explode( '|', $oOwner->fields[$this->pmconnection]->keys ); $i = 0; if($aData == "" || count($aData['FIELDS']) < 1){ - $message = G::LoadTranslation( 'ID_PMTABLE_NOT_FOUND' ); + $message = G::LoadTranslation( 'ID_PMTABLE_NOT_FOUND' ); G::SendMessageText( $message, "WARNING" ); $sValue = ""; } else { - foreach ($aData['FIELDS'] as $aField) { - if ($aField['FLD_KEY'] == '1') { - // note added by gustavo cruz gustavo[at]colosa[dot]com - // this additional [if] checks if a case variable has been set - // in the keys attribute, so it can be parsed and replaced for - // their respective value. - if (preg_match( "/@#/", $aValues[$i] )) { - // check if a case are running in order to prevent that preview is - // erroneous rendered. - if (isset( $_SESSION['APPLICATION'] )) { - G::LoadClass( 'case' ); - $oApp = new Cases(); - if ($oApp->loadCase( $_SESSION['APPLICATION'] ) != null) { - $aFields = $oApp->loadCase( $_SESSION['APPLICATION'] ); - $formVariable = substr( $aValues[$i], 2 ); - if (isset( $aFields['APP_DATA'][$formVariable] )) { - $formVariableValue = $aFields['APP_DATA'][$formVariable]; - $aKeys[$aField['FLD_NAME']] = (isset( $formVariableValue ) ? G::replaceDataField( $formVariableValue, $oOwner->values ) : ''); - } else { - $aKeys[$aField['FLD_NAME']] = ''; - } - } else { - $aKeys[$aField['FLD_NAME']] = ''; - } - } else { - $aKeys[$aField['FLD_NAME']] = ''; - } - } else { - $aKeys[$aField['FLD_NAME']] = (isset( $aValues[$i] ) ? G::replaceDataField( $aValues[$i], $oOwner->values ) : ''); - } - $i ++; - } + foreach ($aData['FIELDS'] as $aField) { + if ($aField['FLD_KEY'] == '1') { + // note added by gustavo cruz gustavo[at]colosa[dot]com + // this additional [if] checks if a case variable has been set + // in the keys attribute, so it can be parsed and replaced for + // their respective value. + if (preg_match( "/@#/", $aValues[$i] )) { + // check if a case are running in order to prevent that preview is + // erroneous rendered. + if (isset( $_SESSION['APPLICATION'] )) { + G::LoadClass( 'case' ); + $oApp = new Cases(); + if ($oApp->loadCase( $_SESSION['APPLICATION'] ) != null) { + $aFields = $oApp->loadCase( $_SESSION['APPLICATION'] ); + $formVariable = substr( $aValues[$i], 2 ); + if (isset( $aFields['APP_DATA'][$formVariable] )) { + $formVariableValue = $aFields['APP_DATA'][$formVariable]; + $aKeys[$aField['FLD_NAME']] = (isset( $formVariableValue ) ? G::replaceDataField( $formVariableValue, $oOwner->values ) : ''); + } else { + $aKeys[$aField['FLD_NAME']] = ''; + } + } else { + $aKeys[$aField['FLD_NAME']] = ''; + } + } else { + $aKeys[$aField['FLD_NAME']] = ''; + } + } else { + $aKeys[$aField['FLD_NAME']] = (isset( $aValues[$i] ) ? G::replaceDataField( $aValues[$i], $oOwner->values ) : ''); + } + $i ++; + } } - try { - $aData = $oAdditionalTables->getDataTable( $oOwner->fields[$this->pmconnection]->pmtable, $aKeys ); - } catch (Exception $oError) { - $aData = array (); - } - if (isset( $aData[$this->pmfield] )) { - $sValue = $aData[$this->pmfield]; + try { + $aData = $oAdditionalTables->getDataTable( $oOwner->fields[$this->pmconnection]->pmtable, $aKeys ); + } catch (Exception $oError) { + $aData = array (); + } + if (isset( $aData[$this->pmfield] )) { + $sValue = $aData[$this->pmfield]; } } - + } } } @@ -4493,17 +4493,50 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText { $part1 = $sign * substr( $date, 0, strlen( $date ) - 1 ); $part2 = substr( $date, strlen( $date ) - 1 ); + + $year = (int)(date("Y")); + $month = (int)(date("m")); + $day = (int)(date("d")); + + $osIsLinux = strtoupper(substr(PHP_OS, 0, 3)) != "WIN"; + $checkYear = false; + switch ($part2) { - case 'd': - $res = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + $part1, date( 'Y' ) ) ); + case "y": + $year = $year + $part1; + + $res = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)); + + $checkYear = true; break; - case 'm': - $res = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ) + $part1, date( 'd' ), date( 'Y' ) ) ); + case "m": + $month = $month + $part1; + + $res = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)); + + if ($month > 12) { + $year = $year + (int)($month / 12); + + $checkYear = true; + } break; - case 'y': - $res = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + $part1 ) ); + case "d": + $res = date("Y-m-d", mktime(0, 0, 0, $month, $day + $part1, $year)); + + $dayAux = ($month * 31) - (31 - $day) + $part1; + + if ($dayAux > 365) { + $year = $year + (int)($dayAux / 365); + + $checkYear = true; + } break; } + + if (!$osIsLinux && $checkYear && !preg_match("/^$year\-\d{2}\-\d{2}$/", $res)) { + $res = preg_replace("/^\d{4}(\-\d{2}\-\d{2})$/", "$year$1", $res); + } + return $res; } From 9989cbbad688f19d777c31d249b998fdd24ffcab Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Fri, 12 Dec 2014 16:10:23 -0400 Subject: [PATCH 24/30] BUG-16459 Cases Notes: No muestra todo el texto introducido --- workflow/engine/templates/app/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/engine/templates/app/main.js b/workflow/engine/templates/app/main.js index 6a03efda2..cf514ff1a 100644 --- a/workflow/engine/templates/app/main.js +++ b/workflow/engine/templates/app/main.js @@ -173,7 +173,7 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU caseNotesWindow = new Ext.Window({ title: _('ID_CASES_NOTES'), //Title of the Window id: 'caseNotesWindowPanel', //ID of the Window Panel - width: 350, //Width of the Window + width: 380, //Width of the Window resizable: true, //Resize of the Window, if false - it cannot be resized closable: true, //Hide close button of the Window modal: modalSw, //When modal:true it make the window modal and mask everything behind it when displayed @@ -181,7 +181,7 @@ function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskU autoCreate: true, height:400, shadow:true, - minWidth:300, + minWidth:380, minHeight:200, proxyDrag: true, constrain: true, From aef82289c28d3d6823bf931ed7feebab70e71427 Mon Sep 17 00:00:00 2001 From: Luis Fernando Saisa Lopez Date: Sat, 13 Dec 2014 16:06:47 -0400 Subject: [PATCH 25/30] PM 940 "ProcessMaker-MA "Email Server (endpoints)"" SOLVED --- .../engine/src/ProcessMaker/BusinessModel/EmailServer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php index 0a6689359..b049ccb1a 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php @@ -940,11 +940,11 @@ class EmailServer //SQL $criteria = $this->getEmailServerCriteria(); - $criteria->add(EmailServerPeer::MESS_DEFAULT, 1, Criteria::EQUAL); + $criteria->add(\EmailServerPeer::MESS_DEFAULT, 1, \Criteria::EQUAL); //QUERY - $rsCriteria = EmailServerPeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rsCriteria = \EmailServerPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); From 4f52f0a4336929f42ae5ec7bb4d5c69693c6d819 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Sat, 13 Dec 2014 16:45:53 -0400 Subject: [PATCH 26/30] PM-1111 "16332: Grids with same name (Small fix)" SOLVED Small fix --- workflow/engine/methods/dynaforms/dynaforms_Save.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workflow/engine/methods/dynaforms/dynaforms_Save.php b/workflow/engine/methods/dynaforms/dynaforms_Save.php index 8a64a7774..16a145edc 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Save.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Save.php @@ -91,6 +91,7 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameDynaform') { //if ($aData['DYN_UID']==='') unset($aData['DYN_UID']); $dynaform = new dynaform(); + $dynaFormAux = new ProcessMaker\BusinessModel\DynaForm(); if (isset($aData["DYN_UID"])) { $dynaform->Save($aData); @@ -162,7 +163,8 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameDynaform') { $aDataAux = $aData; $aDataAux["DYN_TYPE"] = "grid"; - $aDataAux["DYN_TITLE"] = $copyDynGrdTitle . ((!$dynaformGrid->verifyExistingName($copyDynGrdTitle, $dynaform->getProUid()))? " (" . $dynaform->getDynTitle() . ")" : ""); + + $aDataAux["DYN_TITLE"] = $copyDynGrdTitle . (($dynaFormAux->existsTitle($dynaform->getProUid(), $copyDynGrdTitle))? " (" . $dynaform->getDynTitle() . ")" : ""); $aDataAux["DYN_DESCRIPTION"] = $copyDynGrdDescription; $aFields = $dynaformGrid->create($aDataAux); From 2f0053a66798333360540dc64d0603243c054ab6 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Sat, 13 Dec 2014 16:50:32 -0400 Subject: [PATCH 27/30] PM-1111 "16332: Grids with same name (Small fix)" SOLVED Small fix --- workflow/engine/methods/dynaforms/dynaforms_Save.php | 1 - 1 file changed, 1 deletion(-) diff --git a/workflow/engine/methods/dynaforms/dynaforms_Save.php b/workflow/engine/methods/dynaforms/dynaforms_Save.php index 16a145edc..f39e6a6f2 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Save.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Save.php @@ -163,7 +163,6 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameDynaform') { $aDataAux = $aData; $aDataAux["DYN_TYPE"] = "grid"; - $aDataAux["DYN_TITLE"] = $copyDynGrdTitle . (($dynaFormAux->existsTitle($dynaform->getProUid(), $copyDynGrdTitle))? " (" . $dynaform->getDynTitle() . ")" : ""); $aDataAux["DYN_DESCRIPTION"] = $copyDynGrdDescription; From f712cb4468da8623da866be1acfd0393558632e9 Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Tue, 16 Dec 2014 11:53:11 -0400 Subject: [PATCH 28/30] PM-1117 Paused Case - SOLVED --- workflow/engine/templates/cases/casesList.js | 37 ++++++++++++++------ 1 file changed, 27 insertions(+), 10 deletions(-) mode change 100644 => 100755 workflow/engine/templates/cases/casesList.js diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js old mode 100644 new mode 100755 index 80b3c8446..a40c81fa3 --- a/workflow/engine/templates/cases/casesList.js +++ b/workflow/engine/templates/cases/casesList.js @@ -25,17 +25,33 @@ var textJump; var ids = ''; var winReassignInCasesList; -function formatAMPM(date, initVal) { - var hours = date.getHours(); - var minutes = (initVal === true)? ((date.getMinutes()<15)? 0: ((date.getMinutes()<30)? 15: ((date.getMinutes()<45)? 30: 45))): date.getMinutes(); - var ampm = hours >= 12 ? 'PM' : 'AM'; - hours = hours % 12; - hours = hours ? hours : 12; // the hour '0' should be '12' - minutes = minutes < 10 ? '0' + minutes : minutes; - var strTime = hours + ':' + minutes + ' ' + ampm; +function formatAMPM(date, initVal, calendarDate) { + + var currentDate = new Date(); + var currentDay = currentDate.getDate(); + var currentMonth = currentDate.getMonth()+1; + if (currentDay < 10) { + currentDay = '0' + currentDay; + } + if (currentMonth < 10) { + currentMonth = '0' + currentMonth; + } + currentDate = currentMonth + '-' + currentDay; + if (currentDate == calendarDate) { + var hours = date.getHours(); + var minutes = (initVal === true)? ((date.getMinutes()<15)? 15: ((date.getMinutes()<30)? 30: ((date.getMinutes()<45)? 45: 45))): date.getMinutes(); + var ampm = hours >= 12 ? 'PM' : 'AM'; + hours = hours % 12; + hours = hours ? hours : 12; // the hour '0' should be '12' + minutes = minutes < 10 ? '0' + minutes : minutes; + var strTime = hours + ':' + minutes + ' ' + ampm; + } else { + var strTime = '12:00 AM'; + } return strTime; } + Ext.Ajax.timeout = 4 * 60 * 1000; var caseSummary = function() { @@ -248,13 +264,14 @@ function pauseCase(date){ items: [ { html: '
' + _('ID_PAUSE_CASE_TO_DATE') +' '+date.format('M j, Y')+'?

' + }, new Ext.form.TimeField({ id: 'unpauseTime', fieldLabel: _('ID_UNPAUSE_TIME'), name: 'unpauseTime', - value: formatAMPM(new Date(), false), - minValue: formatAMPM(new Date(), true), + value: formatAMPM(new Date(), false, date.format('m-d')), + minValue: formatAMPM(new Date(), true, date.format('m-d')), format: 'h:i A' }), { From f10fdd757239a00dcda6aec07b8906b45b21911a Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Tue, 16 Dec 2014 11:13:09 -0400 Subject: [PATCH 29/30] BUG 16211 Messages History: No muestra los mensajes enviados --- workflow/engine/methods/cases/caseMessageHistory_Ajax.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php index d97c6c00e..c1a2b056a 100755 --- a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php @@ -97,6 +97,8 @@ if ($actionAjax == 'messageHistoryGridList_JXP') { if ($respMess == 'BLOCK' || $respMess == '') { $appMessageArray[$index]['APP_MSG_BODY'] = ""; } + $appMessageArray[$index]['APP_MSG_BODY'] = str_replace('\"','"',$appMessageArray[$index]['APP_MSG_BODY']); + $appMessageArray[$index]['APP_MSG_BODY'] = str_replace('"','\"',$appMessageArray[$index]['APP_MSG_BODY']); $aProcesses[] = array_merge($appMessageArray[$index], array('MSGS_HISTORY' => $respMess)); } } From d4d9c5845fa940faabdfd5111d8ace701458adf6 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 16 Dec 2014 15:48:11 -0400 Subject: [PATCH 30/30] PMFormDesigner --- Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Rakefile b/Rakefile index 30f7e8c48..40f0a5ebb 100644 --- a/Rakefile +++ b/Rakefile @@ -243,6 +243,7 @@ def buildMafe(homeDir, targetDir, mode) "#{homeDir}/lib/jQueryLayout/jquery.layout.min.js" => "#{jsTargetDir}/jquery.layout.min.js", "#{homeDir}/lib/modernizr/modernizr.js" => "#{jsTargetDir}/modernizr.js" }) + system "cp -rf #{homeDir}/src/formDesigner/img/* #{mafeDir}/../img" puts "\nMichelangelo FE Build Finished\n".magenta end