ProcessMaker-BE "Replace harcoded labels by a translation ID"

- Se ha reemplazado todas los labels harcoded por un ID de translation, para
  los sgtes Endpoints:
    - Calendar
    - Case Tracker
    - Category
    - DynaForms Resources
    - Group
    - Input Documents Resources
    - Process of a Project Resources
    - Process Variables
    - Project Properties - Step Resources
    - Trigger Wizard
    - Web Entry
    - Project Import
- Se ha creado el ID en el workspace OS
This commit is contained in:
Victor Saisa Lopez
2014-05-19 17:30:00 -04:00
parent c9f617b479
commit 9fef15f6ef
19 changed files with 245 additions and 295 deletions

View File

@@ -251,9 +251,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 exist.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_CALENDAR_DOES_NOT_EXIST", array($fieldNameForException, $calendarUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -273,9 +271,7 @@ class Calendar
{
try {
if ($this->existsName($calendarName, $calendarUidExclude)) {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $calendarName), "The calendar name with {0}: \"{1}\" already exists");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_CALENDAR_NAME_ALREADY_EXISTS", array($fieldNameForException, $calendarName)));
}
} catch (\Exception $e) {
throw $e;
@@ -331,7 +327,7 @@ class Calendar
if (isset($arrayData["CAL_WORK_HOUR"])) {
foreach ($arrayData["CAL_WORK_HOUR"] as $value) {
if ($value["DAY"] != 0 && !in_array($value["DAY"], $arrayData["CAL_WORK_DAYS"], true)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]), "Value specified for \"{0}\" does not exist in \"{1}\".")));
throw new \Exception(\G::LoadTranslation("ID_VALUE_SPECIFIED_DOES_NOT_EXIST", array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"])));
}
$arrayCalendarWorkHour[] = array(
@@ -438,7 +434,7 @@ class Calendar
foreach ($arrayAux as $value) {
if (isset($arrayData["CAL_WORK_HOUR"]) && $value["DAY"] != 0 && !in_array($value["DAY"], $calendarWorkDays, true)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]), "Value specified for \"{0}\" does not exist in \"{1}\".")));
throw new \Exception(\G::LoadTranslation("ID_VALUE_SPECIFIED_DOES_NOT_EXIST", array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"])));
}
$arrayCalendarWorkHour[] = array(

View File

@@ -17,11 +17,9 @@ class CaseTracker
$arrayDataIni = $arrayData;
//Verify data
$process = new \Process();
$process = new \ProcessMaker\BusinessModel\Process();
if (!$process->exists($processUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" does not exist in table {1}")));
}
$process->throwExceptionIfNotExistsProcess($processUid, "prj_uid");
//Update
$caseTracker = new \CaseTracker();
@@ -64,11 +62,9 @@ class CaseTracker
$arrayCaseTracker = array();
//Verify data
$process = new \Process();
$process = new \ProcessMaker\BusinessModel\Process();
if (!$process->exists($processUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" does not exist in table {1}")));
}
$process->throwExceptionIfNotExistsProcess($processUid, "prj_uid");
//Get data
$criteria = new \Criteria();
@@ -118,11 +114,9 @@ class CaseTracker
$arrayAvailableCaseTrackerObject = array();
//Verify data
$process = new \Process();
$process = new \ProcessMaker\BusinessModel\Process();
if (!$process->exists($processUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" does not exist in table {1}")));
}
$process->throwExceptionIfNotExistsProcess($processUid, "prj_uid");
//Get Uids
$arrayDynaFormUid = array();
@@ -315,11 +309,9 @@ class CaseTracker
$arrayCaseTrackerObject = array();
//Verify data
$process = new \Process();
$process = new \ProcessMaker\BusinessModel\Process();
if (!$process->exists($processUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" does not exist in table {1}")));
}
$process->throwExceptionIfNotExistsProcess($processUid, "prj_uid");
$dynaform = new \Dynaform();
$inputDocument = new \InputDocument();

View File

