Merged in darojas/processmaker (pull request #499)

Se modifica la clase wsBase para que se ejecuten los triggers before assigment, cuando se realiza el route-case. Replace harcoded labels by a translation ID
This commit is contained in:
Erik Amaru Ortiz
2014-05-26 12:22:02 -04:00
11 changed files with 205 additions and 258 deletions

View File

@@ -2221,7 +2221,7 @@ class wsBase
} }
} }
//Execute triggers before derivation //Execute triggers before derivation BEFORE_ROUTING
$aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'BEFORE' ); $aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'BEFORE' );
if (count( $aTriggers ) > 0) { if (count( $aTriggers ) > 0) {
@@ -2272,6 +2272,51 @@ class wsBase
} }
} }
//Execute triggers before derivation BEFORE_ASSIGNMENT
$aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 1, 'BEFORE' );
if (count( $aTriggers ) > 0) {
$varTriggers .= "<b>-= Before Derivation =-</b><br/>";
$oPMScript = new PMScript();
foreach ($aTriggers as $aTrigger) {
//Set variables
$params = new stdClass();
$params->appData = $appFields["APP_DATA"];
if ($this->stored_system_variables) {
$params->option = "STORED SESSION";
$params->SID = $this->wsSessionId;
}
$appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) );
//PMScript
$oPMScript->setFields( $appFields['APP_DATA'] );
$bExecute = true;
if ($aTrigger['ST_CONDITION'] !== '') {
$oPMScript->setScript( $aTrigger['ST_CONDITION'] );
$bExecute = $oPMScript->evaluate();
}
if ($bExecute) {
$oPMScript->setScript( $aTrigger['TRI_WEBBOT'] );
$oPMScript->execute();
$oTrigger = TriggersPeer::retrieveByPk( $aTrigger['TRI_UID'] );
$varTriggers .= "&nbsp;- " . nl2br( htmlentities( $oTrigger->getTriTitle(), ENT_QUOTES ) ) . "<br/>";
$appFields['APP_DATA'] = $oPMScript->aFields;
unset($appFields['APP_STATUS']);
unset($appFields['APP_PROC_STATUS']);
unset($appFields['APP_PROC_CODE']);
unset($appFields['APP_PIN']);
$oCase->updateCase( $caseId, $appFields );
}
}
}
$oDerivation = new Derivation(); $oDerivation = new Derivation();
$derive = $oDerivation->prepareInformation( $aData ); $derive = $oDerivation->prepareInformation( $aData );

View File

