BY-195 Agregando validacion para obtener los datos del proceso hijo al enviar el mail

BY-195 Agregando validacion para obtener los datos del proceso hijo al enviar el mail

BY-195 Agregando validacion para obtener los datos del proceso hijo al enviar el mail

BY-195 Agregando validacion para obtener los datos del proceso hijo al enviar el mail

Adding validation to get the data of the last task in the parent subprocess when the thread is going back from the son threat.

Fixing merge conflicts
This commit is contained in:
Jenny Murillo
2016-03-11 19:05:40 -04:00
parent 1e5924249c
commit 5e93d7481c
8 changed files with 171 additions and 77 deletions

View File

@@ -311,7 +311,8 @@ class AppDocumentDrive
$sw_file_exists_pdf = false;
$sw_file_exists = false;
$realPath = '';
if ($appDoc->getAppDocType() == 'OUTPUT') {
if ($appDoc->getAppDocType() === 'OUTPUT') {
//$name = substr($name, 1, -1);
$realPathDoc = PATH_DOCUMENT . $appUid . '/outdocs/' . $appDocUid . '_' . $docVersion . '.' . 'doc';
$realPathDoc1 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '_' . $docVersion . '.' . 'doc';
$realPathDoc2 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '.' . 'doc';

View File

@@ -5314,8 +5314,6 @@ class Cases
$oUser = new Users();
foreach ($arrayTask as $aTask) {
$sTo = null;
$sCc = null;
if (isset($aTask['DEL_INDEX'])) {
$arrayData2 = $arrayData;
@@ -5396,6 +5394,8 @@ class Cases
public function getTo($taskType, $taskUid, $taskUsrUid, $arrayData)
{
$sTo = null;
$sCc = null;
$arrayResp = array();
$task = new Tasks();
$group = new Groups();

View File

@@ -37,6 +37,52 @@ class SubApplication extends BaseSubApplication
}
}
public function loadSubProUidByParent($appUidParent, $delThreadParent, $delIndexParent )
{
try {
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(SubApplicationPeer::APP_UID);
$criteria->add(SubApplicationPeer::APP_PARENT, $appUidParent);
$criteria->add(SubApplicationPeer::DEL_INDEX_PARENT, $delIndexParent);
$criteria->add(SubApplicationPeer::DEL_THREAD_PARENT, $delThreadParent);
$rsCriteria = SubApplicationPeer::doSelectRs($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
}
if(is_array( $row )){
return($row['APP_UID']);
}
return "";
} catch (Exception $oError) {
throw($oError);
}
}
public function loadSubProUidBySon($appUidSon, $delThreadParent, $delIndexParent )
{
try {
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(SubApplicationPeer::APP_PARENT);
$criteria->add(SubApplicationPeer::APP_UID, $appUidSon);
$criteria->add(SubApplicationPeer::DEL_INDEX_PARENT, $delIndexParent);
$criteria->add(SubApplicationPeer::DEL_THREAD_PARENT, $delThreadParent);
$rsCriteria = SubApplicationPeer::doSelectRs($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
}
if(is_array( $row )){
return($row['APP_PARENT']);
}
return "";
} catch (Exception $oError) {
throw($oError);
}
}
public function create($aData)
{
$oConnection = Propel::getConnection(SubApplicationPeer::DATABASE_NAME);

View File

@@ -2,7 +2,7 @@
if (typeof window.parent != 'undefined') {
<?php
/*----------------------------------********---------------------------------*/
$pathDerivateGmail = 'derivatedGmail?tasks=';
$pathDerivateGmail = 'derivatedGmail';
$statusPMGmail = false;
$licensedFeatures = &PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
@@ -23,7 +23,7 @@ if (isset( $_GET['ux'] )) {
}
/*----------------------------------********---------------------------------*/
} else if( $statusPMGmail ){
$url = $pathDerivateGmail . $_GET['tasks'].'&arrayData='.$_GET['arrayData'];
$url = $pathDerivateGmail;
/*----------------------------------********---------------------------------*/
} else {
$url = 'casesListExtJs';
@@ -35,7 +35,7 @@ echo " window.parent.location.href = '$url';";
if (isset( $_GET['ux'] )) {
/*----------------------------------********---------------------------------*/
if(PMLicensedFeatures::getSingleton()->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09') && $statusPMGmail){
echo '} else { window.parent.location.href = \''.$pathDerivateGmail.$_GET['tasks'].'&arrayData='.$_GET['arrayData'].'\'; }';
echo '} else { window.parent.location.href = \''.$pathDerivateGmail.'\'; }';
} else {
/*----------------------------------********---------------------------------*/
echo '} else { window.parent.location.href = \'casesListExtJs\'; }';

View File

@@ -164,6 +164,23 @@ try {
$oUser = new Users();
$aUser = $oUser->load( $_SESSION['USER_LOGGED'] );
$sFromName = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ($aUser['USR_EMAIL'] != '' ? ' <' . $aUser['USR_EMAIL'] . '>' : '');
$flagGmail = false;
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton();
if($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')){
G::LoadClass( "pmGoogleApi" );
$pmGoogle = new PMGoogleApi();
if($pmGoogle->getServiceGmailStatus()){
$flagGmail = true;
}
}
if( $flagGmail === true ){
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$Pmgmail->sendEmail($_SESSION['APPLICATION'], "", $_SESSION['INDEX'], $_POST['form']['TASKS'], $appFields['APP_DATA']);
}
/*----------------------------------********---------------------------------*/
try {
$oCase->sendNotifications( $_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName );
} catch (Exception $e) {
@@ -225,21 +242,12 @@ try {
$debuggerAvailable = true;
$flagGmail = false;
if($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')){
G::LoadClass( "pmGoogleApi" );
$pmGoogle = new PMGoogleApi();
if($pmGoogle->getServiceGmailStatus()){
$flagGmail = true;
}
}
$casesRedirector = 'casesListExtJsRedirector';
if (isset( $_SESSION['user_experience'] ) && $flagGmail === false ) {
$aNextStep['PAGE'] = $casesRedirector.'?ux=' . $_SESSION['user_experience'];
$debuggerAvailable = false;
} else if( $flagGmail == true ){
$aNextStep['PAGE'] = $casesRedirector.'?gmail=1&tasks='.serialize($_POST['form']['TASKS']) . '&arrayData='.serialize($appFields['APP_DATA']);
$aNextStep['PAGE'] = $casesRedirector.'?gmail=1';
} else {
$aNextStep['PAGE'] = $casesRedirector;
}

View File

@@ -17,19 +17,6 @@ $appDel = new AppDelegation();
$actualThread = $appDel->Load($caseId, $actualIndex);
$actualLastIndex = $actualThread['DEL_PREVIOUS'];
$appDelPrev = $appDel->LoadParallel($caseId);
if($appDelPrev == array()){
$appDelPrev['0'] = $actualThread;
}
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
foreach ($appDelPrev as $app){
if( ($app['DEL_INDEX'] != $actualIndex) && ($app['DEL_PREVIOUS'] != $actualLastIndex) ){ //Sending the email to all threads of the case except the actual thread
$response = $Pmgmail->sendEmail($caseId, "", $app['DEL_INDEX'], unserialize($_GET['tasks']), unserialize($_GET['arrayData']));
}
}
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.labelsGmail.php");
$oLabels = new labelsGmail();
$oLabels->addRelabelingToQueue($caseId, $actualIndex, $actualLastIndex, false);

View File

@@ -95,6 +95,7 @@ class Pmgmail {
$frmData = unserialize($formData['APP_DATA']);
$dataFormToShowString = "";
foreach ($frmData as $field => $value) {
if (($field != 'SYS_LANG') &&
($field != 'SYS_SKIN') &&
@@ -139,17 +140,16 @@ class Pmgmail {
$oCases = new \Cases();
foreach ($arrayTask as $aTask) {
if (!isset($aTask["USR_UID"])) {
if(!isset($aTask["USR_UID"])){
$aTask["USR_UID"] = "";
}
$respTo = $oCases->getTo($aTask["TAS_ASSIGN_TYPE"], $aTask["TAS_UID"], $aTask["USR_UID"],
$arrayData);
$respTo = $oCases->getTo($aTask["TAS_ASSIGN_TYPE"], $aTask["TAS_UID"], $aTask["USR_UID"], $arrayData);
$mailToAddresses = $respTo['to'];
$mailCcAddresses = $respTo['cc'];
if ($aTask["TAS_ASSIGN_TYPE"] === "SELF_SERVICE") {
if($aTask["TAS_ASSIGN_TYPE"] === "SELF_SERVICE"){
$labelID = "PMUASS";
if ((string)$mailToAddresses === "") { // Self Service Value Based
if ((string)$mailToAddresses === ""){ // Self Service Value Based
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\AppAssignSelfServiceValuePeer::GRP_UID);
$criteria->add(\AppAssignSelfServiceValuePeer::APP_UID, $app_uid);
@@ -169,9 +169,61 @@ class Pmgmail {
$mailToAddresses .= ($mailToAddresses == '') ? $nextMail : ',' . $nextMail;
}
}
}
}
} else {
if (!$aTask["TAS_PARENT"]){
$aTask["TAS_PARENT"] = $tasUid;
}
$oTask = new \Task();
$aTaskInfo = $oTask->load($aTask["TAS_PARENT"]);
$oSubPro = new \SubApplication();
if( ($aTaskInfo["TAS_TYPE"] === "SUBPROCESS") ){
$subProAppUid = $oSubPro->loadSubProUidByParent($app_uid, $index, $index+1);
$index = 1;
} else if($aTask['TAS_UID'] == -1 && $aTask['TAS_ASSIGN_TYPE'] == "nobody"){
$subProAppUid = $oSubPro->loadSubProUidBySon($app_uid, $index, $index+1);
$appDel = new \AppDelegation();
$actualThread = $appDel->Load($subProAppUid, $index+1);
$index = $actualThread['DEL_INDEX'];
$aCriteria = new \Criteria("workflow");
$aCriteria->addSelectColumn(\RoutePeer::ROU_NEXT_TASK);
$aCriteria->add(\RoutePeer::TAS_UID, $actualThread['TAS_UID']);
$roCriteria = \RoutePeer::doSelectRs($aCriteria);
$roCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($roCriteria->next()) {
$rowTas = $roCriteria->getRow();
}
$aTaskInfo = $oTask->load($rowTas['ROU_NEXT_TASK']);
$newTask = new \Tasks();
$aTaskUsers = $newTask->getUsersOfTask($rowTas['ROU_NEXT_TASK'],1);
foreach ($aTaskUsers as $user) {
$nextMail = $user['USR_EMAIL'];
$mailToAddresses .= ($mailToAddresses == '') ? $nextMail : ',' . $nextMail;
}
}
if($subProAppUid !== ""){
$subProData = $oApplication->Load($subProAppUid);
$oProcess = new \Processes();
$proInfo = $oProcess->getProcessRow($subProData['PRO_UID']);
$appNumber = $subProData['APP_NUMBER'];
$app_uid = $subProAppUid;
$tasName = $aTaskInfo["TAS_TITLE"];
$appStatus = $subProData['APP_STATUS'];
$prvUsr = $nextUsr;
$delegateDate = $subProData['APP_CREATE_DATE'];
$proName = $proInfo['PRO_TITLE'];
}
}
}
}else {
$oUsers = new \Users();
$usrData = $oUsers->loadDetails($nextUsr);

View File

@@ -30,8 +30,8 @@ if(curl_exec($gCurl) === false){
} else {
$gCurl_response = curl_exec($gCurl);
curl_close($gCurl);
$gResp = json_decode($gCurl_response);
if ($gResp == false) {
$gResp = G::json_decode($gCurl_response);
if ($gResp === false) {
echo Bootstrap::LoadTranslation('ID_NO_LICENSE_FEATURE_ENABLED');
die;
}
@@ -47,7 +47,7 @@ curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0);
$curl_response = curl_exec( $curl );
curl_close($curl);
$decodedResp = json_decode($curl_response);
$decodedResp = G::json_decode($curl_response);
if(!is_object($decodedResp) || property_exists($decodedResp,'error')) {
die($decodedResp->error->message);
@@ -81,7 +81,7 @@ if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp
curl_setopt_array($ch, $optArray);
// execute request and get response
$result = curl_exec($ch);
$response = (json_decode($result));
$response = (G::json_decode($result));
curl_close($ch);
//First validate if this user (mail) corresponds to a PM user