Merged in cochalo/processmaker (pull request #513)

Correccion de label añadiendo TRANSLATIONS
This commit is contained in:
Erik Amaru Ortiz
2014-05-29 17:07:01 -04:00
8 changed files with 81 additions and 82 deletions

View File

@@ -97,7 +97,7 @@ class Translation extends BaseTranslation
"$dateTo",
Criteria::LESS_EQUAL
)
)
)
);
}
// end filter
@@ -180,10 +180,10 @@ class Translation extends BaseTranslation
//$json = new Services_JSON(); DEPRECATED
$f = fopen( $cacheFileJS, 'w' );
if ($f == false) {
error_log("Error: Cannot write into cachefilejs: $cacheFileJS\n");
error_log("Error: Cannot write into cachefilejs: $cacheFileJS\n");
} else {
fwrite( $f, "var G_STRINGS =" . Bootstrap::json_encode( $translationJS ) . ";\n");
fclose( $f );
fwrite( $f, "var G_STRINGS =" . Bootstrap::json_encode( $translationJS ) . ";\n");
fclose( $f );
}
$res['cacheFile'] = $cacheFile;
@@ -215,7 +215,7 @@ class Translation extends BaseTranslation
foreach ($tranlations as $key => $row) {
if ($row->getTrnCategory() === 'LABEL') {
$translation[$row->getTrnLang()][$row->getTrnId()] = $row->getTrnValue();
$translation[$row->getTrnLang()][$row->getTrnId()] = $row->getTrnValue();
}
}
@@ -228,10 +228,10 @@ class Translation extends BaseTranslation
$f = fopen( $cacheFileMafe, 'w' );
if ($f == false) {
error_log("Error: Cannot write into cacheFileMafe: $cacheFileMafe\n");
error_log("Error: Cannot write into cacheFileMafe: $cacheFileMafe\n");
} else {
fwrite( $f, "var __TRANSLATIONMAFE = " . Bootstrap::json_encode( $translation ) . ";\n");
fclose( $f );
fwrite( $f, "var __TRANSLATIONMAFE = " . Bootstrap::json_encode( $translation ) . ";\n");
fclose( $f );
}
$res['cacheFileMafe'] = $cacheFileMafe;
@@ -622,7 +622,7 @@ class Translation extends BaseTranslation
}
return false;
}
public function generateTransaltionMafe ($lang='en')
{
if (!file_exists(PATH_TRUNK .'vendor/colosa/MichelangeloFE/' . 'labels.php')) {
@@ -636,4 +636,3 @@ class Translation extends BaseTranslation
}
}
}

View File