@@ -70,7 +70,7 @@ class CaseScheduler
try { try {
$oCaseSchedulerTest = \CaseSchedulerPeer::retrieveByPK( $sCaseSchedulerUID ); $oCaseSchedulerTest = \CaseSchedulerPeer::retrieveByPK( $sCaseSchedulerUID );
if (is_null($oCaseSchedulerTest)) { if (is_null($oCaseSchedulerTest)) {
throw (new \Exception( 'This id: '. $sCaseSchedulerUID .' does not correspond to a registered case scheduler')); throw new \Exception(\G::LoadTranslation("ID_CASE_SCHEDULER_DOES_NOT_EXIST", array($sCaseSchedulerUID)));
} }
$oCriteria = new \Criteria( 'workflow' ); $oCriteria = new \Criteria( 'workflow' );
$oCriteria->clearSelectColumns(); $oCriteria->clearSelectColumns();
@@ -217,7 +217,7 @@ class CaseScheduler
$oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER ); $oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER );
$userIsAssigned = \GroupUserPeer::doCount( $oCriteria ); $userIsAssigned = \GroupUserPeer::doCount( $oCriteria );
if (! ($userIsAssigned >= 1)) { if (! ($userIsAssigned >= 1)) {
throw (new \Exception( "The User " . $sWS_USER . " doesn't have the activity " . $sTASKS . " assigned")); throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_HAVE_ACTIVITY", array($sWS_USER, $sTASKS)));
} }
} }
$oDataset = \TaskUserPeer::doSelectRS($oCriteria); $oDataset = \TaskUserPeer::doSelectRS($oCriteria);
@@ -251,17 +251,17 @@ class CaseScheduler
$caseSchedulerData = array_change_key_case($caseSchedulerData, CASE_UPPER); $caseSchedulerData = array_change_key_case($caseSchedulerData, CASE_UPPER);
$sOption = $caseSchedulerData['SCH_OPTION']; $sOption = $caseSchedulerData['SCH_OPTION'];
if (empty($caseSchedulerData)) { if (empty($caseSchedulerData)) {
die( 'the information sended is empty!' ); die( \G::LoadTranslation("ID_INFORMATION_EMPTY") );
} }
$arrayTaskUid = $this->getTaskUid($caseSchedulerData['TAS_UID']); $arrayTaskUid = $this->getTaskUid($caseSchedulerData['TAS_UID']);
if (empty($arrayTaskUid)) { if (empty($arrayTaskUid)) {
throw (new \Exception( 'Task not found for id: '. $caseSchedulerData['TAS_UID'])); throw (new \Exception( \G::LoadTranslation("ID_TASK_NOT_FOUND", array($caseSchedulerData['TAS_UID']))));
} }
if ($caseSchedulerData['SCH_NAME']=='') { if ($caseSchedulerData['SCH_NAME']=='') {
throw (new \Exception( 'sch_name can not be empty')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_EMPTY", array ('sch_name')));
} }
if ($this->existsName($sProcessUID, $caseSchedulerData['SCH_NAME'])) { if ($this->existsName($sProcessUID, $caseSchedulerData['SCH_NAME'])) {
throw (new \Exception( 'Duplicate Case Scheduler name')); throw new \Exception(\G::LoadTranslation("ID_CASE_SCHEDULER_DUPLICATE"));
} }
$mUser = $this->getUser($caseSchedulerData['SCH_DEL_USER_NAME'], $caseSchedulerData['TAS_UID']); $mUser = $this->getUser($caseSchedulerData['SCH_DEL_USER_NAME'], $caseSchedulerData['TAS_UID']);
$oUser = \UsersPeer::retrieveByPK( $mUser ); $oUser = \UsersPeer::retrieveByPK( $mUser );
@@ -273,19 +273,19 @@ class CaseScheduler
if ($sOption != '5') { if ($sOption != '5') {
$pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/"; $pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/";
if (!preg_match($pattern, $caseSchedulerData['SCH_START_TIME'])) { if (!preg_match($pattern, $caseSchedulerData['SCH_START_TIME'])) {
throw (new \Exception( 'Invalid value specified for sch_start_time. Expecting time in HH:MM format (The time can not be increased to 23:59)')); throw new \Exception(\G::LoadTranslation("ID_INVALID_SCH_START_TIME"));
} }
} }
$patternDate="/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/"; $patternDate="/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/";
if ($sOption == '1' || $sOption == '2' || $sOption == '3') { if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
if (!preg_match($patternDate, $caseSchedulerData['SCH_START_DATE'])) { if (!preg_match($patternDate, $caseSchedulerData['SCH_START_DATE'])) {
throw (new \Exception( 'Invalid value specified for sch_start_date. Expecting date in YYYY-MM-DD format, such as 2014-01-01')); throw new \Exception(\G::LoadTranslation("ID_INVALID_SCH_START_DATE"));
} }
if (!preg_match($patternDate, $caseSchedulerData['SCH_END_DATE'])) { if (!preg_match($patternDate, $caseSchedulerData['SCH_END_DATE'])) {
throw (new \Exception( 'Invalid value specified for sch_end_date. Expecting date in YYYY-MM-DD format, such as 2014-01-01')); throw new \Exception(\G::LoadTranslation("ID_INVALID_SCH_END_DATE"));
} }
if ($caseSchedulerData['SCH_START_DATE'] == "") { if ($caseSchedulerData['SCH_START_DATE'] == "") {
throw (new \Exception( 'sch_start_date can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_date')));
} }
} }
if ($sOption == '2') { if ($sOption == '2') {
@@ -331,7 +331,7 @@ class CaseScheduler
break; break;
case '2': // If the option is zero, set by default 1 case '2': // If the option is zero, set by default 1
if ($caseSchedulerData['SCH_WEEK_DAYS'] == "") { if ($caseSchedulerData['SCH_WEEK_DAYS'] == "") {
throw (new \Exception( 'sch_week_days can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_week_days')));
} else { } else {
$weeks = $caseSchedulerData['SCH_WEEK_DAYS']; $weeks = $caseSchedulerData['SCH_WEEK_DAYS'];
$weeks = explode("|", $weeks); $weeks = explode("|", $weeks);
@@ -339,7 +339,7 @@ class CaseScheduler
if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7") { if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7") {
$caseSchedulerData['SCH_WEEK_DAYS'] = $caseSchedulerData['SCH_WEEK_DAYS']; $caseSchedulerData['SCH_WEEK_DAYS'] = $caseSchedulerData['SCH_WEEK_DAYS'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_week_days')); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_week_days')));
} }
} }
} }
@@ -359,49 +359,49 @@ class CaseScheduler
case '3': case '3':
$nStartDay = $caseSchedulerData['SCH_START_DAY']; $nStartDay = $caseSchedulerData['SCH_START_DAY'];
if ($nStartDay == "") { if ($nStartDay == "") {
throw (new \Exception( 'sch_start_day can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_day')));
} }
if ($nStartDay == 1) { if ($nStartDay == 1) {
if ($caseSchedulerData['SCH_START_DAY_OPT_1'] == "") { if ($caseSchedulerData['SCH_START_DAY_OPT_1'] == "") {
throw (new \Exception( 'sch_start_day_opt_1 can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_day_opt_1')));
} }
$temp = $caseSchedulerData['SCH_START_DAY_OPT_1']; $temp = $caseSchedulerData['SCH_START_DAY_OPT_1'];
$temp = (int)$temp; $temp = (int)$temp;
if ($temp >= 1 && $temp <= 31) { if ($temp >= 1 && $temp <= 31) {
$caseSchedulerData['SCH_START_DAY_OPT_1'] = $caseSchedulerData['SCH_START_DAY_OPT_1']; $caseSchedulerData['SCH_START_DAY_OPT_1'] = $caseSchedulerData['SCH_START_DAY_OPT_1'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_start_day_opt_1. Must be between 1 and 31')); throw new \Exception(\G::LoadTranslation("ID_INVALID_SCH_START_DAY_1"));
} }
$caseSchedulerData['SCH_START_DAY'] = $nStartDay . '|' . $caseSchedulerData['SCH_START_DAY_OPT_1']; $caseSchedulerData['SCH_START_DAY'] = $nStartDay . '|' . $caseSchedulerData['SCH_START_DAY_OPT_1'];
} else { } else {
if ($caseSchedulerData['SCH_START_DAY_OPT_2'] == "") { if ($caseSchedulerData['SCH_START_DAY_OPT_2'] == "") {
throw (new \Exception( 'sch_start_day_opt_2 can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_day_opt_2')));
} }
$caseSchedulerData['SCH_START_DAY'] = $nStartDay . '|' . $caseSchedulerData['SCH_START_DAY_OPT_2']; $caseSchedulerData['SCH_START_DAY'] = $nStartDay . '|' . $caseSchedulerData['SCH_START_DAY_OPT_2'];
$optionTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{0}; $optionTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{0};
if ($optionTwo == "1" || $optionTwo == "2" || $optionTwo == "3" || $optionTwo == "4" || $optionTwo == "5") { if ($optionTwo == "1" || $optionTwo == "2" || $optionTwo == "3" || $optionTwo == "4" || $optionTwo == "5") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2']; $caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_start_day_opt_2')); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_start_day_opt_2')));
} }
$pipelineTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{1}; $pipelineTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{1};
if ($pipelineTwo == "|") { if ($pipelineTwo == "|") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2']; $caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_start_day_opt_2')); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_start_day_opt_2')));
} }
$dayTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{2}; $dayTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{2};
if ($dayTwo == "1" || $dayTwo == "2" || $dayTwo == "3" || $dayTwo == "4" || $dayTwo == "5" || $dayTwo == "6" || $dayTwo == "7") { if ($dayTwo == "1" || $dayTwo == "2" || $dayTwo == "3" || $dayTwo == "4" || $dayTwo == "5" || $dayTwo == "6" || $dayTwo == "7") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2']; $caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_start_day_opt_2')); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_start_day_opt_2')));
} }
} }
if ($nStartDay == "") { if ($nStartDay == "") {
throw (new \Exception( 'sch_start_day can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_day')));
} }
if ($caseSchedulerData['SCH_MONTHS'] == "") { if ($caseSchedulerData['SCH_MONTHS'] == "") {
throw (new \Exception( 'sch_months can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_months')));
} }
if (! empty( $caseSchedulerData['SCH_MONTHS'] )) { if (! empty( $caseSchedulerData['SCH_MONTHS'] )) {
$aMonths = $caseSchedulerData['SCH_MONTHS']; $aMonths = $caseSchedulerData['SCH_MONTHS'];
@@ -410,7 +410,7 @@ class CaseScheduler
if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7"|| $row == "8" || $row == "9" || $row == "10"|| $row == "11" || $row == "12") { if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7"|| $row == "8" || $row == "9" || $row == "10"|| $row == "11" || $row == "12") {
$caseSchedulerData['SCH_MONTHS'] = $caseSchedulerData['SCH_MONTHS']; $caseSchedulerData['SCH_MONTHS'] = $caseSchedulerData['SCH_MONTHS'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_months')); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_months')));
} }
} }
} }
@@ -469,11 +469,11 @@ class CaseScheduler
$caseSchedulerData['SCH_START_TIME'] = time(); $caseSchedulerData['SCH_START_TIME'] = time();
$caseSchedulerData['SCH_START_DATE'] = $caseSchedulerData['SCH_START_TIME']; $caseSchedulerData['SCH_START_DATE'] = $caseSchedulerData['SCH_START_TIME'];
if ($caseSchedulerData['SCH_REPEAT_EVERY'] == "") { if ($caseSchedulerData['SCH_REPEAT_EVERY'] == "") {
throw (new \Exception( 'sch_repeat_every can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_repeat_every')));
} }
$patternHour="/^([0-1][0-9]|[2][0-3])[\.]([0-5][0-9])$/"; $patternHour="/^([0-1][0-9]|[2][0-3])[\.]([0-5][0-9])$/";
if (!preg_match($patternHour, $caseSchedulerData['SCH_REPEAT_EVERY'])) { if (!preg_match($patternHour, $caseSchedulerData['SCH_REPEAT_EVERY'])) {
throw (new \Exception( 'Invalid value specified for sch_repeat_every. Expecting time in HH.MM format')); throw new \Exception(\G::LoadTranslation("ID_INVALID_SCH_REPEAT"));
} }
$nextRun = $caseSchedulerData['SCH_REPEAT_EVERY'] * 60 * 60; $nextRun = $caseSchedulerData['SCH_REPEAT_EVERY'] * 60 * 60;
$caseSchedulerData['SCH_REPEAT_EVERY'] = $caseSchedulerData['SCH_REPEAT_EVERY']; $caseSchedulerData['SCH_REPEAT_EVERY'] = $caseSchedulerData['SCH_REPEAT_EVERY'];
@@ -525,7 +525,7 @@ class CaseScheduler
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php"); require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php");
$caseSchedulerData = array_change_key_case($caseSchedulerData, CASE_UPPER); $caseSchedulerData = array_change_key_case($caseSchedulerData, CASE_UPPER);
if (empty( $caseSchedulerData )) { if (empty( $caseSchedulerData )) {
die( 'The information sended is empty!' ); die( \G::LoadTranslation("ID_INFORMATION_EMPTY") );
} }
$oCaseScheduler = new \CaseScheduler(); $oCaseScheduler = new \CaseScheduler();
$aFields = $oCaseScheduler->Load($sSchUID); $aFields = $oCaseScheduler->Load($sSchUID);
@@ -538,18 +538,15 @@ class CaseScheduler
$caseSchedulerData['sch_repeat_stop_if_running'] = '0'; $caseSchedulerData['sch_repeat_stop_if_running'] = '0';
$caseSchedulerData['case_sh_plugin_uid'] = null; $caseSchedulerData['case_sh_plugin_uid'] = null;
$caseSchedulerData = array_change_key_case($caseSchedulerData, CASE_UPPER); $caseSchedulerData = array_change_key_case($caseSchedulerData, CASE_UPPER);
if (empty($caseSchedulerData)) {
die( 'the information sended is empty!' );
}
$arrayTaskUid = $this->getTaskUid($caseSchedulerData['TAS_UID']); $arrayTaskUid = $this->getTaskUid($caseSchedulerData['TAS_UID']);
if (empty($arrayTaskUid)) { if (empty($arrayTaskUid)) {
throw (new \Exception( 'Task not found for id: '. $caseSchedulerData['TAS_UID'])); throw new \Exception(\G::LoadTranslation("ID_TASK_NOT_FOUND", array($caseSchedulerData['TAS_UID'])));
} }
if ($caseSchedulerData['SCH_NAME']=='') { if ($caseSchedulerData['SCH_NAME']=='') {
throw (new \Exception( 'sch_name can not be empty')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_EMPTY", array ('sch_name')));
} }
if ($this->existsNameUpdate($sSchUID, $caseSchedulerData['SCH_NAME'])) { if ($this->existsNameUpdate($sSchUID, $caseSchedulerData['SCH_NAME'])) {
throw (new \Exception( 'Duplicate Case Scheduler name')); throw new \Exception(\G::LoadTranslation("ID_CASE_SCHEDULER_DUPLICATE"));
} }
$mUser = $this->getUser($caseSchedulerData['SCH_DEL_USER_NAME'], $caseSchedulerData['TAS_UID']); $mUser = $this->getUser($caseSchedulerData['SCH_DEL_USER_NAME'], $caseSchedulerData['TAS_UID']);
$oUser = \UsersPeer::retrieveByPK( $mUser ); $oUser = \UsersPeer::retrieveByPK( $mUser );
@@ -561,19 +558,19 @@ class CaseScheduler
if ($sOption != '5') { if ($sOption != '5') {
$pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/"; $pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/";
if (!preg_match($pattern, $caseSchedulerData['SCH_START_TIME'])) { if (!preg_match($pattern, $caseSchedulerData['SCH_START_TIME'])) {
throw (new \Exception( 'Invalid value specified for sch_start_time. Expecting time in HH:MM format (The time can not be increased to 23:59)')); throw new \Exception(\G::LoadTranslation("ID_INVALID_SCH_START_TIME"));
} }
} }
$patternDate="/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/"; $patternDate="/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/";
if ($sOption == '1' || $sOption == '2' || $sOption == '3') { if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
if (!preg_match($patternDate, $caseSchedulerData['SCH_START_DATE'])) { if (!preg_match($patternDate, $caseSchedulerData['SCH_START_DATE'])) {
throw (new \Exception( 'Invalid value specified for sch_start_date. Expecting date in YYYY-MM-DD format, such as 2014-01-01')); throw new \Exception(\G::LoadTranslation("ID_INVALID_SCH_START_DATE"));
} }
if (!preg_match($patternDate, $caseSchedulerData['SCH_END_DATE'])) { if (!preg_match($patternDate, $caseSchedulerData['SCH_END_DATE'])) {
throw (new \Exception( 'Invalid value specified for sch_end_date. Expecting date in YYYY-MM-DD format, such as 2014-01-01')); throw new \Exception(\G::LoadTranslation("ID_INVALID_SCH_END_DATE"));
} }
if ($caseSchedulerData['SCH_START_DATE'] == "") { if ($caseSchedulerData['SCH_START_DATE'] == "") {
throw (new \Exception( 'sch_start_date can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_date')));
} }
} }
if ($sOption == '2') { if ($sOption == '2') {
@@ -626,7 +623,7 @@ class CaseScheduler
break; break;
case '2': // If the option is zero, set by default 1 case '2': // If the option is zero, set by default 1
if ($caseSchedulerData['SCH_WEEK_DAYS'] == "") { if ($caseSchedulerData['SCH_WEEK_DAYS'] == "") {
throw (new \Exception( 'sch_week_days can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_week_days')));
} else { } else {
$weeks = $caseSchedulerData['SCH_WEEK_DAYS']; $weeks = $caseSchedulerData['SCH_WEEK_DAYS'];
$weeks = explode("|", $weeks); $weeks = explode("|", $weeks);
@@ -634,7 +631,7 @@ class CaseScheduler
if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7") { if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7") {
$caseSchedulerData['SCH_WEEK_DAYS'] = $caseSchedulerData['SCH_WEEK_DAYS']; $caseSchedulerData['SCH_WEEK_DAYS'] = $caseSchedulerData['SCH_WEEK_DAYS'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_week_days')); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_week_days')));
} }
} }
} }
@@ -654,49 +651,49 @@ class CaseScheduler
case '3': case '3':
$nStartDay = $caseSchedulerData['SCH_START_DAY']; $nStartDay = $caseSchedulerData['SCH_START_DAY'];
if ($nStartDay == "") { if ($nStartDay == "") {
throw (new \Exception( 'sch_start_day can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_day')));
} }
if ($nStartDay == 1) { if ($nStartDay == 1) {
if ($caseSchedulerData['SCH_START_DAY_OPT_1'] == "") { if ($caseSchedulerData['SCH_START_DAY_OPT_1'] == "") {
throw (new \Exception( 'sch_start_day_opt_1 can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_day_opt_1')));
} }
$temp = $caseSchedulerData['SCH_START_DAY_OPT_1']; $temp = $caseSchedulerData['SCH_START_DAY_OPT_1'];
$temp = (int)$temp; $temp = (int)$temp;
if ($temp >= 1 && $temp <= 31) { if ($temp >= 1 && $temp <= 31) {
$caseSchedulerData['SCH_START_DAY_OPT_1'] = $caseSchedulerData['SCH_START_DAY_OPT_1']; $caseSchedulerData['SCH_START_DAY_OPT_1'] = $caseSchedulerData['SCH_START_DAY_OPT_1'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_start_day_opt_1. Must be between 1 and 31')); throw new \Exception(\G::LoadTranslation("ID_INVALID_SCH_START_DAY_1"));
} }
$caseSchedulerData['SCH_START_DAY'] = $nStartDay . '|' . $caseSchedulerData['SCH_START_DAY_OPT_1']; $caseSchedulerData['SCH_START_DAY'] = $nStartDay . '|' . $caseSchedulerData['SCH_START_DAY_OPT_1'];
} else { } else {
if ($caseSchedulerData['SCH_START_DAY_OPT_2'] == "") { if ($caseSchedulerData['SCH_START_DAY_OPT_2'] == "") {
throw (new \Exception( 'sch_start_day_opt_2 can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_day_opt_2')));
} }
$caseSchedulerData['SCH_START_DAY'] = $nStartDay . '|' . $caseSchedulerData['SCH_START_DAY_OPT_2']; $caseSchedulerData['SCH_START_DAY'] = $nStartDay . '|' . $caseSchedulerData['SCH_START_DAY_OPT_2'];
$optionTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{0}; $optionTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{0};
if ($optionTwo == "1" || $optionTwo == "2" || $optionTwo == "3" || $optionTwo == "4" || $optionTwo == "5") { if ($optionTwo == "1" || $optionTwo == "2" || $optionTwo == "3" || $optionTwo == "4" || $optionTwo == "5") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2']; $caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_start_day_opt_2')); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_start_day_opt_2')));
} }
$pipelineTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{1}; $pipelineTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{1};
if ($pipelineTwo == "|") { if ($pipelineTwo == "|") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2']; $caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_start_day_opt_2')); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_start_day_opt_2')));
} }
$dayTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{2}; $dayTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{2};
if ($dayTwo == "1" || $dayTwo == "2" || $dayTwo == "3" || $dayTwo == "4" || $dayTwo == "5" || $dayTwo == "6" || $dayTwo == "7") { if ($dayTwo == "1" || $dayTwo == "2" || $dayTwo == "3" || $dayTwo == "4" || $dayTwo == "5" || $dayTwo == "6" || $dayTwo == "7") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2']; $caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_start_day_opt_2')); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_start_day_opt_2')));
} }
} }
if ($nStartDay == "") { if ($nStartDay == "") {
throw (new \Exception( 'sch_start_day can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_day')));
} }
if ($caseSchedulerData['SCH_MONTHS'] == "") { if ($caseSchedulerData['SCH_MONTHS'] == "") {
throw (new \Exception( 'sch_months can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_months')));
} }
if (! empty( $caseSchedulerData['SCH_MONTHS'] )) { if (! empty( $caseSchedulerData['SCH_MONTHS'] )) {
$aMonths = $caseSchedulerData['SCH_MONTHS']; $aMonths = $caseSchedulerData['SCH_MONTHS'];
@@ -705,7 +702,7 @@ class CaseScheduler
if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7"|| $row == "8" || $row == "9" || $row == "10"|| $row == "11" || $row == "12") { if ($row == "1" || $row == "2" || $row == "3" || $row == "4" || $row == "5"|| $row == "6" || $row == "7"|| $row == "8" || $row == "9" || $row == "10"|| $row == "11" || $row == "12") {
$caseSchedulerData['SCH_MONTHS'] = $caseSchedulerData['SCH_MONTHS']; $caseSchedulerData['SCH_MONTHS'] = $caseSchedulerData['SCH_MONTHS'];
} else { } else {
throw (new \Exception( 'Invalid value specified for sch_months')); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_months')));
} }
} }
} }
@@ -765,11 +762,11 @@ class CaseScheduler
$caseSchedulerData['SCH_START_TIME'] = time(); $caseSchedulerData['SCH_START_TIME'] = time();
$caseSchedulerData['SCH_START_DATE'] = $caseSchedulerData['SCH_START_TIME']; $caseSchedulerData['SCH_START_DATE'] = $caseSchedulerData['SCH_START_TIME'];
if ($caseSchedulerData['SCH_REPEAT_EVERY'] == "") { if ($caseSchedulerData['SCH_REPEAT_EVERY'] == "") {
throw (new \Exception( 'sch_repeat_every can not be null')); throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_repeat_every')));
} }
$patternHour="/^([0-1][0-9]|[2][0-3])[\.]([0-5][0-9])$/"; $patternHour="/^([0-1][0-9]|[2][0-3])[\.]([0-5][0-9])$/";
if (!preg_match($patternHour, $caseSchedulerData['SCH_REPEAT_EVERY'])) { if (!preg_match($patternHour, $caseSchedulerData['SCH_REPEAT_EVERY'])) {
throw (new \Exception( 'Invalid value specified for sch_repeat_every. Expecting time in HH.MM format')); throw new \Exception(\G::LoadTranslation("ID_INVALID_SCH_REPEAT"));
} }
$nextRun = $caseSchedulerData['SCH_REPEAT_EVERY'] * 60 * 60; $nextRun = $caseSchedulerData['SCH_REPEAT_EVERY'] * 60 * 60;
$caseSchedulerData['SCH_REPEAT_EVERY'] = $caseSchedulerData['SCH_REPEAT_EVERY']; $caseSchedulerData['SCH_REPEAT_EVERY'] = $caseSchedulerData['SCH_REPEAT_EVERY'];

