Merged in bugfix/HOR-2501 (pull request #5353)

HOR-2501

Approved-by: Julio Cesar Laura Avendaño
Approved-by: Paula Quispe
This commit is contained in:
Julio Cesar Laura Avendaño
2017-02-07 13:23:32 +00:00
4 changed files with 31 additions and 85 deletions

View File

@@ -1,36 +1,29 @@
<?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_ID_MENU_SELECTED = 'CASES';
$_POST['qs'] = '';
$arrayAux = explode('?', $_SERVER['REQUEST_URI']);
preg_match('/^.*\/cases\/opencase\/([\w\-]{32})$/', $arrayAux[0], $arrayMatch);
$applicationUid = $arrayMatch[1];
$case = new \ProcessMaker\BusinessModel\Cases();
$arrayApplicationData = $case->getApplicationRecordByPk($applicationUid, [], false);
$G_PUBLISH = new Publisher();
if ($arrayApplicationData !== false) {
$isBrowserMobile = G::check_is_mobile(strtolower($_SERVER['HTTP_USER_AGENT']));
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 {
if ($isBrowserMobile) {
$delIndex = 0;
if ($arrayApplicationData !== false) {
$case = new \ProcessMaker\BusinessModel\Cases();
$arrayResult = $case->getStatusInfo($applicationUid, 0, $_SESSION['USER_LOGGED']);
@@ -42,26 +35,30 @@ if ($arrayApplicationData !== false) {
$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);
}
$urlMobile = 'processmakerMobile://' . $applicationUid . '/' . $delIndex;
G::header('Location: ' . $urlMobile);
exit(0);
} else {
$G_PUBLISH->AddContent(
'xmlform',
'xmlform',
'login/showMessage',
'',
['MESSAGE' => \G::LoadTranslation('ID_CASE_DOES_NOT_EXIST2', ['app_uid', $applicationUid])]
);
if ($arrayApplicationData !== false) {
$_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 {
$G_PUBLISH->AddContent(
'xmlform',
'xmlform',
'login/showMessage',
'',
['MESSAGE' => \G::LoadTranslation('ID_CASE_DOES_NOT_EXIST2', ['app_uid', $applicationUid])]
);
}
}
G::RenderPage('publish');