@@ -25,7 +25,7 @@ class Cases
{
Validator::isArray($dataList, '$dataList');
if (!isset($dataList["userId"])) {
throw (new \Exception("The user with userId: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('userId',''))));
} else {
Validator::usrUid($dataList["userId"], "userId");
}
@@ -53,7 +53,7 @@ class Cases
$valuesCorrect = array('todo', 'draft', 'paused', 'sent', 'selfservice', 'unassigned', 'search');
if (!in_array($action, $valuesCorrect)) {
throw (new \Exception('The value for $action is incorrect.'));
throw (new \Exception(\G::LoadTranslation("ID_INCORRECT_VALUE_ACTION")));
}
$start = (int)$start;
@@ -669,7 +669,7 @@ class Cases
$case = new \Cases();
$fields = $case->loadCase($app_uid);
if ($fields['APP_STATUS'] == 'CANCELLED') {
throw (new \Exception("The case '$app_uid' is already canceled"));
throw (new \Exception(\G::LoadTranslation("ID_CASE_ALREADY_CANCELED", array($app_uid))));
}
$case->cancelCase( $app_uid, $del_index, $usr_uid );
}
@@ -697,7 +697,7 @@ class Cases
$case = new \Cases();
$fields = $case->loadCase($app_uid);
if ($fields['APP_STATUS'] == 'CANCELLED') {
throw (new \Exception("The case '$app_uid' is canceled"));
throw (new \Exception(\G::LoadTranslation("ID_CASE_IS_CANCELED", array($app_uid))));
}
if ($del_index === false) {
@@ -1413,7 +1413,7 @@ class Cases
$respView = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW' );
$respBlock = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK' );
if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) {
throw (new \Exception("You do not have permission to cases notes."));
throw (new \Exception(\G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS")));
}
if ($sort != 'APP_NOTE.NOTE_DATE') {
@@ -1496,7 +1496,7 @@ class Cases
Validator::isString($note_content, '$note_content');
if (strlen($note_content) > 500) {
throw (new \Exception("Invalid value for '$note_content', the permitted maximum length of 500 characters."));
throw (new \Exception(\G::LoadTranslation("ID_INVALID_MAX_PERMITTED", array($note_content,'500'))));
}
Validator::isBoolean($send_mail, '$send_mail');
@@ -1508,7 +1508,7 @@ class Cases
$respView = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW' );
$respBlock = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK' );
if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) {
throw (new \Exception("You do not have permission to cases notes."));
throw (new \Exception(\G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS")));
}
$note_content = addslashes($note_content);

View File

@@ -105,21 +105,21 @@ class DataBaseConnection
$typesExists[] = $value['id'];
}
if (!in_array($dataDBConnection['DBS_TYPE'], $typesExists)) {
throw (new \Exception("The dababase connection with dbs_type: '" . $dataDBConnection['DBS_TYPE'] . " is invalid"));
throw (new \Exception(\G::LoadTranslation("ID_DBC_TYPE_INVALID", array($dataDBConnection['DBS_TYPE']))));
}
}
if (isset($dataDBConnection['DBS_SERVER']) && $dataDBConnection['DBS_SERVER'] == '') {
throw (new \Exception("The dababase connection with dbs_server: '" . $dataDBConnection['DBS_SERVER'] . "', is invalid"));
throw (new \Exception(\G::LoadTranslation("ID_DBC_SERVER_INVALID", array($dataDBConnection['DBS_SERVER']))));
}
if (isset($dataDBConnection['DBS_DATABASE_NAME']) && $dataDBConnection['DBS_DATABASE_NAME'] == '') {
throw (new \Exception("The dababase connection with dbs_database_name: '" . $dataDBConnection['DBS_DATABASE_NAME'] . "', is invalid"));
throw (new \Exception(\G::LoadTranslation("ID_DBC_DBNAME_INVALID", array($dataDBConnection['DBS_DATABASE_NAME']))));
}
if (isset($dataDBConnection['DBS_PORT']) &&
($dataDBConnection['DBS_PORT'] == ''|| $dataDBConnection['DBS_PORT'] == 0)) {
throw (new \Exception("The dababase connection with dbs_port: '" . $dataDBConnection['DBS_PORT'] . "', is invalid"));
throw (new \Exception(\G::LoadTranslation("ID_DBC_PORT_INVALID", array($dataDBConnection['DBS_PORT']))));
}
if (isset($dataDBConnection['DBS_ENCODE'])) {
@@ -130,7 +130,7 @@ class DataBaseConnection
$encodesExists[] = $value['0'];
}
if (!in_array($dataDBConnection['DBS_ENCODE'], $encodesExists)) {
throw (new \Exception( "The dababase connection with dbs_encode: '" . $dataDBConnection['DBS_ENCODE'] . "', is invalid" ));
throw (new \Exception(\G::LoadTranslation("ID_DBC_ENCODE_INVALID", array($dataDBConnection['DBS_ENCODE']))));
}
}
@@ -342,11 +342,11 @@ class DataBaseConnection
{
$pro_uid = trim($pro_uid);
if ($pro_uid == '') {
throw (new \Exception("The project with prj_uid: '', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_PROJECT_NOT_EXIST", array('prj_uid',''))));
}
$oProcess = new \Process();
if (!($oProcess->processExists($pro_uid))) {
throw (new \Exception("The project with prj_uid: '$pro_uid', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_PROJECT_NOT_EXIST", array('prj_uid', $pro_uid))));
}
return $pro_uid;
}
@@ -365,11 +365,11 @@ class DataBaseConnection
{
$dbs_uid = trim($dbs_uid);
if ($dbs_uid == '') {
throw (new \Exception("The database connection with dbs_uid: '', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_DBC_NOT_EXIST", array('dbs_uid',''))));
}
$oDBSource = new DbSource();
if (!($oDBSource->Exists($dbs_uid, $pro_uid))) {
throw (new \Exception("The database connection with dbs_uid: '$dbs_uid', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_DBC_NOT_EXIST", array('dbs_uid',$dbs_uid))));
}
return $dbs_uid;
}

