Replace harcoded labels by a translation ID

This commit is contained in:
Daniel Rojas
2014-05-22 09:12:35 -04:00
parent acae269532
commit 2b88d112f0
10 changed files with 159 additions and 257 deletions

View File

@@ -501,7 +501,7 @@ class Cases
}
//Return
if (empty($result)) {
throw (new \Exception('Incorrect or unavailable information about this case: ' .$applicationUid));
throw new \Exception(\G::LoadTranslation("ID_CASES_INCORRECT_INFORMATION", array($applicationUid)));
} else {
return $result;
}
@@ -528,13 +528,10 @@ class Cases
if ($variables) {
$variables = array_shift($variables);
}
$oProcesses = new \Processes();
if (! $oProcesses->processExists($processUid)) {
throw (new \Exception( 'Invalid value specified for \'pro_uid\''));
}
Validator::proUid($processUid, '$pro_uid');
$oTask = new \Task();
if (! $oTask->taskExists($taskUid)) {
throw (new \Exception( 'Invalid value specified for \'tas_uid\''));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('tas_uid')));
}
$fields = $ws->newCase($processUid, $userUid, $taskUid, $variables);
$array = json_decode(json_encode($fields), true);
@@ -577,21 +574,18 @@ class Cases
} elseif ($variables == null) {
$variables = array(array());
}
$oProcesses = new \Processes();
if (! $oProcesses->processExists($processUid)) {
throw (new \Exception( 'Invalid value specified for \'pro_uid\''));
}
Validator::proUid($processUid, '$pro_uid');
$user = new \Users();
if (! $user->userExists( $userUid )) {
throw (new \Exception( 'Invalid value specified for \'usr_uid\''));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('usr_uid')));
}
$fields = $ws->newCaseImpersonate($processUid, $userUid, $variables, $taskUid);
$array = json_decode(json_encode($fields), true);
if ($array ["status_code"] != 0) {
if ($array ["status_code"] == 12) {
throw (new \Exception( G::loadTranslation( 'ID_NO_STARTING_TASK' ) . '. \'tas_uid\'.'));
throw (new \Exception(\G::loadTranslation('ID_NO_STARTING_TASK') . '. tas_uid.'));
} elseif ($array ["status_code"] == 13) {
throw (new \Exception( G::loadTranslation( 'ID_MULTIPLE_STARTING_TASKS' ) . '. \'tas_uid\'.'));
throw (new \Exception(\G::loadTranslation('ID_MULTIPLE_STARTING_TASKS') . '. tas_uid.'));
}
throw (new \Exception($array ["message"]));
} else {
@@ -641,7 +635,7 @@ class Cases
unset($array['timestamp']);
}
} else {
throw (new \Exception('The Application with app_uid: '.$applicationUid.' doesn\'t exist'));
throw new \Exception(\G::LoadTranslation("ID_CASES_INCORRECT_INFORMATION", array($applicationUid)));
}
} catch (\Exception $e) {
throw $e;

View File

@@ -84,7 +84,7 @@ class InputDocument
if ($docrow['app_doc_uid'] == $inputDocumentUid) {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, $row['DOC_VERSION'] );
if (is_null( $oAppDocument )) {
throw (new \Exception('This input document with id: '.$inputDocumentUid.' doesn\'t exist!'));
throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_DOES_NOT_EXIST", array($inputDocumentUid)));
}
$result = $docrow;
}
@@ -109,7 +109,7 @@ class InputDocument
try {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 );
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
throw (new \Exception('This input document with inp_doc_uid: '.$inputDocumentUid.' doesn\'t exist!'));
throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_DOES_NOT_EXIST", array($inputDocumentUid)));
}
\G::LoadClass('wsBase');
$ws = new \wsBase();
@@ -180,7 +180,7 @@ class InputDocument
$arrayTrigger = $case->loadTriggers($taskUid, "INPUT_DOCUMENT", $inputDocumentUid, "AFTER");
//Add Input Document
if (empty($_FILES)) {
throw (new \Exception('This document filename doesn\'t exist!'));
throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_FILENAME_DOES_NOT_EXIST"));
}
if (!$_FILES["form"]["error"]) {
$_FILES["form"]["error"] = 0;

View File

@@ -82,7 +82,7 @@ class OutputDocument
if ($docrow['app_doc_uid'] == $applicationDocumentUid) {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, $row['DOC_VERSION'] );
if (is_null( $oAppDocument )) {
throw (new \Exception('This output document with id: '.$applicationDocumentUid.' doesn\'t exist!'));
throw new \Exception(\G::LoadTranslation("ID_CASES_OUTPUT_DOES_NOT_EXIST", array($applicationDocumentUid)));
}
$result = $docrow;
}
@@ -108,7 +108,7 @@ class OutputDocument
$lastDocVersion = $oAppDocumentVersion->getLastAppDocVersion($applicationDocumentUid);
$oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, $lastDocVersion);
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
throw (new \Exception('This output document with id: '.$applicationDocumentUid.' doesn\'t exist!'));
throw new \Exception(\G::LoadTranslation("ID_CASES_OUTPUT_DOES_NOT_EXIST", array($applicationDocumentUid)));
}
$aFields = array ('APP_DOC_UID' => $applicationDocumentUid,'DOC_VERSION' => $lastDocVersion,'APP_DOC_STATUS' => 'DELETED');
$oAppDocument->update( $aFields );

