Merged in qronald/processmaker/HOR-684 (pull request #4051)

HOR-684
This commit is contained in:
Julio Cesar Laura Avendaño
2016-04-05 15:56:06 -04:00
3 changed files with 60 additions and 44 deletions

View File

@@ -2519,11 +2519,13 @@ class wsBase
// Send notifications Mobile - Start // Send notifications Mobile - Start
try { try {
$oLight = new \ProcessMaker\BusinessModel\Light();
$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'], if ($notificationMobile->checkMobileNotifications()) {
$appFields, $nextDelegations, $nextIndex, $delIndex); $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) { } 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

@@ -163,32 +163,32 @@ try {
// Send notifications - Start // Send notifications - Start
$oUser = new Users(); $oUser = new Users();
$aUser = $oUser->load( $_SESSION['USER_LOGGED'] ); $aUser = $oUser->load( $_SESSION['USER_LOGGED'] );
$sFromName = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ($aUser['USR_EMAIL'] != '' ? ' <' . $aUser['USR_EMAIL'] . '>' : ''); $sFromName = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ($aUser['USR_EMAIL'] != '' ? ' <' . $aUser['USR_EMAIL'] . '>' : '');
$flagGmail = false; $flagGmail = false;
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton (); $licensedFeatures = &PMLicensedFeatures::getSingleton ();
if ($licensedFeatures->verifyfeature ( '7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09' )) { if ($licensedFeatures->verifyfeature ( '7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09' )) {
G::LoadClass ( "pmGoogleApi" ); G::LoadClass ( "pmGoogleApi" );
$pmGoogle = new PMGoogleApi (); $pmGoogle = new PMGoogleApi ();
if ($pmGoogle->getServiceGmailStatus ()) { if ($pmGoogle->getServiceGmailStatus ()) {
$flagGmail = true; $flagGmail = true;
$appDel = new AppDelegation (); $appDel = new AppDelegation ();
$actualThread = $appDel->Load ( $_SESSION ['APPLICATION'], $_SESSION ['INDEX'] ); $actualThread = $appDel->Load ( $_SESSION ['APPLICATION'], $_SESSION ['INDEX'] );
$appDelPrev = $appDel->LoadParallel ( $_SESSION ['APPLICATION'] ); $appDelPrev = $appDel->LoadParallel ( $_SESSION ['APPLICATION'] );
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail (); $Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail ();
if (! $appDelPrev) { if (! $appDelPrev) {
$Pmgmail->sendEmail ( $_SESSION ['APPLICATION'], "", $_SESSION ['INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] ); $Pmgmail->sendEmail ( $_SESSION ['APPLICATION'], "", $_SESSION ['INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] );
} else { } else {
foreach ( $appDelPrev as $app ) { foreach ( $appDelPrev as $app ) {
if (($app ['DEL_INDEX'] != $_SESSION ['INDEX']) && ($app ['DEL_PREVIOUS'] != $actualThread ['DEL_PREVIOUS'])) { if (($app ['DEL_INDEX'] != $_SESSION ['INDEX']) && ($app ['DEL_PREVIOUS'] != $actualThread ['DEL_PREVIOUS'])) {
$Pmgmail->sendEmail ( $_SESSION ['APPLICATION'], "", $app ['DEL_INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] ); $Pmgmail->sendEmail ( $_SESSION ['APPLICATION'], "", $app ['DEL_INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] );
} }
} }
} }
} }
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
@@ -201,11 +201,13 @@ try {
// Send notifications Mobile - Start // Send notifications Mobile - Start
try { try {
$oLight = new \ProcessMaker\BusinessModel\Light();
$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'], if ($notificationMobile->checkMobileNotifications()) {
$appFields, $_POST['form']['TASKS'], $nextIndex, $appFields['DEL_INDEX']); $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) { } 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");
} }
@@ -251,16 +253,16 @@ try {
// Set users drive - End // Set users drive - End
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$debuggerAvailable = true; $debuggerAvailable = true;
$casesRedirector = 'casesListExtJsRedirector'; $casesRedirector = 'casesListExtJsRedirector';
if (isset ( $_SESSION ['user_experience'] ) && $flagGmail === false) { if (isset ( $_SESSION ['user_experience'] ) && $flagGmail === false) {
$aNextStep ['PAGE'] = $casesRedirector . '?ux=' . $_SESSION ['user_experience']; $aNextStep ['PAGE'] = $casesRedirector . '?ux=' . $_SESSION ['user_experience'];
$debuggerAvailable = false; $debuggerAvailable = false;
} else if ($flagGmail === true) { } else if ($flagGmail === true) {
$aNextStep ['PAGE'] = $casesRedirector . '?gmail=1'; $aNextStep ['PAGE'] = $casesRedirector . '?gmail=1';
} else { } else {
$aNextStep ['PAGE'] = $casesRedirector; $aNextStep ['PAGE'] = $casesRedirector;
} }
if (isset( $_SESSION['PMDEBUGGER'] ) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) { if (isset( $_SESSION['PMDEBUGGER'] ) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) {

View File

@@ -7,6 +7,18 @@ use G;
class NotificationDevice class NotificationDevice
{ {
public function checkMobileNotifications()
{
$conf = \System::getSystemConfiguration('', '', SYS_SYS);
$activeNotifications = true;
if (isset($conf['mobileNotifications'])) {
$activeNotifications = $conf['mobileNotifications'] == 1 ? true : false;
}
return $activeNotifications;
}
/** /**
* Post Create register device with userUid * Post Create register device with userUid
* *