PM-444 "0013316: Be able to assign users to different time zone (user's time zone)" SOLVED

Issue:
    PM-444:  0013316: Be able to assign users to different time zone
    PM-3493: Agregar soporte multiple timezone a los endpoints usando formato fecha ISO 8601
Cause:
    New feature
Solution:
    Added functionality for time zone
This commit is contained in:
Victor Saisa Lopez
2015-11-26 20:11:58 -04:00
parent 4879d8089e
commit 6cd975664b
36 changed files with 931 additions and 276 deletions

View File

@@ -447,25 +447,9 @@ class WebApplication
\Bootstrap::registerSystemClasses();
$arraySystemConfiguration = \System::getSystemConfiguration();
$config = \System::getSystemConfiguration();
// Do not change any of these settings directly, use env.ini instead
ini_set( "display_errors", $config["display_errors"]);
ini_set( "error_reporting", $config["error_reporting"]);
ini_set( "short_open_tag", "On" ); // ??
ini_set( "default_charset", "UTF-8" ); // ??
ini_set( "memory_limit", $config["memory_limit"] );
ini_set( "soap.wsdl_cache_enabled", $config["wsdl_cache"] );
ini_set( "date.timezone", $config["time_zone"] );
define("DEBUG_SQL_LOG", $config["debug_sql"]);
define("DEBUG_TIME_LOG", $config["debug_time"]);
define("DEBUG_CALENDAR_LOG", $config["debug_calendar"]);
define("MEMCACHED_ENABLED", $config["memcached"]);
define("MEMCACHED_SERVER", $config["memcached_server"]);
define("TIME_ZONE", $config["time_zone"]);
define("SYS_SKIN", $config["default_skin"]);
ini_set('date.timezone', $arraySystemConfiguration['time_zone']); //Set Time Zone
// set include path
set_include_path(
@@ -511,6 +495,27 @@ class WebApplication
exit(0);
}
$arraySystemConfiguration = \System::getSystemConfiguration('', '', SYS_SYS);
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1;
//Do not change any of these settings directly, use env.ini instead
ini_set('display_errors', $arraySystemConfiguration['display_errors']);
ini_set('error_reporting', $arraySystemConfiguration['error_reporting']);
ini_set('short_open_tag', 'On'); //??
ini_set('default_charset', 'UTF-8'); //??
ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
ini_set('date.timezone', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])? 'UTC' : $arraySystemConfiguration['time_zone']); //Set Time Zone
define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']);
define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']);
define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']);
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
define('TIME_ZONE', ini_get('date.timezone'));
define('SYS_SKIN', $arraySystemConfiguration['default_skin']);
require_once (PATH_DB . SYS_SYS . "/db.php");
// defining constant for workspace shared directory

View File

@@ -31,12 +31,3 @@
define ( 'G_DEV_ENV', 'DEVELOPMENT' );
define ( 'G_TEST_ENV', 'TEST' );
///************TimeZone Set***************//
if (version_compare(phpversion(), "5.1.0", ">=")) {
date_default_timezone_set("America/La_Paz");
}
else {
// you're not
}

View File

@@ -51,11 +51,3 @@
define ( 'G_DEV_ENV', 'DEVELOPMENT' );
define ( 'G_TEST_ENV', 'TEST' );
///************TimeZone Set***************//
if (version_compare(phpversion(), "5.1.0", ">=")) {
date_default_timezone_set("America/La_Paz");
}
else {
// you're not
}

View File

@@ -1,11 +1,6 @@
<?php
//sysGeneric, to redirect workspace, the url should by encrypted or not
if (version_compare(phpversion(), "5.1.0", ">=")) {
date_default_timezone_set("America/La_Paz");
} else {
// you're not
}
//***************** URL KEY *********************************************
define("URL_KEY", 'c0l0s40pt1mu59r1m3' );

View File

@@ -38,14 +38,14 @@ class PmBootstrap extends Bootstrap
ini_set('default_charset', "UTF-8");
ini_set('memory_limit', $this->pmConfig['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $this->pmConfig['wsdl_cache']);
ini_set('date.timezone', $this->pmConfig['time_zone']);
ini_set('date.timezone', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])? 'UTC' : $this->pmConfig['time_zone']); //Set Time Zone
define ('DEBUG_SQL_LOG', $this->pmConfig['debug_sql']);
define ('DEBUG_TIME_LOG', $this->pmConfig['debug_time']);
define ('DEBUG_CALENDAR_LOG', $this->pmConfig['debug_calendar']);
define ('MEMCACHED_ENABLED', $this->pmConfig['memcached']);
define ('MEMCACHED_SERVER', $this->pmConfig['memcached_server']);
define ('TIME_ZONE', $this->pmConfig['time_zone']);
define ('TIME_ZONE', ini_get('date.timezone'));
// enable ERROR_SHOW_SOURCE_CODE to display the source code for any WARNING OR NOTICE
define ('ERROR_SHOW_SOURCE_CODE', true);

View File

@@ -209,7 +209,7 @@ class Installer
}
$path_site = $this->options['path_data'] . "/sites/" . $this->options['name'] . "/";
$db_file = $path_site . "db.php";
@mkdir($path_site, 0777, true);
@mkdir($path_site . "files/", 0777, true);
@mkdir($path_site . "mailTemplates/", 0777, true);
@@ -217,6 +217,8 @@ class Installer
@mkdir($path_site . "reports/", 0777, true);
@mkdir($path_site . "xmlForms", 0777, true);
//Generate the db.php file
$db_file = $path_site . 'db.php';
$db_text = "<?php\n" . "// Processmaker configuration\n" . "define ('DB_ADAPTER', 'mysql' );\n" . "define ('DB_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_NAME', '" . $wf . "' );\n" . "define ('DB_USER', '" . (($this->cc_status == 1) ? $wf : $this->options['database']['username']) . "' );\n" . "define ('DB_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_RBAC_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_RBAC_NAME', '" . $rb . "' );\n" . "define ('DB_RBAC_USER', '" . (($this->cc_status == 1) ? $rb : $this->options['database']['username']) . "' );\n" . "define ('DB_RBAC_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_REPORT_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_REPORT_NAME', '" . $rp . "' );\n" . "define ('DB_REPORT_USER', '" . (($this->cc_status == 1) ? $rp : $this->options['database']['username']) . "' );\n" . "define ('DB_REPORT_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n";
if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {
$db_text .= "define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG') && PARTNER_FLAG != '') ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG']:'false')) . ");\n";
@@ -225,12 +227,24 @@ class Installer
}
}
$db_text .="?>";
$fp = @fopen($db_file, "w");
$this->log("Create: " . $db_file . " => " . ((!$fp) ? $fp : "OK") . "\n", $fp === false);
$ff = @fputs($fp, $db_text, strlen($db_text));
$this->log("Write: " . $db_file . " => " . ((!$ff) ? $ff : "OK") . "\n", $ff === false);
fclose($fp);
//Generate the env.ini file
$envIniFile = $path_site . 'env.ini';
$content = 'system_utc_time_zone = 1' . "\n";
$fp = @fopen($envIniFile, 'w');
$this->log('Create: ' . $envIniFile . ' => ' . ((!$fp)? $fp : 'OK') . "\n", $fp === false);
$ff = @fputs($fp, $content, strlen($content));
$this->log('Write: ' . $envIniFile . ' => ' . ((!$ff)? $ff : 'OK') . "\n", $ff === false);
fclose($fp);
//Set data
$this->setPartner();
$this->setAdmin();

View File

@@ -2471,7 +2471,6 @@ class ldapAdvanced
*/
public function convertDateADtoPM($dateAD)
{
//date_default_timezone_set('America/New_York');
$unixTimestamp = ($dateAD / 10000000) - 11644560000;
$datePM = date('Y-m-d', mktime(0, 0, 0, date('m'), '01', date('Y') + 2));//(date('Y') + 10)."-12-01";
if ($unixTimestamp >0) {

View File

@@ -70,7 +70,8 @@ class System
'ie_cookie_lifetime' => 1,
'safari_cookie_lifetime' => 1,
'error_reporting' => "",
'display_errors' => 'On'
'display_errors' => 'On',
'system_utc_time_zone' => 0
);
/**
@@ -1099,33 +1100,7 @@ class System
public function getAllTimeZones ()
{
$timezones = DateTimeZone::listAbbreviations();
$cities = array ();
foreach ($timezones as $key => $zones) {
foreach ($zones as $id => $zone) {
/**
* Only get timezones explicitely not part of "Others".
*
* @see http://www.php.net/manual/en/timezones.others.php
*/
if (preg_match( '/^(America|Antartica|Arctic|Asia|Atlantic|Africa|Europe|Indian|Pacific)\//', $zone['timezone_id'] ) && $zone['timezone_id']) {
$cities[$zone['timezone_id']][] = $key;
}
}
}
// For each city, have a comma separated list of all possible timezones for that city.
foreach ($cities as $key => $value) {
$cities[$key] = join( ', ', $value );
}
// Only keep one city (the first and also most important) for each set of possibilities.
$cities = array_unique( $cities );
// Sort by area/city name.
ksort( $cities );
return $cities;
throw new Exception(__METHOD__ . ': The method is deprecated');
}
public static function getSystemConfiguration ($globalIniFile = '', $wsIniFile = '', $wsName = '')

View File