View File

@@ -62,7 +62,7 @@ class FilesManager
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $sSubDirectory;
break;
default:
throw (new \Exception( 'Invalid value specified for path. Expecting templates or public'));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('path')));
break;
}
\G::verifyPath($sDirectory, true);
@@ -147,7 +147,7 @@ class FilesManager
try {
$aData['prf_path'] = rtrim($aData['prf_path'], '/') . '/';
if (!$aData['prf_filename']) {
throw (new \Exception( 'Invalid value specified for prf_filename.'));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_filename')));
}
$extention = strstr($aData['prf_filename'], '.');
if (!$extention) {
@@ -162,7 +162,7 @@ class FilesManager
}
$sMainDirectory = current(explode("/", $aData['prf_path']));
if ($sMainDirectory != 'public' && $sMainDirectory != 'templates') {
throw (new \Exception( 'Invalid value specified for prf_path. Expecting templates/ or public/'));
throw new \Exception(\G::LoadTranslation("ID_INVALID_PRF_PATH"));
}
if (strstr($aData['prf_path'],'/')) {
$sSubDirectory = substr($aData['prf_path'], strpos($aData['prf_path'], "/")+1) ;
@@ -186,7 +186,8 @@ class FilesManager
$content = $aData['prf_content'];
if (is_string($content)) {
if (file_exists(PATH_SEP.$sDirectory)) {
throw (new \Exception( 'The file: '.$sMainDirectory. PATH_SEP . $sSubDirectory . $aData['prf_filename'] . ' already exists.'));
$directory = $sMainDirectory. PATH_SEP . $sSubDirectory . $aData['prf_filename'];
throw new \Exception(\G::LoadTranslation("ID_EXISTS_FILE", array($directory)));
}
}
if (!file_exists($sCheckDirectory)) {
@@ -329,7 +330,7 @@ class FilesManager
$rsCriteria->next();
}
if ($path == '') {
throw new \Exception('Invalid value specified for prf_uid.');
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid')));
}
$sFile = end(explode("/",$path));
$sPath = str_replace($sFile,'',$path);
@@ -348,7 +349,7 @@ class FilesManager
$sEditable = false;
}
if ($sEditable == false) {
throw (new \Exception( 'Unable to edit. Make sure your file has an editable extension.'));
throw new \Exception(\G::LoadTranslation("ID_UNABLE_TO_EDIT"));
}
$oProcessFiles = \ProcessFilesPeer::retrieveByPK($prfUid);
$sDate = date('Y-m-d H:i:s');
@@ -398,7 +399,7 @@ class FilesManager
$rsCriteria->next();
}
if ($path == '') {
throw new \Exception('Invalid value specified for prf_uid.');
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid')));
}
$sFile = end(explode("/",$path));
$sPath = str_replace($sFile,'',$path);
@@ -440,7 +441,7 @@ class FilesManager
$rsCriteria->next();
}
if ($path == '') {
throw new \Exception('Invalid value specified for prf_uid.');
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid')));
}
$sFile = end(explode("/",$path));
$sPath = str_replace($sFile,'',$path);
@@ -492,7 +493,7 @@ class FilesManager
if (file_exists($sDirectory.$sDirToDelete)) {
\G::rm_dir($sDirectory.$sDirToDelete);
} else {
throw (new \Exception( 'Invalid value specified for path.'));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('path')));
}
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\ProcessFilesPeer::PRF_PATH);

