This commit is contained in:
Paula V. Quispe
2016-12-06 10:58:25 -05:00
parent 157b65aea5
commit 4c82fb5dd5
5 changed files with 88 additions and 8 deletions

View File

@@ -5792,6 +5792,39 @@ class G
{
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,3 +3946,22 @@ function PMFSendMessageToGroup(
//Return
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

@@ -77,7 +77,8 @@ class System
'server_protocol' => '',
'leave_case_warning' => 0,
'server_hostname_requests_frontend' => '',
'load_headers_ie' => 0
'load_headers_ie' => 0,
'redirect_to_mobile' => 0
);
/**

View File

@@ -19,14 +19,41 @@ $arrayApplicationData = $case->getApplicationRecordByPk($applicationUid, [], fal
$G_PUBLISH = new Publisher();
if ($arrayApplicationData !== false) {
$_SESSION['__CD__'] = '../';
$_SESSION['__OPEN_APPLICATION_UID__'] = $applicationUid;
$isBrowserMobile = G::check_is_mobile(strtolower($_SERVER['HTTP_USER_AGENT']));
$G_PUBLISH->AddContent('view', 'cases/cases_Load');
if (!(defined('REDIRECT_TO_MOBILE') && REDIRECT_TO_MOBILE == 1 && $isBrowserMobile)) {
$_SESSION['__CD__'] = '../';
$_SESSION['__OPEN_APPLICATION_UID__'] = $applicationUid;
$headPublisher = &headPublisher::getSingleton();
$headPublisher->addScriptFile('/jscore/src/PM.js');
$headPublisher->addScriptFile('/jscore/src/Sessions.js');
$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();
$arrayResult = $case->getStatusInfo($applicationUid, 0, $_SESSION['USER_LOGGED']);
$arrayDelIndex = [];
if (!empty($arrayResult)) {
$arrayDelIndex = $arrayResult['DEL_INDEX'];
} else {
$arrayResult = $case->getStatusInfo($applicationUid);
$arrayDelIndex = $arrayResult['DEL_INDEX'];
}
$delIndex = 0;
if (count($arrayDelIndex) == 1) {
$delIndex = $arrayDelIndex[0];
}
$urlMobile = G::caseLinkMobile($applicationUid, $delIndex);
G::header('Location: ' . $urlMobile);
exit(0);
}
} else {
$G_PUBLISH->AddContent(
'xmlform',

View File

@@ -340,8 +340,8 @@ define( 'MEMCACHED_SERVER', $config['memcached_server'] );
define ('WS_IN_LOGIN', isset($config['WS_IN_LOGIN']) ? $config['WS_IN_LOGIN'] : 'serverconf');
define('LOAD_HEADERS_IE', $config['load_headers_ie']);
define('LEAVE_CASE_WARNING', $config['leave_case_warning']);
define('REDIRECT_TO_MOBILE', $config['redirect_to_mobile']);
// IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it.
$_SERVER['SERVER_ADDR'] = isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME'];