diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php b/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php index 2df0651d4..8d7d14bd2 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php @@ -221,7 +221,7 @@ class Calendar $obj = \CalendarDefinitionPeer::retrieveByPK($calendarUid); if (!(is_object($obj) && get_class($obj) == "CalendarDefinition")) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $calendarUid), "The calendar with {0}: {1} does not exists"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $calendarUid), "The calendar with {0}: {1} does not exist."); throw (new \Exception($msg)); } @@ -301,7 +301,7 @@ class Calendar if (isset($arrayData["CAL_WORK_HOUR"])) { foreach ($arrayData["CAL_WORK_HOUR"] as $value) { if ($value["DAY"] != "ALL" && !in_array($value["DAY"], $arrayData["CAL_WORK_DAYS"])) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]), "Value specified for \"{0}\" does not exists in \"{1}\""))); + throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]), "Value specified for \"{0}\" does not exist in \"{1}\"."))); } $arrayCalendarWorkHour[] = array( @@ -408,7 +408,7 @@ class Calendar foreach ($arrayAux as $value) { if (isset($arrayData["CAL_WORK_HOUR"]) && $value["DAY"] != "ALL" && !in_array($value["DAY"], $calendarWorkDays)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]), "Value specified for \"{0}\" does not exists in \"{1}\""))); + throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]), "Value specified for \"{0}\" does not exist in \"{1}\"."))); } $arrayCalendarWorkHour[] = array( diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/CaseTrackerObject.php b/workflow/engine/src/ProcessMaker/BusinessModel/CaseTrackerObject.php index 1f83e44b6..315ffa524 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/CaseTrackerObject.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/CaseTrackerObject.php @@ -74,11 +74,11 @@ class CaseTrackerObject } if (!isset($arrayData["CTO_TYPE_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_TYPE_OBJ")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_TYPE_OBJ")), "Undefined value for \"{0}\", it is required."))); } if (!isset($arrayData["CTO_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_UID_OBJ")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_UID_OBJ")), "Undefined value for \"{0}\", it is required."))); } $step = new \ProcessMaker\BusinessModel\Step(); @@ -148,11 +148,11 @@ class CaseTrackerObject } if (isset($arrayData["CTO_TYPE_OBJ"]) && !isset($arrayData["CTO_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_UID_OBJ")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_UID_OBJ")), "Undefined value for \"{0}\", it is required."))); } if (!isset($arrayData["CTO_TYPE_OBJ"]) && isset($arrayData["CTO_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_TYPE_OBJ")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_TYPE_OBJ")), "Undefined value for \"{0}\", it is required."))); } if (isset($arrayData["CTO_TYPE_OBJ"]) && isset($arrayData["CTO_UID_OBJ"])) { @@ -324,7 +324,8 @@ class CaseTrackerObject * * @return void */ - public function moveCaseTrackerObject($cto_uid, $pro_uid, $cto_pos) { + public function moveCaseTrackerObject($cto_uid, $pro_uid, $cto_pos) + { $aCaseTrackerObject = CaseTracker::getCaseTrackerObjects($pro_uid); foreach ($aCaseTrackerObject as $dataCaseTracker) { diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php index 7e365383c..dbcc3752c 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php @@ -282,7 +282,7 @@ class DynaForm $rsCriteria = \DynaformPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $dynaFormUid), "The DynaForm with {0}: {1}, does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $dynaFormUid), "The DynaForm with {0}: {1}, does not exist."); throw (new \Exception($msg)); } @@ -512,27 +512,27 @@ class DynaForm $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true); if (!isset($arrayData["COPY_IMPORT"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT")), "Undefined value for \"{0}\", it is required."))); } if (!isset($arrayData["COPY_IMPORT"]["PRJ_UID"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID")), "Undefined value for \"{0}\", it is required."))); } $arrayData["COPY_IMPORT"]["PRJ_UID"] = trim($arrayData["COPY_IMPORT"]["PRJ_UID"]); if ($arrayData["COPY_IMPORT"]["PRJ_UID"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID")), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID")), "Invalid value for \"{0}\", it can not be empty."))); } if (!isset($arrayData["COPY_IMPORT"]["DYN_UID"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID")), "Undefined value for \"{0}\", it is required."))); } $arrayData["COPY_IMPORT"]["DYN_UID"] = trim($arrayData["COPY_IMPORT"]["DYN_UID"]); if ($arrayData["COPY_IMPORT"]["DYN_UID"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID")), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID")), "Invalid value for \"{0}\", it can not be empty."))); } $this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"]); @@ -715,29 +715,29 @@ class DynaForm $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true); if ($arrayData["DYN_TYPE"] == "grid") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayFieldNameForException["dynaFormType"]), "Invalid value specified for \"{0}\""))); + throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayFieldNameForException["dynaFormType"], "xmlform"), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); } if (!isset($arrayData["PMTABLE"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE")), "Undefined value for \"{0}\", it is required."))); } if (!isset($arrayData["PMTABLE"]["TAB_UID"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID")), "Undefined value for \"{0}\", it is required."))); } $arrayData["PMTABLE"]["TAB_UID"] = trim($arrayData["PMTABLE"]["TAB_UID"]); if ($arrayData["PMTABLE"]["TAB_UID"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID")), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID")), "Invalid value for \"{0}\", it can not be empty."))); } if (!isset($arrayData["PMTABLE"]["FIELDS"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "Undefined value for \"{0}\", it is required."))); } if (count($arrayData["PMTABLE"]["FIELDS"]) == 0) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "Invalid value for \"{0}\", it can not be empty."))); } $this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"]); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Group.php b/workflow/engine/src/ProcessMaker/BusinessModel/Group.php index 57ef66a2d..626c1adea 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Group.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Group.php @@ -143,7 +143,7 @@ class Group $group = new \Groupwf(); if (!$group->GroupwfExists($groupUid)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $groupUid), "The group with {0}: {1} does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $groupUid), "The group with {0}: {1} does not exist."); throw (new \Exception($msg)); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php index 1660fa273..5880be1ca 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php @@ -161,7 +161,7 @@ class InputDocument $rsCriteria = \InputDocumentPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $inputDocumentUid), "The Input Document with {0}: {1} does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $inputDocumentUid), "The Input Document with {0}: {1} does not exist."); throw (new \Exception($msg)); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php index ab22db6da..67e8d975f 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php @@ -176,7 +176,7 @@ class Process $fieldNameAux = (isset($arrayFieldNameForException[$arrayFieldDefinition[$fieldName]["fieldNameAux"]]))? $arrayFieldNameForException[$arrayFieldDefinition[$fieldName]["fieldNameAux"]] : ""; if ($arrayFieldDefinition[$fieldName]["required"] && !isset($arrayData[$fieldName])) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Undefined value for \"{0}\", it is required."))); } } } @@ -201,12 +201,12 @@ class Process case 1: //empty if (!$arrayFieldDefinition[$fieldName]["empty"] && trim($fieldValue) . "" == "") { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\", it can not be empty."))); } //defaultValues if (count($arrayFieldDefinition[$fieldName]["defaultValues"]) > 0 && !in_array($fieldValue, $arrayFieldDefinition[$fieldName]["defaultValues"])) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value specified for \"{0}\""))); + throw (new \Exception(str_replace(array("{0}", "{1}"), array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"])), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); } //type @@ -220,17 +220,17 @@ class Process switch ($arrayFieldDefinition[$fieldName]["type"]) { case "date": if (!preg_match("/^" . $eregDate . "$/", $fieldValue)) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value specified for \"{0}\""))); + throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\"."))); } break; case "hour": if (!preg_match("/^" . $eregHour . "$/", $fieldValue)) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value specified for \"{0}\""))); + throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\"."))); } break; case "datetime": if (!preg_match("/^" . $eregDatetime . "$/", $fieldValue)) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value specified for \"{0}\""))); + throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\"."))); } break; } @@ -242,7 +242,7 @@ class Process //type if (!is_array($fieldValue)) { if ($fieldValue != "" && !preg_match("/^\s*array\s*\(.*\)\s*$/", $fieldValue)) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "The \"{0}\" attribute is not array"))); + throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\", this value must be an array."))); } } @@ -259,7 +259,7 @@ class Process } if (count($arrayAux) == 0) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\", it can not be empty."))); } } @@ -277,7 +277,7 @@ class Process foreach ($arrayAux as $value) { if (!in_array($value, $arrayFieldDefinition[$fieldName]["defaultValues"])) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value specified for \"{0}\""))); + throw (new \Exception(str_replace(array("{0}", "{1}"), array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"])), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); } } } @@ -307,7 +307,7 @@ class Process $nameForException = (isset($arrayFieldNameForException[$key]))? $arrayFieldNameForException[$key] : ""; if (!is_null($value) && ($value . "" == "" || !preg_match("/^(?:\+|\-)?(?:0|[1-9]\d*)$/", $value . "") || (int)($value) < 0)) { - throw (new \Exception(str_replace(array("{0}"), array($nameForException), "Invalid value specified for \"{0}\". Expecting positive integer value"))); + throw (new \Exception(str_replace(array("{0}"), array($nameForException), "Invalid value for \"{0}\". Expecting positive integer value."))); } } } catch (\Exception $e) { @@ -329,7 +329,7 @@ class Process $process = new \Process(); if (!$process->processExists($processUid)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $processUid), "The project with {0}: {1} does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $processUid), "The project with {0}: {1} does not exist."); throw (new \Exception($msg)); } @@ -352,7 +352,7 @@ class Process $user = new \Users(); if (!$user->userExists($userUid)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $userUid), "The user with {0}: {1}, does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $userUid), "The user with {0}: {1}, does not exist."); throw (new \Exception($msg)); } @@ -397,7 +397,7 @@ class Process $obj = \ProcessCategoryPeer::retrieveByPK($processCategoryUid); if (!(is_object($obj) && get_class($obj) == "ProcessCategory")) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $processCategoryUid), "The project category with {0}: {1}, does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $processCategoryUid), "The project category with {0}: {1}, does not exist."); throw (new \Exception($msg)); } @@ -420,7 +420,7 @@ class Process $obj = \AdditionalTablesPeer::retrieveByPK($additionalTableUid); if (!(is_object($obj) && get_class($obj) == "AdditionalTables")) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $additionalTableUid), "The PM Table with {0}: {1} does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $additionalTableUid), "The PM Table with {0}: {1} does not exist."); throw (new \Exception($msg)); } @@ -454,7 +454,7 @@ class Process $rsCriteria = \TaskPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $taskUid), "The activity with {0}: {1} does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $taskUid), "The activity with {0}: {1} does not exist."); throw (new \Exception($msg)); } @@ -488,7 +488,7 @@ class Process } if ($flag == 0) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $fileName), "The routing screen template with {0}: {1} does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $fileName), "The routing screen template with {0}: {1} does not exist."); throw (new \Exception($msg)); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Step.php b/workflow/engine/src/ProcessMaker/BusinessModel/Step.php index 000c83855..be848289a 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Step.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Step.php @@ -167,9 +167,11 @@ class Step */ public function throwExceptionIfHaveInvalidValueInTypeObj($stepTypeObj) { - if (!in_array($stepTypeObj, array("DYNAFORM", "INPUT_DOCUMENT", "OUTPUT_DOCUMENT", "EXTERNAL"))) { + $arrayDefaultValues = array("DYNAFORM", "INPUT_DOCUMENT", "OUTPUT_DOCUMENT", "EXTERNAL"); + + if (!in_array($stepTypeObj, $arrayDefaultValues)) { $field = $this->arrayParamException["stepTypeObj"]; - throw (new \Exception(str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\""))); + throw (new \Exception(str_replace(array("{0}", "{1}"), array($field, implode("|", $arrayDefaultValues)), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); } } @@ -182,10 +184,12 @@ class Step */ public function throwExceptionIfHaveInvalidValueInMode($stepMode) { - if (!in_array($stepMode, array("EDIT", "VIEW"))) { + $arrayDefaultValues = array("EDIT", "VIEW"); + + if (!in_array($stepMode, $arrayDefaultValues)) { $field = $this->arrayParamException["stepMode"]; - throw (new \Exception(str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\""))); + throw (new \Exception(str_replace(array("{0}", "{1}"), array($field, implode("|", $arrayDefaultValues)), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); } } @@ -201,10 +205,7 @@ class Step $step = new \Step(); if (!$step->StepExists($stepUid)) { - $field = $this->arrayParamException["stepUid"]; - - $msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / "; - $msg = $msg . str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" does not exist in table {1}"); + $msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["stepUid"], $stepUid), "The step with {0}: {1} does not exist."); throw (new \Exception($msg)); } @@ -222,10 +223,7 @@ class Step $task = new \Task(); if (!$task->taskExists($taskUid)) { - $field = $this->arrayParamException["taskUid"]; - - $msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / "; - $msg = $msg . str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" does not exist in table {1}"); + $msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["taskUid"], $taskUid), "The activity with {0}: {1} does not exist."); throw (new \Exception($msg)); } @@ -243,10 +241,7 @@ class Step $process = new \Process(); if (!$process->exists($processUid)) { - $field = $this->arrayParamException["processUid"]; - - $msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / "; - $msg = $msg . str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" does not exist in table {1}"); + $msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["processUid"], $processUid), "The project with {0}: {1} does not exist."); throw (new \Exception($msg)); } @@ -274,33 +269,33 @@ class Step $this->throwExceptionIfNotExistsProcess($processUid); if (!isset($arrayData["STEP_TYPE_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "Undefined value for \"{0}\", it is required."))); } $arrayData["STEP_TYPE_OBJ"] = trim($arrayData["STEP_TYPE_OBJ"]); if ($arrayData["STEP_TYPE_OBJ"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "Invalid value for \"{0}\", it can not be empty."))); } if (!isset($arrayData["STEP_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "Undefined value for \"{0}\", it is required."))); } $arrayData["STEP_UID_OBJ"] = trim($arrayData["STEP_UID_OBJ"]); if ($arrayData["STEP_UID_OBJ"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "Invalid value for \"{0}\", it can not be empty."))); } if (!isset($arrayData["STEP_MODE"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "Undefined value for \"{0}\", it is required."))); } $arrayData["STEP_MODE"] = trim($arrayData["STEP_MODE"]); if ($arrayData["STEP_MODE"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "Invalid value for \"{0}\", it can not be empty."))); } $this->throwExceptionIfHaveInvalidValueInTypeObj($arrayData["STEP_TYPE_OBJ"]); @@ -372,18 +367,18 @@ class Step //Verify data if (isset($arrayData["STEP_TYPE_OBJ"]) && !isset($arrayData["STEP_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "Undefined value for \"{0}\", it is required."))); } if (!isset($arrayData["STEP_TYPE_OBJ"]) && isset($arrayData["STEP_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "Undefined value for \"{0}\", it is required."))); } if (isset($arrayData["STEP_TYPE_OBJ"])) { $arrayData["STEP_TYPE_OBJ"] = trim($arrayData["STEP_TYPE_OBJ"]); if ($arrayData["STEP_TYPE_OBJ"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "Invalid value for \"{0}\", it can not be empty."))); } } @@ -391,7 +386,7 @@ class Step $arrayData["STEP_UID_OBJ"] = trim($arrayData["STEP_UID_OBJ"]); if ($arrayData["STEP_UID_OBJ"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "Invalid value for \"{0}\", it can not be empty."))); } } @@ -399,7 +394,7 @@ class Step $arrayData["STEP_MODE"] = trim($arrayData["STEP_MODE"]); if ($arrayData["STEP_MODE"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "The \"{0}\" attribute is empty"))); + throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "Invalid value for \"{0}\", it can not be empty."))); } } @@ -859,7 +854,8 @@ class Step * * @return void */ - public function moveSteps($pro_uid, $tas_uid, $step_uid, $step_pos) { + public function moveSteps($pro_uid, $tas_uid, $step_uid, $step_pos) + { $this->setFormatFieldNameInUppercase(false); $this->setArrayParamException(array("taskUid" => "act_uid")); $aSteps = $this->getSteps($tas_uid); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Task.php b/workflow/engine/src/ProcessMaker/BusinessModel/Task.php index ae507dadb..8734ce721 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Task.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Task.php @@ -75,10 +75,7 @@ class Task $task = new \Task(); if (!$task->taskExists($taskUid)) { - $field = $this->arrayParamException["taskUid"]; - - $msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / "; - $msg = $msg . str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}"); + $msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["taskUid"], $taskUid), "The activity with {0}: {1} does not exist."); throw (new \Exception($msg)); } @@ -2188,3 +2185,4 @@ class Task } } } + diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php b/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php index 8b1fc7870..e7a3876ed 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php @@ -265,7 +265,7 @@ class Trigger $rsCriteria = \TriggersPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $triggerUid), "The trigger with {0}: {1}, does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $triggerUid), "The trigger with {0}: {1}, does not exist."); throw (new \Exception($msg)); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/TriggerWizard.php b/workflow/engine/src/ProcessMaker/BusinessModel/TriggerWizard.php index d9428880b..a744d23c5 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/TriggerWizard.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/TriggerWizard.php @@ -111,7 +111,7 @@ class TriggerWizard $arrayLibrary = $this->library->getRegisteredClasses(); if (!isset($arrayLibrary[$this->libraryGetLibraryName($libraryName)])) { - $msg = str_replace(array("{0}", "{1}"), array($libraryFieldNameForException, $libraryName), "The library with {0}: \"{1}\" does not exist"); + $msg = str_replace(array("{0}", "{1}"), array($libraryFieldNameForException, $libraryName), "The library with {0}: \"{1}\" does not exist."); throw (new \Exception($msg)); } @@ -138,7 +138,7 @@ class TriggerWizard $library = $this->library->getLibraryDefinition($this->libraryGetLibraryName($libraryName)); if (!isset($library->methods[$methodName])) { - $msg = str_replace(array("{0}", "{1}"), array($methodFieldNameForException, $methodName), "The function with {0}: \"{1}\" does not exist in the library"); + $msg = str_replace(array("{0}", "{1}"), array($methodFieldNameForException, $methodName), "The function with {0}: \"{1}\" does not exist in the library."); throw (new \Exception($msg)); } @@ -231,22 +231,22 @@ class TriggerWizard if ($nInputParam > 0 || $nOutputParam > 0) { if (!isset($arrayData["TRI_PARAMS"])) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameForException), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($fieldNameForException), "Undefined value for \"{0}\", it is required."))); } if (!is_array($arrayData["TRI_PARAMS"])) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameForException), "The \"{0}\" attribute is not array"))); + throw (new \Exception(str_replace(array("{0}"), array($fieldNameForException), "Invalid value for \"{0}\", this value must be an array."))); } $arrayData["TRI_PARAMS"] = array_change_key_case($arrayData["TRI_PARAMS"], CASE_UPPER); if ($nInputParam > 0) { if (!isset($arrayData["TRI_PARAMS"]["INPUT"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT")), "Undefined value for \"{0}\", it is required."))); } if (!is_array($arrayData["TRI_PARAMS"]["INPUT"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT")), "The \"{0}\" attribute is not array"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT")), "Invalid value for \"{0}\", this value must be an array."))); } $arrayParamData["input"] = $arrayData["TRI_PARAMS"]["INPUT"]; @@ -254,11 +254,11 @@ class TriggerWizard if ($nOutputParam > 0) { if (!isset($arrayData["TRI_PARAMS"]["OUTPUT"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT")), "The \"{0}\" attribute is not defined"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT")), "Undefined value for \"{0}\", it is required."))); } if (!is_array($arrayData["TRI_PARAMS"]["OUTPUT"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT")), "The \"{0}\" attribute is not array"))); + throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT")), "Invalid value for \"{0}\", this value must be an array."))); } $arrayParamData["output"] = $arrayData["TRI_PARAMS"]["OUTPUT"]; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php b/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php index 93be26c74..b00b2a48b 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php @@ -344,7 +344,7 @@ class Validator { try { if (!is_array($data)) { - $msg = str_replace(array("{0}"), array($dataNameForException), "The data \"{0}\" is not array"); + $msg = str_replace(array("{0}"), array($dataNameForException), "Invalid value for \"{0}\", this value must be an array."); throw (new \Exception($msg)); } @@ -365,7 +365,7 @@ class Validator { try { if (empty($data)) { - $msg = str_replace(array("{0}"), array($dataNameForException), "The data \"{0}\" is empty"); + $msg = str_replace(array("{0}"), array($dataNameForException), "Invalid value for \"{0}\", it can not be empty."); throw (new \Exception($msg)); } diff --git a/workflow/engine/src/Tests/BusinessModel/CalendarTest.php b/workflow/engine/src/Tests/BusinessModel/CalendarTest.php index 994158d2a..811858039 100644 --- a/workflow/engine/src/Tests/BusinessModel/CalendarTest.php +++ b/workflow/engine/src/Tests/BusinessModel/CalendarTest.php @@ -172,7 +172,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @covers \ProcessMaker\BusinessModel\Calendar::create * * @expectedException Exception - * @expectedExceptionMessage The data "$arrayData" is not array + * @expectedExceptionMessage Invalid value for "$arrayData", this value must be an array. */ public function testCreateExceptionNoIsArrayData() { @@ -187,7 +187,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @covers \ProcessMaker\BusinessModel\Calendar::create * * @expectedException Exception - * @expectedExceptionMessage The data "$arrayData" is empty + * @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty. */ public function testCreateExceptionEmptyData() { @@ -202,7 +202,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @covers \ProcessMaker\BusinessModel\Calendar::create * * @expectedException Exception - * @expectedExceptionMessage The "CAL_NAME" attribute is not defined + * @expectedExceptionMessage Undefined value for "CAL_NAME", it is required. */ public function testCreateExceptionRequiredDataCalName() { @@ -222,7 +222,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @covers \ProcessMaker\BusinessModel\Calendar::create * * @expectedException Exception - * @expectedExceptionMessage The "CAL_NAME" attribute is empty + * @expectedExceptionMessage Invalid value for "CAL_NAME", it can not be empty. */ public function testCreateExceptionInvalidDataCalName() { @@ -242,7 +242,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @covers \ProcessMaker\BusinessModel\Calendar::create * * @expectedException Exception - * @expectedExceptionMessage Invalid value specified for "CAL_WORK_DAYS" + * @expectedExceptionMessage Invalid value for "CAL_WORK_DAYS", it only accepts values: "SUN|MON|TUE|WED|THU|FRI|SAT". */ public function testCreateExceptionInvalidDataCalWorkDays() { @@ -282,7 +282,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @covers \ProcessMaker\BusinessModel\Calendar::update * * @expectedException Exception - * @expectedExceptionMessage The data "$arrayData" is not array + * @expectedExceptionMessage Invalid value for "$arrayData", this value must be an array. */ public function testUpdateExceptionNoIsArrayData() { @@ -297,7 +297,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @covers \ProcessMaker\BusinessModel\Calendar::update * * @expectedException Exception - * @expectedExceptionMessage The data "$arrayData" is empty + * @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty. */ public function testUpdateExceptionEmptyData() { @@ -312,7 +312,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @covers \ProcessMaker\BusinessModel\Calendar::update * * @expectedException Exception - * @expectedExceptionMessage The calendar with CAL_UID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx does not exists + * @expectedExceptionMessage The calendar with CAL_UID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx does not exist. */ public function testUpdateExceptionInvalidCalUid() { @@ -335,7 +335,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @param array $arrayRecord Data of the calendars * * @expectedException Exception - * @expectedExceptionMessage The "CAL_NAME" attribute is empty + * @expectedExceptionMessage Invalid value for "CAL_NAME", it can not be empty. */ public function testUpdateExceptionInvalidDataCalName($arrayRecord) { @@ -358,7 +358,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @param array $arrayRecord Data of the calendars * * @expectedException Exception - * @expectedExceptionMessage Invalid value specified for "CAL_WORK_DAYS" + * @expectedExceptionMessage Invalid value for "CAL_WORK_DAYS", it only accepts values: "SUN|MON|TUE|WED|THU|FRI|SAT". */ public function testUpdateExceptionInvalidDataCalWorkDays($arrayRecord) {