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:
@@ -343,7 +343,7 @@ class WebApplication
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// Register API Plugins classes
|
||||
$isPluginRequest = strpos($uri, '/plugin-') !== false ? true : false;
|
||||
|
||||
@@ -355,7 +355,7 @@ class WebApplication
|
||||
$pluginName = $tmp[1];
|
||||
$uri = str_replace('plugin-'.$pluginName, strtolower($pluginName), $uri);
|
||||
}
|
||||
|
||||
|
||||
// hook to get rest api classes from plugins
|
||||
if (class_exists('PMPluginRegistry') && file_exists(PATH_DATA_SITE . 'plugin.singleton')) {
|
||||
$pluginRegistry = \PMPluginRegistry::loadSingleton(PATH_DATA_SITE . 'plugin.singleton');
|
||||
@@ -367,12 +367,12 @@ class WebApplication
|
||||
|
||||
$loader = \Maveriks\Util\ClassLoader::getInstance();
|
||||
$loader->add($pluginSourceDir);
|
||||
|
||||
|
||||
foreach ($plugin as $class) {
|
||||
if (class_exists($class['namespace'])) {
|
||||
$this->rest->addAPIClass($class['namespace'], strtolower($pluginName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* defines.php
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
//***************** URL KEY *********************************************
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* defines.php
|
||||
*
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
@@ -14,13 +14,13 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
//***************** URL KEY *********************************************
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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' );
|
||||
|
||||
@@ -80,7 +75,7 @@ $virtualURITable['/(*)'] = PATH_HTML;
|
||||
}
|
||||
|
||||
//************** verify if the URI is encrypted or not **************
|
||||
G::parseURI ( getenv( "REQUEST_URI" ) );
|
||||
G::parseURI ( getenv( "REQUEST_URI" ) );
|
||||
|
||||
//print '-' . SYS_TEMP .'-' . SYS_LANG. '-' . SYS_SKIN.'-' . SYS_COLLECTION.'-' . SYS_TARGET.'<br>';
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -184,8 +185,8 @@ class System
|
||||
* the distro name, such as "CentOS release 5.3 (Final)" or "Ubuntu 10.10"
|
||||
*/
|
||||
$distro = '';
|
||||
if (file_exists("/dev/")){ //Windows does not have this folder
|
||||
$distro = exec( "lsb_release -d -s 2> /dev/null" );
|
||||
if (file_exists("/dev/")){ //Windows does not have this folder
|
||||
$distro = exec( "lsb_release -d -s 2> /dev/null" );
|
||||
}
|
||||
|
||||
/* For distros without lsb_release, we look for *release (such as
|
||||
@@ -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 = '')
|
||||
|
||||
@@ -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.');
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)';
|
||||
|
||||
@@ -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."/>
|
||||
|
||||
@@ -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' );
|
||||
@@ -204,7 +198,7 @@ class Admin extends Controller
|
||||
$this->setView('admin/maintenance');
|
||||
$this->render('extJs');
|
||||
}
|
||||
|
||||
|
||||
function getSystemInfo ()
|
||||
{
|
||||
$this->setResponseType( 'json' );
|
||||
@@ -217,7 +211,7 @@ class Admin extends Controller
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
private function _getSystemInfo ()
|
||||
{
|
||||
G::LoadClass( "system" );
|
||||
@@ -263,7 +257,7 @@ class Admin extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (file_exists(PATH_HTML . "lib/versions")) {
|
||||
$versions = json_decode(file_get_contents(PATH_HTML . "lib/versions"), true);
|
||||
$pmuiVer = $versions["pmui_ver"];
|
||||
@@ -341,7 +335,7 @@ class Admin extends Controller
|
||||
|
||||
return $properties;
|
||||
}
|
||||
|
||||
|
||||
private function lookup ($target)
|
||||
{
|
||||
global $ntarget;
|
||||
|
||||
@@ -315,7 +315,7 @@ class Installer extends Controller
|
||||
$info->success = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$pathShared = $filter->validateInput($_REQUEST['pathShared'], 'path');
|
||||
@@ -392,11 +392,11 @@ class Installer extends Controller
|
||||
return $false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$logFile = $filter->validateInput($logFile, 'path');
|
||||
|
||||
|
||||
$fpt = fopen( $logFile, 'a' );
|
||||
fwrite( $fpt, sprintf( "%s %s\n", date( 'Y:m:d H:i:s' ), trim( $text ) ) );
|
||||
fclose( $fpt );
|
||||
@@ -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 );
|
||||
@@ -805,12 +813,12 @@ class Installer extends Controller
|
||||
|
||||
$this->mysqlFileQuery( PATH_RBAC_HOME . 'engine/data/mysql/schema.sql' );
|
||||
$this->mysqlFileQuery( PATH_RBAC_HOME . 'engine/data/mysql/insert.sql' );
|
||||
|
||||
|
||||
$query = sprintf( "USE %s;", $wf_workpace );
|
||||
$this->mysqlQuery( $query );
|
||||
$this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/schema.sql' );
|
||||
$this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/insert.sql' );
|
||||
|
||||
|
||||
|
||||
if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {
|
||||
$this->setPartner();
|
||||
@@ -1297,7 +1305,7 @@ class Installer extends Controller
|
||||
}
|
||||
|
||||
$db_host = ($db_port != '' && $db_port != 1433) ? $db_hostname . ':' . $db_port : $db_hostname;
|
||||
|
||||
|
||||
$link = @mysql_connect( $db_host, $db_username, $db_password );
|
||||
if (! $link) {
|
||||
$info->message .= G::LoadTranslation('ID_MYSQL_CREDENTIALS_WRONG');
|
||||
@@ -1305,7 +1313,7 @@ class Installer extends Controller
|
||||
}
|
||||
$db_username = $filter->validateInput($db_username, 'nosql');
|
||||
$db_hostname = $filter->validateInput($db_hostname, 'nosql');
|
||||
$query = "SELECT * FROM `information_schema`.`USER_PRIVILEGES` where (GRANTEE = \"'%s'@'%s'\" OR GRANTEE = \"'%s'@'%%'\") ";
|
||||
$query = "SELECT * FROM `information_schema`.`USER_PRIVILEGES` where (GRANTEE = \"'%s'@'%s'\" OR GRANTEE = \"'%s'@'%%'\") ";
|
||||
$query = $filter->preventSqlInjection($query, array($db_username, $db_hostname, $db_username));
|
||||
$res = @mysql_query( $query, $link );
|
||||
$row = @mysql_fetch_array( $res );
|
||||
@@ -1350,7 +1358,7 @@ class Installer extends Controller
|
||||
}
|
||||
|
||||
$db_host = ($db_port != '' && $db_port != 1433) ? $db_hostname . ':' . $db_port : $db_hostname;
|
||||
|
||||
|
||||
$link = @mssql_connect( $db_host, $db_username, $db_password );
|
||||
if (! $link) {
|
||||
$info->message .= G::LoadTranslation('ID_MYSQL_CREDENTIALS_WRONG');
|
||||
@@ -1665,7 +1673,7 @@ class Installer extends Controller
|
||||
$wf = $filter->validateInput($wf);
|
||||
|
||||
$db_host = ($db_port != '' && $db_port != 3306) ? $db_hostname . ':' . $db_port : $db_hostname;
|
||||
|
||||
|
||||
$link = @mysql_connect( $db_host, $db_username, $db_password );
|
||||
@mysql_select_db($wf, $link);
|
||||
$res = mysql_query( "SELECT STORE_ID FROM ADDONS_MANAGER WHERE ADDON_NAME = '" . $namePlugin . "'", $link );
|
||||
|
||||
@@ -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';
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -181,7 +181,7 @@ $ieVersion = null;
|
||||
if(preg_match("/^.*\(.*MSIE (\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch) || preg_match("/^.*\(.*rv.(\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)){
|
||||
$ieVersion = intval($arrayMatch[1]);
|
||||
}
|
||||
|
||||
|
||||
if (isset( $_GET['breakpoint'] ) && $ieVersion != 11) {
|
||||
|
||||
$G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameLoader' );
|
||||
@@ -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':
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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']);
|
||||
|
||||
@@ -30,7 +30,7 @@ $dir = isset( $_POST['dir'] ) ? $_POST['dir'] : 'ASC';
|
||||
$sort = isset( $_POST['sort'] ) ? $_POST['sort'] : '';
|
||||
|
||||
$oProcess = new Process();
|
||||
$oProcess->dir = $dir;
|
||||
$oProcess->dir = $dir;
|
||||
$oProcess->sort = $sort;
|
||||
|
||||
//$memcache = & PMmemcached::getSingleton( SYS_SYS );
|
||||
@@ -55,8 +55,8 @@ if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
|
||||
$proData = array_splice($proData, $start, $limit);
|
||||
$memcacheUsed = 'no';
|
||||
} else {
|
||||
$proData = $oProcess->orderMemcache($proData, $start, $limit);
|
||||
$totalCount = $proData->totalCount;
|
||||
$proData = $oProcess->orderMemcache($proData, $start, $limit);
|
||||
$totalCount = $proData->totalCount;
|
||||
$proData = $proData->dataMemcache;
|
||||
}
|
||||
} else {
|
||||
@@ -65,7 +65,7 @@ if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
|
||||
$memcacheUsed = 'yes';
|
||||
if (($proData = $memcache->get( $memkey )) === false || ($totalCount = $memcache->get( $memkeyTotal )) === false) {
|
||||
$proData = $oProcess->getAllProcesses( $start, $limit, null, null, true, false, $_SESSION["USER_LOGGED"]);
|
||||
$totalCount = count($proData);
|
||||
$totalCount = count($proData);
|
||||
$proData = array_splice($proData, $start, $limit);
|
||||
$memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR );
|
||||
$memcache->set( $memkeyTotal, $totalCount, PMmemcached::ONE_HOUR );
|
||||
@@ -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 );
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$_POST = $filter->xssFilterHard($_POST);
|
||||
if(isset($_SESSION['USER_LOGGED'])) {
|
||||
$_SESSION['USER_LOGGED'] = $filter->xssFilterHard($_SESSION['USER_LOGGED']);
|
||||
}
|
||||
if(isset($_SESSION['USR_USERNAME'])) {
|
||||
$_SESSION['USR_USERNAME'] = $filter->xssFilterHard($_SESSION['USR_USERNAME']);
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$_POST = $filter->xssFilterHard($_POST);
|
||||
if(isset($_SESSION['USER_LOGGED'])) {
|
||||
$_SESSION['USER_LOGGED'] = $filter->xssFilterHard($_SESSION['USER_LOGGED']);
|
||||
}
|
||||
if(isset($_SESSION['USR_USERNAME'])) {
|
||||
$_SESSION['USR_USERNAME'] = $filter->xssFilterHard($_SESSION['USR_USERNAME']);
|
||||
}
|
||||
|
||||
global $RBAC;
|
||||
@@ -18,7 +18,7 @@ switch ($_POST['action']) {
|
||||
$c = new Criteria();
|
||||
$c->add(IsoCountryPeer::IC_UID, null, Criteria::ISNOTNULL);
|
||||
$c->addAscendingOrderByColumn(IsoCountryPeer::IC_NAME);
|
||||
|
||||
|
||||
$countries = IsoCountryPeer::doSelect($c);
|
||||
foreach ($countries as $rowid => $row) {
|
||||
$oData[] = Array('IC_UID' => $row->getICUid(), 'IC_NAME' => $row->getICName());
|
||||
@@ -92,7 +92,7 @@ switch ($_POST['action']) {
|
||||
$aUserInfo[] = array('USR_UID' => $aRow1['USR_UID'], 'USER_FULLNAME' => $infoUser);
|
||||
}
|
||||
print (G::json_encode($aUserInfo));
|
||||
|
||||
|
||||
break;
|
||||
case 'availableCalendars':
|
||||
G::LoadClass('calendar');
|
||||
@@ -163,14 +163,15 @@ switch ($_POST['action']) {
|
||||
$status = $form['USR_STATUS'] ? " - Status: ". $form['USR_STATUS'] : "";
|
||||
}
|
||||
$address = $form['USR_ADDRESS'] ? " - Address: ". $form['USR_ADDRESS'] : "";
|
||||
$phone = $form['USR_PHONE'] ? " - Phone: ". $form['USR_PHONE'] : "";
|
||||
$zipCode = $form['USR_ZIP_CODE'] ? " - Zip Code: ". $form['USR_ZIP_CODE'] : "";
|
||||
$position = $form['USR_POSITION'] ? " - Position: ". $form['USR_POSITION'] : "";
|
||||
$phone = $form['USR_PHONE'] ? " - Phone: ". $form['USR_PHONE'] : "";
|
||||
$zipCode = $form['USR_ZIP_CODE'] ? " - Zip Code: ". $form['USR_ZIP_CODE'] : "";
|
||||
$position = $form['USR_POSITION'] ? " - Position: ". $form['USR_POSITION'] : "";
|
||||
$role = $form['USR_ROLE'] ? " - Role: ". $form['USR_ROLE'] : "";
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$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,12 +216,13 @@ 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);
|
||||
if ($_FILES['USR_PHOTO']['tmp_name'] != '') {
|
||||
@@ -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']);
|
||||
@@ -572,12 +578,12 @@ switch ($_POST['action']) {
|
||||
$aFields['USER_LOGGED_ROLE'] = $aUserLog['USR_ROLE'];
|
||||
|
||||
$aFields['CASES_MENUSELECTED_NAME'] = $casesMenuSelected;
|
||||
|
||||
|
||||
require_once 'classes/model/UsersProperties.php';
|
||||
$oUserProperty = new UsersProperties();
|
||||
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($aFields['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array($aFields['USR_PASSWORD']))));
|
||||
$aFields['USR_LOGGED_NEXT_TIME'] = $aUserProperty['USR_LOGGED_NEXT_TIME'];
|
||||
|
||||
|
||||
$result->success = true;
|
||||
$result->user = $aFields;
|
||||
|
||||
@@ -602,8 +608,8 @@ switch ($_POST['action']) {
|
||||
case 'PM_DASHBOARD':
|
||||
$rows[] = Array('id' => 'PM_DASHBOARD', 'name' => strtoupper(G::LoadTranslation('ID_DASHBOARD'))
|
||||
);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
// NEW DASHBOARD MODULE
|
||||
/*----------------------------------********---------------------------------*/
|
||||
// NEW DASHBOARD MODULE
|
||||
$licensedFeatures = & PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=')) {
|
||||
$rows[] = Array('id' => 'PM_STRATEGIC_DASHBOARD', 'name' => strtoupper(G::LoadTranslation('ID_STRATEGIC_DASHBOARD'))
|
||||
|
||||
@@ -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' );
|
||||
|
||||
|
||||
@@ -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' );
|
||||
|
||||
@@ -1,25 +1,32 @@
|
||||
<?php
|
||||
<?php
|
||||
global $RBAC;
|
||||
$RBAC->requirePermissions( 'PM_USERS' );
|
||||
|
||||
|
||||
//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;
|
||||
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
$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', '' );
|
||||
$oHeadPublisher->assign( 'MODE', $_GET['MODE'] );
|
||||
$oHeadPublisher->assign( 'MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ' );
|
||||
$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' );
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ class SkinEngine
|
||||
$freeOfChargeText = "";
|
||||
if (! defined('SKIP_FREE_OF_CHARGE_TEXT'))
|
||||
$freeOfChargeText = "Supplied free of charge with no support, certification, warranty, <br>maintenance nor indemnity by Processmaker and its Certified Partners.";
|
||||
if(file_exists(PATH_CLASSES."class.pmLicenseManager.php")) $freeOfChargeText="";
|
||||
if(file_exists(PATH_CLASSES."class.pmLicenseManager.php")) $freeOfChargeText="";
|
||||
|
||||
$fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
|
||||
if (file_exists($fileFooter)) {
|
||||
@@ -706,7 +706,7 @@ class SkinEngine
|
||||
$freeOfChargeText = "";
|
||||
if (! defined('SKIP_FREE_OF_CHARGE_TEXT'))
|
||||
$freeOfChargeText = "Supplied free of charge with no support, certification, warranty, maintenance nor indemnity by ProcessMaker and its Certified Partners.";
|
||||
if(file_exists(PATH_CLASSES."class.pmLicenseManager.php")) $freeOfChargeText="";
|
||||
if(file_exists(PATH_CLASSES."class.pmLicenseManager.php")) $freeOfChargeText="";
|
||||
|
||||
$fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
|
||||
if (file_exists($fileFooter)) {
|
||||
@@ -759,11 +759,11 @@ 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'] : '');
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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"],
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$this->getFieldNameByFormatFieldName("USR_COST_BY_HOUR") => $record["USR_COST_BY_HOUR"],
|
||||
$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 = [];
|
||||
$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'];
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_COST_BY_HOUR')] = $record['USR_COST_BY_HOUR'];
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_UNIT_COST')] = $record['USR_UNIT_COST'];
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
361
workflow/engine/src/ProcessMaker/Util/DateTime.php
Normal file
361
workflow/engine/src/ProcessMaker/Util/DateTime.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,7 +950,15 @@ 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);
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
//$e_all = E_ALL & ~ E_DEPRECATED & ~ E_STRICT & ~ E_NOTICE & ~E_WARNING;
|
||||
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$filter = new InputFilter();
|
||||
$config['display_errors'] = $filter->validateInput($config['display_errors']);
|
||||
$config['error_reporting'] = $filter->validateInput($config['error_reporting']);
|
||||
$config['memory_limit'] = $filter->validateInput($config['memory_limit']);
|
||||
@@ -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'];
|
||||
@@ -276,7 +276,7 @@
|
||||
//Load filter class
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
|
||||
|
||||
// Installer, redirect to install if we don't have a valid shared data folder
|
||||
if ( !defined('PATH_DATA') || !file_exists(PATH_DATA)) {
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user