Cases Link is not executing the redirect when the connections comes from a Mobile Device.
This commit is contained in:
dheeyi william
2017-01-18 16:38:39 -04:00
parent b7789599f2
commit e1da377db1
4 changed files with 31 additions and 85 deletions

View File

@@ -5792,39 +5792,6 @@ class G
{ {
return $e->getMessage(); return $e->getMessage();
} }
/**
* Direct case link mobile
* @access public
*
* @param string
* @param int
*
* @return string
*/
public static function caseLinkMobile($applicationUid, $delIndex = 0)
{
$application = ApplicationPeer::retrieveByPK($applicationUid);
if (is_null($application) || !is_numeric($delIndex) || $delIndex < 0) {
return false;
}
if ($delIndex != 0) {
$appDelegation = AppDelegationPeer::retrieveByPK($applicationUid, $delIndex);
if (is_null($appDelegation)) {
return false;
}
$uri = 'processmakerMobile://' . $applicationUid . '/' . $delIndex;
} else {
$uri = 'processmakerMobile://' . $applicationUid;
}
//Return
return $uri;
}
} }
/** /**

View File

@@ -3946,22 +3946,3 @@ function PMFSendMessageToGroup(
//Return //Return
return 1; return 1;
} }
/**
* @method
*
* Direct case link mobile
*
* @name PMFCaseLinkMobile
* @label PMF Direct case link mobile
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFCaseLinkMobile.28.29
*
* @param string(32) | $applicationUid | ID of the case | The unique ID of the case
* @param int | $delIndex = 0 | Delegation index of the case | Optional parameter. The delegation index of a case
* @return string | $url | Direct case link to Mobile | Returns the direct case link to Mobile, FALSE otherwise
*/
function PMFCaseLinkMobile($applicationUid, $delIndex = 0)
{
//Return
return G::caseLinkMobile($applicationUid, $delIndex);
}

View File

@@ -1,36 +1,29 @@
<?php <?php
$RBAC->requirePermissions('PM_CASES'); $isBrowserMobile = G::check_is_mobile(strtolower($_SERVER['HTTP_USER_AGENT']));
if (!((defined('REDIRECT_TO_MOBILE') && REDIRECT_TO_MOBILE == 1 && $isBrowserMobile))) {
$isBrowserMobile = false;
if ($RBAC->userCanAccess('PM_CASES') != 1) {
header('location: ' . SYS_URI . 'login/login' . '?u=' . urlencode($_SERVER['REQUEST_URI']));
die();
}
}
$G_MAIN_MENU = 'processmaker'; $G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'CASES'; $G_ID_MENU_SELECTED = 'CASES';
$_POST['qs'] = ''; $_POST['qs'] = '';
$arrayAux = explode('?', $_SERVER['REQUEST_URI']); $arrayAux = explode('?', $_SERVER['REQUEST_URI']);
preg_match('/^.*\/cases\/opencase\/([\w\-]{32})$/', $arrayAux[0], $arrayMatch); preg_match('/^.*\/cases\/opencase\/([\w\-]{32})$/', $arrayAux[0], $arrayMatch);
$applicationUid = $arrayMatch[1]; $applicationUid = $arrayMatch[1];
$case = new \ProcessMaker\BusinessModel\Cases(); $case = new \ProcessMaker\BusinessModel\Cases();
$arrayApplicationData = $case->getApplicationRecordByPk($applicationUid, [], false); $arrayApplicationData = $case->getApplicationRecordByPk($applicationUid, [], false);
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
if ($arrayApplicationData !== false) { if ($isBrowserMobile) {
$isBrowserMobile = G::check_is_mobile(strtolower($_SERVER['HTTP_USER_AGENT'])); $delIndex = 0;
if ($arrayApplicationData !== false) {
if (!(defined('REDIRECT_TO_MOBILE') && REDIRECT_TO_MOBILE == 1 && $isBrowserMobile)) {
$_SESSION['__CD__'] = '../';
$_SESSION['__OPEN_APPLICATION_UID__'] = $applicationUid;
$G_PUBLISH->AddContent('view', 'cases/cases_Load');
$headPublisher = &headPublisher::getSingleton();
$headPublisher->addScriptFile('/jscore/src/PM.js');
$headPublisher->addScriptFile('/jscore/src/Sessions.js');
} else {
$case = new \ProcessMaker\BusinessModel\Cases(); $case = new \ProcessMaker\BusinessModel\Cases();
$arrayResult = $case->getStatusInfo($applicationUid, 0, $_SESSION['USER_LOGGED']); $arrayResult = $case->getStatusInfo($applicationUid, 0, $_SESSION['USER_LOGGED']);
@@ -42,26 +35,30 @@ if ($arrayApplicationData !== false) {
$arrayResult = $case->getStatusInfo($applicationUid); $arrayResult = $case->getStatusInfo($applicationUid);
$arrayDelIndex = $arrayResult['DEL_INDEX']; $arrayDelIndex = $arrayResult['DEL_INDEX'];
} }
$delIndex = 0;
if (count($arrayDelIndex) == 1) { if (count($arrayDelIndex) == 1) {
$delIndex = $arrayDelIndex[0]; $delIndex = $arrayDelIndex[0];
} }
$urlMobile = G::caseLinkMobile($applicationUid, $delIndex);
G::header('Location: ' . $urlMobile);
exit(0);
} }
$urlMobile = 'processmakerMobile://' . $applicationUid . '/' . $delIndex;
G::header('Location: ' . $urlMobile);
exit(0);
} else { } else {
$G_PUBLISH->AddContent( if ($arrayApplicationData !== false) {
'xmlform', $_SESSION['__CD__'] = '../';
'xmlform', $_SESSION['__OPEN_APPLICATION_UID__'] = $applicationUid;
'login/showMessage', $G_PUBLISH->AddContent('view', 'cases/cases_Load');
'', $headPublisher = &headPublisher::getSingleton();
['MESSAGE' => \G::LoadTranslation('ID_CASE_DOES_NOT_EXIST2', ['app_uid', $applicationUid])] $headPublisher->addScriptFile('/jscore/src/PM.js');
); $headPublisher->addScriptFile('/jscore/src/Sessions.js');
} else {
$G_PUBLISH->AddContent(
'xmlform',
'xmlform',
'login/showMessage',
'',
['MESSAGE' => \G::LoadTranslation('ID_CASE_DOES_NOT_EXIST2', ['app_uid', $applicationUid])]
);
}
} }
G::RenderPage('publish'); G::RenderPage('publish');

View File

@@ -960,6 +960,7 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
$noLoginFiles[] = 'propelTableAjax'; $noLoginFiles[] = 'propelTableAjax';
$noLoginFiles[] = 'licenseUpdate'; $noLoginFiles[] = 'licenseUpdate';
$noLoginFiles[] = 'casesStreamingFile'; $noLoginFiles[] = 'casesStreamingFile';
$noLoginFiles[] = 'opencase';
$noLoginFolders[] = 'services'; $noLoginFolders[] = 'services';
$noLoginFolders[] = 'tracker'; $noLoginFolders[] = 'tracker';