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:
@@ -2512,7 +2512,8 @@ class wsBase
|
||||
$oLight = new \ProcessMaker\BusinessModel\Light();
|
||||
$nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $delIndex);
|
||||
$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) {
|
||||
\G::log(G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . '|' . $e->getMessage() , PATH_DATA, "mobile.log");
|
||||
}
|
||||
|
||||
@@ -196,4 +196,22 @@ class NotificationDevice extends BaseNotificationDevice {
|
||||
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
|
||||
|
||||
@@ -163,7 +163,8 @@ try {
|
||||
$oLight = new \ProcessMaker\BusinessModel\Light();
|
||||
$nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $appFields['DEL_INDEX']);
|
||||
$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) {
|
||||
\G::log(G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . '|' . $e->getMessage() , PATH_DATA, "mobile.log");
|
||||
}
|
||||
|
||||
@@ -147,7 +147,8 @@ class NotificationDevice
|
||||
* @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 {
|
||||
$response = array();
|
||||
@@ -184,7 +185,6 @@ class NotificationDevice
|
||||
);
|
||||
|
||||
if ($userIds) {
|
||||
|
||||
$oNoti = new \NotificationDevice();
|
||||
$devices = array();
|
||||
if (is_array($userIds)) {
|
||||
@@ -210,13 +210,15 @@ class NotificationDevice
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (count($devicesAppleIds) > 0) {
|
||||
$isExistNextNotifications = $oNoti->isExistNextNotification($appFields['APP_UID'],
|
||||
$currentDelIndex);
|
||||
if (count($devicesAppleIds) > 0 && $isExistNextNotifications) {
|
||||
$oNotification = new PushMessageIOS();
|
||||
$oNotification->setSettingNotification();
|
||||
$oNotification->setDevices($devicesAppleIds);
|
||||
$response['apple'] = $oNotification->send($message, $data);
|
||||
}
|
||||
if (count($devicesAndroidIds) > 0) {
|
||||
if (count($devicesAndroidIds) > 0 && $isExistNextNotifications) {
|
||||
$oNotification = new PushMessageAndroid();
|
||||
$oNotification->setSettingNotification();
|
||||
$oNotification->setDevices($devicesAndroidIds);
|
||||
|
||||
Reference in New Issue
Block a user