@@ -67,30 +67,28 @@ class CaseTrackerObject
unset($arrayData["CTO_UID"]);
//Verify data
$process = new \Process();
$process = new \ProcessMaker\BusinessModel\Process();
if (!$process->exists($processUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}")));
}
$process->throwExceptionIfNotExistsProcess($processUid, "prj_uid");
if (!isset($arrayData["CTO_TYPE_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_TYPE_OBJ")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array(strtolower("CTO_TYPE_OBJ"))));
}
if (!isset($arrayData["CTO_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_UID_OBJ")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array(strtolower("CTO_UID_OBJ"))));
}
$step = new \ProcessMaker\BusinessModel\Step();
$msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"]);
$msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"], strtolower("CTO_UID_OBJ"));
if ($msg != "") {
throw (new \Exception($msg));
throw new \Exception($msg);
}
if ($this->existsRecord($processUid, $arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid . ", " . $arrayData["CTO_TYPE_OBJ"] . ", " . $arrayData["CTO_UID_OBJ"], "CASE_TRACKER_OBJECT"), "The record \"{0}\", exists in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($processUid . ", " . $arrayData["CTO_TYPE_OBJ"] . ", " . $arrayData["CTO_UID_OBJ"], "CASE_TRACKER_OBJECT")));
}
$ctoPosition = $arrayData["CTO_POSITION"];
@@ -144,28 +142,28 @@ class CaseTrackerObject
//Verify data
if (!$caseTrackerObject->caseTrackerObjectExists($caseTrackerObjectUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($caseTrackerObjectUid, "CASE_TRACKER_OBJECT"), "The UID \"{0}\" doesn't exist in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_CASE_TRACKER_OBJECT_DOES_NOT_EXIST", array(strtolower("CTO_UID"), $caseTrackerObjectUid)));
}
if (isset($arrayData["CTO_TYPE_OBJ"]) && !isset($arrayData["CTO_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_UID_OBJ")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array(strtolower("CTO_UID_OBJ"))));
}
if (!isset($arrayData["CTO_TYPE_OBJ"]) && isset($arrayData["CTO_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_TYPE_OBJ")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array(strtolower("CTO_TYPE_OBJ"))));
}
if (isset($arrayData["CTO_TYPE_OBJ"]) && isset($arrayData["CTO_UID_OBJ"])) {
$step = new \ProcessMaker\BusinessModel\Step();
$msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"]);
$msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"], strtolower("CTO_UID_OBJ"));
if ($msg != "") {
throw (new \Exception($msg));
throw new \Exception($msg);
}
if ($this->existsRecord($processUid, $arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"], 0, $caseTrackerObjectUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid . ", " . $arrayData["CTO_TYPE_OBJ"] . ", " . $arrayData["CTO_UID_OBJ"], "CASE_TRACKER_OBJECT"), "The record \"{0}\", exists in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($processUid . ", " . $arrayData["CTO_TYPE_OBJ"] . ", " . $arrayData["CTO_UID_OBJ"], "CASE_TRACKER_OBJECT")));
}
}
@@ -230,7 +228,7 @@ class CaseTrackerObject
//Verify data
if (!$caseTrackerObject->caseTrackerObjectExists($caseTrackerObjectUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($caseTrackerObjectUid, "CASE_TRACKER_OBJECT"), "The UID \"{0}\" doesn't exist in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_CASE_TRACKER_OBJECT_DOES_NOT_EXIST", array(strtolower("CTO_UID"), $caseTrackerObjectUid)));
}
//Delete
@@ -256,7 +254,7 @@ class CaseTrackerObject
$caseTrackerObject = new \CaseTrackerObject();
if (!$caseTrackerObject->caseTrackerObjectExists($caseTrackerObjectUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($caseTrackerObjectUid, "CASE_TRACKER_OBJECT"), "The UID \"{0}\" doesn't exist in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_CASE_TRACKER_OBJECT_DOES_NOT_EXIST", array(strtolower("CTO_UID"), $caseTrackerObjectUid)));
}
//Get data

View File

