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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user