PM-4286 Notifica despues de derivar un paralelo aun cuando los hilos no terminaron

undefined variables

fix in del_index
This commit is contained in:
Ronald Q
2015-12-03 13:56:52 -04:00
parent 9cc0377309
commit 933543fd29
4 changed files with 62 additions and 40 deletions

View File

@@ -970,10 +970,10 @@ class wsBase
$oCase = new Cases(); $oCase = new Cases();
$oldFields = $oCase->loadCase( $caseId ); $oldFields = $oCase->loadCase( $caseId );
if($gmail == 1){ if($gmail == 1){
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP; $pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP;
}else { }else {
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP; $pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP;
} }
$fileTemplate = $pathEmail . $sTemplate; $fileTemplate = $pathEmail . $sTemplate;
G::mk_dir( $pathEmail, 0777, true ); G::mk_dir( $pathEmail, 0777, true );
@@ -2512,7 +2512,8 @@ class wsBase
$oLight = new \ProcessMaker\BusinessModel\Light(); $oLight = new \ProcessMaker\BusinessModel\Light();
$nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $delIndex); $nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $delIndex);
$notificationMobile = new \ProcessMaker\BusinessModel\Light\NotificationDevice(); $notificationMobile = new \ProcessMaker\BusinessModel\Light\NotificationDevice();
$notificationMobile->routeCaseNotification($userId, $_SESSION["PROCESS"], $appdel['TAS_UID'], $appFields, $nextDelegations, $nextIndex); $notificationMobile->routeCaseNotification($userId, $_SESSION["PROCESS"], $appdel['TAS_UID'],
$appFields, $nextDelegations, $nextIndex, $delIndex);
} catch (Exception $e) { } catch (Exception $e) {
\G::log(G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . '|' . $e->getMessage() , PATH_DATA, "mobile.log"); \G::log(G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . '|' . $e->getMessage() , PATH_DATA, "mobile.log");
} }

View File

@@ -196,4 +196,22 @@ class NotificationDevice extends BaseNotificationDevice {
return (( get_class ($oRow) == 'NotificationDevice' )&&(!is_null($oRow))); return (( get_class ($oRow) == 'NotificationDevice' )&&(!is_null($oRow)));
} }
public function isExistNextNotification($app_uid, $del_index)
{
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppDelegationPeer::APP_UID);
$oCriteria->add(AppDelegationPeer::APP_UID, $app_uid);
$oCriteria->add(AppDelegationPeer::DEL_PREVIOUS, $del_index);
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
$oCriteria->setLimit(1);
//execute the query
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($oDataset->next()) {
return true;
} else {
return false;
}
}
} // NotificationDevice } // NotificationDevice

View File