View File

@@ -264,7 +264,7 @@ class Department
if (isset($dep_data['DEP_TITLE'])) {
Validator::depTitle($dep_data['DEP_TITLE']);
} else {
throw (new \Exception("The field dep_title is required."));
throw (new \Exception(\G::LoadTranslation("ID_FIELD_REQUIRED", array('dep_title'))));
}
$dep_uid = $oDepartment->create($dep_data);
$response = $this->getDepartment($dep_uid);
@@ -288,11 +288,11 @@ class Department
$oDepartment = new \Department();
$countUsers = $oDepartment->cantUsersInDepartment($dep_uid);
if ($countUsers != 0) {
throw (new \Exception("Department cannot be deleted while has assigned users."));
throw (new \Exception(\G::LoadTranslation("ID_CANT_DELETE_DEPARTMENT_HAS_USERS")));
}
$dep_data = $this->getDepartment($dep_uid);
if ($dep_data['has_children'] != 0) {
throw (new \Exception("Can not delete the department, it has a children department."));
throw (new \Exception(\G::LoadTranslation("ID_CANT_DELETE_DEPARTMENT_HAS_CHILDREN")));
}
$oDepartment->remove($dep_uid);
}

View File

@@ -28,7 +28,7 @@ class Event
$oProcess = new \Process();
if (!($oProcess->processExists($pro_uid))) {
throw (new \Exception( 'This process does not exist!' ));
throw (new \Exception(\G::LoadTranslation("ID_PROCESS_NOT_EXIST", array('pro_uid',$pro_uid))));
}
$sDelimiter = \DBAdapter::getStringDelimiter();
@@ -75,7 +75,7 @@ class Event
}
if ($evn_uid != '' && empty($eventsArray)) {
throw (new \Exception( 'This row does not exist!' ));
throw (new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST")));
} elseif ($evn_uid != '' && !empty($eventsArray)) {
return current($eventsArray);
}
@@ -106,18 +106,18 @@ class Event
$dataEvent = array_change_key_case($dataEvent, CASE_UPPER);
if ($dataEvent['EVN_RELATED_TO'] == 'SINGLE') {
if (empty($dataEvent['TAS_UID'])) {
throw (new \Exception('The field "tas_uid" is required!'));
throw (new \Exception(\G::LoadTranslation("ID_FIELD_REQUIRED", array('tas_uid'))));
}
$this->validateTasUid($dataEvent['TAS_UID']);
} else {
if (empty($dataEvent['EVN_TAS_UID_FROM'])) {
throw (new \Exception('The field "evn_tas_uid_from" is required!'));
throw (new \Exception(\G::LoadTranslation("ID_FIELD_REQUIRED", array('evn_tas_uid_from'))));
}
$this->validateTasUid($dataEvent['EVN_TAS_UID_FROM']);
$dataEvent['TAS_UID'] = $dataEvent['EVN_TAS_UID_FROM'];
if (empty($dataEvent['EVN_TAS_UID_TO'])) {
throw (new \Exception('The field "evn_tas_uid_to" is required!'));
throw (new \Exception(\G::LoadTranslation("ID_FIELD_REQUIRED", array('evn_tas_uid_to'))));
}
$this->validateTasUid($dataEvent['EVN_TAS_UID_TO']);
}
@@ -178,11 +178,11 @@ class Event
{
$pro_uid = trim($pro_uid);
if ($pro_uid == '') {
throw (new \Exception("The project with prj_uid: '', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_PROJECT_NOT_EXIST", array('prj_uid',''))));
}
$oProcess = new \Process();
if (!($oProcess->processExists($pro_uid))) {
throw (new \Exception("The project with prj_uid: '$pro_uid', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_PROJECT_NOT_EXIST", array('prj_uid',$pro_uid))));
}
return $pro_uid;
}
@@ -200,11 +200,11 @@ class Event
{
$evn_uid = trim($evn_uid);
if ($evn_uid == '') {
throw (new \Exception("The event with evn_uid: '', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_EVENT_NOT_EXIST", array('evn_uid',''))));
}
$oEvent = new \Event();
if (!($oEvent->Exists($evn_uid))) {
throw (new \Exception("The event with evn_uid: '$evn_uid', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_EVENT_NOT_EXIST", array('evn_uid',$evn_uid))));
}
return $evn_uid;
}
@@ -222,11 +222,11 @@ class Event
{
$tas_uid = trim($tas_uid);
if ($tas_uid == '') {
throw (new \Exception("The task with tas_uid: '', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_TASK_NOT_EXIST", array('tas_uid',''))));
}
$oTask = new \Task();
if (!($oTask->taskExists($tas_uid))) {
throw (new \Exception("The task with tas_uid: '$tas_uid', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_TASK_NOT_EXIST", array('tas_uid',$tas_uid))));
}
return $tas_uid;
}
@@ -244,12 +244,12 @@ class Event
{
$tri_uid = trim($tri_uid);
if ($tri_uid == '') {
throw (new \Exception("The trigger with tri_uid: '', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array('tri_uid',''))));
}
$oTriggers = new \Triggers();
if (!($oTriggers->TriggerExists($tri_uid))) {
throw (new \Exception("The trigger with tri_uid: '', does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array('tri_uid',$tri_uid))));
}
return $tri_uid;

View File

@@ -176,7 +176,7 @@ class ProcessPermissions
}
if ($op_uid != '' && empty($aObjectsPermissions)) {
throw (new \Exception( 'This row does not exist!!' ));
throw (new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST")));
} elseif ($op_uid != '' && !empty($aObjectsPermissions)) {
$aObjectsPermissions = array_change_key_case($aObjectsPermissions, CASE_LOWER);
return current($aObjectsPermissions);
@@ -314,11 +314,11 @@ class ProcessPermissions
{
$pro_uid = trim($pro_uid);
if ($pro_uid == '') {
throw (new \Exception("The project with prj_uid: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_PROJECT_NOT_EXIST", array('prj_uid',''))));
}
$oProcess = new \Process();
if (!($oProcess->processExists($pro_uid))) {
throw (new \Exception("The project with prj_uid: '$pro_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_PROJECT_NOT_EXIST", array('prj_uid',$pro_uid))));
}
return $pro_uid;
}
@@ -336,11 +336,11 @@ class ProcessPermissions
{
$op_uid = trim($op_uid);
if ($op_uid == '') {
throw (new \Exception("The process permission with op_uid: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_PROCESS_PERMISSION_NOT_EXIST", array('op_uid',''))));
}
$oObjectPermission = new \ObjectPermission();
if (!($oObjectPermission->Exists($op_uid))) {
throw (new \Exception("The process permission with op_uid: '$op_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_PROCESS_PERMISSION_NOT_EXIST", array('op_uid',$op_uid))));
}
return $op_uid;
}
@@ -358,11 +358,11 @@ class ProcessPermissions
{
$usr_uid = trim($usr_uid);
if ($usr_uid == '') {
throw (new \Exception("The user with usr_uid: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('usr_uid',''))));
}
$oUsers = new \Users();
if (!($oUsers->userExists($usr_uid))) {
throw (new \Exception("The user with usr_uid: '$usr_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('usr_uid',$usr_uid))));
}
return $usr_uid;
}
@@ -380,11 +380,11 @@ class ProcessPermissions
{
$grp_uid = trim($grp_uid);
if ($grp_uid == '') {
throw (new \Exception("The group with usr_uid: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_GROUP_NOT_EXIST", array('grp_uid',''))));
}
$oGroup = new \Groupwf();
if (!($oGroup->GroupwfExists($grp_uid))) {
throw (new \Exception("The group with usr_uid: '$grp_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_GROUP_NOT_EXIST", array('grp_uid',$grp_uid))));
}
return $grp_uid;
}
@@ -402,11 +402,11 @@ class ProcessPermissions
{
$tas_uid = trim($tas_uid);
if ($tas_uid == '') {
throw (new \Exception("The task with tas_uid: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_TASK_NOT_EXIST", array('tas_uid',''))));
}
$oTask = new \Task();
if (!($oTask->taskExists($tas_uid))) {
throw (new \Exception("The task with tas_uid: '$tas_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_TASK_NOT_EXIST", array('tas_uid',$tas_uid))));
}
return $tas_uid;
}
@@ -424,11 +424,11 @@ class ProcessPermissions
{
$dyn_uid = trim($dyn_uid);
if ($dyn_uid == '') {
throw (new \Exception("The dynaform with dynaforms: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_DYNAFORM_NOT_EXIST", array('dyn_uid',''))));
}
$oDynaform = new \Dynaform();
if (!($oDynaform->dynaformExists($dyn_uid))) {
throw (new \Exception("The dynaform with dynaforms: '$dyn_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_DYNAFORM_NOT_EXIST", array('dyn_uid',$dyn_uid))));
}
return $dyn_uid;
}
@@ -446,11 +446,11 @@ class ProcessPermissions
{
$inp_uid = trim($inp_uid);
if ($inp_uid == '') {
throw (new \Exception("The input with inputs: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_INPUT_NOT_EXIST", array('inp_uid',''))));
}
$oInputDocument = new \InputDocument();
if (!($oInputDocument->InputExists($inp_uid))) {
throw (new \Exception("The input with inputs: '$inp_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_INPUT_NOT_EXIST", array('inp_uid',$inp_uid))));
}
return $inp_uid;
}
@@ -468,11 +468,11 @@ class ProcessPermissions
{
$out_uid = trim($out_uid);
if ($out_uid == '') {
throw (new \Exception("The output with outputs: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_OUTPUT_NOT_EXIST", array('out_uid',''))));
}
$oOutputDocument = new \OutputDocument();
if (!($oOutputDocument->OutputExists($out_uid))) {
throw (new \Exception("The output with outputs: '$out_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_OUTPUT_NOT_EXIST", array('out_uid',$out_uid))));
}
return $out_uid;
}