@@ -282,9 +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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_DOES_NOT_EXIST", array($fieldNameForException, $dynaFormUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -305,9 +303,7 @@ class DynaForm
{
try {
if ($this->existsTitle($processUid, $dynaFormTitle, $dynaFormUidExclude)) {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $dynaFormTitle), "The DynaForm title with {0}: \"{1}\", already exists");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_TITLE_ALREADY_EXISTS", array($fieldNameForException, $dynaFormTitle)));
}
} catch (\Exception $e) {
throw $e;
@@ -331,9 +327,7 @@ class DynaForm
$arrayDynaFormData = $dynaForm->Load($dynaFormUid);
if ($arrayDynaFormData["DYN_TYPE"] != "grid") {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $dynaFormUid), "The DynaForm with {0}: {1}, is not grid");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_IS_NOT_GRID", array($fieldNameForException, $dynaFormUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -458,10 +452,11 @@ class DynaForm
$processUid = $arrayDynaFormData["PRO_UID"];
//Verify dependencies dynaforms
$resultDependeds = $this->dynaFormDepends($dynaFormUid, $processUid);
if ($resultDependeds != '') {
throw (new \Exception($resultDependeds));
//Verify dependences dynaforms
$resultDepends = $this->dynaFormDepends($dynaFormUid, $processUid);
if ($resultDepends != "") {
throw new \Exception($resultDepends);
}
//Delete
@@ -512,27 +507,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")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("COPY_IMPORT"))));
}
if (!isset($arrayData["COPY_IMPORT"]["PRJ_UID"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID"))));
}
$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")), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID"))));
}
if (!isset($arrayData["COPY_IMPORT"]["DYN_UID"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID"))));
}
$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")), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID"))));
}
$this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"]);
@@ -715,29 +710,29 @@ class DynaForm
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
if ($arrayData["DYN_TYPE"] == "grid") {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayFieldNameForException["dynaFormType"], "xmlform"), "Invalid value for \"{0}\", it only accepts values: \"{1}\".")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($this->arrayFieldNameForException["dynaFormType"], "xmlform")));
}
if (!isset($arrayData["PMTABLE"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("PMTABLE"))));
}
if (!isset($arrayData["PMTABLE"]["TAB_UID"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID"))));
}
$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")), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID"))));
}
if (!isset($arrayData["PMTABLE"]["FIELDS"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"))));
}
if (count($arrayData["PMTABLE"]["FIELDS"]) == 0) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"))));
}
$this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"]);
@@ -756,7 +751,7 @@ class DynaForm
}
if ($flagValidFieldKey == 0) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "The attribute {0}, has an element invalid (incorrect keys)")));
throw new \Exception(\G::LoadTranslation("ID_ATTRIBUTE_HAS_INVALID_ELEMENT_KEY", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"))));
}
//Is Primary Key
@@ -777,7 +772,7 @@ class DynaForm
}
if ($flagValidFieldPk == 0) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS.FLD_NAME"), $invalidFieldPk), "The field {0}: {1}, is not a primary key field of the PM Table")));
throw new \Exception(\G::LoadTranslation("ID_PMTABLE_FIELD_IS_NOT_PRIMARY_KEY", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS.FLD_NAME"), $invalidFieldPk)));
}
//All Primary Keys
@@ -793,7 +788,7 @@ class DynaForm
}
if ($flagAllFieldPk == 0) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($missingFieldPk, $this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "The primary key field {0} of the PM Table is missing in the attribute {1}")));
throw new \Exception(\G::LoadTranslation("ID_PMTABLE_PRIMARY_KEY_FIELD_IS_MISSING_IN_ATTRIBUTE", array($missingFieldPk, $this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"))));
}
//Total of Primary Keys
@@ -801,7 +796,7 @@ class DynaForm
$n2 = count($arrayFieldPkAux);
if ($n1 != $n2) {
throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($n1, $this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"), $n2), "The total primary key fields of the PM Table is {0}, the attribute {1} has {2} primary keys")));
throw new \Exception(\G::LoadTranslation("ID_PMTABLE_TOTAL_PRIMARY_KEY_FIELDS_IS_NOT_EQUAL_IN_ATTRIBUTE", array($n1, $this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"), $n2)));
}
//Set data
@@ -889,7 +884,7 @@ class DynaForm
//Return
return $arrayDataAux;
} else {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($msgMethod)), "It is trying to create a DynaForm by \"{0}\", please send only one attribute for creation")));
throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_IT_IS_TRYING_CREATE_BY_SEVERAL_METHODS", array($this->getFieldNameByFormatFieldName($msgMethod))));
}
} catch (\Exception $e) {
throw $e;

View File

@@ -143,9 +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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_GROUP_DOES_NOT_EXIST", array($fieldNameForException, $groupUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -165,9 +163,7 @@ class Group
{
try {
if ($this->existsTitle($groupTitle, $groupUidExclude)) {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $groupTitle), "The group title with {0}: \"{1}\" already exists");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_GROUP_TITLE_ALREADY_EXISTS", array($fieldNameForException, $groupTitle)));
}
} catch (\Exception $e) {
throw $e;

View File

@@ -95,9 +95,7 @@ class User
$obj = \GroupUserPeer::retrieveByPK($groupUid, $userUid);
if (!(is_object($obj) && get_class($obj) == "GroupUser")) {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $userUid), "The user with {0}: {1} is not assigned to the group");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_GROUP_USER_IS_NOT_ASSIGNED", array($fieldNameForException, $userUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -119,9 +117,7 @@ class User
$obj = \GroupUserPeer::retrieveByPK($groupUid, $userUid);
if (is_object($obj) && get_class($obj) == "GroupUser") {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $userUid), "The user with {0}: {1} is already assigned to the group");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_GROUP_USER_IS_ALREADY_ASSIGNED", array($fieldNameForException, $userUid)));
}
} catch (\Exception $e) {
throw $e;

View File

@@ -161,9 +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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_INPUT_DOCUMENT_DOES_NOT_EXIST", array($fieldNameForException, $inputDocumentUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -184,9 +182,7 @@ class InputDocument
{
try {
if ($this->existsTitle($processUid, $inputDocumentTitle, $inputDocumentUidExclude)) {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $inputDocumentTitle), "The Input Document title with {0}: \"{1}\" already exists");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_INPUT_DOCUMENT_TITLE_ALREADY_EXISTS", array($fieldNameForException, $inputDocumentTitle)));
}
} catch (\Exception $e) {
throw $e;

View File

@@ -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), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($fieldNameAux)));
}
}
}
@@ -201,12 +201,12 @@ class Process
case 1:
//empty
if (!$arrayFieldDefinition[$fieldName]["empty"] && trim($fieldValue) . "" == "") {
throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($fieldNameAux)));
}
//defaultValues
if (count($arrayFieldDefinition[$fieldName]["defaultValues"]) > 0 && !in_array($fieldValue, $arrayFieldDefinition[$fieldName]["defaultValues"], true)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"])), "Invalid value for \"{0}\", it only accepts values: \"{1}\".")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"]))));
}
//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 for \"{0}\".")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux)));
}
break;
case "hour":
if (!preg_match("/^" . $eregHour . "$/", $fieldValue)) {
throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\".")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux)));
}
break;
case "datetime":
if (!preg_match("/^" . $eregDatetime . "$/", $fieldValue)) {
throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\".")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux)));
}
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), "Invalid value for \"{0}\", this value must be an array.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($fieldNameAux)));
}
}
@@ -259,7 +259,7 @@ class Process
}
if (count($arrayAux) == 0) {
throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($fieldNameAux)));
}
}
@@ -277,7 +277,7 @@ class Process
foreach ($arrayAux as $value) {
if (!in_array($value, $arrayFieldDefinition[$fieldName]["defaultValues"], true)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"])), "Invalid value for \"{0}\", it only accepts values: \"{1}\".")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"]))));
}
}
}
@@ -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 for \"{0}\". Expecting positive integer value.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_EXPECTING_POSITIVE_INTEGER", array($nameForException)));
}
}
} catch (\Exception $e) {
@@ -329,9 +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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_PROJECT_DOES_NOT_EXIST", array($fieldNameForException, $processUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -352,9 +350,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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_EXIST", array($fieldNameForException, $userUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -374,9 +370,7 @@ class Process
{
try {
if ($this->existsTitle($processTitle, $processUidExclude)) {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $processTitle), "The project title with {0}: \"{1}\", already exists");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_PROJECT_TITLE_ALREADY_EXISTS", array($fieldNameForException, $processTitle)));
}
} catch (\Exception $e) {
throw $e;
@@ -397,9 +391,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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_PROJECT_CATEGORY_DOES_NOT_EXIST", array($fieldNameForException, $processCategoryUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -420,9 +412,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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_PMTABLE_DOES_NOT_EXIST", array($fieldNameForException, $additionalTableUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -454,9 +444,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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array($fieldNameForException, $taskUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -488,9 +476,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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_ROUTING_SCREEN_TEMPLATE_DOES_NOT_EXIST", array($fieldNameForException, $fileName)));
}
} catch (\Exception $e) {
throw $e;
@@ -1649,7 +1635,8 @@ class Process
if (is_file(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml")) {
$dyn = new \dynaFormHandler(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml");
if ($dyn->getHeaderAttribute("type") !== "xmlform" && $dyn->getHeaderAttribute("type") !== "") { // skip it, if that is not a xmlform
if ($dyn->getHeaderAttribute("type") !== "xmlform" && $dyn->getHeaderAttribute("type") !== "") {
// skip it, if that is not a xmlform
$oDataset->next();
continue;
}
@@ -1701,7 +1688,8 @@ class Process
if (is_file(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml")) {
$dyn = new \dynaFormHandler(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml");
if ($dyn->getHeaderAttribute("type") === "xmlform") { // skip it, if that is not a xmlform
if ($dyn->getHeaderAttribute("type") === "xmlform") {
// skip it, if that is not a xmlform
$oDataset->next();
continue;
}

View File

@@ -118,12 +118,13 @@ class Step
/**
* Verify if exists the "Object UID" in the corresponding table
*
* @param string $type Type of Step (DYNAFORM, INPUT_DOCUMENT, OUTPUT_DOCUMENT)
* @param string $objectUid Unique id of Object
* @param string $type Type of Step (DYNAFORM, INPUT_DOCUMENT, OUTPUT_DOCUMENT)
* @param string $objectUid Unique id of Object
* @param string $fieldNameForException Field name for the exception
*
* return strin Return empty string if $objectUid exists in the corresponding table, return string with data if $objectUid doesn't exist
*/
public function existsObjectUid($type, $objectUid)
public function existsObjectUid($type, $objectUid, $fieldNameForException)
{
try {
$msg = "";
@@ -133,21 +134,21 @@ class Step
$dynaform = new \Dynaform();
if (!$dynaform->dynaformExists($objectUid)) {
$msg = str_replace(array("{0}", "{1}"), array($objectUid, "DYNAFORM"), "The UID \"{0}\" does not exist in table {1}");
$msg = \G::LoadTranslation("ID_DYNAFORM_DOES_NOT_EXIST", array($fieldNameForException, $objectUid));
}
break;
case "INPUT_DOCUMENT":
$inputdoc = new \InputDocument();
if (!$inputdoc->InputExists($objectUid)) {
$msg = str_replace(array("{0}", "{1}"), array($objectUid, "INPUT_DOCUMENT"), "The UID \"{0}\" does not exist in table {1}");
$msg = \G::LoadTranslation("ID_INPUT_DOCUMENT_DOES_NOT_EXIST", array($fieldNameForException, $objectUid));
}
break;
case "OUTPUT_DOCUMENT":
$outputdoc = new \OutputDocument();
if (!$outputdoc->OutputExists($objectUid)) {
$msg = str_replace(array("{0}", "{1}"), array($objectUid, "OUTPUT_DOCUMENT"), "The UID \"{0}\" does not exist in table {1}");
$msg = \G::LoadTranslation("ID_OUTPUT_DOCUMENT_DOES_NOT_EXIST", array($fieldNameForException, $objectUid));
}
break;
}
@@ -171,7 +172,8 @@ class Step
if (!in_array($stepTypeObj, $arrayDefaultValues)) {
$field = $this->arrayParamException["stepTypeObj"];
throw (new \Exception(str_replace(array("{0}", "{1}"), array($field, implode("|", $arrayDefaultValues)), "Invalid value for \"{0}\", it only accepts values: \"{1}\".")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($field, implode("|", $arrayDefaultValues))));
}
}
@@ -189,7 +191,7 @@ class Step
if (!in_array($stepMode, $arrayDefaultValues)) {
$field = $this->arrayParamException["stepMode"];
throw (new \Exception(str_replace(array("{0}", "{1}"), array($field, implode("|", $arrayDefaultValues)), "Invalid value for \"{0}\", it only accepts values: \"{1}\".")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($field, implode("|", $arrayDefaultValues))));
}
}
@@ -205,9 +207,7 @@ class Step
$step = new \Step();
if (!$step->StepExists($stepUid)) {
$msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["stepUid"], $stepUid), "The step with {0}: {1} does not exist.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_STEP_DOES_NOT_EXIST", array($this->arrayParamException["stepUid"], $stepUid)));
}
}
@@ -223,9 +223,7 @@ class Step
$task = new \Task();
if (!$task->taskExists($taskUid)) {
$msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["taskUid"], $taskUid), "The activity with {0}: {1} does not exist.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array($this->arrayParamException["taskUid"], $taskUid)));
}
}
@@ -241,9 +239,7 @@ class Step
$process = new \Process();
if (!$process->exists($processUid)) {
$msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["processUid"], $processUid), "The project with {0}: {1} does not exist.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_PROJECT_DOES_NOT_EXIST", array($this->arrayParamException["processUid"], $processUid)));
}
}
@@ -269,47 +265,47 @@ class Step
$this->throwExceptionIfNotExistsProcess($processUid);
if (!isset($arrayData["STEP_TYPE_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepTypeObj"])));
}
$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"]), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepTypeObj"])));
}
if (!isset($arrayData["STEP_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepUidObj"])));
}
$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"]), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepUidObj"])));
}
if (!isset($arrayData["STEP_MODE"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepMode"])));
}
$arrayData["STEP_MODE"] = trim($arrayData["STEP_MODE"]);
if ($arrayData["STEP_MODE"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepMode"])));
}
$this->throwExceptionIfHaveInvalidValueInTypeObj($arrayData["STEP_TYPE_OBJ"]);
$this->throwExceptionIfHaveInvalidValueInMode($arrayData["STEP_MODE"]);
$msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"]);
$msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], $this->arrayParamException["stepUidObj"]);
if ($msg != "") {
throw (new \Exception($msg));
throw new \Exception($msg);
}
if ($this->existsRecord($taskUid, $arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP"), "The record \"{0}\", exists in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP")));
}
//Create
@@ -367,18 +363,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"]), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepUidObj"])));
}
if (!isset($arrayData["STEP_TYPE_OBJ"]) && isset($arrayData["STEP_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepTypeObj"])));
}
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"]), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepTypeObj"])));
}
}
@@ -386,7 +382,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"]), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepUidObj"])));
}
}
@@ -394,7 +390,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"]), "Invalid value for \"{0}\", it can not be empty.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepMode"])));
}
}
@@ -407,14 +403,14 @@ class Step
}
if (isset($arrayData["STEP_TYPE_OBJ"]) && isset($arrayData["STEP_UID_OBJ"])) {
$msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"]);
$msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], $this->arrayParamException["stepUidObj"]);
if ($msg != "") {
throw (new \Exception($msg));
throw new \Exception($msg);
}
if ($this->existsRecord($taskUid, $arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], 0, $stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP"), "The record \"{0}\", exists in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP")));
}
}

