Merge remote-tracking branch 'upstream/3.0.1.7' into 3.0.1.7-Gmail

This commit is contained in:
Dante
2015-12-04 11:41:17 -04:00
22 changed files with 259 additions and 71 deletions

View File

@@ -5495,16 +5495,31 @@ class G
}
break;
case 'docx':
if ($docType[1] == 'vnd.openxmlformats-officedocument.wordprocessingml.document') {
$res->status = true;
return $res;
}
break;
case 'pptx':
if ($docType[1] == 'vnd.openxmlformats-officedocument.presentationml.presentation') {
$res->status = true;
return $res;
}
break;
case 'xlsx':
if ($docType[1] == 'zip') {
if ($docType[1] == 'vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
$res->status = true;
return $res;
}
break;
case 'exe':
if ($docType[1] == 'x-msdownload' || $docType[1] == 'x-dosexec') {
$res->status = true;
return $res;
}
break;
case 'wmv':
if($docType[1] == 'octet-stream'){
if($docType[1] == 'x-ms-asf' || $docType[1] == 'x-ms-wmv'){
$res->status = true;
return $res;
}

View File

@@ -5392,7 +5392,21 @@ class Cases
$fileTemplate = $pathEmail . $conf["TAS_DEF_MESSAGE_TEMPLATE"];
if (!file_exists($fileTemplate)) {
throw (new Exception("Template file \"$fileTemplate\" does not exist."));
$tempale = PATH_CORE."templates".PATH_SEP."mails".PATH_SEP."alert_message.html";
$copied = @copy($tempale,$fileTemplate);
if($copied) {
$dataTemplate = array("prf_filename"=>$conf["TAS_DEF_MESSAGE_TEMPLATE"],
"prf_path"=>$fileTemplate,
"pro_uid"=>$aTaskInfo["PRO_UID"],
"usr_uid"=>"00000000000000000000000000000001",
"prf_uid"=>G::generateUniqueID(),
"prf_type"=>"file",
"prf_create_date"=>date("Y-m-d H:i:s"));
$filesManager = new ProcessMaker\BusinessModel\FilesManager();
$filesManager->addProcessFilesManagerInDb($dataTemplate);
} else {
throw (new Exception("Template file \"$fileTemplate\" does not exist."));
}
}
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $aFields, false);

View File

@@ -1063,6 +1063,9 @@ class Derivation
$this->case->closeAllDelegations( $currentDelegation['APP_UID'] );
$this->case->closeAllThreads( $currentDelegation['APP_UID'] );
//I think we need to change the APP_STATUS to completed,
if (!isset($nextDel['ROU_CONDITION'])) {
$nextDel['ROU_CONDITION'] = '';
}
if (isset($nextDel["TAS_UID_DUMMY"]) ) {
$taskDummy = TaskPeer::retrieveByPK($nextDel["TAS_UID_DUMMY"]);
if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType())) {

View File

@@ -1743,6 +1743,9 @@ function PMFGenerateOutputDocument ($outputID, $sApplication = null, $index = nu
$aProperties['media'] = $aOD['OUT_DOC_MEDIA'];
$aProperties['margins'] = array ('left' => $aOD['OUT_DOC_LEFT_MARGIN'],'right' => $aOD['OUT_DOC_RIGHT_MARGIN'],'top' => $aOD['OUT_DOC_TOP_MARGIN'],'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN']
);
if ($aOD['OUT_DOC_PDF_SECURITY_ENABLED'] == '1') {
$aProperties['pdfSecurity'] = array('openPassword' => $aOD['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], 'ownerPassword' => $aOD['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], 'permissions' => $aOD['OUT_DOC_PDF_SECURITY_PERMISSIONS']);
}
if (isset($aOD['OUT_DOC_REPORT_GENERATOR'])) {
$aProperties['report_generator'] = $aOD['OUT_DOC_REPORT_GENERATOR'];
}

View File

@@ -553,6 +553,15 @@ class ReportTables
public function updateTables ($sProcessUid, $sApplicationUid, $iApplicationNumber, $aFields)
{
try {
$c = new Criteria('workflow');
$c->addSelectColumn(BpmnProjectPeer::PRJ_UID);
$c->add(BpmnProjectPeer::PRJ_UID, $sProcessUid, Criteria::EQUAL);
$ds = ProcessPeer::doSelectRS($c);
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$ds->next();
$row = $ds->getRow();
$isBpmn = isset($row['PRJ_UID']);
if (!class_exists('ReportTablePeer')) {
require_once 'classes/model/ReportTablePeer.php';
}
@@ -583,7 +592,7 @@ class ReportTables
foreach ($aTableFields as $aField) {
$sQuery .= '`' . $aField['sFieldName'] . '` = ';
if(!isset($aFields[$aField['sFieldName']])){
if(!$isBpmn && !isset($aFields[$aField['sFieldName']])){
foreach($aFields as $row){
if(is_array($row) && isset($row[count($row)])){
$aFields = $row[count($row)];

View File

@@ -970,10 +970,10 @@ class wsBase
$oCase = new Cases();
$oldFields = $oCase->loadCase( $caseId );
if($gmail == 1){
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP;
}else {
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP;
if($gmail == 1){
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP;
}else {
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP;
}
$fileTemplate = $pathEmail . $sTemplate;
G::mk_dir( $pathEmail, 0777, true );
@@ -2512,7 +2512,8 @@ class wsBase
$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);
$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

@@ -196,4 +196,22 @@ class NotificationDevice extends BaseNotificationDevice {
return (( get_class ($oRow) == 'NotificationDevice' )&&(!is_null($oRow)));
}
public function isExistNextNotification($app_uid, $del_index)
{
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppDelegationPeer::APP_UID);
$oCriteria->add(AppDelegationPeer::APP_UID, $app_uid);
$oCriteria->add(AppDelegationPeer::DEL_PREVIOUS, $del_index);
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
$oCriteria->setLimit(1);
//execute the query
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($oDataset->next()) {
return true;
} else {
return false;
}
}
} // NotificationDevice

View File

@@ -131,10 +131,31 @@ class Designer extends Controller
$translation = new Translation();
$translation->generateFileTranslationMafe();
}
$this->setVar('sys_skin', SYS_SKIN);
$this->setView('designer/index');
//Verify user
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(OauthAccessTokensPeer::ACCESS_TOKEN);
$criteria->addSelectColumn(OauthAccessTokensPeer::USER_ID);
$criteria->add(OauthAccessTokensPeer::ACCESS_TOKEN, $clientToken['access_token'], Criteria::EQUAL);
$rsCriteria = OauthAccessTokensPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$user = new \ProcessMaker\BusinessModel\User();
if ($user->checkPermission($row['USER_ID'], 'PM_FACTORY')) {
$this->setView('designer/index');
} else {
$this->setVar('accessDenied', G::LoadTranslation('ID_ACCESS_DENIED'));
$this->setView('designer/accessDenied');
}
}
$this->render();
}

View File

@@ -21,34 +21,34 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
var olink = document.location.href;
olink = ( olink.search("gmail") == -1 ) ? parent.document.location.href : olink;
if(olink.search("gmail") == -1){
parent.location = "../cases/casesStartPage?action=startCase";
} else {
var data = olink.split("?");
var odata = data[1].split("&");
var appUid = odata[0].split("=");
var dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
""
],
"expectReturn": false
};
var x = parent.postMessage(JSON.stringify(dataToSend), "*");
if (x == undefined){
x = parent.parent.postMessage(JSON.stringify(dataToSend), "*");
}
}
</script>');
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
var olink = document.location.href;
olink = ( olink.search("gmail") == -1 ) ? parent.document.location.href : olink;
if(olink.search("gmail") == -1){
parent.location = "../cases/casesStartPage?action=startCase";
} else {
var data = olink.split("?");
var odata = data[1].split("&");
var appUid = odata[0].split("=");
var dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
""
],
"expectReturn": false
};
var x = parent.postMessage(JSON.stringify(dataToSend), "*");
if (x == undefined){
x = parent.parent.postMessage(JSON.stringify(dataToSend), "*");
}
}
</script>');
}
/* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) {
@@ -163,7 +163,8 @@ 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);
$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");
}

View File

@@ -212,7 +212,7 @@ try {
$_SESSION['USR_USERNAME'] = $usr;
$_SESSION['USR_PASSWORD'] = $pwd;
$_SESSION['BROWSER_TIME_ZONE'] = $dateTime->getTimeZoneIdByTimeZoneOffset((int)($_POST['form']['BROWSER_TIME_ZONE_OFFSET']));
$_SESSION['BROWSER_TIME_ZONE'] = $dateTime->getTimeZoneIdByTimeZoneOffset((int)($_POST['form']['BROWSER_TIME_ZONE_OFFSET']), false);
if (strpos($_SERVER['HTTP_REFERER'], 'home/login') !== false) {
$d = serialize(['u' => $usr, 'p' => $pwd, 'm' => '', 'timeZoneFailed' => 1, 'userTimeZone' => $_SESSION['USR_TIME_ZONE'], 'browserTimeZone' => $_SESSION['BROWSER_TIME_ZONE']]);

View File

@@ -194,10 +194,25 @@ if (in_array(G::encryptOld($licenseManager->result), array('38afd7ae34bd5e3e6fc1
/*----------------------------------********---------------------------------*/
if ($timeZoneFailed) {
$dateTime = new \ProcessMaker\Util\DateTime();
$userTimeZoneOffset = $dateTime->getTimeZoneOffsetByTimeZoneId($userTimeZone);
$browserTimeZoneOffset = $dateTime->getTimeZoneOffsetByTimeZoneId($browserTimeZone);
$userUtcOffset = $dateTime->getUtcOffsetByTimeZoneOffset($userTimeZoneOffset);
$browserUtcOffset = $dateTime->getUtcOffsetByTimeZoneOffset($browserTimeZoneOffset);
$arrayTimeZoneId = $dateTime->getTimeZoneIdByTimeZoneOffset($browserTimeZoneOffset);
array_unshift($arrayTimeZoneId, 'false');
array_walk($arrayTimeZoneId, function (&$value, $key, $parameter) { $value = ['TZ_UID' => $value, 'TZ_NAME' => '(UTC' . $parameter . ') ' . $value]; }, $browserUtcOffset);
$_SESSION['_DBArray'] = ['TIME_ZONE' => $arrayTimeZoneId];
$arrayData = [
'USR_USERNAME' => $userUsername,
'USR_PASSWORD' => $userPassword,
'USR_TIME_ZONE' => $userTimeZone,
'USR_TIME_ZONE' => '(UTC' . $userUtcOffset . ') ' . $userTimeZone,
'BROWSER_TIME_ZONE' => $browserTimeZone
];
@@ -216,7 +231,12 @@ $translationsTable = $Translations->getTranslationEnvironments();
$availableLangArray = array ();
$availableLangArray [] = array ('LANG_ID' => 'char', 'LANG_NAME' => 'char' );
$availableLangArray [] = array ('LANG_ID' => 'default', 'LANG_NAME' => G::LoadTranslation("ID_DEFAULT_LANGUAGE") );
/*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkdKR3ROS0VzWGdoLzNQYz0=')) {
$availableLangArray [] = array ('LANG_ID' => 'default', 'LANG_NAME' => G::LoadTranslation("ID_DEFAULT_LANGUAGE") );
}
/*----------------------------------********---------------------------------*/
foreach ($translationsTable as $locale) {
$row['LANG_ID'] = $locale['LOCALE'];
@@ -240,7 +260,12 @@ $oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
if (isset($oConf->aConfig["login_defaultLanguage"]) && $oConf->aConfig["login_defaultLanguage"] != "") {
$aFields["USER_LANG"] = $oConf->aConfig["login_defaultLanguage"];
$aFields["USER_LANG"] = "default";
/*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkdKR3ROS0VzWGdoLzNQYz0=')) {
$aFields["USER_LANG"] = "default";
}
/*----------------------------------********---------------------------------*/
} else {
$myUrl = explode("/", $_SERVER["REQUEST_URI"]);

View File

@@ -121,7 +121,6 @@ $translationsTable = $Translations->getTranslationEnvironments();
$availableLangArray = array ();
$availableLangArray [] = array ('LANG_ID' => 'char', 'LANG_NAME' => 'char');
$availableLangArray [] = array ('LANG_ID' => 'default', 'LANG_NAME' => G::LoadTranslation("ID_DEFAULT_LANGUAGE") );
foreach ($translationsTable as $locale) {
$aFields['LANG_ID'] = $locale['LOCALE'];
@@ -150,7 +149,6 @@ $_SESSION ['_DBArray'] = $_DBArray;
$aField ['LOGIN_VERIFY_MSG'] = G::loadTranslation ('LOGIN_VERIFY_MSG');
$aField['USER_LANG'] = SYS_LANG;
$aField['USER_LANG'] = "default";
$G_PUBLISH = new Publisher ();
if (!defined('WS_IN_LOGIN')) {

View File

@@ -13,6 +13,13 @@ $uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ($postMaxSize < $uploadMaxSize) {
$uploadMaxSize = $postMaxSize;
}
$languageManagement = 0;
/*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkdKR3ROS0VzWGdoLzNQYz0=')) {
$languageManagement = 1;
}
/*----------------------------------********---------------------------------*/
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
@@ -24,6 +31,7 @@ $oHeadPublisher->assign( 'MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ' );
$oHeadPublisher->assign('SYSTEM_TIME_ZONE', $arraySystemConfiguration['time_zone']);
$oHeadPublisher->assign('TIME_ZONE_DATA', array_map(function ($value) { return [$value, $value]; }, DateTimeZone::listIdentifiers()));
$oHeadPublisher->assign('__SYSTEM_UTC_TIME_ZONE__', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])? 1 : 0);
$oHeadPublisher->assign('LANGUAGE_MANAGEMENT', $languageManagement);
G::RenderPage( 'publish', 'extJs' );

View File

@@ -26,6 +26,13 @@ $uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ($postMaxSize < $uploadMaxSize) {
$uploadMaxSize = $postMaxSize;
}
$languageManagement = 0;
/*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkdKR3ROS0VzWGdoLzNQYz0=')) {
$languageManagement = 1;
}
/*----------------------------------********---------------------------------*/
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
@@ -41,5 +48,6 @@ $oHeadPublisher->assign( 'MODE', '' );
$oHeadPublisher->assign('SYSTEM_TIME_ZONE', $arraySystemConfiguration['time_zone']);
$oHeadPublisher->assign('TIME_ZONE_DATA', array_map(function ($value) { return [$value, $value]; }, DateTimeZone::listIdentifiers()));
$oHeadPublisher->assign('__SYSTEM_UTC_TIME_ZONE__', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])? 1 : 0);
$oHeadPublisher->assign('LANGUAGE_MANAGEMENT', $languageManagement);
G::RenderPage( 'publish', 'extJs' );

View File

@@ -458,8 +458,8 @@ class Consolidated
$dataTask = $oDyna->load($dyn_uid);
if ($dataTask['DYN_VERSION'] > 0) {
G::LoadClass("pmDynaform");
$pmDyna = new \pmDynaform(array('APP_DATA' => array()));
$pmDyna->fields["CURRENT_DYNAFORM"] = $dyn_uid;
$_SESSION['PROCESS'] = $pro_uid;
$pmDyna = new \pmDynaform(array('APP_DATA' => array(), "CURRENT_DYNAFORM" => $dyn_uid));
$json = G::json_decode($dataTask["DYN_CONTENT"]);
$pmDyna->jsonr($json);
$fieldsDyna = $json->items[0]->items;

View File

@@ -147,7 +147,8 @@ class NotificationDevice
* @author Ronald Quenta <ronald.quenta@processmaker.com>
*
*/
public function routeCaseNotification($currentUserId, $processId, $currentTaskId, $appFields, $aTasks, $nextIndex)
public function routeCaseNotification($currentUserId, $processId, $currentTaskId, $appFields, $aTasks,
$nextIndex, $currentDelIndex)
{
try {
$response = array();
@@ -166,7 +167,7 @@ class NotificationDevice
$delIndex = null;
foreach ($nextIndex as $nIndex) {
if($aTask['TAS_UID'] == $nIndex['TAS_UID']){
if ($aTask['TAS_UID'] == $nIndex['TAS_UID']) {
$delIndex = $nIndex['DEL_INDEX'];
break;
}
@@ -184,10 +185,9 @@ class NotificationDevice
);
if ($userIds) {
$oNoti = new \NotificationDevice();
$devices = array();
if (is_array($userIds)){
if (is_array($userIds)) {
$devices = $oNoti->loadUsersArrayId($userIds);
} else {
$devices = $oNoti->loadByUsersId($userIds);
@@ -210,13 +210,15 @@ class NotificationDevice
break;
}
}
if (count($devicesAppleIds) > 0) {
$isExistNextNotifications = $oNoti->isExistNextNotification($appFields['APP_UID'],
$currentDelIndex);
if (count($devicesAppleIds) > 0 && $isExistNextNotifications) {
$oNotification = new PushMessageIOS();
$oNotification->setSettingNotification();
$oNotification->setDevices($devicesAppleIds);
$response['apple'] = $oNotification->send($message, $data);
}
if (count($devicesAndroidIds) > 0) {
if (count($devicesAndroidIds) > 0 && $isExistNextNotifications) {
$oNotification = new PushMessageAndroid();
$oNotification->setSettingNotification();
$oNotification->setDevices($devicesAndroidIds);

View File

@@ -112,7 +112,7 @@ class PushMessageIOS
$fp = stream_socket_client($this->url, $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);
if (!$fp) {
throw (new \Exception( G::LoadTranslation( 'ID_FAILED' ).': ' ."$err $errstr"));
throw (new \Exception( \G::LoadTranslation( 'ID_FAILED' ).': ' ."$err $errstr"));
} else {
//echo 'Apple service is online. ' . '<br />';
}

View File

@@ -30,24 +30,33 @@ class DateTime
/**
* Get Time Zone ID by Time Zone Offset
*
* @param int $offset Time Zone Offset
* @param int $offset Time Zone Offset
* @param bool $flagAllResults Flag which sets include all the results
*
* @return string Return the Time Zone ID; UTC ID otherwise
* @return mixed Return the Time Zone ID; UTC ID otherwise
*/
public function getTimeZoneIdByTimeZoneOffset($offset)
public function getTimeZoneIdByTimeZoneOffset($offset, $flagAllResults = true)
{
try {
$timeZoneId = ($flagAllResults)? [] : '';
foreach (\DateTimeZone::listIdentifiers() as $value) {
$timeZoneOffset = $this->getTimeZoneOffsetByTimeZoneId($value);
if ($timeZoneOffset !== false && $timeZoneOffset == $offset) {
//Return
return $value;
if ($flagAllResults) {
$timeZoneId[] = $value;
} else {
$timeZoneId = $value;
break;
}
}
}
$timeZoneId = (!empty($timeZoneId))? $timeZoneId : (($flagAllResults)? ['UTC'] : 'UTC');
//Return
return 'UTC';
return $timeZoneId;
} catch (\Exception $e) {
throw $e;
}
@@ -75,7 +84,31 @@ class DateTime
$offset = (($sign == '+')? '' : '-') . (($h * 60 * 60) + ($m * 60)); //Convert UTC Offset to seconds
//Return
return $this->getTimeZoneIdByTimeZoneOffset((int)($offset));
return $this->getTimeZoneIdByTimeZoneOffset((int)($offset), false);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get UTC Offset by Time Zone Offset
*
* @param int $offset Time Zone Offset
*
* @return string Return the UTC Offset
*/
public function getUtcOffsetByTimeZoneOffset($offset)
{
try {
$sign = ($offset >= 0)? '+' : '-';
$offset = abs($offset) / 60; //Convert seconds to minutes
$h = floor($offset / 60);
$m = $offset - ($h * 60);
//Return
return $sign . sprintf('%02d:%02d', $h, $m);
} catch (\Exception $e) {
throw $e;
}

View File

@@ -0,0 +1,9 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<div><h1>{$accessDenied}</h1></div>
</body>
</html>

View File

@@ -427,6 +427,7 @@ Ext.onReady(function () {
hidden: !(__SYSTEM_UTC_TIME_ZONE__ == 1)
});
/*----------------------------------********---------------------------------*/
storeLanguage = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: "usersAjax",
@@ -457,8 +458,10 @@ Ext.onReady(function () {
editable : false,
allowBlank : false,
triggerAction : 'all',
mode : 'local'
mode : 'local',
hidden : !(LANGUAGE_MANAGEMENT == 1)
});
/*----------------------------------********---------------------------------*/
var informationFields = new Ext.form.FieldSet({
title : _('ID_PERSONAL_INFORMATION'),
@@ -570,8 +573,10 @@ Ext.onReady(function () {
comboCalendar,
comboStatus,
comboRole,
cboTimeZone,
comboLanguage
cboTimeZone
/*----------------------------------********---------------------------------*/
,comboLanguage
/*----------------------------------********---------------------------------*/
]
});
/*----------------------------------********---------------------------------*/
@@ -999,7 +1004,8 @@ Ext.onReady(function () {
id : 'USR_DEFAULT_LANG2',
fieldLabel : _('ID_DEFAULT_LANGUAGE'),
xtype : 'label',
width : 260
width : 260,
hidden : !(LANGUAGE_MANAGEMENT == 1)
}
]
});
@@ -1397,10 +1403,12 @@ function loadData()
});
comboRole.store.load();
/*----------------------------------********---------------------------------*/
comboLanguage.store.on("load", function (store) {
comboLanguage.setValue(store.getAt(1).get("LAN_ID"));
});
comboLanguage.store.load();
/*----------------------------------********---------------------------------*/
comboDefaultMainMenuOption.store.on("load", function (store) {
comboDefaultMainMenuOption.setValue(store.getAt(0).get("id"));
@@ -1465,8 +1473,8 @@ function loadUserData()
Ext.getCmp("USR_STATUS2").setText(_('ID_' + data.user.USR_STATUS));
Ext.getCmp("USR_ROLE2").setText(data.user.USR_ROLE_NAME);
Ext.getCmp("USR_TIME_ZONE2").setText((data.user.USR_TIME_ZONE != "")? data.user.USR_TIME_ZONE : SYSTEM_TIME_ZONE);
Ext.getCmp("USR_DEFAULT_LANG2").setText(data.user.USR_DEFAULT_LANG_NAME);
/*----------------------------------********---------------------------------*/
Ext.getCmp("USR_DEFAULT_LANG2").setText(data.user.USR_DEFAULT_LANG_NAME);
Ext.getCmp("USR_COST_BY_HOUR2").setText(data.user.USR_COST_BY_HOUR);
Ext.getCmp("USR_UNIT_COST2").setText(data.user.USR_UNIT_COST);
/*----------------------------------********---------------------------------*/
@@ -1510,9 +1518,11 @@ function loadUserData()
cboTimeZone.setValue((data.user.USR_TIME_ZONE != "")? data.user.USR_TIME_ZONE : SYSTEM_TIME_ZONE);
/*----------------------------------********---------------------------------*/
comboLanguage.store.on("load", function (store) {
comboLanguage.setValue(data.user.USR_DEFAULT_LANG);
});
/*----------------------------------********---------------------------------*/
if (infoMode) {
comboDefaultMainMenuOption.store.on("load", function (store) {
@@ -1561,7 +1571,9 @@ function loadUserData()
storeRole.load();
/*----------------------------------********---------------------------------*/
storeLanguage.load();
/*----------------------------------********---------------------------------*/
storeDefaultMainMenuOption.load();

View File

@@ -7,9 +7,7 @@
{$form.USR_USERNAME}
{$form.USR_PASSWORD}
{$form.USR_TIME_ZONE}
{$form.BROWSER_TIME_ZONE}
<fieldset>
<label class="panel-login">
@@ -20,6 +18,8 @@
<br />
<br />
<span id="details">{php}echo G::LoadTranslation("ID_TIME_ZONE_LOGIN_DESCRIPTION_DETAILS");{/php}</span>
<br />
{$form.BROWSER_TIME_ZONE}
</div>
</label>
</fieldset>

View File

@@ -6,7 +6,14 @@
<USR_PASSWORD type="hidden" />
<USR_TIME_ZONE type="hidden" />
<BROWSER_TIME_ZONE type="hidden" />
<BROWSER_TIME_ZONE type="dropdown" sqlconnection="dbarray">
<![CDATA[
SELECT TZ_UID, TZ_NAME
FROM TIME_ZONE
]]>
<en></en>
</BROWSER_TIME_ZONE>
<BTNOK type="submit">
<en></en>
@@ -20,7 +27,8 @@
var strHtml = document.getElementById("details").innerHTML;
strHtml = stringReplace("\\{0\\}", document.getElementById("form[USR_TIME_ZONE]").value, strHtml);
strHtml = stringReplace("\\{1\\}", document.getElementById("form[BROWSER_TIME_ZONE]").value, strHtml);
strHtml = stringReplace("\\{1\\}.", "", strHtml);
strHtml = stringReplace("\\{1\\}", "", strHtml);
document.getElementById("details").innerHTML = strHtml;