PM-4413 "Cuando se tiene habilitado el timezone, el due date..." SOLVED
Issue:
Cuando se tiene habilitado el timezone, el due date del correo que envia processmaker no es correcto
Cause:
No se realiza la conversion de los datos al Time Zone del usuario
Solution:
Se hace la conversion de los datos al Time Zone del usuario
This commit is contained in:
@@ -5470,6 +5470,16 @@ class Cases
|
|||||||
$arrayData2 = $arrayData;
|
$arrayData2 = $arrayData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($aTask['USR_UID']) && !empty($aTask['USR_UID'])) {
|
||||||
|
$user = new \ProcessMaker\BusinessModel\User();
|
||||||
|
|
||||||
|
$arrayUserData = $user->getUser($aTask['USR_UID'], true);
|
||||||
|
|
||||||
|
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2, (trim($arrayUserData['USR_TIME_ZONE']) != '')? trim($arrayUserData['USR_TIME_ZONE']) : \ProcessMaker\Util\System::getTimeZone());
|
||||||
|
} else {
|
||||||
|
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2);
|
||||||
|
}
|
||||||
|
|
||||||
$sBody2 = G::replaceDataGridField($sBody, $arrayData2, false);
|
$sBody2 = G::replaceDataGridField($sBody, $arrayData2, false);
|
||||||
|
|
||||||
switch ($aTask["TAS_ASSIGN_TYPE"]) {
|
switch ($aTask["TAS_ASSIGN_TYPE"]) {
|
||||||
|
|||||||
@@ -393,15 +393,7 @@ class User
|
|||||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_PHOTO_PATH')] = $pathPhotoUser;
|
$arrayResult[$this->getFieldNameByFormatFieldName('USR_PHOTO_PATH')] = $pathPhotoUser;
|
||||||
|
|
||||||
if (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) {
|
if (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) {
|
||||||
$userTimeZone = $record['USR_TIME_ZONE'];
|
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TIME_ZONE')] = (trim($record['USR_TIME_ZONE']) != '')? trim($record['USR_TIME_ZONE']) : \ProcessMaker\Util\System::getTimeZone();
|
||||||
|
|
||||||
if (trim($userTimeZone) == '') {
|
|
||||||
$arraySystemConfiguration = \System::getSystemConfiguration('', '', SYS_SYS);
|
|
||||||
|
|
||||||
$userTimeZone = $arraySystemConfiguration['time_zone'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TIME_ZONE')] = $userTimeZone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
@@ -774,7 +766,7 @@ class User
|
|||||||
$rsCriteria = \UsersPeer::doSelectRS($criteria);
|
$rsCriteria = \UsersPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$rsCriteria->next();
|
$result = $rsCriteria->next();
|
||||||
|
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
|
|
||||||
|
|||||||
@@ -341,13 +341,14 @@ class DateTime
|
|||||||
/**
|
/**
|
||||||
* Convert UTC to Time Zone
|
* Convert UTC to Time Zone
|
||||||
*
|
*
|
||||||
* @param mixed $data Data
|
* @param mixed $data Data
|
||||||
* @param array $arrayKey Keys that convert to Time Zone
|
* @param string $toTimeZone Time Zone to convert
|
||||||
* @param string $format Format to return data
|
* @param array $arrayKey Keys that convert to Time Zone
|
||||||
|
* @param string $format Format to return data
|
||||||
*
|
*
|
||||||
* @return mixed Return data
|
* @return mixed Return data
|
||||||
*/
|
*/
|
||||||
public static function convertUtcToTimeZone($data, array $arrayKey = [], $format = 'Y-m-d H:i:s')
|
public static function convertUtcToTimeZone($data, $toTimeZone = null, array $arrayKey = [], $format = 'Y-m-d H:i:s')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (!(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])) {
|
if (!(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])) {
|
||||||
@@ -356,7 +357,7 @@ class DateTime
|
|||||||
}
|
}
|
||||||
|
|
||||||
$fromTimeZone = 'UTC';
|
$fromTimeZone = 'UTC';
|
||||||
$toTimeZone = \ProcessMaker\BusinessModel\User::getUserLoggedTimeZone();
|
$toTimeZone = (!is_null($toTimeZone))? $toTimeZone : \ProcessMaker\BusinessModel\User::getUserLoggedTimeZone();
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
return (new \ProcessMaker\Util\DateTime())->convertDataToTimeZone($data, $fromTimeZone, $toTimeZone, $arrayKey, $format);
|
return (new \ProcessMaker\Util\DateTime())->convertDataToTimeZone($data, $fromTimeZone, $toTimeZone, $arrayKey, $format);
|
||||||
|
|||||||
23
workflow/engine/src/ProcessMaker/Util/System.php
Normal file
23
workflow/engine/src/ProcessMaker/Util/System.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
namespace ProcessMaker\Util;
|
||||||
|
|
||||||
|
class System
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get Time Zone
|
||||||
|
*
|
||||||
|
* @return string Return Time Zone
|
||||||
|
*/
|
||||||
|
public static function getTimeZone()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$arraySystemConfiguration = \System::getSystemConfiguration('', '', SYS_SYS);
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return $arraySystemConfiguration['time_zone'];
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user