View File

@@ -501,7 +501,7 @@ class Cases
} }
//Return //Return
if (empty($result)) { 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 { } else {
return $result; return $result;
} }
@@ -528,13 +528,10 @@ class Cases
if ($variables) { if ($variables) {
$variables = array_shift($variables); $variables = array_shift($variables);
} }
$oProcesses = new \Processes(); Validator::proUid($processUid, '$pro_uid');
if (! $oProcesses->processExists($processUid)) {
throw (new \Exception( 'Invalid value specified for \'pro_uid\''));
}
$oTask = new \Task(); $oTask = new \Task();
if (! $oTask->taskExists($taskUid)) { 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); $fields = $ws->newCase($processUid, $userUid, $taskUid, $variables);
$array = json_decode(json_encode($fields), true); $array = json_decode(json_encode($fields), true);
@@ -577,21 +574,18 @@ class Cases
} elseif ($variables == null) { } elseif ($variables == null) {
$variables = array(array()); $variables = array(array());
} }
$oProcesses = new \Processes(); Validator::proUid($processUid, '$pro_uid');
if (! $oProcesses->processExists($processUid)) {
throw (new \Exception( 'Invalid value specified for \'pro_uid\''));
}
$user = new \Users(); $user = new \Users();
if (! $user->userExists( $userUid )) { 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); $fields = $ws->newCaseImpersonate($processUid, $userUid, $variables, $taskUid);
$array = json_decode(json_encode($fields), true); $array = json_decode(json_encode($fields), true);
if ($array ["status_code"] != 0) { if ($array ["status_code"] != 0) {
if ($array ["status_code"] == 12) { 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) { } 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"])); throw (new \Exception($array ["message"]));
} else { } else {
@@ -641,7 +635,7 @@ class Cases
unset($array['timestamp']); unset($array['timestamp']);
} }
} else { } 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) { } catch (\Exception $e) {
throw $e; throw $e;

View File

@@ -84,7 +84,7 @@ class InputDocument
if ($docrow['app_doc_uid'] == $inputDocumentUid) { if ($docrow['app_doc_uid'] == $inputDocumentUid) {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, $row['DOC_VERSION'] ); $oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, $row['DOC_VERSION'] );
if (is_null( $oAppDocument )) { 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; $result = $docrow;
} }
@@ -109,7 +109,7 @@ class InputDocument
try { try {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 ); $oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 );
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') { 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'); \G::LoadClass('wsBase');
$ws = new \wsBase(); $ws = new \wsBase();
@@ -180,7 +180,7 @@ class InputDocument
$arrayTrigger = $case->loadTriggers($taskUid, "INPUT_DOCUMENT", $inputDocumentUid, "AFTER"); $arrayTrigger = $case->loadTriggers($taskUid, "INPUT_DOCUMENT", $inputDocumentUid, "AFTER");
//Add Input Document //Add Input Document
if (empty($_FILES)) { 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"]) { if (!$_FILES["form"]["error"]) {
$_FILES["form"]["error"] = 0; $_FILES["form"]["error"] = 0;

View File

@@ -82,7 +82,7 @@ class OutputDocument
if ($docrow['app_doc_uid'] == $applicationDocumentUid) { if ($docrow['app_doc_uid'] == $applicationDocumentUid) {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, $row['DOC_VERSION'] ); $oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, $row['DOC_VERSION'] );
if (is_null( $oAppDocument )) { 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; $result = $docrow;
} }
@@ -108,7 +108,7 @@ class OutputDocument
$lastDocVersion = $oAppDocumentVersion->getLastAppDocVersion($applicationDocumentUid); $lastDocVersion = $oAppDocumentVersion->getLastAppDocVersion($applicationDocumentUid);
$oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, $lastDocVersion); $oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, $lastDocVersion);
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') { 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'); $aFields = array ('APP_DOC_UID' => $applicationDocumentUid,'DOC_VERSION' => $lastDocVersion,'APP_DOC_STATUS' => 'DELETED');
$oAppDocument->update( $aFields ); $oAppDocument->update( $aFields );

