HOR-684 Permitir deshabilitar las notificaciones de Mobile

HOR-684 change name variable

HOR-684 up observations
This commit is contained in:
Ronald Q
2016-04-05 11:34:37 -04:00
parent 4b5cc4f910
commit 1c7794bb9a
3 changed files with 60 additions and 44 deletions

View File

@@ -2519,11 +2519,13 @@ class wsBase
// Send notifications Mobile - Start
try {
$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, $delIndex);
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");
}

View File

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

View File

@@ -7,6 +7,18 @@ use G;
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
*