Se agregan validaciones en Input Documents y Cases

This commit is contained in:
Daniel Rojas
2014-04-08 12:50:16 -04:00
parent df5ea3ae23
commit 184e4b6d62
2 changed files with 25 additions and 5 deletions

View File

@@ -321,7 +321,7 @@ class Cases
$array['app_name'] = $array['caseName'];
$array['app_status'] = $array['caseStatus'];
$array['app_init_usr_uid'] = $array['caseCreatorUser'];
$array['app_init_usr_username'] = $array['caseCreatorUserName'];
$array['app_init_usr_username'] = trim($array['caseCreatorUserName']);
$array['pro_uid'] = $array['processId'];
$array['pro_name'] = $array['processName'];
$array['app_create_date'] = $array['createDate'];
@@ -412,7 +412,7 @@ class Cases
$array['app_name'] = $array['caseName'];
$array['app_status'] = $array['caseStatus'];
$array['app_init_usr_uid'] = $array['caseCreatorUser'];
$array['app_init_usr_username'] = $array['caseCreatorUserName'];
$array['app_init_usr_username'] = trim($array['caseCreatorUserName']);
$array['pro_uid'] = $array['processId'];
$array['pro_name'] = $array['processName'];
$array['app_create_date'] = $array['createDate'];
@@ -529,6 +529,14 @@ class Cases
if ($variables) {
$variables = array_shift($variables);
}
$oProcesses = new \Processes();
if (! $oProcesses->processExists($processUid)) {
throw (new \Exception( 'Invalid value specified for \'pro_uid\''));
}
$oTask = new \Task();
if (! $oTask->taskExists($taskUid)) {
throw (new \Exception( 'Invalid value specified for \'tas_uid\''));
}
$fields = $ws->newCase($processUid, $userUid, $taskUid, $variables);
$array = json_decode(json_encode($fields), true);
if ($array ["status_code"] != 0) {
@@ -570,6 +578,14 @@ class Cases
} elseif ($variables == null) {
$variables = array(array());
}
$oProcesses = new \Processes();
if (! $oProcesses->processExists($processUid)) {
throw (new \Exception( 'Invalid value specified for \'pro_uid\''));
}
$user = new \Users();
if (! $user->userExists( $userUid )) {
throw (new \Exception( 'Invalid value specified for \'usr_uid\''));
}
$fields = $ws->newCaseImpersonate($processUid, $userUid, $variables, $taskUid);
$array = json_decode(json_encode($fields), true);
if ($array ["status_code"] != 0) {

View File

@@ -14,6 +14,10 @@ class InputDocument
public function getCasesInputDocuments($applicationUid, $userUid)
{
try {
$oApplication = \ApplicationPeer::retrieveByPk($applicationUid);
if (!is_object($oApplication)) {
throw (new \Exception("The Application with app_uid: '$applicationUid' doesn't exist!"));
}
$sApplicationUID = $applicationUid;
$sUserUID = $userUid;
\G::LoadClass('case');
@@ -32,7 +36,7 @@ class InputDocument
$docrow['app_doc_filename'] = $row['APP_DOC_FILENAME'];
$docrow['doc_uid'] = $row['DOC_UID'];
$docrow['app_doc_version'] = $row['DOC_VERSION'];
$docrow['app_doc_create_date'] = $row['CREATE_DATE'];
$docrow['app_doc_create_date'] = $row['CREATE_DATE'];
$docrow['app_doc_create_user'] = $row['CREATED_BY'];
$docrow['app_doc_type'] = $row['TYPE'];
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
@@ -60,7 +64,7 @@ class InputDocument
try {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 );
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
throw (new \Exception('This input document with id: '.$inputDocumentUid.' doesn\'t exist!'));
throw (new \Exception('This input document with inp_doc_uid: '.$inputDocumentUid.' doesn\'t exist!'));
}
$sApplicationUID = $applicationUid;
$sUserUID = $userUid;
@@ -109,7 +113,7 @@ class InputDocument
try {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 );
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
throw (new \Exception('This input document with id: '.$inputDocumentUid.' doesn\'t exist!'));
throw (new \Exception('This input document with inp_doc_uid: '.$inputDocumentUid.' doesn\'t exist!'));
}
\G::LoadClass('wsBase');
$ws = new \wsBase();