View File

@@ -175,7 +175,7 @@ class Trigger
if (isset($dataTrigger['TRI_TITLE'])) {
if (!$this->verifyNameTrigger($sProcessUID, $dataTrigger['TRI_TITLE'], $sTriggerUid)) {
throw new \Exception('A trigger with the same name already exists in this process');
throw new \Exception(\G::LoadTranslation("ID_CANT_SAVE_TRIGGER"));
}
}

View File

@@ -26,11 +26,11 @@ class Validator
{
$dep_uid = trim($dep_uid);
if ($dep_uid == '') {
throw (new \Exception("The departament with $nameField: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($nameField,''))));
}
$oDepartment = new \Department();
if (!($oDepartment->existsDepartment($dep_uid))) {
throw (new \Exception("The departament with $nameField: '$dep_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($nameField,$dep_uid))));
}
return $dep_uid;
}
@@ -52,7 +52,7 @@ class Validator
{
$dep_title = trim($dep_title);
if ($dep_title == '') {
throw (new \Exception("The departament with dep_title: '' is incorrect."));
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_title',''))));
}
$oCriteria = new \Criteria( 'workflow' );
@@ -71,7 +71,7 @@ class Validator
$oDataset = \DepartmentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
if ($oDataset->next()) {
throw (new \Exception("The departament with dep_title: '$dep_title' already exists."));
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_title',$dep_title))));
}
return $dep_title;
}
@@ -92,7 +92,7 @@ class Validator
$dep_status = trim($dep_status);
$values = array('ACTIVE', 'INACTIVE');
if (!in_array($dep_status, $values)) {
throw (new \Exception("The departament with dep_status: '$dep_status' is incorrect."));
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_status',$dep_status))));
}
return $dep_status;
}
@@ -113,11 +113,11 @@ class Validator
{
$usr_uid = trim($usr_uid);
if ($usr_uid == '') {
throw (new \Exception("The user with $nameField: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array($nameField,''))));
}
$oUsers = new \Users();
if (!($oUsers->userExists($usr_uid))) {
throw (new \Exception("The user with $nameField: '$usr_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array($nameField,$usr_uid))));
}
return $usr_uid;
}
@@ -138,11 +138,11 @@ class Validator
{
$app_uid = trim($app_uid);
if ($app_uid == '') {
throw (new \Exception("The application with $nameField: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_APPLICATION_NOT_EXIST", array($nameField,''))));
}
$oApplication = new \Application();
if (!($oApplication->exists($app_uid))) {
throw (new \Exception("The application with $nameField: '$app_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_APPLICATION_NOT_EXIST", array($nameField,$app_uid))));
}
return $app_uid;
}
@@ -163,11 +163,11 @@ class Validator
{
$tri_uid = trim($tri_uid);
if ($tri_uid == '') {
throw (new \Exception("The trigger with $nameField: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array($nameField,''))));
}
$oTriggers = new \Triggers();
if (!($oTriggers->TriggerExists($tri_uid))) {
throw (new \Exception("The trigger with $nameField: '$tri_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array($nameField,$tri_uid))));
}
return $tri_uid;
}
@@ -188,11 +188,11 @@ class Validator
{
$pro_uid = trim($pro_uid);
if ($pro_uid == '') {
throw (new \Exception("The process with $nameField: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_PROCESS_NOT_EXIST", array($nameField,''))));
}
$oProcess = new \Process();
if (!($oProcess->exists($pro_uid))) {
throw (new \Exception("The process with $nameField: '$pro_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_PROCESS_NOT_EXIST", array($nameField,$pro_uid))));
}
return $pro_uid;
}
@@ -213,11 +213,11 @@ class Validator
{
$cat_uid = trim($cat_uid);
if ($cat_uid == '') {
throw (new \Exception("The category with $nameField: '' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_CATEGORY_NOT_EXIST", array($nameField,''))));
}
$oCategory = new \ProcessCategory();
if (!($oCategory->exists($cat_uid))) {
throw (new \Exception("The category with $nameField: '$cat_uid' does not exist."));
throw (new \Exception(\G::LoadTranslation("ID_CATEGORY_NOT_EXIST", array($nameField,$cat_uid))));
}
return $cat_uid;
}
@@ -238,11 +238,11 @@ class Validator
{
$date = trim($date);
if ($date == '') {
throw (new \Exception("The value '' is not a valid date for the format '$format'."));
throw (new \Exception(\G::LoadTranslation("ID_DATE_NOT_VALID", array('',$format))));
}
$d = \DateTime::createFromFormat($format, $date);
if (!($d && $d->format($format) == $date)) {
throw (new \Exception("The value '$date' is not a valid date for the format '$format'."));
throw (new \Exception(\G::LoadTranslation("ID_DATE_NOT_VALID", array($date,$format))));
}
return $date;
}
@@ -260,7 +260,7 @@ class Validator
static public function isArray($field, $nameField)
{
if (!is_array($field)) {
throw (new \Exception("Invalid value for '$nameField' it must be an array."));
throw (new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ARRAY", array($nameField))));
}
}
@@ -277,7 +277,7 @@ class Validator
static public function isString($field, $nameField)
{
if (!is_string($field)) {
throw (new \Exception("Invalid value for '$nameField' it must be a string."));
throw (new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_STRING", array($nameField))));
}
}
@@ -294,7 +294,7 @@ class Validator
static public function isInteger($field, $nameField)
{
if (!is_integer($field)) {
throw (new \Exception("Invalid value for '$nameField' it must be a integer."));
throw (new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_INTEGER", array($nameField))));
}
}
@@ -311,7 +311,7 @@ class Validator
static public function isBoolean($field, $nameField)
{
if (!is_bool($field)) {
throw (new \Exception("Invalid value for '$nameField' it must be a boolean."));
throw (new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_BOOLEAN", array($nameField))));
}
}
@@ -328,7 +328,7 @@ class Validator
static public function isNotEmpty($field, $nameField)
{
if (empty($field)) {
throw (new \Exception("The field '$nameField' is empty."));
throw (new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_IS_EMPTY", array($nameField))));
}
}