View File

@@ -235,7 +235,7 @@ class OutputDocument
if ($row == "print" || $row == "modify" || $row == "copy" || $row == "forms" || $row == "") {
$outputDocumentData['out_doc_pdf_security_permissions'] = $outputDocumentData['out_doc_pdf_security_permissions'];
} else {
throw (new \Exception( 'Invalid value specified for out_doc_pdf_security_permissions'));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('out_doc_pdf_security_permissions')));
}
}
try {
@@ -245,7 +245,7 @@ class OutputDocument
//Verify data
Validator::proUid($sProcessUID, '$pro_uid');
if ($outputDocumentData["OUT_DOC_TITLE"]=="") {
throw (new \Exception( 'Invalid value specified for out_doc_title, can not be null'));
throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('out_doc_title')));
}
if (isset($outputDocumentData["OUT_DOC_TITLE"]) && $this->existsTitle($sProcessUID, $outputDocumentData["OUT_DOC_TITLE"])) {
throw (new \Exception(\G::LoadTranslation("ID_OUTPUT_NOT_SAVE")));
@@ -303,7 +303,7 @@ class OutputDocument
if ($row == "print" || $row == "modify" || $row == "copy" || $row == "forms" || $row == "") {
$outputDocumentData['out_doc_pdf_security_permissions'] = $outputDocumentData['out_doc_pdf_security_permissions'];
} else {
throw (new \Exception( 'Invalid value specified for out_doc_pdf_security_permissions'));
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('out_doc_pdf_security_permissions')));
}
}
try {
@@ -339,10 +339,10 @@ class OutputDocument
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage();
}
throw (new \Exception('The registry cannot be updated!' . $sMessage));
throw (new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . $sMessage));
}
} else {
throw (new \Exception('This row does not exist!'));
throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
}
} catch (\Exception $e) {
throw $e;

View File

@@ -90,7 +90,7 @@ class ProcessSupervisor
$aResp = array();
$oProcess = \ProcessUserPeer::retrieveByPK( $sPuUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for pu_uid: '. $sPuUID .' does not correspond to a valid relation'));
throw new \Exception(\G::LoadTranslation("ID_NOT_VALID_RELATION", array($sPuUID)));
}
// Groups
$oCriteria = new \Criteria('workflow');
@@ -321,7 +321,7 @@ class ProcessSupervisor
$aResp = array();
$oDynaformSupervisor = \StepSupervisorPeer::retrieveByPK( $sPudUID );
if (is_null( $oDynaformSupervisor ) ) {
throw (new \Exception( 'This id: '. $sPudUID .' does not correspond to a registered process supervisor '));
throw new \Exception(\G::LoadTranslation("ID_NOT_REGISTERED_PROCESS_SUPERVISOR", array($sPudUID)));
}
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
@@ -473,7 +473,7 @@ class ProcessSupervisor
$aResp = array();
$oInputDocumentSupervisor = \StepSupervisorPeer::retrieveByPK( $sPuiUID );
if (is_null( $oInputDocumentSupervisor ) ) {
throw (new \Exception( 'This id: '. $sPuiUID .' does not correspond to a registered process supervisor '));
throw new \Exception(\G::LoadTranslation("ID_NOT_REGISTERED_PROCESS_SUPERVISOR", array($sPuiUID)));
}
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
@@ -575,16 +575,16 @@ class ProcessSupervisor
$oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sUsrUID );
$oTypeAssigneeU = \UsersPeer::retrieveByPK( $sUsrUID );
if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
throw (new \Exception( 'This id: '. $sUsrUID .' does not correspond to a registered ' .$sTypeUID ));
throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_CORRESPOND_TYPE", array($sUsrUID, $sTypeUID)));
}
if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) {
if ( "SUPERVISOR"!= $sTypeUID ) {
throw (new \Exception( 'This id: '. $sUsrUID .' does not correspond to a registered ' .$sTypeUID ));
throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_CORRESPOND_TYPE", array($sUsrUID, $sTypeUID)));
}
}
if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
if ( "GROUP_SUPERVISOR" != $sTypeUID ) {
throw (new \Exception( 'This id: '. $sUsrUID .' does not correspond to a registered ' .$sTypeUID ));
throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_CORRESPOND_TYPE", array($sUsrUID, $sTypeUID)));
}
}
// validate Groups
@@ -632,7 +632,7 @@ class ProcessSupervisor
$oCriteria = $this->getProcessSupervisor($sProcessUID, $sPuUID);
return $oCriteria;
} else {
throw (new \Exception('This relation already exist!'));
throw new \Exception(\G::LoadTranslation("ID_RELATION_EXIST"));
}
}
@@ -648,7 +648,7 @@ class ProcessSupervisor
{
$oTypeDynaform = \DynaformPeer::retrieveByPK($sDynUID);
if (is_null( $oTypeDynaform )) {
throw (new \Exception( 'This id for dyn_uid: '. $sDynUID .' does not correspond to a registered Dynaform'));
throw new \Exception(\G::LoadTranslation("ID_DOES NOT_DYNAFORM", array($sDynUID)));
}
$aResp = array();
$sPuUIDT = array();
@@ -717,7 +717,7 @@ class ProcessSupervisor
}
return $aResp;
} else {
throw (new \Exception('This relation already exist!'));
throw new \Exception(\G::LoadTranslation("ID_RELATION_EXIST"));
}
}
@@ -734,7 +734,7 @@ class ProcessSupervisor
{
$oTypeInputDocument= \InputDocumentPeer::retrieveByPK($sInputDocumentUID);
if (is_null( $oTypeInputDocument )) {
throw (new \Exception( 'This id for inp_doc_uid: '. $sInputDocumentUID .' does not correspond to a registered InputDocument'));
throw new \Exception(\G::LoadTranslation("ID_DOES NOT_INPUT_DOCUMENT", array($sInputDocumentUID)));
}
$aResp = array();
$sPuUIDT = array();
@@ -804,7 +804,7 @@ class ProcessSupervisor
}
return $aResp;
} else {
throw (new \Exception('This relation already exist!'));
throw new \Exception(\G::LoadTranslation("ID_RELATION_EXIST"));
}
}
@@ -826,7 +826,7 @@ class ProcessSupervisor
$oConnection->commit();
return $iResult;
} else {
throw (new \Exception('This row does not exist!'));
throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
}
} catch (\Exception $e) {
$oConnection->rollback();
@@ -849,7 +849,7 @@ class ProcessSupervisor
$oProcessMap = new \processMap(new \DBConnection());
$oProcessMap->removeSupervisorStep( $oDynaformSupervidor->getStepUid(), $sProcessUID, 'DYNAFORM', $oDynaformSupervidor->getStepUidObj(), $oDynaformSupervidor->getStepPosition() );
} else {
throw (new \Exception('This row does not exist!'));
throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
}
} catch (Exception $oError) {
throw ($oError);
@@ -871,7 +871,7 @@ class ProcessSupervisor
$oProcessMap = new \processMap(new \DBConnection());
$oProcessMap->removeSupervisorStep( $oInputDocumentSupervidor->getStepUid(), $sProcessUID, 'INPUT_DOCUMENT', $oInputDocumentSupervidor->getStepUidObj(), $oInputDocumentSupervidor->getStepPosition() );
} else {
throw (new \Exception('This row does not exist!'));
throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
}
} catch (Exception $oError) {
throw ($oError);

View File

@@ -17,10 +17,7 @@ class ProjectUser
public function getProjectUsers($sProcessUID)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
Validator::proUid($sProcessUID, '$prj_uid');
$aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
@@ -103,10 +100,7 @@ class ProjectUser
public function getProjectStartingTasks($sProcessUID)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
Validator::proUid($sProcessUID, '$prj_uid');
$aUsers = array();
$usersIds = array();
@@ -183,14 +177,8 @@ class ProjectUser
public function getProjectStartingTaskUsers($sProcessUID, $sUserUID)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oUser = \UsersPeer::retrieveByPK($sUserUID);
if (is_null($oUser)) {
throw (new \Exception( 'This id for usr_uid: '. $sUserUID .' does not correspond to a registered user'));
}
Validator::proUid($sProcessUID, '$prj_uid');
Validator::usrUid($sUserUID, '$usr_uid');
$aUsers = array();
\G::LoadClass( 'case' );
$oCase = new \Cases();
@@ -207,7 +195,7 @@ class ProjectUser
}
}
if (sizeof($aUsers) < 1) {
throw (new \Exception( 'This user usr_uid: '. $sUserUID .' does not have initial activities assigned in this project.'));
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_INITIAL ACTIVITIES", array($sUserUID)));
}
return $aUsers;
} catch (Exception $e) {
@@ -229,10 +217,7 @@ class ProjectUser
public function projectWsUserCanStartTask($sProcessUID, $sActivityUID, $oData)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
Validator::proUid($sProcessUID, '$prj_uid');
/**
* process_webEntryValidate
* validates if the username and password are valid data and if the user assigned
@@ -309,9 +294,9 @@ class ProjectUser
$userIsAssigned = \GroupUserPeer::doCount( $oCriteria );
if (! ($userIsAssigned >= 1)) {
if ($sTASKS) {
throw (new \Exception( "The usr_uid: " . $sWS_USER . " doesn't have the activity act_uid: " . $sTASKS . " assigned"));
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_ID_ACTIVITY", array($sWS_USER, $sTASKS)));
} else {
throw (new \Exception( "The usr_uid: " . $sWS_USER . " doesn't have an activity assigned"));
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_ACTIVITY", array($sWS_USER)));
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -223,7 +223,7 @@ class User
if ($form['USR_COUNTRY'] != '') {
$oCountry = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']);
if (is_null($oCountry)) {
throw new \Exception('Invalid value for usr_country: '.$form['USR_COUNTRY']);
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($form['USR_COUNTRY'])));
}
}
}
@@ -231,7 +231,7 @@ class User
if ($form['USR_CITY'] != '') {
$oCity = \IsoSubdivisionPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_CITY']);
if (is_null($oCity)) {
throw new \Exception('Invalid value for usr_city: '.$form['USR_CITY']);
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($form['USR_CITY'])));
}
}
}
@@ -239,7 +239,7 @@ class User
if ($form['USR_LOCATION'] != '') {
$oLocation = \IsoLocationPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_LOCATION']);
if (is_null($oLocation)) {
throw new \Exception('Invalid value for usr_location: '.$form['USR_LOCATION']);
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($form['USR_LOCATION'])));
}
}
}
@@ -298,7 +298,7 @@ class User
$userData['USR_LASTNAME'] = $form['USR_LASTNAME'];
}
if ($form['USR_EMAIL'] == '') {
throw new \Exception('Invalid value specified for usr_email, can not be null.');
throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('usr_email')));
} else {
if (!filter_var($form['USR_EMAIL'], FILTER_VALIDATE_EMAIL)) {
throw new \Exception('usr_email. '.\G::LoadTranslation('ID_INCORRECT_EMAIL'));
@@ -326,16 +326,16 @@ class User
$userData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN'];
$statusWF = $form['USR_STATUS'];
if ($form['USR_STATUS'] == '') {
throw new \Exception('Invalid value specified for usr_status, can not be null');
throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('usr_status')));
} else {
if ($form['USR_STATUS'] == 'ACTIVE' || $form['USR_STATUS'] == 'INACTIVE' || $form['USR_STATUS'] == 'VACATION') {
$userData['USR_STATUS'] = $form['USR_STATUS'];
} else {
throw new \Exception('usr_status. Invalid value for status field.');
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('usr_status')));
}
}
if ($form['USR_ROLE'] == '') {
throw new \Exception('Invalid value specified for usr_role, can not be null');
throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('usr_role')));
} else {
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Roles.php");
$oCriteria = new \Criteria('rbac');
@@ -346,7 +346,7 @@ class User
if ($oDataset->getRow()) {
$userData['USR_ROLE'] = $form['USR_ROLE'];
} else {
throw new \Exception('usr_role. Invalid value for role field.');
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('usr_role')));
}
}
try {
@@ -411,7 +411,7 @@ class User
}
}
if ($countPermission != 1) {
throw new \Exception('This user: '.$usrLoggedUid. ', can not update the data.');
throw new \Exception(\G::LoadTranslation("ID_USER_CAN_NOT_UPDATE", array($usrLoggedUid)));
}
if (isset($arrayUserData['USR_USERNAME'])) {
$criteria = new \Criteria();
@@ -566,7 +566,7 @@ class User
if ($oDataset->getRow()) {
$userData['USR_ROLE'] = $form['USR_ROLE'];
} else {
throw new \Exception('usr_role. Invalid value for field.');
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('usr_role')));
}
$this->updateUser($userData, $form['USR_ROLE']);
} else {
@@ -581,7 +581,7 @@ class User
if ($form['USR_COUNTRY'] != '') {
$oReplacedBy = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']);
if (is_null($oReplacedBy)) {
throw new \Exception('Invalid value for usr_country: '.$form['USR_COUNTRY']);
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($form['USR_COUNTRY'])));
} else {
$userData['USR_COUNTRY'] = $form['USR_COUNTRY'];
$userData['USR_CITY'] = '';
@@ -593,7 +593,7 @@ class User
if ($form['USR_CITY'] != '') {
$oCity = \IsoSubdivisionPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_CITY']);
if (is_null($oCity)) {
throw new \Exception('Invalid value for usr_city: '.$form['USR_CITY']);
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($form['USR_CITY'])));
} else {
$userData['USR_CITY'] = $form['USR_CITY'];
}
@@ -603,7 +603,7 @@ class User
if ($form['USR_LOCATION'] != '') {
$oLocation = \IsoLocationPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_LOCATION']);
if (is_null($oLocation)) {
throw new \Exception('Invalid value for usr_location: '.$form['USR_LOCATION']);
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($form['USR_LOCATION'])));
} else {
$userData['USR_LOCATION'] = $form['USR_LOCATION'];
}
@@ -695,7 +695,7 @@ class User
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID);
$history += \ApplicationPeer::doCount($c);
if ($total > 0) {
throw (new \Exception( 'The user with usr_uid: '. $USR_UID .', cannot be deleted while it has cases assigned.'));
throw new \Exception(\G::LoadTranslation("ID_USER_CAN_NOT_BE_DELETED", array($USR_UID)));
} else {
$UID = $usrUid;
\G::LoadClass('tasks');
@@ -745,14 +745,14 @@ class User
}
if ($start) {
if ($start < 0) {
throw (new \Exception( 'Invalid value specified for start.'));
throw new \Exception(\G::LoadTranslation("ID_INVALID_START"));
} else {
$oCriteria->setOffset($start);
}
}
if ($limit != '') {
if ($limit < 0) {
throw (new \Exception( 'Invalid value specified for limit.'));
throw new \Exception(\G::LoadTranslation("ID_INVALID_LIMIT"));
} else {
if ($limit == 0) {
return $aUserInfo;
@@ -788,10 +788,7 @@ class User
try {
$filter = '';
$aUserInfo = array();
$oUser = \UsersPeer::retrieveByPK($userUid);
if (is_null($oUser)) {
throw (new \Exception( 'This id for usr_uid: '. $userUid .' does not correspond to a registered user'));
}
Validator::usrUid($userUid, '$usr_uid');
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
$oCriteria = new \Criteria();
if ($filter != '') {