Adding validation when getting the index of the process.

This commit is contained in:
Jenny Murillo
2016-03-22 16:35:57 -04:00
parent 9b83bfc00b
commit d798d01f69
3 changed files with 135 additions and 141 deletions

View File

@@ -5400,6 +5400,7 @@ class Cases
$task = new Tasks ();
$group = new Groups ();
$oUser = new Users ();
switch ($taskType) {
case "SELF_SERVICE" :
if (isset ( $taskUid ) && ! empty ( $taskUid )) {
@@ -5439,10 +5440,7 @@ class Cases
while ( $rsCriteria->next () ) {
$row = $rsCriteria->getRow ();
$toAux = (
(($row["USR_FIRSTNAME"] != "") || ($row["USR_LASTNAME"] != "")) ?
$row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"] . " " : ""
) . "<" . $row["USR_EMAIL"] . ">";
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
if ($sw == 1) {
$to = $toAux;
@@ -5463,10 +5461,7 @@ class Cases
$userFields = $oDerivation->getUsersFullNameFromArray ( $oDerivation->getAllUsersFromAnyTask ( $taskUid ) );
if (isset ( $userFields )) {
foreach ( $userFields as $row ) {
$toAux = (
(($row["USR_FIRSTNAME"] != "") || ($row["USR_LASTNAME"] != "")) ?
$row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"] . " " : ""
) . "<" . $row["USR_EMAIL"] . ">";
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
if ($sw == 1) {
$to = $toAux;
$sw = 0;
@@ -5491,10 +5486,7 @@ class Cases
$userFields = $oDerivation->getUsersFullNameFromArray ( $arrayUsers );
foreach ( $userFields as $row ) {
$toAux = (
(($row["USR_FIRSTNAME"] != "") || ($row["USR_LASTNAME"] != "")) ?
$row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"] . " " : ""
) . "<" . $row["USR_EMAIL"] . ">";
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
if ($sw == 1) {
$to = $toAux;
$sw = 0;
@@ -5509,10 +5501,7 @@ class Cases
default :
if (isset ( $taskUsrUid ) && ! empty ( $taskUsrUid )) {
$aUser = $oUser->load ( $taskUsrUid );
$sTo = (
(($aUser["USR_FIRSTNAME"] != "") || ($aUser["USR_LASTNAME"] != "")) ?
$aUser["USR_FIRSTNAME"] . " " . $aUser["USR_LASTNAME"] . " " : ""
) . "<" . $aUser["USR_EMAIL"] . ">";
$sTo = ((($aUser ["USR_FIRSTNAME"] != "") || ($aUser ["USR_LASTNAME"] != "")) ? $aUser ["USR_FIRSTNAME"] . " " . $aUser ["USR_LASTNAME"] . " " : "") . "<" . $aUser ["USR_EMAIL"] . ">";
}
$arrayResp ['to'] = $sTo;
$arrayResp ['cc'] = '';

View File

@@ -172,15 +172,16 @@ try {
G::LoadClass( "pmGoogleApi" );
$pmGoogle = new PMGoogleApi();
if($pmGoogle->getServiceGmailStatus()){
$flagGmail = true;
$appDel = new AppDelegation();
$actualThread = $appDel->Load($_SESSION['APPLICATION'], $_SESSION['INDEX']);
$appDelPrev = $appDel->LoadParallel($_SESSION['APPLICATION']);
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
if($appDelPrev == array()){
if(!$appDelPrev){
$Pmgmail->sendEmail($_SESSION['APPLICATION'], "", $_SESSION['INDEX'], $_POST['form']['TASKS'], $appFields['APP_DATA']);
}
}else{
foreach ($appDelPrev as $app){
if( ($app['DEL_INDEX'] != $_SESSION['INDEX']) && ($app['DEL_PREVIOUS'] != $actualThread['DEL_PREVIOUS']) ){
$Pmgmail->sendEmail($_SESSION['APPLICATION'], "", $app['DEL_INDEX'], $_POST['form']['TASKS'], $appFields['APP_DATA']);
@@ -188,6 +189,7 @@ try {
}
}
}
}
/*----------------------------------********---------------------------------*/
try {

View File

@@ -115,6 +115,10 @@ class Pmgmail {
}
$appData = $this->getDraftApp($app_uid, $index);
if (!$appData){
$appData = $this->getDraftApp($app_uid, $index-1);
}
foreach ($appData as $application) {
$appNumber = $application['APP_NUMBER'];
$appStatus = $application['APP_STATUS'];
@@ -179,8 +183,7 @@ class Pmgmail {
$oSubPro = new \SubApplication();
$subProAppUid = "";
if( ($aTaskInfo["TAS_TYPE"] === "SUBPROCESS") ){
$subProAppUid = $oSubPro->loadSubProUidByParent($app_uid, 1, $index-1);
$index = 1;
$subProAppUid = $oSubPro->loadSubProUidByParent($app_uid, $index, $index+1);
} else if($aTask['TAS_UID'] == -1 && $aTask['TAS_ASSIGN_TYPE'] == "nobody"){
$subProAppUid = $oSubPro->loadSubProUidBySon($app_uid, $index, $index+1);