HOR-998
(Notification) La aplicación crashea cuando se abre una notificación luego de derivar a un subproceso de tipo sincrono HOR-998 (Notification) La aplicación crashea cuando se abre una notificación luego de derivar a un subproceso de tipo sincrono HOR-998 (Notification) La aplicación crashea cuando se abre una notificación luego de derivar a un subproceso de tipo sincrono
This commit is contained in:
@@ -1401,6 +1401,7 @@ class Derivation
|
||||
{
|
||||
$iAppThreadIndex = $appFields['DEL_THREAD'];
|
||||
$delType = 'NORMAL';
|
||||
$sendNotificationsMobile = false;
|
||||
|
||||
if (is_numeric( $nextDel['DEL_PRIORITY'] )) {
|
||||
$nextDel['DEL_PRIORITY'] = (isset( $nextDel['DEL_PRIORITY'] ) ? ($nextDel['DEL_PRIORITY'] >= 1 && $nextDel['DEL_PRIORITY'] <= 5 ? $nextDel['DEL_PRIORITY'] : '3') : '3');
|
||||
@@ -1523,6 +1524,8 @@ class Derivation
|
||||
}
|
||||
}
|
||||
|
||||
$sendNotificationsMobile = $this->sendNotificationsMobile($aOldFields, $aSP, $aNewCase['INDEX']);
|
||||
|
||||
//If not is SYNCHRONOUS derivate one more time
|
||||
if ($aSP['SP_SYNCHRONOUS'] == 0) {
|
||||
$this->case->setDelInitDate( $currentDelegation['APP_UID'], $iNewDelIndex );
|
||||
@@ -1553,6 +1556,10 @@ class Derivation
|
||||
}
|
||||
}
|
||||
} //end switch
|
||||
|
||||
if($iNewDelIndex !== 0 && !$sendNotificationsMobile){
|
||||
$sendNotificationsMobile = $this->sendNotificationsMobile($appFields, $nextDel, $iNewDelIndex);
|
||||
}
|
||||
return $iNewDelIndex;
|
||||
}
|
||||
|
||||
@@ -1800,5 +1807,24 @@ class Derivation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $appFields
|
||||
* @param $nextDel
|
||||
* @param $iNewDelIndex
|
||||
* @return bool
|
||||
*/
|
||||
private function sendNotificationsMobile($appFields, $nextDel, $iNewDelIndex)
|
||||
{
|
||||
try {
|
||||
$notificationMobile = new \ProcessMaker\BusinessModel\Light\NotificationDevice();
|
||||
if ($notificationMobile->checkMobileNotifications()) {
|
||||
$notificationMobile->routeCaseNotificationDevice($appFields, $nextDel, $iNewDelIndex);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
\G::log(G::loadTranslation('ID_NOTIFICATION_ERROR') . '|' . $e->getMessage(), PATH_DATA, "mobile.log");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2518,20 +2518,6 @@ class wsBase
|
||||
|
||||
$oCase->sendNotifications( $appdel['TAS_UID'], $nextDelegations, $appFields['APP_DATA'], $caseId, $delIndex, $sFromName );
|
||||
|
||||
// Send notifications Mobile - Start
|
||||
try {
|
||||
$notificationMobile = new \ProcessMaker\BusinessModel\Light\NotificationDevice();
|
||||
if ($notificationMobile->checkMobileNotifications()) {
|
||||
$oLight = new \ProcessMaker\BusinessModel\Light();
|
||||
$nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $delIndex);
|
||||
$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");
|
||||
}
|
||||
// Send notifications Mobile - End
|
||||
|
||||
//Save data - Start
|
||||
//$appFields = $oCase->loadCase($caseId);
|
||||
//$oCase->updateCase($caseId, $appFields);
|
||||
|
||||
@@ -194,21 +194,6 @@ try {
|
||||
G::SendTemporalMessage( G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . ' - ' . $e->getMessage(), 'warning', 'string', null, '100%' );
|
||||
}
|
||||
// Send notifications - End
|
||||
|
||||
// Send notifications Mobile - Start
|
||||
try {
|
||||
$notificationMobile = new \ProcessMaker\BusinessModel\Light\NotificationDevice();
|
||||
if ($notificationMobile->checkMobileNotifications()) {
|
||||
$oLight = new \ProcessMaker\BusinessModel\Light();
|
||||
$nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $appFields['DEL_INDEX']);
|
||||
$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");
|
||||
}
|
||||
// Send notifications Mobile - End
|
||||
|
||||
// Events - Start
|
||||
$oEvent = new Event();
|
||||
|
||||
|
||||
@@ -154,54 +154,43 @@ class NotificationDevice
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Message each user id
|
||||
*
|
||||
* @param array $request_data
|
||||
* @author Ronald Quenta <ronald.quenta@processmaker.com>
|
||||
*
|
||||
* @param $appFields
|
||||
* @param $nextDel
|
||||
* @param $iNewDelIndex
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function routeCaseNotification($currentUserId, $processId, $currentTaskId, $appFields, $aTasks,
|
||||
$nextIndex, $currentDelIndex)
|
||||
public function routeCaseNotificationDevice($appFields, $nextDel, $iNewDelIndex)
|
||||
{
|
||||
try {
|
||||
$response = array();
|
||||
$typeList = 'todo';
|
||||
foreach ($aTasks as $aTask) {
|
||||
$arrayTaskUser = array();
|
||||
switch ($aTask["TAS_ASSIGN_TYPE"]) {
|
||||
switch ($nextDel["TAS_ASSIGN_TYPE"]) {
|
||||
case "SELF_SERVICE":
|
||||
$arrayTaskUser = $this->getTaskUserSelfService($aTask["TAS_UID"], $appFields);
|
||||
$arrayTaskUser = $this->getTaskUserSelfService($nextDel["TAS_UID"], $appFields);
|
||||
$typeList = 'unassigned';
|
||||
break;
|
||||
default:
|
||||
if (isset($aTask["USR_UID"]) && !empty($aTask["USR_UID"])) {
|
||||
$arrayTaskUser = $aTask["USR_UID"];
|
||||
if (isset($nextDel["USR_UID"]) && !empty($nextDel["USR_UID"])) {
|
||||
$arrayTaskUser = $nextDel["USR_UID"];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$delIndex = null;
|
||||
foreach ($nextIndex as $nIndex) {
|
||||
if ($aTask['TAS_UID'] == $nIndex['TAS_UID']) {
|
||||
$delIndex = $nIndex['DEL_INDEX'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$userIds = $arrayTaskUser;
|
||||
$message = '#'. $appFields['APP_NUMBER'] . ' : '.$appFields['APP_TITLE'];
|
||||
$message = '#' . $appFields['APP_NUMBER'] . ' : ' . $appFields['APP_TITLE'];
|
||||
$data = array(
|
||||
'processId' => $processId,
|
||||
'taskId' => $aTask["TAS_UID"],
|
||||
'processId' => $appFields['PRO_UID'],
|
||||
'taskId' => $nextDel["TAS_UID"],
|
||||
'caseId' => $appFields['APP_UID'],
|
||||
'caseTitle' => $appFields['APP_TITLE'],
|
||||
'delIndex' => $delIndex,
|
||||
'delIndex' => $iNewDelIndex,
|
||||
'typeList' => $typeList
|
||||
);
|
||||
|
||||
if ($userIds) {
|
||||
$oNoti = new \NotificationDevice();
|
||||
$devices = array();
|
||||
if (is_array($userIds)) {
|
||||
$devices = $oNoti->loadUsersArrayId($userIds);
|
||||
} else {
|
||||
@@ -225,11 +214,9 @@ class NotificationDevice
|
||||
break;
|
||||
}
|
||||
}
|
||||
$isExistNextNotifications = $oNoti->isExistNextNotification($appFields['APP_UID'],
|
||||
$currentDelIndex);
|
||||
if (count($devicesAppleIds) > 0 && $isExistNextNotifications) {
|
||||
if (count($devicesAppleIds) > 0) {
|
||||
$arrayData = array();
|
||||
$arrayData['NOT_FROM'] = $currentUserId;
|
||||
$arrayData['NOT_FROM'] = $appFields['APP_CUR_USER'];
|
||||
$arrayData['DEV_TYPE'] = 'apple';
|
||||
$arrayData['DEV_UID'] = serialize($devicesAppleIds);
|
||||
$arrayData['NOT_MSG'] = $message;
|
||||
@@ -238,9 +225,9 @@ class NotificationDevice
|
||||
$notQueue = new \NotificationQueue();
|
||||
$notQueue->create($arrayData);
|
||||
}
|
||||
if (count($devicesAndroidIds) > 0 && $isExistNextNotifications) {
|
||||
if (count($devicesAndroidIds) > 0) {
|
||||
$arrayData = array();
|
||||
$arrayData['NOT_FROM'] = $currentUserId;
|
||||
$arrayData['NOT_FROM'] = $appFields['APP_CUR_USER'];
|
||||
$arrayData['DEV_TYPE'] = 'android';
|
||||
$arrayData['DEV_UID'] = serialize($devicesAndroidIds);
|
||||
$arrayData['NOT_MSG'] = $message;
|
||||
@@ -250,11 +237,9 @@ class NotificationDevice
|
||||
$notQueue->create($arrayData);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage(), Api::STAT_APP_EXCEPTION);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user