BUG 15243 "Email Notification from Subprocess" SOLVED

- Email Notification from Subprocess.
- Problema resuelto, cuando se tiene un subproceso que tiene notificacion en la ultima tarea y este debe retornar al proceso
  principal, entonces la notificacion se enviara al usuario del proceso principal.
This commit is contained in:
Luis Fernando Saisa Lopez
2014-07-03 12:42:37 -04:00
parent 63980bdd39
commit 1877369b91
2 changed files with 24 additions and 54 deletions

View File

@@ -638,7 +638,7 @@ class Derivation
//Close case
$appFields["APP_STATUS"] = "COMPLETED";
$appFields["APP_FINISH_DATE"] = "now";
$this->verifyIsCaseChild( $currentDelegation["APP_UID"] );
$this->verifyIsCaseChild($currentDelegation["APP_UID"], $currentDelegation["DEL_INDEX"]);
$sw = 1;
}
@@ -793,7 +793,7 @@ class Derivation
* @param string $sApplicationUID
* @return void
*/
function verifyIsCaseChild ($sApplicationUID)
function verifyIsCaseChild ($sApplicationUID, $delIndex = 0)
{
//Obtain the related row in the table SUB_APPLICATION
$oCriteria = new Criteria( 'workflow' );
@@ -814,7 +814,7 @@ class Derivation
$oDataset->next();
$aSP = $oDataset->getRow();
if ($aSP['SP_SYNCHRONOUS'] == 1) {
$appFields = $oCase->loadCase( $sApplicationUID );
$appFields = $oCase->loadCase($sApplicationUID, $delIndex);
//Copy case variables to parent case
$aFields = unserialize( $aSP['SP_VARIABLES_IN'] );
$aNewFields = array ();
@@ -853,6 +853,25 @@ class Derivation
$currentDelegation2 = array ('APP_UID' => $aSA['APP_PARENT'],'DEL_INDEX' => $aSA['DEL_INDEX_PARENT'],'APP_STATUS' => 'TO_DO','TAS_UID' => $aParentCase['TAS_UID'],'ROU_TYPE' => $aDeriveTasks[1]['ROU_TYPE']
);
$this->derivate( $currentDelegation2, $nextDelegations2 );
// Send notifications - Start
$oUser = new Users();
$aUser = $oUser->load($appFields["APP_DATA"]["USER_LOGGED"]);
$sFromName = $aUser["USR_FIRSTNAME"] . " " . $aUser["USR_LASTNAME"] . ($aUser["USR_EMAIL"] != "" ? " <" . $aUser["USR_EMAIL"] . ">" : "");
try {
$oCase->sendNotifications($appFields["APP_DATA"]["TASK"],
$nextDelegations2,
$appFields["APP_DATA"],
$sApplicationUID,
$delIndex,
$sFromName);
} catch (Exception $e) {
G::SendTemporalMessage(G::loadTranslation("ID_NOTIFICATION_ERROR") . " - " . $e->getMessage(), "warning", "string", null, "100%");
}
// Send notifications - End
}
}
}

View File

@@ -116,65 +116,16 @@ try {
// Send notifications - Start
$oUser = new Users();
$aUser = $oUser->load( $_SESSION['USER_LOGGED'] );
$sFromName = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ($aUser['USR_EMAIL'] != '' ? ' <' . $aUser['USR_EMAIL'] . '>' : '');
$arrayUser = array();
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(SubApplicationPeer::APP_PARENT);
$criteria->addSelectColumn(SubApplicationPeer::DEL_INDEX_PARENT);
$criteria->addJoin(SubApplicationPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
$criteria->add(SubApplicationPeer::APP_UID, $_SESSION["APPLICATION"], Criteria::EQUAL);
$criteria->add(ApplicationPeer::APP_STATUS, "COMPLETED", Criteria::EQUAL);
$rsCriteria = SubApplicationPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$record = $row;
//Get Users
$criteria2 = new Criteria("workflow");
$criteria2->addSelectColumn(AppDelegationPeer::USR_UID);
$criteria2->add(AppDelegationPeer::APP_UID, $record["APP_PARENT"], Criteria::EQUAL);
$criteria2->add(AppDelegationPeer::DEL_PREVIOUS, $record["DEL_INDEX_PARENT"], Criteria::EQUAL);
$rsCriteria2 = AppDelegationPeer::doSelectRS($criteria2);
$rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria2->next()) {
$row2 = $rsCriteria2->getRow();
$record2 = $row2;
$arrayUser[] = array(
"TAS_ASSIGN_TYPE" => "",
"USR_UID" => $record2["USR_UID"]
);
}
}
try {
$oCase->sendNotifications( $_SESSION['TASK'],
(count($arrayUser) == 0)? $_POST["form"]["TASKS"] : $arrayUser,
$appFields['APP_DATA'],
$_SESSION['APPLICATION'],
$_SESSION['INDEX'],
$sFromName );
$oCase->sendNotifications( $_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName );
} catch (Exception $e) {
G::SendTemporalMessage( G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . ' - ' . $e->getMessage(), 'warning', 'string', null, '100%' );
}
// Send notifications - End
// Events - Start
$oEvent = new Event();