View File

@@ -95,24 +95,24 @@ class Trigger
$step = new \Step();
if (!$step->StepExists($stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_STEP_DOES_NOT_EXIST", array("step_uid", $stepUid)));
}
}
$task = new \Task();
if (!$task->taskExists($taskUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array("act_uid", $taskUid)));
}
$trigger = new \Triggers();
if (!$trigger->TriggerExists($triggerUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($triggerUid, "TRIGGERS"), "The UID \"{0}\" doesn't exist in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_TRIGGER_DOES_NOT_EXIST", array("tri_uid", $triggerUid)));
}
if ($this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", exists in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER")));
}
//Create
@@ -175,14 +175,14 @@ class Trigger
$step = new \Step();
if (!$step->StepExists($stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_STEP_DOES_NOT_EXIST", array("step_uid", $stepUid)));
}
}
$trigger = new \Triggers();
if (!$trigger->TriggerExists($triggerUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($triggerUid, "TRIGGERS"), "The UID \"{0}\" doesn't exist in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_TRIGGER_DOES_NOT_EXIST", array("tri_uid", $triggerUid)));
}
//Update
@@ -245,7 +245,7 @@ class Trigger
//Verify data
if (!$this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_RECORD_DOES_NOT_EXIST_IN_TABLE", array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER")));
}
//Get position
@@ -326,7 +326,7 @@ class Trigger
//Verify data
if (!$this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}")));
throw new \Exception(\G::LoadTranslation("ID_RECORD_DOES_NOT_EXIST_IN_TABLE", array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER")));
}
//Get data
@@ -372,7 +372,8 @@ class Trigger
*
* @return void
*/
public function moveStepTriggers($tasUid, $stepUid, $triUid, $type, $newPos) {
public function moveStepTriggers($tasUid, $stepUid, $triUid, $type, $newPos)
{
$stepTrigger = new \ProcessMaker\BusinessModel\Step();
$tempStep = $stepUid;
$typeCompare = $type;

View File

@@ -75,9 +75,7 @@ class Task
$task = new \Task();
if (!$task->taskExists($taskUid)) {
$msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["taskUid"], $taskUid), "The activity with {0}: {1} does not exist.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array($this->arrayParamException["taskUid"], $taskUid)));
}
}

View File

@@ -265,9 +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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_TRIGGER_DOES_NOT_EXIST", array($fieldNameForException, $triggerUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -288,9 +286,7 @@ class Trigger
{
try {
if (!$this->verifyNameTrigger($processUid, $triggerTitle, $triggerUidExclude)) {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $triggerTitle), "The trigger title with {0}: \"{1}\" already exists");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_TRIGGER_TITLE_ALREADY_EXISTS", array($fieldNameForException, $triggerTitle)));
}
} catch (\Exception $e) {
throw $e;

View File

@@ -111,9 +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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_LIBRARY_DOES_NOT_EXIST", array($libraryFieldNameForException, $libraryName)));
}
} catch (\Exception $e) {
throw $e;
@@ -138,9 +136,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.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_LIBRARY_FUNCTION_DOES_NOT_EXIST", array($methodFieldNameForException, $methodName)));
}
} catch (\Exception $e) {
throw $e;
@@ -177,26 +173,20 @@ class TriggerWizard
$triggerParam = unserialize($arrayTriggerData["TRI_PARAM"]);
if ($arrayTriggerData["TRI_PARAM"] == "" || !isset($triggerParam["hash"])) {
$msg = str_replace(array("{0}", "{1}"), array($triggerUidFieldNameForException, $triggerUid), "The trigger with {0}: {1}, has not been created with the wizard");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_TRIGGER_HAS_NOT_BEEN_CREATED_WITH_WIZARD", array($triggerUidFieldNameForException, $triggerUid)));
}
$arrayTriggerData["TRI_PARAM"] = $triggerParam;
if (md5($arrayTriggerData["TRI_WEBBOT"]) != $arrayTriggerData["TRI_PARAM"]["hash"]) {
$msg = str_replace(array("{0}", "{1}"), array($triggerUidFieldNameForException, $triggerUid), "The trigger with {0}: {1}, has been modified manually. It is invalid for the wizard");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_TRIGGER_HAS_BEEN_MODIFIED_MANUALLY_INVALID_FOR_WIZARD", array($triggerUidFieldNameForException, $triggerUid)));
}
$triggerParamLibraryName = (preg_match("/^class\.?(.*)\.pmFunctions\.php$/", $arrayTriggerData["TRI_PARAM"]["params"]["LIBRARY_CLASS"], $arrayMatch))? ((isset($arrayMatch[1]) && $arrayMatch[1] != "")? $arrayMatch[1] : "pmFunctions") : $arrayTriggerData["TRI_PARAM"]["params"]["LIBRARY_CLASS"];
$triggerParamMethodName = $arrayTriggerData["TRI_PARAM"]["params"]["PMFUNTION_NAME"];
if ($libraryName != $triggerParamLibraryName || $methodName != $triggerParamMethodName) {
$msg = str_replace(array("{0}", "{1}", "{2}", "{3}"), array($libraryName, $methodName, $triggerUidFieldNameForException, $triggerUid), "The wizard with the library \"{0}\" and function \"{1}\", is invalid for the trigger with {2}: {3}");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_WIZARD_LIBRARY_AND_FUNCTION_IS_INVALID_FOR_TRIGGER", array($libraryName, $methodName, $triggerUidFieldNameForException, $triggerUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -231,22 +221,22 @@ class TriggerWizard
if ($nInputParam > 0 || $nOutputParam > 0) {
if (!isset($arrayData["TRI_PARAMS"])) {
throw (new \Exception(str_replace(array("{0}"), array($fieldNameForException), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($fieldNameForException)));
}
if (!is_array($arrayData["TRI_PARAMS"])) {
throw (new \Exception(str_replace(array("{0}"), array($fieldNameForException), "Invalid value for \"{0}\", this value must be an array.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($fieldNameForException)));
}
$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")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT"))));
}
if (!is_array($arrayData["TRI_PARAMS"]["INPUT"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT")), "Invalid value for \"{0}\", this value must be an array.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT"))));
}
$arrayParamData["input"] = $arrayData["TRI_PARAMS"]["INPUT"];
@@ -254,11 +244,11 @@ class TriggerWizard
if ($nOutputParam > 0) {
if (!isset($arrayData["TRI_PARAMS"]["OUTPUT"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT")), "Undefined value for \"{0}\", it is required.")));
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT"))));
}
if (!is_array($arrayData["TRI_PARAMS"]["OUTPUT"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT")), "Invalid value for \"{0}\", this value must be an array.")));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT"))));
}
$arrayParamData["output"] = $arrayData["TRI_PARAMS"]["OUTPUT"];