@@ -21,34 +21,34 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
if (!isset($_SESSION['USER_LOGGED'])) { if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' ); G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript"> die( '<script type="text/javascript">
var olink = document.location.href; var olink = document.location.href;
olink = ( olink.search("gmail") == -1 ) ? parent.document.location.href : olink; olink = ( olink.search("gmail") == -1 ) ? parent.document.location.href : olink;
if(olink.search("gmail") == -1){ if(olink.search("gmail") == -1){
parent.location = "../cases/casesStartPage?action=startCase"; parent.location = "../cases/casesStartPage?action=startCase";
} else { } else {
var data = olink.split("?"); var data = olink.split("?");
var odata = data[1].split("&"); var odata = data[1].split("&");
var appUid = odata[0].split("="); var appUid = odata[0].split("=");
var dataToSend = { var dataToSend = {
"action": "credentials", "action": "credentials",
"operation": "refreshPmSession", "operation": "refreshPmSession",
"type": "processCall", "type": "processCall",
"funParams": [ "funParams": [
appUid[1], appUid[1],
"" ""
], ],
"expectReturn": false "expectReturn": false
}; };
var x = parent.postMessage(JSON.stringify(dataToSend), "*"); var x = parent.postMessage(JSON.stringify(dataToSend), "*");
if (x == undefined){ if (x == undefined){
x = parent.parent.postMessage(JSON.stringify(dataToSend), "*"); x = parent.parent.postMessage(JSON.stringify(dataToSend), "*");
} }
} }
</script>'); </script>');
} }
/* Permissions */ /* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) { switch ($RBAC->userCanAccess( 'PM_CASES' )) {
@@ -163,7 +163,8 @@ try {
$oLight = new \ProcessMaker\BusinessModel\Light(); $oLight = new \ProcessMaker\BusinessModel\Light();
$nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $appFields['DEL_INDEX']); $nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $appFields['DEL_INDEX']);
$notificationMobile = new \ProcessMaker\BusinessModel\Light\NotificationDevice(); $notificationMobile = new \ProcessMaker\BusinessModel\Light\NotificationDevice();
$notificationMobile->routeCaseNotification($_SESSION['USER_LOGGED'], $_SESSION['PROCESS'], $_SESSION['TASK'], $appFields, $_POST['form']['TASKS'], $nextIndex); $notificationMobile->routeCaseNotification($_SESSION['USER_LOGGED'], $_SESSION['PROCESS'], $_SESSION['TASK'],
$appFields, $_POST['form']['TASKS'], $nextIndex, $appFields['DEL_INDEX']);
} catch (Exception $e) { } catch (Exception $e) {
\G::log(G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . '|' . $e->getMessage() , PATH_DATA, "mobile.log"); \G::log(G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . '|' . $e->getMessage() , PATH_DATA, "mobile.log");
} }

View File

@@ -147,7 +147,8 @@ class NotificationDevice
* @author Ronald Quenta <ronald.quenta@processmaker.com> * @author Ronald Quenta <ronald.quenta@processmaker.com>
* *
*/ */
public function routeCaseNotification($currentUserId, $processId, $currentTaskId, $appFields, $aTasks, $nextIndex) public function routeCaseNotification($currentUserId, $processId, $currentTaskId, $appFields, $aTasks,
$nextIndex, $currentDelIndex)
{ {
try { try {
$response = array(); $response = array();
@@ -166,7 +167,7 @@ class NotificationDevice
$delIndex = null; $delIndex = null;
foreach ($nextIndex as $nIndex) { foreach ($nextIndex as $nIndex) {
if($aTask['TAS_UID'] == $nIndex['TAS_UID']){ if ($aTask['TAS_UID'] == $nIndex['TAS_UID']) {
$delIndex = $nIndex['DEL_INDEX']; $delIndex = $nIndex['DEL_INDEX'];
break; break;
} }
@@ -184,10 +185,9 @@ class NotificationDevice
); );
if ($userIds) { if ($userIds) {
$oNoti = new \NotificationDevice(); $oNoti = new \NotificationDevice();
$devices = array(); $devices = array();
if (is_array($userIds)){ if (is_array($userIds)) {
$devices = $oNoti->loadUsersArrayId($userIds); $devices = $oNoti->loadUsersArrayId($userIds);
} else { } else {
$devices = $oNoti->loadByUsersId($userIds); $devices = $oNoti->loadByUsersId($userIds);
@@ -210,13 +210,15 @@ class NotificationDevice
break; break;
} }
} }
if (count($devicesAppleIds) > 0) { $isExistNextNotifications = $oNoti->isExistNextNotification($appFields['APP_UID'],
$currentDelIndex);
if (count($devicesAppleIds) > 0 && $isExistNextNotifications) {
$oNotification = new PushMessageIOS(); $oNotification = new PushMessageIOS();
$oNotification->setSettingNotification(); $oNotification->setSettingNotification();
$oNotification->setDevices($devicesAppleIds); $oNotification->setDevices($devicesAppleIds);
$response['apple'] = $oNotification->send($message, $data); $response['apple'] = $oNotification->send($message, $data);
} }
if (count($devicesAndroidIds) > 0) { if (count($devicesAndroidIds) > 0 && $isExistNextNotifications) {
$oNotification = new PushMessageAndroid(); $oNotification = new PushMessageAndroid();
$oNotification->setSettingNotification(); $oNotification->setSettingNotification();
$oNotification->setDevices($devicesAndroidIds); $oNotification->setDevices($devicesAndroidIds);