@@ -137,6 +137,8 @@ class UsersMapBuilder
$tMap->addColumn('USR_BOOKMARK_START_CASES', 'UsrBookmarkStartCases', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('USR_TIME_ZONE', 'UsrTimeZone', 'string', CreoleTypes::VARCHAR, false, 100);
$tMap->addValidator('USR_STATUS', 'validValues', 'propel.validator.ValidValuesValidator', 'ACTIVE|INACTIVE|VACATION|CLOSED', 'Please select a valid type.');
$tMap->addValidator('USR_STATUS', 'required', 'propel.validator.RequiredValidator', '', 'Type is required.');

View File

@@ -243,6 +243,12 @@ abstract class BaseUsers extends BaseObject implements Persistent
*/
protected $usr_bookmark_start_cases;
/**
* The value for the usr_time_zone field.
* @var string
*/
protected $usr_time_zone = '';
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -737,6 +743,17 @@ abstract class BaseUsers extends BaseObject implements Persistent
return $this->usr_bookmark_start_cases;
}
/**
* Get the [usr_time_zone] column value.
*
* @return string
*/
public function getUsrTimeZone()
{
return $this->usr_time_zone;
}
/**
* Set the value of [usr_uid] column.
*
@@ -1551,6 +1568,28 @@ abstract class BaseUsers extends BaseObject implements Persistent
} // setUsrBookmarkStartCases()
/**
* Set the value of [usr_time_zone] column.
*
* @param string $v new value
* @return void
*/
public function setUsrTimeZone($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->usr_time_zone !== $v || $v === '') {
$this->usr_time_zone = $v;
$this->modifiedColumns[] = UsersPeer::USR_TIME_ZONE;
}
} // setUsrTimeZone()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -1640,12 +1679,14 @@ abstract class BaseUsers extends BaseObject implements Persistent
$this->usr_bookmark_start_cases = $rs->getString($startcol + 35);
$this->usr_time_zone = $rs->getString($startcol + 36);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 36; // 36 = UsersPeer::NUM_COLUMNS - UsersPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 37; // 37 = UsersPeer::NUM_COLUMNS - UsersPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating Users object", $e);
@@ -1957,6 +1998,9 @@ abstract class BaseUsers extends BaseObject implements Persistent
case 35:
return $this->getUsrBookmarkStartCases();
break;
case 36:
return $this->getUsrTimeZone();
break;
default:
return null;
break;
@@ -2013,6 +2057,7 @@ abstract class BaseUsers extends BaseObject implements Persistent
$keys[33] => $this->getUsrCostByHour(),
$keys[34] => $this->getUsrUnitCost(),
$keys[35] => $this->getUsrBookmarkStartCases(),
$keys[36] => $this->getUsrTimeZone(),
);
return $result;
}
@@ -2152,6 +2197,9 @@ abstract class BaseUsers extends BaseObject implements Persistent
case 35:
$this->setUsrBookmarkStartCases($value);
break;
case 36:
$this->setUsrTimeZone($value);
break;
} // switch()
}
@@ -2319,6 +2367,10 @@ abstract class BaseUsers extends BaseObject implements Persistent
$this->setUsrBookmarkStartCases($arr[$keys[35]]);
}
if (array_key_exists($keys[36], $arr)) {
$this->setUsrTimeZone($arr[$keys[36]]);
}
}
/**
@@ -2474,6 +2526,10 @@ abstract class BaseUsers extends BaseObject implements Persistent
$criteria->add(UsersPeer::USR_BOOKMARK_START_CASES, $this->usr_bookmark_start_cases);
}
if ($this->isColumnModified(UsersPeer::USR_TIME_ZONE)) {
$criteria->add(UsersPeer::USR_TIME_ZONE, $this->usr_time_zone);
}
return $criteria;
}
@@ -2598,6 +2654,8 @@ abstract class BaseUsers extends BaseObject implements Persistent
$copyObj->setUsrBookmarkStartCases($this->usr_bookmark_start_cases);
$copyObj->setUsrTimeZone($this->usr_time_zone);
$copyObj->setNew(true);

View File

@@ -25,7 +25,7 @@ abstract class BaseUsersPeer
const CLASS_DEFAULT = 'classes.model.Users';
/** The total number of columns. */
const NUM_COLUMNS = 36;
const NUM_COLUMNS = 37;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -139,6 +139,9 @@ abstract class BaseUsersPeer
/** the column name for the USR_BOOKMARK_START_CASES field */
const USR_BOOKMARK_START_CASES = 'USERS.USR_BOOKMARK_START_CASES';
/** the column name for the USR_TIME_ZONE field */
const USR_TIME_ZONE = 'USERS.USR_TIME_ZONE';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -150,10 +153,10 @@ abstract class BaseUsersPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('UsrUid', 'UsrUsername', 'UsrPassword', 'UsrFirstname', 'UsrLastname', 'UsrEmail', 'UsrDueDate', 'UsrCreateDate', 'UsrUpdateDate', 'UsrStatus', 'UsrCountry', 'UsrCity', 'UsrLocation', 'UsrAddress', 'UsrPhone', 'UsrFax', 'UsrCellular', 'UsrZipCode', 'DepUid', 'UsrPosition', 'UsrResume', 'UsrBirthday', 'UsrRole', 'UsrReportsTo', 'UsrReplacedBy', 'UsrUx', 'UsrTotalInbox', 'UsrTotalDraft', 'UsrTotalCancelled', 'UsrTotalParticipated', 'UsrTotalPaused', 'UsrTotalCompleted', 'UsrTotalUnassigned', 'UsrCostByHour', 'UsrUnitCost', 'UsrBookmarkStartCases', ),
BasePeer::TYPE_COLNAME => array (UsersPeer::USR_UID, UsersPeer::USR_USERNAME, UsersPeer::USR_PASSWORD, UsersPeer::USR_FIRSTNAME, UsersPeer::USR_LASTNAME, UsersPeer::USR_EMAIL, UsersPeer::USR_DUE_DATE, UsersPeer::USR_CREATE_DATE, UsersPeer::USR_UPDATE_DATE, UsersPeer::USR_STATUS, UsersPeer::USR_COUNTRY, UsersPeer::USR_CITY, UsersPeer::USR_LOCATION, UsersPeer::USR_ADDRESS, UsersPeer::USR_PHONE, UsersPeer::USR_FAX, UsersPeer::USR_CELLULAR, UsersPeer::USR_ZIP_CODE, UsersPeer::DEP_UID, UsersPeer::USR_POSITION, UsersPeer::USR_RESUME, UsersPeer::USR_BIRTHDAY, UsersPeer::USR_ROLE, UsersPeer::USR_REPORTS_TO, UsersPeer::USR_REPLACED_BY, UsersPeer::USR_UX, UsersPeer::USR_TOTAL_INBOX, UsersPeer::USR_TOTAL_DRAFT, UsersPeer::USR_TOTAL_CANCELLED, UsersPeer::USR_TOTAL_PARTICIPATED, UsersPeer::USR_TOTAL_PAUSED, UsersPeer::USR_TOTAL_COMPLETED, UsersPeer::USR_TOTAL_UNASSIGNED, UsersPeer::USR_COST_BY_HOUR, UsersPeer::USR_UNIT_COST, UsersPeer::USR_BOOKMARK_START_CASES, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID', 'USR_USERNAME', 'USR_PASSWORD', 'USR_FIRSTNAME', 'USR_LASTNAME', 'USR_EMAIL', 'USR_DUE_DATE', 'USR_CREATE_DATE', 'USR_UPDATE_DATE', 'USR_STATUS', 'USR_COUNTRY', 'USR_CITY', 'USR_LOCATION', 'USR_ADDRESS', 'USR_PHONE', 'USR_FAX', 'USR_CELLULAR', 'USR_ZIP_CODE', 'DEP_UID', 'USR_POSITION', 'USR_RESUME', 'USR_BIRTHDAY', 'USR_ROLE', 'USR_REPORTS_TO', 'USR_REPLACED_BY', 'USR_UX', 'USR_TOTAL_INBOX', 'USR_TOTAL_DRAFT', 'USR_TOTAL_CANCELLED', 'USR_TOTAL_PARTICIPATED', 'USR_TOTAL_PAUSED', 'USR_TOTAL_COMPLETED', 'USR_TOTAL_UNASSIGNED', 'USR_COST_BY_HOUR', 'USR_UNIT_COST', 'USR_BOOKMARK_START_CASES', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, )
BasePeer::TYPE_PHPNAME => array ('UsrUid', 'UsrUsername', 'UsrPassword', 'UsrFirstname', 'UsrLastname', 'UsrEmail', 'UsrDueDate', 'UsrCreateDate', 'UsrUpdateDate', 'UsrStatus', 'UsrCountry', 'UsrCity', 'UsrLocation', 'UsrAddress', 'UsrPhone', 'UsrFax', 'UsrCellular', 'UsrZipCode', 'DepUid', 'UsrPosition', 'UsrResume', 'UsrBirthday', 'UsrRole', 'UsrReportsTo', 'UsrReplacedBy', 'UsrUx', 'UsrTotalInbox', 'UsrTotalDraft', 'UsrTotalCancelled', 'UsrTotalParticipated', 'UsrTotalPaused', 'UsrTotalCompleted', 'UsrTotalUnassigned', 'UsrCostByHour', 'UsrUnitCost', 'UsrBookmarkStartCases', 'UsrTimeZone', ),
BasePeer::TYPE_COLNAME => array (UsersPeer::USR_UID, UsersPeer::USR_USERNAME, UsersPeer::USR_PASSWORD, UsersPeer::USR_FIRSTNAME, UsersPeer::USR_LASTNAME, UsersPeer::USR_EMAIL, UsersPeer::USR_DUE_DATE, UsersPeer::USR_CREATE_DATE, UsersPeer::USR_UPDATE_DATE, UsersPeer::USR_STATUS, UsersPeer::USR_COUNTRY, UsersPeer::USR_CITY, UsersPeer::USR_LOCATION, UsersPeer::USR_ADDRESS, UsersPeer::USR_PHONE, UsersPeer::USR_FAX, UsersPeer::USR_CELLULAR, UsersPeer::USR_ZIP_CODE, UsersPeer::DEP_UID, UsersPeer::USR_POSITION, UsersPeer::USR_RESUME, UsersPeer::USR_BIRTHDAY, UsersPeer::USR_ROLE, UsersPeer::USR_REPORTS_TO, UsersPeer::USR_REPLACED_BY, UsersPeer::USR_UX, UsersPeer::USR_TOTAL_INBOX, UsersPeer::USR_TOTAL_DRAFT, UsersPeer::USR_TOTAL_CANCELLED, UsersPeer::USR_TOTAL_PARTICIPATED, UsersPeer::USR_TOTAL_PAUSED, UsersPeer::USR_TOTAL_COMPLETED, UsersPeer::USR_TOTAL_UNASSIGNED, UsersPeer::USR_COST_BY_HOUR, UsersPeer::USR_UNIT_COST, UsersPeer::USR_BOOKMARK_START_CASES, UsersPeer::USR_TIME_ZONE, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID', 'USR_USERNAME', 'USR_PASSWORD', 'USR_FIRSTNAME', 'USR_LASTNAME', 'USR_EMAIL', 'USR_DUE_DATE', 'USR_CREATE_DATE', 'USR_UPDATE_DATE', 'USR_STATUS', 'USR_COUNTRY', 'USR_CITY', 'USR_LOCATION', 'USR_ADDRESS', 'USR_PHONE', 'USR_FAX', 'USR_CELLULAR', 'USR_ZIP_CODE', 'DEP_UID', 'USR_POSITION', 'USR_RESUME', 'USR_BIRTHDAY', 'USR_ROLE', 'USR_REPORTS_TO', 'USR_REPLACED_BY', 'USR_UX', 'USR_TOTAL_INBOX', 'USR_TOTAL_DRAFT', 'USR_TOTAL_CANCELLED', 'USR_TOTAL_PARTICIPATED', 'USR_TOTAL_PAUSED', 'USR_TOTAL_COMPLETED', 'USR_TOTAL_UNASSIGNED', 'USR_COST_BY_HOUR', 'USR_UNIT_COST', 'USR_BOOKMARK_START_CASES', 'USR_TIME_ZONE', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, )
);
/**
@@ -163,10 +166,10 @@ abstract class BaseUsersPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('UsrUid' => 0, 'UsrUsername' => 1, 'UsrPassword' => 2, 'UsrFirstname' => 3, 'UsrLastname' => 4, 'UsrEmail' => 5, 'UsrDueDate' => 6, 'UsrCreateDate' => 7, 'UsrUpdateDate' => 8, 'UsrStatus' => 9, 'UsrCountry' => 10, 'UsrCity' => 11, 'UsrLocation' => 12, 'UsrAddress' => 13, 'UsrPhone' => 14, 'UsrFax' => 15, 'UsrCellular' => 16, 'UsrZipCode' => 17, 'DepUid' => 18, 'UsrPosition' => 19, 'UsrResume' => 20, 'UsrBirthday' => 21, 'UsrRole' => 22, 'UsrReportsTo' => 23, 'UsrReplacedBy' => 24, 'UsrUx' => 25, 'UsrTotalInbox' => 26, 'UsrTotalDraft' => 27, 'UsrTotalCancelled' => 28, 'UsrTotalParticipated' => 29, 'UsrTotalPaused' => 30, 'UsrTotalCompleted' => 31, 'UsrTotalUnassigned' => 32, 'UsrCostByHour' => 33, 'UsrUnitCost' => 34, 'UsrBookmarkStartCases' => 35, ),
BasePeer::TYPE_COLNAME => array (UsersPeer::USR_UID => 0, UsersPeer::USR_USERNAME => 1, UsersPeer::USR_PASSWORD => 2, UsersPeer::USR_FIRSTNAME => 3, UsersPeer::USR_LASTNAME => 4, UsersPeer::USR_EMAIL => 5, UsersPeer::USR_DUE_DATE => 6, UsersPeer::USR_CREATE_DATE => 7, UsersPeer::USR_UPDATE_DATE => 8, UsersPeer::USR_STATUS => 9, UsersPeer::USR_COUNTRY => 10, UsersPeer::USR_CITY => 11, UsersPeer::USR_LOCATION => 12, UsersPeer::USR_ADDRESS => 13, UsersPeer::USR_PHONE => 14, UsersPeer::USR_FAX => 15, UsersPeer::USR_CELLULAR => 16, UsersPeer::USR_ZIP_CODE => 17, UsersPeer::DEP_UID => 18, UsersPeer::USR_POSITION => 19, UsersPeer::USR_RESUME => 20, UsersPeer::USR_BIRTHDAY => 21, UsersPeer::USR_ROLE => 22, UsersPeer::USR_REPORTS_TO => 23, UsersPeer::USR_REPLACED_BY => 24, UsersPeer::USR_UX => 25, UsersPeer::USR_TOTAL_INBOX => 26, UsersPeer::USR_TOTAL_DRAFT => 27, UsersPeer::USR_TOTAL_CANCELLED => 28, UsersPeer::USR_TOTAL_PARTICIPATED => 29, UsersPeer::USR_TOTAL_PAUSED => 30, UsersPeer::USR_TOTAL_COMPLETED => 31, UsersPeer::USR_TOTAL_UNASSIGNED => 32, UsersPeer::USR_COST_BY_HOUR => 33, UsersPeer::USR_UNIT_COST => 34, UsersPeer::USR_BOOKMARK_START_CASES => 35, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID' => 0, 'USR_USERNAME' => 1, 'USR_PASSWORD' => 2, 'USR_FIRSTNAME' => 3, 'USR_LASTNAME' => 4, 'USR_EMAIL' => 5, 'USR_DUE_DATE' => 6, 'USR_CREATE_DATE' => 7, 'USR_UPDATE_DATE' => 8, 'USR_STATUS' => 9, 'USR_COUNTRY' => 10, 'USR_CITY' => 11, 'USR_LOCATION' => 12, 'USR_ADDRESS' => 13, 'USR_PHONE' => 14, 'USR_FAX' => 15, 'USR_CELLULAR' => 16, 'USR_ZIP_CODE' => 17, 'DEP_UID' => 18, 'USR_POSITION' => 19, 'USR_RESUME' => 20, 'USR_BIRTHDAY' => 21, 'USR_ROLE' => 22, 'USR_REPORTS_TO' => 23, 'USR_REPLACED_BY' => 24, 'USR_UX' => 25, 'USR_TOTAL_INBOX' => 26, 'USR_TOTAL_DRAFT' => 27, 'USR_TOTAL_CANCELLED' => 28, 'USR_TOTAL_PARTICIPATED' => 29, 'USR_TOTAL_PAUSED' => 30, 'USR_TOTAL_COMPLETED' => 31, 'USR_TOTAL_UNASSIGNED' => 32, 'USR_COST_BY_HOUR' => 33, 'USR_UNIT_COST' => 34, 'USR_BOOKMARK_START_CASES' => 35, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, )
BasePeer::TYPE_PHPNAME => array ('UsrUid' => 0, 'UsrUsername' => 1, 'UsrPassword' => 2, 'UsrFirstname' => 3, 'UsrLastname' => 4, 'UsrEmail' => 5, 'UsrDueDate' => 6, 'UsrCreateDate' => 7, 'UsrUpdateDate' => 8, 'UsrStatus' => 9, 'UsrCountry' => 10, 'UsrCity' => 11, 'UsrLocation' => 12, 'UsrAddress' => 13, 'UsrPhone' => 14, 'UsrFax' => 15, 'UsrCellular' => 16, 'UsrZipCode' => 17, 'DepUid' => 18, 'UsrPosition' => 19, 'UsrResume' => 20, 'UsrBirthday' => 21, 'UsrRole' => 22, 'UsrReportsTo' => 23, 'UsrReplacedBy' => 24, 'UsrUx' => 25, 'UsrTotalInbox' => 26, 'UsrTotalDraft' => 27, 'UsrTotalCancelled' => 28, 'UsrTotalParticipated' => 29, 'UsrTotalPaused' => 30, 'UsrTotalCompleted' => 31, 'UsrTotalUnassigned' => 32, 'UsrCostByHour' => 33, 'UsrUnitCost' => 34, 'UsrBookmarkStartCases' => 35, 'UsrTimeZone' => 36, ),
BasePeer::TYPE_COLNAME => array (UsersPeer::USR_UID => 0, UsersPeer::USR_USERNAME => 1, UsersPeer::USR_PASSWORD => 2, UsersPeer::USR_FIRSTNAME => 3, UsersPeer::USR_LASTNAME => 4, UsersPeer::USR_EMAIL => 5, UsersPeer::USR_DUE_DATE => 6, UsersPeer::USR_CREATE_DATE => 7, UsersPeer::USR_UPDATE_DATE => 8, UsersPeer::USR_STATUS => 9, UsersPeer::USR_COUNTRY => 10, UsersPeer::USR_CITY => 11, UsersPeer::USR_LOCATION => 12, UsersPeer::USR_ADDRESS => 13, UsersPeer::USR_PHONE => 14, UsersPeer::USR_FAX => 15, UsersPeer::USR_CELLULAR => 16, UsersPeer::USR_ZIP_CODE => 17, UsersPeer::DEP_UID => 18, UsersPeer::USR_POSITION => 19, UsersPeer::USR_RESUME => 20, UsersPeer::USR_BIRTHDAY => 21, UsersPeer::USR_ROLE => 22, UsersPeer::USR_REPORTS_TO => 23, UsersPeer::USR_REPLACED_BY => 24, UsersPeer::USR_UX => 25, UsersPeer::USR_TOTAL_INBOX => 26, UsersPeer::USR_TOTAL_DRAFT => 27, UsersPeer::USR_TOTAL_CANCELLED => 28, UsersPeer::USR_TOTAL_PARTICIPATED => 29, UsersPeer::USR_TOTAL_PAUSED => 30, UsersPeer::USR_TOTAL_COMPLETED => 31, UsersPeer::USR_TOTAL_UNASSIGNED => 32, UsersPeer::USR_COST_BY_HOUR => 33, UsersPeer::USR_UNIT_COST => 34, UsersPeer::USR_BOOKMARK_START_CASES => 35, UsersPeer::USR_TIME_ZONE => 36, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID' => 0, 'USR_USERNAME' => 1, 'USR_PASSWORD' => 2, 'USR_FIRSTNAME' => 3, 'USR_LASTNAME' => 4, 'USR_EMAIL' => 5, 'USR_DUE_DATE' => 6, 'USR_CREATE_DATE' => 7, 'USR_UPDATE_DATE' => 8, 'USR_STATUS' => 9, 'USR_COUNTRY' => 10, 'USR_CITY' => 11, 'USR_LOCATION' => 12, 'USR_ADDRESS' => 13, 'USR_PHONE' => 14, 'USR_FAX' => 15, 'USR_CELLULAR' => 16, 'USR_ZIP_CODE' => 17, 'DEP_UID' => 18, 'USR_POSITION' => 19, 'USR_RESUME' => 20, 'USR_BIRTHDAY' => 21, 'USR_ROLE' => 22, 'USR_REPORTS_TO' => 23, 'USR_REPLACED_BY' => 24, 'USR_UX' => 25, 'USR_TOTAL_INBOX' => 26, 'USR_TOTAL_DRAFT' => 27, 'USR_TOTAL_CANCELLED' => 28, 'USR_TOTAL_PARTICIPATED' => 29, 'USR_TOTAL_PAUSED' => 30, 'USR_TOTAL_COMPLETED' => 31, 'USR_TOTAL_UNASSIGNED' => 32, 'USR_COST_BY_HOUR' => 33, 'USR_UNIT_COST' => 34, 'USR_BOOKMARK_START_CASES' => 35, 'USR_TIME_ZONE' => 36, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, )
);
/**
@@ -339,6 +342,8 @@ abstract class BaseUsersPeer
$criteria->addSelectColumn(UsersPeer::USR_BOOKMARK_START_CASES);
$criteria->addSelectColumn(UsersPeer::USR_TIME_ZONE);
}
const COUNT = 'COUNT(USERS.USR_UID)';

View File

@@ -1493,6 +1493,7 @@
<parameter name="Extra" value=""/>
</vendor>
</column>
<column name="USR_TIME_ZONE" type="VARCHAR" size="100" default="" />
<validator column="USR_STATUS">
<rule name="validValues" value="ACTIVE|INACTIVE|VACATION|CLOSED" message="Please select a valid type."/>
<rule name="required" message="Type is required."/>

View File

@@ -26,8 +26,6 @@ class Admin extends Controller
}
}
$skins = array ();
$timeZonesList = System::getAllTimeZones();
$timeZonesList = array_keys( $timeZonesList );
$mainController = new Main();
$languagesList = $mainController->getLanguagesList();
$languagesList[] = array ("", G::LoadTranslation("ID_USE_LANGUAGE_URL"));
@@ -37,10 +35,6 @@ class Admin extends Controller
$skins[] = array ($skin['SKIN_FOLDER_ID'],$skin['SKIN_NAME']);
}
foreach ($timeZonesList as $tz) {
$timeZones[] = array ($tz,$tz);
}
$this->includeExtJS( 'admin/system' );
//G::LoadClass('configuration');
@@ -55,7 +49,7 @@ class Admin extends Controller
$this->setJSVar( 'skinsList', $skins );
$this->setJSVar( 'languagesList', $languagesList );
$this->setJSVar( 'timeZonesList', $timeZones );
$this->setJSVar('timeZonesList', array_map(function ($value) { return [$value, $value]; }, DateTimeZone::listIdentifiers()));
$this->setJSVar( 'sysConf', $sysConf );
G::RenderPage( 'publish', 'extJs' );

View File

@@ -744,7 +744,7 @@ class Installer extends Controller
// Generate the db.php file and folders
$pathSharedSites = $pathShared;
$path_site = $pathShared . "/sites/" . $workspace . "/";
$db_file = $path_site . "db.php";
@mkdir( $path_site, 0777, true );
@mkdir( $path_site . "files/", 0777, true );
@mkdir( $path_site . "mailTemplates/", 0777, true );
@@ -752,6 +752,7 @@ class Installer extends Controller
@mkdir( $path_site . "reports/", 0777, true );
@mkdir( $path_site . "xmlForms", 0777, true );
$db_file = $path_site . 'db.php';
$dbText = "<?php\n";
$dbText .= sprintf( "// Processmaker configuration\n" );
$dbText .= sprintf( " define ('DB_ADAPTER', '%s' );\n", 'mysql' );
@@ -779,7 +780,14 @@ class Installer extends Controller
$this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) ));
file_put_contents( $db_file, $dbText );
// Generate the databases.php file
//Generate the env.ini file
$envIniFile = $path_site . 'env.ini';
$content = 'system_utc_time_zone = 1' . "\n";
$this->installLog(G::LoadTranslation('ID_CREATING', SYS_LANG, [$envIniFile]));
file_put_contents($envIniFile, $content);
//Generate the databases.php file
$databases_file = $path_site . 'databases.php';
$dbData = sprintf( "\$dbAdapter = '%s';\n", 'mysql' );
$dbData .= sprintf( "\$dbHost = '%s';\n", $db_host );

View File

@@ -717,6 +717,7 @@ CREATE TABLE `USERS`
`USR_COST_BY_HOUR` DECIMAL(7,2) default 0,
`USR_UNIT_COST` VARCHAR(50) default '',
`USR_BOOKMARK_START_CASES` MEDIUMTEXT,
`USR_TIME_ZONE` VARCHAR(100) default '',
PRIMARY KEY (`USR_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Users';
#-----------------------------------------------------------------------------

View File

@@ -284,11 +284,11 @@ try {
$FieldsPmDynaform["STEP_MODE"] = $oStep->getStepMode();
$FieldsPmDynaform["PRO_SHOW_MESSAGE"] = $noShowTitle;
$FieldsPmDynaform["TRIGGER_DEBUG"] = $_SESSION['TRIGGER_DEBUG']['ISSET'];
$a = new pmDynaform($FieldsPmDynaform);
$a = new pmDynaform(\ProcessMaker\Util\DateTime::convertUtcToTimeZone($FieldsPmDynaform));
if ($a->isResponsive()) {
$a->printEdit();
} else {
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : ''));
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', \ProcessMaker\Util\DateTime::convertUtcToTimeZone($Fields['APP_DATA']), 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', ((strtolower($oStep->getStepMode()) != 'edit')? strtolower($oStep->getStepMode()) : ''));
}
break;
case 'INPUT_DOCUMENT':

View File

@@ -103,6 +103,8 @@ try {
$category
);
$data['data'] = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($data['data']);
$result = G::json_encode($data);
} else {
G::LoadClass("applications");
@@ -126,6 +128,8 @@ try {
$category
);
$data['data'] = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($data['data']);
$result = G::json_encode($data);
}

View File

@@ -184,7 +184,7 @@ try {
$response = $filter->xssFilterHard($response);
$response["data"] = $result;
$response['data'] = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($result);
echo G::json_encode($response);
} catch (Exception $e) {

View File

@@ -180,6 +180,22 @@ try {
$_SESSION['USR_USERNAME'] = $usr;
}
//Set User Time Zone
$user = UsersPeer::retrieveByPK($_SESSION['USER_LOGGED']);
if (!is_null($user)) {
$userTimeZone = $user->getUsrTimeZone();
if (trim($userTimeZone) == '') {
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
$userTimeZone = $arraySystemConfiguration['time_zone'];
}
$_SESSION['USR_TIME_ZONE'] = $userTimeZone;
}
//Set data
$aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']);
$RBAC->loadUserRolePermission($RBAC->sSystem, $_SESSION['USER_LOGGED']);
//$rol = $RBAC->rolesObj->load($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_UID']);

View File

@@ -80,7 +80,7 @@ if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
$r = new stdclass();
$r->memkey = $memkey;
$r->memcache = $memcacheUsed;
$r->data = $proData;
$r->data = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($proData);
$r->totalCount = $totalCount;
echo G::json_encode( $r );

View File

@@ -171,6 +171,7 @@ switch ($_POST['action']) {
$costByHour = $form['USR_COST_BY_HOUR'] ? $form['USR_COST_BY_HOUR'] : "";
$unit = $form['USR_UNIT_COST'] ? $form['USR_UNIT_COST'] : "";
/*----------------------------------********---------------------------------*/
$timeZone = (isset($form['USR_TIME_ZONE']))? ' - Time Zone: ' . $form['USR_TIME_ZONE'] : '';
if ($form['USR_UID'] == '') {
$criteria = new Criteria();
@@ -215,11 +216,12 @@ switch ($_POST['action']) {
$aData['USR_UNIT_COST'] = $form['USR_UNIT_COST'];
/*----------------------------------********---------------------------------*/
$aData['USR_REPLACED_BY'] = $form['USR_REPLACED_BY'];
$aData['USR_TIME_ZONE'] = $form['USR_TIME_ZONE'];
require_once 'classes/model/Users.php';
$oUser = new Users();
$oUser->create($aData);
G::auditLog("CreateUser", "User Name: ". $aData['USR_USERNAME']." - User ID: (".$aData['USR_UID'].") ".$firstName.$lastName.$email.$dueDate.$status.$address.$phone.$zipCode.$position.$role );
G::auditLog('CreateUser', 'User Name: ' . $aData['USR_USERNAME'] . ' - User ID: (' . $aData['USR_UID'] . ') ' . $firstName . $lastName . $email . $dueDate . $status . $address . $phone . $zipCode . $position . $role . $timeZone);
if ($_FILES['USR_PHOTO']['error'] != 1) {
//print (PATH_IMAGES_ENVIRONMENT_USERS);
@@ -400,10 +402,14 @@ switch ($_POST['action']) {
$aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN'];
}
if (isset($form['USR_TIME_ZONE'])) {
$aData['USR_TIME_ZONE'] = $form['USR_TIME_ZONE'];
}
require_once 'classes/model/Users.php';
$oUser = new Users();
$oUser->update($aData);
G::auditLog("UpdateUser", "User Name: ". $aData['USR_USERNAME']." - User ID: (".$aData['USR_UID'].") ".$firstName.$lastName.$email.$dueDate.$status.$address.$phone.$zipCode.$position.$role );
G::auditLog('UpdateUser', 'User Name: ' . $aData['USR_USERNAME'] . ' - User ID: (' . $aData['USR_UID'] . ') ' . $firstName . $lastName . $email . $dueDate . $status . $address . $phone . $zipCode . $position . $role . $timeZone);
if ($_FILES['USR_PHOTO']['error'] != 1) {
if ($_FILES['USR_PHOTO']['tmp_name'] != '') {
$aAux = explode('.', $_FILES['USR_PHOTO']['name']);

View File

@@ -1 +1,29 @@
<?php
<?php
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get( 'post_max_size' );
$mul = substr( $POST_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ($postMaxSize < $uploadMaxSize) {
$uploadMaxSize = $postMaxSize;
}
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js
$oHeadPublisher->assign( 'USR_UID', $_GET['USR_UID'] );
$oHeadPublisher->assign( 'MODE', $_GET['MODE'] );
$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);
G::RenderPage( 'publish', 'extJs' );

View File

@@ -23,8 +23,11 @@ $mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ($postMaxSize < $uploadMaxSize)
if ($postMaxSize < $uploadMaxSize) {
$uploadMaxSize = $postMaxSize;
}
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js
@@ -35,5 +38,8 @@ $oHeadPublisher->assign( 'EDITPROFILE', 1);
$oHeadPublisher->assign( 'canEdit', $canEdit );
$oHeadPublisher->assign( 'MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ' );
$oHeadPublisher->assign( 'MODE', '' );
G::RenderPage( 'publish', 'extJs' );
$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);
G::RenderPage( 'publish', 'extJs' );

View File

@@ -13,13 +13,20 @@ $mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ($postMaxSize < $uploadMaxSize)
if ($postMaxSize < $uploadMaxSize) {
$uploadMaxSize = $postMaxSize;
}
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js
$oHeadPublisher->assign( 'USR_UID', '' );
$oHeadPublisher->assign( 'MODE', $_GET['MODE'] );
$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);
G::RenderPage( 'publish', 'extJs' );

View File

@@ -759,9 +759,9 @@ class SkinEngine
$conf = new Configurations();
$conf->getFormats();
if ( defined('SYS_SYS')) {
$smarty->assign('udate', $conf->getSystemDate(date('Y-m-d H:i:s')));
$smarty->assign('udate', $conf->getSystemDate(\ProcessMaker\Util\DateTime::convertUtcToTimeZone(date('Y-m-d H:i:s'))));
} else {
$smarty->assign('udate', G::getformatedDate(date('Y-m-d H:i:s'), 'M d, yyyy', SYS_LANG));
$smarty->assign('udate', G::getformatedDate(\ProcessMaker\Util\DateTime::convertUtcToTimeZone(date('Y-m-d H:i:s')), 'M d, yyyy', SYS_LANG));
}
$name = $conf->userNameFormat(isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME']: '', isset($_SESSION['USR_FULLNAME']) ? htmlentities($_SESSION['USR_FULLNAME'] , ENT_QUOTES, 'UTF-8'): '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
$smarty->assign('user',$name);

View File

@@ -169,32 +169,32 @@ class Process
public function throwExceptionIfDataNotMetFieldDefinition($arrayData, $arrayFieldDefinition, $arrayFieldNameForException, $flagValidateRequired = true)
{
try {
\G::LoadSystem('inputfilter');
$filter = new \InputFilter();
if ($flagValidateRequired) {
foreach ($arrayFieldDefinition as $key => $value) {
$fieldName = $key;
$fieldNameAux = (isset($arrayFieldNameForException[$arrayFieldDefinition[$fieldName]["fieldNameAux"]]))? $arrayFieldNameForException[$arrayFieldDefinition[$fieldName]["fieldNameAux"]] : "";
$fieldNameAux = (isset($arrayFieldNameForException[$arrayFieldDefinition[$fieldName]['fieldNameAux']]))? $arrayFieldNameForException[$arrayFieldDefinition[$fieldName]['fieldNameAux']] : $fieldName;
if ($arrayFieldDefinition[$fieldName]["required"] && !isset($arrayData[$fieldName])) {
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($fieldNameAux)));
throw new \Exception(\G::LoadTranslation('ID_UNDEFINED_VALUE_IS_REQUIRED', [$fieldNameAux]));
}
}
}
$arrayType1 = array("int", "integer", "float", "real", "double", "bool", "boolean", "string", "date", "hour", "datetime");
$arrayType2 = array("array", "object");
$arrayType1 = [
'int', 'integer', 'float', 'real', 'double',
'bool', 'boolean',
'string',
'date', 'hour', 'datetime'
];
$arrayType2 = ['array', 'object'];
foreach ($arrayData as $key => $value) {
$fieldName = $key;
$fieldValue = $value;
if (isset($arrayFieldDefinition[$fieldName])) {
$fieldNameAux = (isset($arrayFieldNameForException[$arrayFieldDefinition[$fieldName]["fieldNameAux"]]))? $arrayFieldNameForException[$arrayFieldDefinition[$fieldName]["fieldNameAux"]] : "";
$fieldNameAux = (isset($arrayFieldNameForException[$arrayFieldDefinition[$fieldName]['fieldNameAux']]))? $arrayFieldNameForException[$arrayFieldDefinition[$fieldName]['fieldNameAux']] : $fieldName;
$arrayFieldDefinition[$fieldName]["type"] = strtolower($arrayFieldDefinition[$fieldName]["type"]);
@@ -205,38 +205,43 @@ class Process
switch ($optionType) {
case 1:
//empty
if (!$arrayFieldDefinition[$fieldName]["empty"] && trim($fieldValue) . "" == "") {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($fieldNameAux)));
if (!$arrayFieldDefinition[$fieldName]['empty'] && trim($fieldValue) == '') {
throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE_CAN_NOT_BE_EMPTY', [$fieldNameAux]));
}
//defaultValues
if (count($arrayFieldDefinition[$fieldName]["defaultValues"]) > 0 && !in_array($fieldValue, $arrayFieldDefinition[$fieldName]["defaultValues"], true)) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"]))));
if (isset($arrayFieldDefinition[$fieldName]['defaultValues']) &&
!empty($arrayFieldDefinition[$fieldName]['defaultValues']) &&
!in_array($fieldValue, $arrayFieldDefinition[$fieldName]['defaultValues'], true)
) {
throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES', [$fieldNameAux, implode('|', $arrayFieldDefinition[$fieldName]['defaultValues'])]));
}
//type
$fieldValue = (!is_array($fieldValue)) ? $fieldValue : '';
$fieldValue = (!is_array($fieldValue))? $fieldValue : '';
if ($arrayFieldDefinition[$fieldName]["empty"] && $fieldValue . "" == "") {
//
} else {
$regexpDate = "[1-9]\d{3}\-(?:0[1-9]|1[012])\-(?:[0][1-9]|[12][0-9]|3[01])";
$regexpHour = "(?:[0-1]\d|2[0-3])\:(?:[0-5]\d)(?:\:[0-5]\d)?";
$regexpDatetime = $regexpDate . "\s" . $regexpHour;
$regexpDate = \ProcessMaker\Util\DateTime::REGEXPDATE;
$regexpTime = \ProcessMaker\Util\DateTime::REGEXPTIME;
$regexpDatetime = $regexpDate . '\s' . $regexpTime;
switch ($arrayFieldDefinition[$fieldName]["type"]) {
case "date":
if (!preg_match("/^" . $regexpDate . "$/", $fieldValue)) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux)));
throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE', [$fieldNameAux]));
}
break;
case "hour":
if (!preg_match("/^" . $regexpHour . "$/", $fieldValue)) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux)));
if (!preg_match('/^' . $regexpTime . '$/', $fieldValue)) {
throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE', [$fieldNameAux]));
}
break;
case "datetime":
if (!preg_match("/^" . $regexpDatetime . "$/", $fieldValue)) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux)));
throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE', [$fieldNameAux]));
}
break;
}
@@ -251,7 +256,7 @@ class Process
//type
if (!is_array($fieldValue)) {
if ($fieldValue != "" && !preg_match("/^" . $regexpArray1 . ".*" . $regexpArray2 . "$/", $fieldValue)) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($fieldNameAux)));
throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE_THIS_MUST_BE_ARRAY', [$fieldNameAux]));
}
}
@@ -263,37 +268,38 @@ class Process
$arrayAux = $fieldValue;
}
if (is_string($fieldValue) && trim($fieldValue) . "" != "") {
if (is_string($fieldValue) && trim($fieldValue) != '') {
//eval("\$arrayAux = $fieldValue;");
if (preg_match("/^" . $regexpArray1 . "(.*)" . $regexpArray2 . "$/", $fieldValue, $arrayMatch)) {
if (trim($arrayMatch[1], " ,") != "") {
$arrayAux = array(0);
$arrayAux = [0];
}
}
}
if (count($arrayAux) == 0) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($fieldNameAux)));
if (empty($arrayAux)) {
throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE_CAN_NOT_BE_EMPTY', [$fieldNameAux]));
}
}
//defaultValues
if (count($arrayFieldDefinition[$fieldName]["defaultValues"]) > 0) {
$arrayAux = array();
if (isset($arrayFieldDefinition[$fieldName]['defaultValues']) &&
!empty($arrayFieldDefinition[$fieldName]['defaultValues'])
) {
$arrayAux = [];
if (is_array($fieldValue)) {
$arrayAux = $fieldValue;
}
if (is_string($fieldValue) && trim($fieldValue) . "" != "") {
$fieldValue = $filter->validateInput($fieldValue);
if (is_string($fieldValue) && trim($fieldValue) != '') {
eval("\$arrayAux = $fieldValue;");
}
foreach ($arrayAux as $value) {
if (!in_array($value, $arrayFieldDefinition[$fieldName]["defaultValues"], true)) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"]))));
throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES', [$fieldNameAux, implode('|', $arrayFieldDefinition[$fieldName]['defaultValues'])]));
}
}
}
@@ -320,10 +326,10 @@ class Process
{
try {
foreach ($arrayData as $key => $value) {
$nameForException = (isset($arrayFieldNameForException[$key]))? $arrayFieldNameForException[$key] : "";
$nameForException = (isset($arrayFieldNameForException[$key]))? $arrayFieldNameForException[$key] : $key;
if (!is_null($value) && ($value . "" == "" || !preg_match("/^(?:\+|\-)?(?:0|[1-9]\d*)$/", $value . "") || (int)($value) < 0)) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_EXPECTING_POSITIVE_INTEGER", array($nameForException)));
throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE_EXPECTING_POSITIVE_INTEGER', [$nameForException]));
}
}
} catch (\Exception $e) {

View File

@@ -32,7 +32,8 @@ class User
"USR_COST_BY_HOUR" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "usrCostByHour"),
"USR_UNIT_COST" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "usrUnitCost"),
/*----------------------------------********---------------------------------*/
"USR_LOGGED_NEXT_TIME" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "usrLoggedNextTime")
'USR_LOGGED_NEXT_TIME' => ['type' => 'int', 'required' => false, 'empty' => false, 'defaultValues' => [0, 1], 'fieldNameAux' => 'usrLoggedNextTime'],
'USR_TIME_ZONE' => ['type' => 'string', 'required' => false, 'empty' => true, 'defaultValues' => [], 'fieldNameAux' => 'usrTimeZone']
);
private $formatFieldNameInUppercase = true;
@@ -295,6 +296,12 @@ class User
throw new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($this->arrayFieldNameForException["depUid"], $arrayData["DEP_UID"])));
}
}
if (isset($arrayData['USR_TIME_ZONE']) && $arrayData['USR_TIME_ZONE'] != '') {
if (!in_array($arrayData['USR_TIME_ZONE'], \DateTimeZone::listIdentifiers())) {
throw new \Exception(\G::LoadTranslation('ID_TIME_ZONE_DOES_NOT_EXIST', [$this->arrayFieldNameForException['usrTimeZone'], $arrayData['USR_TIME_ZONE']]));
}
}
} catch (\Exception $e) {
throw $e;
}
@@ -343,48 +350,62 @@ class User
$pathPhotoUser = PATH_HOME . "public_html" . PATH_SEP . "images" . PATH_SEP . "user.gif";
}
return array(
$this->getFieldNameByFormatFieldName("USR_UID") => $record["USR_UID"],
$this->getFieldNameByFormatFieldName("USR_USERNAME") => $record["USR_USERNAME"],
//$this->getFieldNameByFormatFieldName("USR_PASSWORD") => $record["USR_PASSWORD"],
$this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $record["USR_FIRSTNAME"],
$this->getFieldNameByFormatFieldName("USR_LASTNAME") => $record["USR_LASTNAME"],
$this->getFieldNameByFormatFieldName("USR_EMAIL") => $record["USR_EMAIL"],
$this->getFieldNameByFormatFieldName("USR_DUE_DATE") => $record["USR_DUE_DATE"],
$this->getFieldNameByFormatFieldName("USR_CREATE_DATE") => $record["USR_CREATE_DATE"],
$this->getFieldNameByFormatFieldName("USR_UPDATE_DATE") => $record["USR_UPDATE_DATE"],
$this->getFieldNameByFormatFieldName("USR_STATUS") => $record["USR_STATUS"],
$this->getFieldNameByFormatFieldName("USR_COUNTRY") => $record["USR_COUNTRY"],
$this->getFieldNameByFormatFieldName("USR_CITY") => $record["USR_CITY"],
$this->getFieldNameByFormatFieldName("USR_LOCATION") => $record["USR_LOCATION"],
$this->getFieldNameByFormatFieldName("USR_ADDRESS") => $record["USR_ADDRESS"],
$this->getFieldNameByFormatFieldName("USR_PHONE") => $record["USR_PHONE"],
$this->getFieldNameByFormatFieldName("USR_FAX") => $record["USR_FAX"],
$this->getFieldNameByFormatFieldName("USR_CELLULAR") => $record["USR_CELLULAR"],
$this->getFieldNameByFormatFieldName("USR_ZIP_CODE") => $record["USR_ZIP_CODE"],
$this->getFieldNameByFormatFieldName("DEP_UID") => $record["DEP_UID"],
$this->getFieldNameByFormatFieldName("USR_POSITION") => $record["USR_POSITION"],
$this->getFieldNameByFormatFieldName("USR_RESUME") => $record["USR_RESUME"],
$this->getFieldNameByFormatFieldName("USR_BIRTHDAY") => $record["USR_BIRTHDAY"],
$this->getFieldNameByFormatFieldName("USR_ROLE") => $record["USR_ROLE"],
$this->getFieldNameByFormatFieldName("USR_REPORTS_TO") => $record["USR_REPORTS_TO"],
$this->getFieldNameByFormatFieldName("USR_REPLACED_BY") => $record["USR_REPLACED_BY"],
$this->getFieldNameByFormatFieldName("USR_CALENDAR_UID") => $aFields["USR_CALENDAR_UID"],
$this->getFieldNameByFormatFieldName("USR_CALENDAR_NAME") => $aFields["USR_CALENDAR"],
$this->getFieldNameByFormatFieldName("USR_UX") => $record["USR_UX"],
$arrayResult = [];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_UID')] = $record['USR_UID'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_USERNAME')] = $record['USR_USERNAME'];
//$arrayResult[$this->getFieldNameByFormatFieldName('USR_PASSWORD')] = $record['USR_PASSWORD'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_FIRSTNAME')] = $record['USR_FIRSTNAME'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_LASTNAME')] = $record['USR_LASTNAME'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_EMAIL')] = $record['USR_EMAIL'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_DUE_DATE')] = $record['USR_DUE_DATE'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_CREATE_DATE')] = $record['USR_CREATE_DATE'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_UPDATE_DATE')] = $record['USR_UPDATE_DATE'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_STATUS')] = $record['USR_STATUS'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_COUNTRY')] = $record['USR_COUNTRY'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_CITY')] = $record['USR_CITY'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_LOCATION')] = $record['USR_LOCATION'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_ADDRESS')] = $record['USR_ADDRESS'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_PHONE')] = $record['USR_PHONE'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_FAX')] = $record['USR_FAX'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_CELLULAR')] = $record['USR_CELLULAR'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_ZIP_CODE')] = $record['USR_ZIP_CODE'];
$arrayResult[$this->getFieldNameByFormatFieldName('DEP_UID')] = $record['DEP_UID'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_POSITION')] = $record['USR_POSITION'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_RESUME')] = $record['USR_RESUME'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_BIRTHDAY')] = $record['USR_BIRTHDAY'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_ROLE')] = $record['USR_ROLE'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_REPORTS_TO')] = $record['USR_REPORTS_TO'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_REPLACED_BY')] = $record['USR_REPLACED_BY'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_CALENDAR_UID')] = $aFields['USR_CALENDAR_UID'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_CALENDAR_NAME')] = $aFields['USR_CALENDAR'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_UX')] = $record['USR_UX'];
/*----------------------------------********---------------------------------*/
$this->getFieldNameByFormatFieldName("USR_COST_BY_HOUR") => $record["USR_COST_BY_HOUR"],
$this->getFieldNameByFormatFieldName("USR_UNIT_COST") => $record["USR_UNIT_COST"],
$arrayResult[$this->getFieldNameByFormatFieldName('USR_COST_BY_HOUR')] = $record['USR_COST_BY_HOUR'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_UNIT_COST')] = $record['USR_UNIT_COST'];
/*----------------------------------********---------------------------------*/
$this->getFieldNameByFormatFieldName("USR_TOTAL_INBOX") => $record["USR_TOTAL_INBOX"],
$this->getFieldNameByFormatFieldName("USR_TOTAL_DRAFT") => $record["USR_TOTAL_DRAFT"],
$this->getFieldNameByFormatFieldName("USR_TOTAL_CANCELLED") => $record["USR_TOTAL_CANCELLED"],
$this->getFieldNameByFormatFieldName("USR_TOTAL_PARTICIPATED") => $record["USR_TOTAL_PARTICIPATED"],
$this->getFieldNameByFormatFieldName("USR_TOTAL_PAUSED") => $record["USR_TOTAL_PAUSED"],
$this->getFieldNameByFormatFieldName("USR_TOTAL_COMPLETED") => $record["USR_TOTAL_COMPLETED"],
$this->getFieldNameByFormatFieldName("USR_TOTAL_UNASSIGNED") => $record["USR_TOTAL_UNASSIGNED"],
$this->getFieldNameByFormatFieldName("USR_PHOTO_PATH") => $pathPhotoUser
);
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_INBOX')] = $record['USR_TOTAL_INBOX'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_DRAFT')] = $record['USR_TOTAL_DRAFT'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_CANCELLED')] = $record['USR_TOTAL_CANCELLED'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_PARTICIPATED')] = $record['USR_TOTAL_PARTICIPATED'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_PAUSED')] = $record['USR_TOTAL_PAUSED'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_COMPLETED')] = $record['USR_TOTAL_COMPLETED'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_UNASSIGNED')] = $record['USR_TOTAL_UNASSIGNED'];
$arrayResult[$this->getFieldNameByFormatFieldName('USR_PHOTO_PATH')] = $pathPhotoUser;
if (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) {
$userTimeZone = $record['USR_TIME_ZONE'];
if (trim($userTimeZone) == '') {
$arraySystemConfiguration = \System::getSystemConfiguration('', '', SYS_SYS);
$userTimeZone = $arraySystemConfiguration['time_zone'];
}
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TIME_ZONE')] = $userTimeZone;
}
//Return
return $arrayResult;
} catch (\Exception $e) {
throw $e;
}
@@ -437,7 +458,9 @@ class User
$criteria->addSelectColumn(\UsersPeer::USR_TOTAL_PAUSED);
$criteria->addSelectColumn(\UsersPeer::USR_TOTAL_COMPLETED);
$criteria->addSelectColumn(\UsersPeer::USR_TOTAL_UNASSIGNED);
$criteria->addSelectColumn(\UsersPeer::USR_TIME_ZONE);
//Return
return $criteria;
} catch (\Exception $e) {
throw $e;
@@ -1250,5 +1273,28 @@ class User
throw $e;
}
}
/**
* Get User-Logged Time Zone
*
* @return string Return the User-Logged Time Zone; Time Zone system settings otherwise
*/
public static function getUserLoggedTimeZone()
{
try {
$timeZone = 'UTC';
if (isset($_SESSION['USR_TIME_ZONE'])) {
$tz = trim($_SESSION['USR_TIME_ZONE']);
$timeZone = ($tz != '')? $tz : $timeZone;
}
//Return
return $timeZone;
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -328,5 +328,51 @@ class Validator
throw $e;
}
}
/**
* Validate data by ISO 8601 format
*
* @param mixed $data Data
* @param mixed $field Fields
*
* @return void Throw exception if data has an invalid value
*/
public static function throwExceptionIfDataNotMetIso8601Format($data, $field = null)
{
try {
if (!(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])) {
return;
}
$regexpDate = \ProcessMaker\Util\DateTime::REGEXPDATE;
$regexpTime = \ProcessMaker\Util\DateTime::REGEXPTIME;
$regexpIso8601 = $regexpDate . 'T' . $regexpTime . '[\+\-]\d{2}:\d{2}';
switch (gettype($data)) {
case 'string':
if (trim($data) != '' && !preg_match('/^' . $regexpIso8601 . '$/', $data)) {
throw new \Exception(\G::LoadTranslation('ID_ISO8601_INVALID_FORMAT', [(!is_null($field) && is_string($field))? $field : $data]));
}
break;
case 'array':
if (!is_null($field) && is_array($field)) {
foreach ($field as $value) {
$fieldName = $value;
$fieldName = (isset($data[strtoupper($fieldName)]))? strtoupper($fieldName) : $fieldName;
$fieldName = (isset($data[strtolower($fieldName)]))? strtolower($fieldName) : $fieldName;
if (isset($data[$fieldName]) && trim($data[$fieldName]) != '' && !preg_match('/^' . $regexpIso8601 . '$/', $data[$fieldName])) {
throw new \Exception(\G::LoadTranslation('ID_ISO8601_INVALID_FORMAT', [$fieldName]));
}
}
}
break;
}
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -15,6 +15,16 @@ use \Luracast\Restler\RestException;
*/
class Lists extends Api
{
private $arrayFieldIso8601 = [
'app_paused_date',
'app_restart_date',
'del_delegate_date',
'del_init_date',
'del_due_date',
'del_task_due_date',
'app_update_date'
];
/**
* Get list Inbox
*
@@ -74,7 +84,8 @@ class Lists extends Api
$lists = new \ProcessMaker\BusinessModel\Lists();
$response = $lists->getList('inbox', $dataList);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -179,7 +190,8 @@ class Lists extends Api
$lists = new \ProcessMaker\BusinessModel\Lists();
$response = $lists->getList('participated_last', $dataList);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -283,7 +295,8 @@ class Lists extends Api
$lists = new \ProcessMaker\BusinessModel\Lists();
$response = $lists->getList('participated_history', $dataList);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -389,7 +402,8 @@ class Lists extends Api
$lists = new \ProcessMaker\BusinessModel\Lists();
$response = $lists->getList('paused', $dataList);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -494,7 +508,8 @@ class Lists extends Api
$lists = new \ProcessMaker\BusinessModel\Lists();
$response = $lists->getList('canceled', $dataList);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -598,7 +613,8 @@ class Lists extends Api
$lists = new \ProcessMaker\BusinessModel\Lists();
$response = $lists->getList('completed', $dataList);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -702,7 +718,8 @@ class Lists extends Api
$lists = new \ProcessMaker\BusinessModel\Lists();
$response = $lists->getList('completed', $dataList);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -806,7 +823,8 @@ class Lists extends Api
$lists = new \ProcessMaker\BusinessModel\Lists();
$response = $lists->getList('unassigned', $dataList);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}

View File

@@ -13,6 +13,12 @@ class TimerEvent extends Api
{
private $timerEvent;
private $arrayFieldIso8601 = [
'tmrevn_next_run_date',
'tmrevn_last_run_date',
'tmrevn_last_execution_date'
];
/**
* Constructor of the class
*
@@ -39,7 +45,7 @@ class TimerEvent extends Api
try {
$response = $this->timerEvent->getTimerEvents($prj_uid);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
@@ -56,7 +62,7 @@ class TimerEvent extends Api
try {
$response = $this->timerEvent->getTimerEvent($tmrevn_uid);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
@@ -73,7 +79,7 @@ class TimerEvent extends Api
try {
$response = $this->timerEvent->getTimerEventByEvent($prj_uid, $evn_uid);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
@@ -90,11 +96,13 @@ class TimerEvent extends Api
public function doPostTimerEvent($prj_uid, array $request_data)
{
try {
$arrayData = $this->timerEvent->create($prj_uid, $request_data);
\ProcessMaker\BusinessModel\Validator::throwExceptionIfDataNotMetIso8601Format($request_data, $this->arrayFieldIso8601);
$arrayData = $this->timerEvent->create($prj_uid, \ProcessMaker\Util\DateTime::convertDataToUtc($request_data, $this->arrayFieldIso8601));
$response = $arrayData;
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}

View File

@@ -11,6 +11,11 @@ use \Luracast\Restler\RestException;
*/
class User extends Api
{
private $arrayFieldIso8601 = [
'usr_create_date',
'usr_update_date'
];
/**
* Constructor of the class
*
@@ -47,7 +52,7 @@ class User extends Api
$response = $user->getUsers($arrayFilterData, null, null, $start, $limit);
return $response["data"];
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response['data'], $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
@@ -65,7 +70,8 @@ class User extends Api
$user->setFormatFieldNameInUppercase(false);
$response = $user->getUser($usr_uid);
return $response;
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}

View File

@@ -357,6 +357,21 @@ class Server implements iAuthenticate
setcookie($session->getSessionName(), $_COOKIE[$session->getSessionName()], time() + $lifetime, "/", null, false, true);
}
//Set User Time Zone
$user = \UsersPeer::retrieveByPK(self::$userId);
if (!is_null($user)) {
$userTimeZone = $user->getUsrTimeZone();
if (trim($userTimeZone) == '') {
$arraySystemConfiguration = \System::getSystemConfiguration('', '', SYS_SYS);
$userTimeZone = $arraySystemConfiguration['time_zone'];
}
$_SESSION['USR_TIME_ZONE'] = $userTimeZone;
}
}
return $allowed;

View File

@@ -0,0 +1,361 @@
<?php
namespace ProcessMaker\Util;
class DateTime
{
const ISO8601 = 'Y-m-d\TH:i:sP';
const REGEXPDATE = '[1-9]\d{3}\-(?:0[1-9]|1[0-2])\-(?:0[1-9]|[12][0-9]|3[01])';
const REGEXPTIME = '(?:[0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d';
/**
* Get Time Zone Offset by Time Zone ID
*
* @param string $timeZoneId Time Zone ID
*
* @return int Return the Time Zone Offset; false otherwise
*/
public function getTimeZoneOffsetByTimeZoneId($timeZoneId)
{
try {
$dt = new \DateTime(null, new \DateTimeZone($timeZoneId));
//Return
return $dt->getOffset();
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get Time Zone ID by Time Zone Offset
*
* @param int $offset Time Zone Offset
*
* @return string Return the Time Zone ID; UTC ID otherwise
*/
public function getTimeZoneIdByTimeZoneOffset($offset)
{
try {
foreach (\DateTimeZone::listIdentifiers() as $value) {
$timeZoneOffset = self::getTimeZoneOffsetByTimeZoneId($value);
if ($timeZoneOffset !== false && $timeZoneOffset == $offset) {
//Return
return $value;
}
}
//Return
return 'UTC';
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get Time Zone ID by UTC Offset
*
* @param string $utcOffset UTC Offset
*
* @return string Return the Time Zone ID; UTC ID otherwise
*/
public function getTimeZoneIdByUtcOffset($utcOffset)
{
try {
if (preg_match('/^([\+\-])(\d{2}):(\d{2})$/', $utcOffset, $arrayMatch)) {
$sign = $arrayMatch[1];
$h = (int)($arrayMatch[2]);
$m = (int)($arrayMatch[3]);
} else {
//Return
return 'UTC';
}
$offset = (($sign == '+')? '' : '-') . (($h * 60 * 60) + ($m * 60)); //Convert UTC Offset to seconds
//Return
return self::getTimeZoneIdByTimeZoneOffset((int)($offset));
} catch (\Exception $e) {
throw $e;
}
}
/**
* Convert date from Time Zone to Time Zone
*
* @param string $date Date
* @param string $fromTimeZone Time Zone source
* @param string $toTimeZone Time Zone to convert
* @param string $format Format to return date
*
* @return string Return date
*/
public function convertTimeZone($date, $fromTimeZone, $toTimeZone, $format = 'Y-m-d H:i:s')
{
try {
$dt = new \DateTime($date, new \DateTimeZone($fromTimeZone)); //From Time Zone
$dt->setTimeZone(new \DateTimeZone($toTimeZone)); //To Time Zone
//Return
return $dt->format($format);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Convert ISO-8601 to Time Zone
*
* @param string $dateIso8601 Date
* @param string $toTimeZone Time Zone to convert
* @param string $format Format to return date
*
* @return string Return date
*/
public function convertIso8601ToTimeZone($dateIso8601, $toTimeZone, $format = 'Y-m-d H:i:s')
{
try {
$fromTimeZone = 'UTC';
if (preg_match('/^.+([\+\-]\d{2}:\d{2})$/', $dateIso8601, $arrayMatch)) {
$fromTimeZone = self::getTimeZoneIdByUtcOffset($arrayMatch[1]);
}
$dt = \DateTime::createFromFormat(self::ISO8601, $dateIso8601, new \DateTimeZone($fromTimeZone)); //From ISO-8601
$dt->setTimeZone(new \DateTimeZone($toTimeZone)); //To Time Zone
//Return
return $dt->format($format);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Convert ISO-8601/datetime/array-ISO-8601-datetime-data to Time Zone
*
* @param mixed $data Data
* @param string $fromTimeZone Time Zone source
* @param string $toTimeZone Time Zone to convert
* @param array $arrayKey Keys that convert to Time Zone
* @param string $format Format to return data
*
* @return mixed Return data
*/
public function convertDataToTimeZone($data, $fromTimeZone, $toTimeZone, array $arrayKey = [], $format = 'Y-m-d H:i:s')
{
try {
$regexpDatetime = '/^' . self::REGEXPDATE . '\s' . self::REGEXPTIME . '$/';
$regexpIso8601 = '/^' . self::REGEXPDATE . 'T' . self::REGEXPTIME . '[\+\-]\d{2}:\d{2}$/';
if (empty($data)) {
//Return
return $data;
}
switch (gettype($data)) {
case 'string':
if (is_string($data) && preg_match($regexpDatetime, $data)) {
if ($fromTimeZone != $toTimeZone) {
$data = self::convertTimeZone($data, $fromTimeZone, $toTimeZone, $format);
}
}
if (is_string($data) && preg_match($regexpIso8601, $data)) {
$data = self::convertIso8601ToTimeZone($data, $toTimeZone, $format);
}
break;
case 'array':
$regexpKey = (!empty($arrayKey))? '/^(?:' . implode('|', $arrayKey) . ')$/i': '';
array_walk_recursive(
$data,
function (&$value, $key, $arrayData)
{
try {
if ($arrayData['regexpKey'] == '' || preg_match($arrayData['regexpKey'], $key)) {
if (is_string($value) && preg_match($arrayData['regexpDatetime'], $value)) {
if ($arrayData['fromTimeZone'] != $arrayData['toTimeZone']) {
$value = self::convertTimeZone($value, $arrayData['fromTimeZone'], $arrayData['toTimeZone'], $arrayData['format']);
}
}
if (is_string($value) && preg_match($arrayData['regexpIso8601'], $value)) {
$value = self::convertIso8601ToTimeZone($value, $arrayData['toTimeZone'], $arrayData['format']);
}
}
} catch (\Exception $e) {
throw $e;
}
},
['fromTimeZone' => $fromTimeZone, 'toTimeZone' => $toTimeZone, 'format' => $format, 'regexpDatetime' => $regexpDatetime, 'regexpIso8601' => $regexpIso8601, 'regexpKey' => $regexpKey]
);
break;
case 'object':
$data = json_decode(json_encode($data), true);
$data = self::convertDataToTimeZone($data, $fromTimeZone, $toTimeZone, $arrayKey, $format);
$data = json_decode(json_encode($data));
break;
}
//Return
return $data;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Convert datetime/array-datetime-data to ISO-8601
*
* @param mixed $data Data
* @param string $fromTimeZone Time Zone source
* @param string $toTimeZone Time Zone to convert
* @param array $arrayKey Keys that convert to ISO-8601
*
* @return mixed Return data
*/
public function convertDataToIso8601($data, $fromTimeZone, $toTimeZone, array $arrayKey = [])
{
try {
$regexpDatetime = '/^' . self::REGEXPDATE . '\s' . self::REGEXPTIME . '$/';
if (empty($data)) {
//Return
return $data;
}
switch (gettype($data)) {
case 'string':
if (is_string($data) && preg_match($regexpDatetime, $data)) {
if ($fromTimeZone != $toTimeZone) {
$data = self::convertTimeZone($data, $fromTimeZone, $toTimeZone);
}
$dt = \DateTime::createFromFormat('Y-m-d H:i:s', $data, new \DateTimeZone($toTimeZone));
$data = $dt->format(self::ISO8601);
}
break;
case 'array':
$regexpKey = (!empty($arrayKey))? '/^(?:' . implode('|', $arrayKey) . ')$/i': '';
array_walk_recursive(
$data,
function (&$value, $key, $arrayData)
{
try {
if (($arrayData['regexpKey'] == '' || preg_match($arrayData['regexpKey'], $key)) &&
is_string($value) && preg_match($arrayData['regexpDatetime'], $value)
) {
if ($arrayData['fromTimeZone'] != $arrayData['toTimeZone']) {
$value = self::convertTimeZone($value, $arrayData['fromTimeZone'], $arrayData['toTimeZone']);
}
$dt = \DateTime::createFromFormat('Y-m-d H:i:s', $value, new \DateTimeZone($arrayData['toTimeZone']));
$value = $dt->format(self::ISO8601);
}
} catch (\Exception $e) {
throw $e;
}
},
['fromTimeZone' => $fromTimeZone, 'toTimeZone' => $toTimeZone, 'regexpDatetime' => $regexpDatetime, 'regexpKey' => $regexpKey]
);
break;
case 'object':
$data = json_decode(json_encode($data), true);
$data = self::convertDataToIso8601($data, $fromTimeZone, $toTimeZone, $arrayKey);
$data = json_decode(json_encode($data));
break;
}
//Return
return $data;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Convert ISO-8601/datetime/array-ISO-8601-datetime-data to UTC
*
* @param mixed $data Data
* @param array $arrayKey Keys that convert to UTC
* @param string $format Format to return data
*
* @return mixed Return data
*/
public static function convertDataToUtc($data, array $arrayKey = [], $format = 'Y-m-d H:i:s')
{
try {
if (!(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])) {
//Return
return $data;
}
$fromTimeZone = \ProcessMaker\BusinessModel\User::getUserLoggedTimeZone();
$toTimeZone = 'UTC';
//Return
return self::convertDataToTimeZone($data, $fromTimeZone, $toTimeZone, $arrayKey, $format);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Convert UTC to Time Zone
*
* @param mixed $data Data
* @param array $arrayKey Keys that convert to Time Zone
* @param string $format Format to return data
*
* @return mixed Return data
*/
public static function convertUtcToTimeZone($data, array $arrayKey = [], $format = 'Y-m-d H:i:s')
{
try {
if (!(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])) {
//Return
return $data;
}
$fromTimeZone = 'UTC';
$toTimeZone = \ProcessMaker\BusinessModel\User::getUserLoggedTimeZone();
//Return
return self::convertDataToTimeZone($data, $fromTimeZone, $toTimeZone, $arrayKey, $format);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Convert UTC to ISO-8601
*
* @param mixed $data Data
* @param array $arrayKey Keys that convert to ISO-8601
*
* @return mixed Return data
*/
public static function convertUtcToIso8601($data, array $arrayKey = [])
{
try {
if (!(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])) {
//Return
return $data;
}
$fromTimeZone = 'UTC';
$toTimeZone = \ProcessMaker\BusinessModel\User::getUserLoggedTimeZone();
//Return
return self::convertDataToIso8601($data, $fromTimeZone, $toTimeZone, $arrayKey);
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -14,6 +14,7 @@ var comboLocation;
var comboReplacedBy;
var comboCalendar;
var comboRole;
var cboTimeZone;
var comboDefaultMainMenuOption;
var comboDefaultCasesMenuOption;
@@ -401,6 +402,29 @@ Ext.onReady(function () {
mode : 'local'
});
cboTimeZone = new Ext.form.ComboBox({
id: "cboTimeZone",
name: "USR_TIME_ZONE",
valueField: "id",
displayField: "value",
value: SYSTEM_TIME_ZONE,
store: new Ext.data.ArrayStore({
idIndex: 0,
fields: ["id", "value"],
data: TIME_ZONE_DATA
}),
fieldLabel: _("ID_TIME_ZONE"),
triggerAction: "all",
mode: "local",
editable: false,
width: 260,
hidden: !(__SYSTEM_UTC_TIME_ZONE__ == 1)
});
var informationFields = new Ext.form.FieldSet({
title : _('ID_PERSONAL_INFORMATION'),
items : [
@@ -510,7 +534,8 @@ Ext.onReady(function () {
dateField,
comboCalendar,
comboStatus,
comboRole
comboRole,
cboTimeZone
]
});
/*----------------------------------********---------------------------------*/
@@ -925,6 +950,14 @@ Ext.onReady(function () {
fieldLabel : _('ID_ROLE'),
xtype : 'label',
width : 260
},
{
id: "USR_TIME_ZONE2",
fieldLabel: _("ID_TIME_ZONE"),
xtype: "label",
width: 260,
hidden: !(__SYSTEM_UTC_TIME_ZONE__ == 1)
}
]
});
@@ -1384,6 +1417,7 @@ function loadUserData()
Ext.getCmp("USR_DUE_DATE2").setText(data.user.USR_DUE_DATE);
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_COST_BY_HOUR2").setText(data.user.USR_COST_BY_HOUR);
Ext.getCmp("USR_UNIT_COST2").setText(data.user.USR_UNIT_COST);
@@ -1426,6 +1460,8 @@ function loadUserData()
comboRole.setValue(data.user.USR_ROLE);
});
cboTimeZone.setValue((data.user.USR_TIME_ZONE != "")? data.user.USR_TIME_ZONE : SYSTEM_TIME_ZONE);
if (infoMode) {
comboDefaultMainMenuOption.store.on("load", function (store) {
comboDefaultMainMenuOption.setValue(data.user.PREF_DEFAULT_MENUSELECTED);

View File

@@ -83,14 +83,14 @@
ini_set('default_charset', "UTF-8");
ini_set('memory_limit', $filter->validateInput($config['memory_limit']) );
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
ini_set('date.timezone', $filter->validateInput($config['time_zone']) );
ini_set('date.timezone', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])? 'UTC' : $config['time_zone']); //Set Time Zone
define ('DEBUG_SQL_LOG', $config['debug_sql']);
define ('DEBUG_TIME_LOG', $config['debug_time']);
define ('DEBUG_CALENDAR_LOG', $config['debug_calendar']);
define ('MEMCACHED_ENABLED', $config['memcached']);
define ('MEMCACHED_SERVER', $config['memcached_server']);
define ('TIME_ZONE', $config['time_zone']);
define ('TIME_ZONE', ini_get('date.timezone'));
// 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'];

View File

@@ -303,6 +303,12 @@ if ((preg_match("/msie/i", $_SERVER ['HTTP_USER_AGENT']) != 1 ||
}
session_start();
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($config['system_utc_time_zone']) == 1;
$_GET = \ProcessMaker\Util\DateTime::convertDataToUtc($_GET);
$_POST = \ProcessMaker\Util\DateTime::convertDataToUtc($_POST);
$_REQUEST = \ProcessMaker\Util\DateTime::convertDataToUtc($_REQUEST);
//$e_all = defined( 'E_DEPRECATED' ) ? E_ALL & ~ E_DEPRECATED : E_ALL;
//$e_all = defined( 'E_STRICT' ) ? $e_all & ~ E_STRICT : $e_all;
//$e_all = $config['debug'] ? $e_all : $e_all & ~ E_NOTICE;
@@ -323,7 +329,7 @@ ini_set( 'short_open_tag', 'On' );
ini_set( 'default_charset', "UTF-8" );
ini_set( 'memory_limit', $config['memory_limit'] );
ini_set( 'soap.wsdl_cache_enabled', $config['wsdl_cache'] );
ini_set( 'date.timezone', $config['time_zone'] );
ini_set('date.timezone', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])? 'UTC' : $config['time_zone']); //Set Time Zone
define( 'DEBUG_SQL_LOG', $config['debug_sql'] );
define( 'DEBUG_SQL', $config['debug'] );
@@ -331,7 +337,7 @@ define( 'DEBUG_TIME_LOG', $config['debug_time'] );
define( 'DEBUG_CALENDAR_LOG', $config['debug_calendar'] );
define( 'MEMCACHED_ENABLED', $config['memcached'] );
define( 'MEMCACHED_SERVER', $config['memcached_server'] );
define( 'TIME_ZONE', $config['time_zone'] );
define('TIME_ZONE', ini_get('date.timezone'));
define ('WS_IN_LOGIN', isset($config['WS_IN_LOGIN']) ? $config['WS_IN_LOGIN'] : 'serverconf');