View File

@@ -344,9 +344,7 @@ class Validator
{
try {
if (!is_array($data)) {
$msg = str_replace(array("{0}"), array($dataNameForException), "Invalid value for \"{0}\", this value must be an array.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($dataNameForException)));
}
} catch (\Exception $e) {
throw $e;
@@ -365,9 +363,7 @@ class Validator
{
try {
if (empty($data)) {
$msg = str_replace(array("{0}"), array($dataNameForException), "Invalid value for \"{0}\", it can not be empty.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($dataNameForException)));
}
} catch (\Exception $e) {
throw $e;

View File

@@ -178,9 +178,7 @@ class WebEntry
$webEntry = \WebEntryPeer::retrieveByPK($webEntryUid);
if (is_null($webEntry)) {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $webEntryUid), "The web entry with {0}: {1} does not exist.");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_DOES_NOT_EXIST", array($fieldNameForException, $webEntryUid)));
}
} catch (\Exception $e) {
throw $e;
@@ -201,9 +199,7 @@ class WebEntry
{
try {
if ($this->existsTitle($processUid, $webEntryTitle, $webEntryUidExclude)) {
$msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $webEntryTitle), "The web entry title with {0}: \"{1}\" already exists");
throw (new \Exception($msg));
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_TITLE_ALREADY_EXISTS", array($fieldNameForException, $webEntryTitle)));
}
} catch (\Exception $e) {
throw $e;
@@ -262,11 +258,11 @@ class WebEntry
if (isset($arrayData["TAS_UID"])) {
if ($arrayTaskData["TAS_START"] == "FALSE") {
throw (new \Exception(str_replace(array("{0}"), array($arrayTaskData["TAS_TITLE"]), "The task \"{0}\" is not initial task")));
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_IS_NOT_INITIAL_ACTIVITY", array($arrayTaskData["TAS_TITLE"])));
}
if ($arrayTaskData["TAS_ASSIGN_TYPE"] != "BALANCED") {
throw (new \Exception(str_replace(array("{0}"), array($arrayTaskData["TAS_TITLE"]), "Web Entry only works with tasks which have \"Cyclical Assignment\", the task \"{0}\" does not have a valid assignment type. Please change the Assignment Rules")));
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_ACTIVITY_DOES_NOT_HAVE_VALID_ASSIGNMENT_TYPE", array($arrayTaskData["TAS_TITLE"])));
}
}
@@ -274,7 +270,7 @@ class WebEntry
$task = new \Tasks();
if ($task->assignUsertoTask($arrayData["TAS_UID"]) == 0) {
throw (new \Exception(str_replace(array("{0}"), array($arrayTaskData["TAS_TITLE"]), "The task \"{0}\" does not have users")));
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_HAVE_USERS", array($arrayTaskData["TAS_TITLE"])));
}
}
@@ -286,7 +282,7 @@ class WebEntry
$step = new \ProcessMaker\BusinessModel\Step();
if (!$step->existsRecord($arrayDataMain["TAS_UID"], "DYNAFORM", $arrayData["DYN_UID"])) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($arrayDynaFormData["DYN_TITLE"], $arrayTaskData["TAS_TITLE"]), "The DynaForm \"{0}\" isn't assigned to the task \"{1}\"")));
throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_IS_NOT_ASSIGNED_TO_ACTIVITY", array($arrayDynaFormData["DYN_TITLE"], $arrayTaskData["TAS_TITLE"])));
}
}
@@ -299,7 +295,7 @@ class WebEntry
$projectUser = new \ProcessMaker\BusinessModel\ProjectUser();
if (!$projectUser->userIsAssignedToTask($arrayData["USR_UID"], $arrayDataMain["TAS_UID"])) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($arrayUserData["USR_USERNAME"], $arrayTaskData["TAS_TITLE"]), "The user \"{0}\" does not have the task \"{1}\" assigned")));
throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_HAVE_ACTIVITY_ASSIGNED", array($arrayUserData["USR_USERNAME"], $arrayTaskData["TAS_TITLE"])));
}
}
} catch (\Exception $e) {
@@ -605,7 +601,7 @@ class WebEntry
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
}
throw (new \Exception("The registry cannot be created!.\n" . $msg));
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg);
}
} catch (\Exception $e) {
$cnn->rollback();
@@ -690,7 +686,7 @@ class WebEntry
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
}
throw (new \Exception("The registry cannot be created!.\n" . $msg));
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg);
}
} catch (\Exception $e) {
$cnn->rollback();