View File

@@ -62,7 +62,7 @@ class FilesManager
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $sSubDirectory; $sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $sSubDirectory;
break; break;
default: 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; break;
} }
\G::verifyPath($sDirectory, true); \G::verifyPath($sDirectory, true);
@@ -147,7 +147,7 @@ class FilesManager
try { try {
$aData['prf_path'] = rtrim($aData['prf_path'], '/') . '/'; $aData['prf_path'] = rtrim($aData['prf_path'], '/') . '/';
if (!$aData['prf_filename']) { 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'], '.'); $extention = strstr($aData['prf_filename'], '.');
if (!$extention) { if (!$extention) {
@@ -162,7 +162,7 @@ class FilesManager
} }
$sMainDirectory = current(explode("/", $aData['prf_path'])); $sMainDirectory = current(explode("/", $aData['prf_path']));
if ($sMainDirectory != 'public' && $sMainDirectory != 'templates') { 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'],'/')) { if (strstr($aData['prf_path'],'/')) {
$sSubDirectory = substr($aData['prf_path'], strpos($aData['prf_path'], "/")+1) ; $sSubDirectory = substr($aData['prf_path'], strpos($aData['prf_path'], "/")+1) ;
@@ -186,7 +186,8 @@ class FilesManager
$content = $aData['prf_content']; $content = $aData['prf_content'];
if (is_string($content)) { if (is_string($content)) {
if (file_exists(PATH_SEP.$sDirectory)) { 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)) { if (!file_exists($sCheckDirectory)) {
@@ -329,7 +330,7 @@ class FilesManager
$rsCriteria->next(); $rsCriteria->next();
} }
if ($path == '') { 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)); $sFile = end(explode("/",$path));
$sPath = str_replace($sFile,'',$path); $sPath = str_replace($sFile,'',$path);
@@ -348,7 +349,7 @@ class FilesManager
$sEditable = false; $sEditable = false;
} }
if ($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); $oProcessFiles = \ProcessFilesPeer::retrieveByPK($prfUid);
$sDate = date('Y-m-d H:i:s'); $sDate = date('Y-m-d H:i:s');
@@ -398,7 +399,7 @@ class FilesManager
$rsCriteria->next(); $rsCriteria->next();
} }
if ($path == '') { 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)); $sFile = end(explode("/",$path));
$sPath = str_replace($sFile,'',$path); $sPath = str_replace($sFile,'',$path);
@@ -440,7 +441,7 @@ class FilesManager
$rsCriteria->next(); $rsCriteria->next();
} }
if ($path == '') { 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)); $sFile = end(explode("/",$path));
$sPath = str_replace($sFile,'',$path); $sPath = str_replace($sFile,'',$path);
@@ -492,7 +493,7 @@ class FilesManager
if (file_exists($sDirectory.$sDirToDelete)) { if (file_exists($sDirectory.$sDirToDelete)) {
\G::rm_dir($sDirectory.$sDirToDelete); \G::rm_dir($sDirectory.$sDirToDelete);
} else { } 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 = new \Criteria("workflow");
$criteria->addSelectColumn(\ProcessFilesPeer::PRF_PATH); $criteria->addSelectColumn(\ProcessFilesPeer::PRF_PATH);

View File

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

View File

@@ -90,7 +90,7 @@ class ProcessSupervisor
$aResp = array(); $aResp = array();
$oProcess = \ProcessUserPeer::retrieveByPK( $sPuUID ); $oProcess = \ProcessUserPeer::retrieveByPK( $sPuUID );
if (is_null($oProcess)) { 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 // Groups
$oCriteria = new \Criteria('workflow'); $oCriteria = new \Criteria('workflow');
@@ -321,7 +321,7 @@ class ProcessSupervisor
$aResp = array(); $aResp = array();
$oDynaformSupervisor = \StepSupervisorPeer::retrieveByPK( $sPudUID ); $oDynaformSupervisor = \StepSupervisorPeer::retrieveByPK( $sPudUID );
if (is_null( $oDynaformSupervisor ) ) { 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(); $sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow'); $oCriteria = new \Criteria('workflow');
@@ -473,7 +473,7 @@ class ProcessSupervisor
$aResp = array(); $aResp = array();
$oInputDocumentSupervisor = \StepSupervisorPeer::retrieveByPK( $sPuiUID ); $oInputDocumentSupervisor = \StepSupervisorPeer::retrieveByPK( $sPuiUID );
if (is_null( $oInputDocumentSupervisor ) ) { 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(); $sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow'); $oCriteria = new \Criteria('workflow');
@@ -575,16 +575,16 @@ class ProcessSupervisor
$oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sUsrUID ); $oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sUsrUID );
$oTypeAssigneeU = \UsersPeer::retrieveByPK( $sUsrUID ); $oTypeAssigneeU = \UsersPeer::retrieveByPK( $sUsrUID );
if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) { 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 (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) {
if ( "SUPERVISOR"!= $sTypeUID ) { 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 (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
if ( "GROUP_SUPERVISOR" != $sTypeUID ) { 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 // validate Groups
@@ -632,7 +632,7 @@ class ProcessSupervisor
$oCriteria = $this->getProcessSupervisor($sProcessUID, $sPuUID); $oCriteria = $this->getProcessSupervisor($sProcessUID, $sPuUID);
return $oCriteria; return $oCriteria;
} else { } 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); $oTypeDynaform = \DynaformPeer::retrieveByPK($sDynUID);
if (is_null( $oTypeDynaform )) { 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(); $aResp = array();
$sPuUIDT = array(); $sPuUIDT = array();
@@ -717,7 +717,7 @@ class ProcessSupervisor
} }
return $aResp; return $aResp;
} else { } 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); $oTypeInputDocument= \InputDocumentPeer::retrieveByPK($sInputDocumentUID);
if (is_null( $oTypeInputDocument )) { 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(); $aResp = array();
$sPuUIDT = array(); $sPuUIDT = array();
@@ -804,7 +804,7 @@ class ProcessSupervisor
} }
return $aResp; return $aResp;
} else { } else {
throw (new \Exception('This relation already exist!')); throw new \Exception(\G::LoadTranslation("ID_RELATION_EXIST"));
} }
} }
@@ -826,7 +826,7 @@ class ProcessSupervisor
$oConnection->commit(); $oConnection->commit();
return $iResult; return $iResult;
} else { } else {
throw (new \Exception('This row does not exist!')); throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
} }
} catch (\Exception $e) { } catch (\Exception $e) {
$oConnection->rollback(); $oConnection->rollback();
@@ -849,7 +849,7 @@ class ProcessSupervisor
$oProcessMap = new \processMap(new \DBConnection()); $oProcessMap = new \processMap(new \DBConnection());
$oProcessMap->removeSupervisorStep( $oDynaformSupervidor->getStepUid(), $sProcessUID, 'DYNAFORM', $oDynaformSupervidor->getStepUidObj(), $oDynaformSupervidor->getStepPosition() ); $oProcessMap->removeSupervisorStep( $oDynaformSupervidor->getStepUid(), $sProcessUID, 'DYNAFORM', $oDynaformSupervidor->getStepUidObj(), $oDynaformSupervidor->getStepPosition() );
} else { } else {
throw (new \Exception('This row does not exist!')); throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
} }
} catch (Exception $oError) { } catch (Exception $oError) {
throw ($oError); throw ($oError);
@@ -871,7 +871,7 @@ class ProcessSupervisor
$oProcessMap = new \processMap(new \DBConnection()); $oProcessMap = new \processMap(new \DBConnection());
$oProcessMap->removeSupervisorStep( $oInputDocumentSupervidor->getStepUid(), $sProcessUID, 'INPUT_DOCUMENT', $oInputDocumentSupervidor->getStepUidObj(), $oInputDocumentSupervidor->getStepPosition() ); $oProcessMap->removeSupervisorStep( $oInputDocumentSupervidor->getStepUid(), $sProcessUID, 'INPUT_DOCUMENT', $oInputDocumentSupervidor->getStepUidObj(), $oInputDocumentSupervidor->getStepPosition() );
} else { } else {
throw (new \Exception('This row does not exist!')); throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
} }
} catch (Exception $oError) { } catch (Exception $oError) {
throw ($oError); throw ($oError);

View File

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

View File

@@ -728,14 +728,8 @@ class Task
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php"); require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php");
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "TaskUser.php"); require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "TaskUser.php");
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "GroupUser.php"); require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "GroupUser.php");
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$aUsers = array(); $aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter(); $sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow'); $oCriteria = new \Criteria('workflow');
@@ -878,14 +872,8 @@ class Task
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php"); require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php");
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "TaskUser.php"); require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "TaskUser.php");
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "GroupUser.php"); require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "GroupUser.php");
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$iType = 1; $iType = 1;
$oTasks = new \Tasks(); $oTasks = new \Tasks();
$aAux = $oTasks->getGroupsOfTask($sTaskUID, $iType); $aAux = $oTasks->getGroupsOfTask($sTaskUID, $iType);
@@ -973,14 +961,14 @@ class Task
} }
if ($start) { if ($start) {
if ($start < 0) { if ($start < 0) {
throw (new \Exception( 'Invalid value specified for start.')); throw new \Exception(\G::LoadTranslation("ID_INVALID_START"));
} }
} else { } else {
$start = 0; $start = 0;
} }
if (isset($limit)) { if (isset($limit)) {
if ($limit < 0) { if ($limit < 0) {
throw (new \Exception( 'Invalid value specified for limit.')); throw new \Exception(\G::LoadTranslation("ID_INVALID_LIMIT"));
} else { } else {
if ($limit == 0) { if ($limit == 0) {
return array(); return array();
@@ -1010,14 +998,8 @@ class Task
public function getTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID) public function getTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
{ {
try { try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$iType = 1; $iType = 1;
$aUsers = array(); $aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter(); $sDelimiter = \DBAdapter::getStringDelimiter();
@@ -1110,7 +1092,7 @@ class Task
$oDataset->next(); $oDataset->next();
} }
if (empty($aUsers)) { if (empty($aUsers)) {
throw (new \Exception( 'Record not found for id: '. $sAssigneeUID)); throw new \Exception(\G::LoadTranslation("ID_RECORD_NOT_FOUND", array($sAssigneeUID)));
} else { } else {
return $aUsers; return $aUsers;
} }
@@ -1134,14 +1116,8 @@ class Task
public function addTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $assType) public function addTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $assType)
{ {
try { try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$iType = 1; $iType = 1;
$iRelation = ''; $iRelation = '';
$oCriteria = new \Criteria('workflow'); $oCriteria = new \Criteria('workflow');
@@ -1157,23 +1133,23 @@ class Task
} }
$oTaskUser = \TaskUserPeer::retrieveByPK( $sTaskUID, $sAssigneeUID, $iType, $iRelation ); $oTaskUser = \TaskUserPeer::retrieveByPK( $sTaskUID, $sAssigneeUID, $iType, $iRelation );
if (! is_null( $oTaskUser )) { if (! is_null( $oTaskUser )) {
throw (new \Exception( 'This id: '. $sAssigneeUID .' is already assigned to task: ' . $sTaskUID )); throw new \Exception(\G::LoadTranslation("ID_ALREADY_ASSIGNED", array($sAssigneeUID, $sTaskUID)));
} else { } else {
$oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sAssigneeUID ); $oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sAssigneeUID );
$oTypeAssigneeU = \UsersPeer::retrieveByPK( $sAssigneeUID ); $oTypeAssigneeU = \UsersPeer::retrieveByPK( $sAssigneeUID );
if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) { if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
throw (new \Exception( 'This id: '. $sAssigneeUID .' does not correspond to a registered ' .$assType )); throw new \Exception(\G::LoadTranslation("ID_DOES_NOT_CORRESPOND", array($sAssigneeUID, $assType)));
} }
if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) { if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) {
$type = "user"; $type = "user";
if ( $type != $assType ) { if ( $type != $assType ) {
throw (new \Exception( 'This id: '. $sAssigneeUID .' does not correspond to a registered ' .$assType )); throw new \Exception(\G::LoadTranslation("ID_DOES_NOT_CORRESPOND", array($sAssigneeUID, $assType)));
} }
} }
if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) { if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
$type = "group"; $type = "group";
if ( $type != $assType ) { if ( $type != $assType ) {
throw (new \Exception( 'This id: '. $sAssigneeUID .' does not correspond to a registered ' .$assType )); throw new \Exception(\G::LoadTranslation("ID_DOES_NOT_CORRESPOND", array($sAssigneeUID, $assType)));
} }
} }
$oTaskUser = new \TaskUser(); $oTaskUser = new \TaskUser();
@@ -1206,14 +1182,8 @@ class Task
public function removeTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID) public function removeTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
{ {
try { try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$iType = 1; $iType = 1;
$iRelation = ''; $iRelation = '';
$oCriteria = new \Criteria('workflow'); $oCriteria = new \Criteria('workflow');
@@ -1231,7 +1201,7 @@ class Task
if (! is_null( $oTaskUser )) { if (! is_null( $oTaskUser )) {
\TaskUserPeer::doDelete($oCriteria); \TaskUserPeer::doDelete($oCriteria);
} else { } else {
throw (new \Exception( 'This row does not exist!' )); throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
} }
} catch (\Exception $e) { } catch (\Exception $e) {
throw $e; throw $e;
@@ -1258,14 +1228,8 @@ class Task
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php"); require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php");
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "TaskUser.php"); require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "TaskUser.php");
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "GroupUser.php"); require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "GroupUser.php");
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$aUsers = array(); $aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter(); $sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow'); $oCriteria = new \Criteria('workflow');
@@ -1365,14 +1329,14 @@ class Task
} }
if ($start) { if ($start) {
if ($start < 0) { if ($start < 0) {
throw (new \Exception( 'Invalid value specified for start.')); throw new \Exception(\G::LoadTranslation("ID_INVALID_START"));
} }
} else { } else {
$start = 0; $start = 0;
} }
if (isset($limit)) { if (isset($limit)) {
if ($limit < 0) { if ($limit < 0) {
throw (new \Exception( 'Invalid value specified for limit.')); throw new \Exception(\G::LoadTranslation("ID_INVALID_LIMIT"));
} else { } else {
if ($limit == 0) { if ($limit == 0) {
return array(); return array();
@@ -1408,14 +1372,8 @@ class Task
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php"); require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php");
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "TaskUser.php"); require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "TaskUser.php");
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "GroupUser.php"); require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "GroupUser.php");
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$iType = 2; $iType = 2;
$oTasks = new \Tasks(); $oTasks = new \Tasks();
$aAux = $oTasks->getGroupsOfTask($sTaskUID, $iType); $aAux = $oTasks->getGroupsOfTask($sTaskUID, $iType);
@@ -1503,14 +1461,14 @@ class Task
} }
if ($start) { if ($start) {
if ($start < 0) { if ($start < 0) {
throw (new \Exception( 'Invalid value specified for start.')); throw new \Exception(\G::LoadTranslation("ID_INVALID_START"));
} }
} else { } else {
$start = 0; $start = 0;
} }
if (isset($limit)) { if (isset($limit)) {
if ($limit < 0) { if ($limit < 0) {
throw (new \Exception( 'Invalid value specified for limit.')); throw new \Exception(\G::LoadTranslation("ID_INVALID_LIMIT"));
} else { } else {
if ($limit == 0) { if ($limit == 0) {
return array(); return array();
@@ -1540,14 +1498,8 @@ class Task
public function getTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID) public function getTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
{ {
try { try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$iType = 2; $iType = 2;
$aUsers = array(); $aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter(); $sDelimiter = \DBAdapter::getStringDelimiter();
@@ -1640,7 +1592,7 @@ class Task
$oDataset->next(); $oDataset->next();
} }
if (empty($aUsers)) { if (empty($aUsers)) {
throw (new \Exception( 'Record not found for id: '. $sAssigneeUID)); throw new \Exception(\G::LoadTranslation("ID_RECORD_NOT_FOUND", array($sAssigneeUID)));
} else { } else {
return $aUsers; return $aUsers;
} }
@@ -1664,14 +1616,8 @@ class Task
public function addTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $assType) public function addTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $assType)
{ {
try { try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$iType = 2; $iType = 2;
$iRelation = ''; $iRelation = '';
$oCriteria = new \Criteria('workflow'); $oCriteria = new \Criteria('workflow');
@@ -1687,23 +1633,23 @@ class Task
} }
$oTaskUser = \TaskUserPeer::retrieveByPK( $sTaskUID, $sAssigneeUID, $iType, $iRelation ); $oTaskUser = \TaskUserPeer::retrieveByPK( $sTaskUID, $sAssigneeUID, $iType, $iRelation );
if (! is_null( $oTaskUser )) { if (! is_null( $oTaskUser )) {
throw (new \Exception( 'This id: '. $sAssigneeUID .' is already assigned to task: ' . $sTaskUID )); throw new \Exception(\G::LoadTranslation("ID_ALREADY_ASSIGNED", array($sAssigneeUID, $sTaskUID)));
} else { } else {
$oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sAssigneeUID ); $oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sAssigneeUID );
$oTypeAssigneeU = \UsersPeer::retrieveByPK( $sAssigneeUID ); $oTypeAssigneeU = \UsersPeer::retrieveByPK( $sAssigneeUID );
if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) { if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
throw (new \Exception( 'This id: '. $sAssigneeUID .' does not correspond to a registered ' .$assType )); throw new \Exception(\G::LoadTranslation("ID_DOES_NOT_CORRESPOND", array($sAssigneeUID, $assType)));
} }
if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) { if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) {
$type = "user"; $type = "user";
if ( $type != $assType ) { if ( $type != $assType ) {
throw (new \Exception( 'This id: '. $sAssigneeUID .' does not correspond to a registered ' .$assType )); throw new \Exception(\G::LoadTranslation("ID_DOES_NOT_CORRESPOND", array($sAssigneeUID, $assType)));
} }
} }
if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) { if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
$type = "group"; $type = "group";
if ( $type != $assType ) { if ( $type != $assType ) {
throw (new \Exception( 'This id: '. $sAssigneeUID .' does not correspond to a registered ' .$assType )); throw new \Exception(\G::LoadTranslation("ID_DOES_NOT_CORRESPOND", array($sAssigneeUID, $assType)));
} }
} }
$oTaskUser = new \TaskUser(); $oTaskUser = new \TaskUser();
@@ -1736,14 +1682,8 @@ class Task
public function removeTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID) public function removeTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
{ {
try { try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$iType = 2; $iType = 2;
$iRelation = ''; $iRelation = '';
$oCriteria = new \Criteria('workflow'); $oCriteria = new \Criteria('workflow');
@@ -1761,7 +1701,7 @@ class Task
if (! is_null( $oTaskUser )) { if (! is_null( $oTaskUser )) {
\TaskUserPeer::doDelete($oCriteria); \TaskUserPeer::doDelete($oCriteria);
} else { } else {
throw (new \Exception( 'This row does not exist!' )); throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
} }
} catch (\Exception $e) { } catch (\Exception $e) {
throw $e; throw $e;
@@ -1863,14 +1803,8 @@ class Task
public function getTaskAssigneesAll($sProcessUID, $sTaskUID, $filter, $start, $limit, $type) public function getTaskAssigneesAll($sProcessUID, $sTaskUID, $filter, $start, $limit, $type)
{ {
try { try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$aUsers = array(); $aUsers = array();
$oTasks = new \Tasks(); $oTasks = new \Tasks();
$aAux = $oTasks->getGroupsOfTask($sTaskUID, 1); $aAux = $oTasks->getGroupsOfTask($sTaskUID, 1);
@@ -1947,14 +1881,14 @@ class Task
} }
if ($start) { if ($start) {
if ($start < 0) { if ($start < 0) {
throw (new \Exception( 'Invalid value specified for start.')); throw new \Exception(\G::LoadTranslation("ID_INVALID_START"));
} }
} else { } else {
$start = 0; $start = 0;
} }
if (isset($limit)) { if (isset($limit)) {
if ($limit < 0) { if ($limit < 0) {
throw (new \Exception( 'Invalid value specified for limit.')); throw new \Exception(\G::LoadTranslation("ID_INVALID_LIMIT"));
} else { } else {
if ($limit == 0) { if ($limit == 0) {
return array(); return array();
@@ -1987,14 +1921,8 @@ class Task
public function getTaskAdhocAssigneesAll($sProcessUID, $sTaskUID, $filter, $start, $limit, $type) public function getTaskAdhocAssigneesAll($sProcessUID, $sTaskUID, $filter, $start, $limit, $type)
{ {
try { try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID ); Validator::proUid($sProcessUID, '$prj_uid');
if (is_null($oProcess)) { $this->validateActUid($sTaskUID);
throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for act_uid: '. $sTaskUID .' does not correspond to a registered activity'));
}
$aUsers = array(); $aUsers = array();
$oTasks = new \Tasks(); $oTasks = new \Tasks();
$aAux = $oTasks->getGroupsOfTask($sTaskUID, 2); $aAux = $oTasks->getGroupsOfTask($sTaskUID, 2);
@@ -2071,14 +1999,14 @@ class Task
} }
if ($start) { if ($start) {
if ($start < 0) { if ($start < 0) {
throw (new \Exception( 'Invalid value specified for start.')); throw new \Exception(\G::LoadTranslation("ID_INVALID_START"));
} }
} else { } else {
$start = 0; $start = 0;
} }
if (isset($limit)) { if (isset($limit)) {
if ($limit < 0) { if ($limit < 0) {
throw (new \Exception( 'Invalid value specified for limit.')); throw new \Exception(\G::LoadTranslation("ID_INVALID_LIMIT"));
} else { } else {
if ($limit == 0) { if ($limit == 0) {
return array(); return array();

View File

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