PMCORE-976

This commit is contained in:
Paula Quispe
2021-03-03 14:03:20 -04:00
parent 1cbb780e76
commit e678760a08
11 changed files with 66 additions and 23 deletions

View File

@@ -395,10 +395,11 @@ class Ajax
} catch (Exception $oError) {
$processData['PRO_AUTHOR'] = '(USER DELETED)';
}
// Apply mask
$dateLabel = applyMaskDateEnvironment($processData['PRO_CREATE_DATE'],'', false);
// Apply the timezone
$processData['PRO_CREATE_DATE'] = DateTime::convertUtcToTimeZone($dateLabel);
$conf = new Configurations();
$conf->getFormats();
$processData['PRO_CREATE_DATE'] = $conf->getSystemDate($processData['PRO_CREATE_DATE']);
print(G::json_encode($processData));
}
@@ -432,6 +433,12 @@ class Ajax
$task = new ModelTask();
$taskData = $task->information($_SESSION['APPLICATION'], $taskUid, $_SESSION['INDEX']);
// Apply mask
$dateInitLabel = applyMaskDateEnvironment($taskData['INIT_DATE'],'', false);
$dateDueLabel = applyMaskDateEnvironment($taskData['DUE_DATE'],'', false);
// Apply the timezone
$taskData['INIT_DATE_LABEL'] = DateTime::convertUtcToTimeZone($dateInitLabel);
$taskData['DUE_DATE_LABEL'] = DateTime::convertUtcToTimeZone($dateDueLabel);
$taskData = DateTime::convertUtcToTimeZone($taskData);
print(G::json_encode($taskData));

View File

@@ -29,6 +29,18 @@ switch ($actionAjax) {
while ($dataSet->next()) {
$result = $dataSet->getRow();
$result['ID_HISTORY'] = $result['PRO_UID'] . '_' . $result['APP_UID'] . '_' . $result['TAS_UID'];
// Apply mask
$dateInitLabel = applyMaskDateEnvironment($result['DEL_INIT_DATE'],'', false);
$dateDelLabel = applyMaskDateEnvironment($result['DEL_DELEGATE_DATE'],'', false);
$dateEndLabel = '-';
// @todo the query for get this '-' needs an update
if ($result['DEL_FINISH_DATE'] != "-") {
$dateEndLabel = applyMaskDateEnvironment($result['DEL_FINISH_DATE'],'', false);
}
// Apply the timezone
$result['DEL_INIT_DATE_LABEL'] = DateTime::convertUtcToTimeZone($dateInitLabel);
$result['DEL_DELEGATE_DATE_LABEL'] = DateTime::convertUtcToTimeZone($dateDelLabel);
$result['DEL_FINISH_DATE_LABEL'] = DateTime::convertUtcToTimeZone($dateEndLabel);
$process[] = $result;
}

View File

@@ -20,6 +20,9 @@ switch ($actionAjax) {
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'DESC';
$sort = isset($_POST['sort']) ? $_POST['sort'] : '';
if ($sort === 'APP_MSG_DATE_LABEL') {
$sort = 'APP_MSG_DATE';
}
global $G_PUBLISH;
$case = new Cases();
@@ -86,7 +89,10 @@ switch ($actionAjax) {
if ($respMess == 'BLOCK' || $respMess == '') {
$appMessageArray[$index]['APP_MSG_BODY'] = '';
}
$appMessageArray[$index]['APP_MSG_DATE'] = DateTime::convertUtcToTimeZone($appMessageArray[$index]['APP_MSG_DATE']);
// Apply mask
$dateLabel = applyMaskDateEnvironment($appMessageArray[$index]['APP_MSG_DATE'], '', false);
// Apply the timezone
$appMessageArray[$index]['APP_MSG_DATE_LABEL'] = DateTime::convertUtcToTimeZone($dateLabel);
$messageList[] = array_merge($appMessageArray[$index], ['MSGS_HISTORY' => $respMess]);
}
}

View File

@@ -669,7 +669,10 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
while ($rs->next()) {
$result = $rs->getRow();
$result["TYPE"] = (array_key_exists($result["TYPE"], $arrayToTranslation)) ? $arrayToTranslation[$result["TYPE"]] : $result["TYPE"];
$result['CREATE_DATE'] = DateTime::convertUtcToTimeZone($result['CREATE_DATE']);
// Apply mask
$dateLabel = applyMaskDateEnvironment($result['CREATE_DATE'], '', false);
// Apply the timezone
$result['CREATE_DATE_LABEL'] = DateTime::convertUtcToTimeZone($dateLabel);
$aProcesses[] = $result;
}
@@ -711,7 +714,10 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
$result["FILEDOCEXIST"] = ($result["FILEDOC"]);
$result["FILEPDFEXIST"] = ($result["FILEPDF"]);
$result["DELETE_FILE"] = (isset($result['ID_DELETE']) && $result['ID_DELETE'] == 'Delete') ? true : false;
$result['CREATE_DATE'] = DateTime::convertUtcToTimeZone($result['CREATE_DATE']);
// Apply mask
$dateLabel = applyMaskDateEnvironment($result['CREATE_DATE'],'', false);
// Apply the timezone
$result['CREATE_DATE_LABEL'] = DateTime::convertUtcToTimeZone($dateLabel);
$aProcesses[] = $result;
$rs->next();

View File

@@ -5,6 +5,7 @@ namespace ProcessMaker\ChangeLog;
use Cases;
use G;
use ProcessMaker\ChangeLog\LogStruct;
use ProcessMaker\Util\DateTime;
use Propel;
class ChangeLogResult
@@ -149,12 +150,16 @@ class ChangeLogResult
$count = 0;
foreach ($appData as $key => $value) {
if ($hasPermission && (!isset($values[$key]) || $values[$key] !== $value)) {
// Apply mask
$dateLabel = applyMaskDateEnvironment($row['DATE'],'', false);
// Apply the timezone
$dateLabel = DateTime::convertUtcToTimeZone($dateLabel);
$previousValue = !isset($values[$key]) ? null : $values[$key];
$record = ''
. G::LoadTranslation('ID_TASK') . ': ' . $row['TAS_TITLE'] . ' / '
. G::LoadTranslation('ID_DYNAFORM') . ': ' . $row['DYN_TITLE'] . ' / '
. G::LoadTranslation('ID_LAN_UPDATE_DATE') . ': ' . $row['DATE'] . ' / '
. G::LoadTranslation('ID_LAN_UPDATE_DATE') . ': ' . $dateLabel . ' / '
. G::LoadTranslation('ID_USER') . ': ' . $row['USR_USERNAME'] . ' / '
. G::LoadTranslation('ID_FROM') . ': ' . ChangeLog::getChangeLog()->getApplicationNameById($row['SOURCE_ID']);

View File

@@ -606,17 +606,24 @@ function getMysqlVersion()
*
* @param string $date in the format <Y-m-d H:m:d>
* @param string $mask
* @param bool $caseListSetting
*
* @return string
*/
function applyMaskDateEnvironment(string $date, $mask = '')
function applyMaskDateEnvironment(string $date, $mask = '', $caseListSetting = true)
{
$result = '';
if (empty($mask)) {
$systemConf = new Configurations();
$systemConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
if ($caseListSetting) {
// Format defined in Cases list: Date Format
$mask = isset($systemConf->aConfig['casesListDateFormat']) ? $systemConf->aConfig['casesListDateFormat'] : '';
} else {
// Format defined in Regional Settings: Global Date Format
$mask = isset($systemConf->aConfig['dateFormat']) ? $systemConf->aConfig['dateFormat'] : '';
}
}
if (!empty($date) && !empty($mask)) {
$date = new DateTime($date);
$result = $date->format($mask);

View File

@@ -192,13 +192,13 @@
{name : 'TAS_TITLE'},
{name : 'PRO_STATUS'},
{name : 'PRO_STATUS_LABEL'},
{name : 'DEL_INIT_DATE'},
{name : 'DEL_INIT_DATE_LABEL'},
{name : 'PRO_DEBUG'},
{name : 'PRO_DEBUG_LABEL'},
{name : 'DEL_DELEGATE_DATE'},
{name : 'DEL_DELEGATE_DATE_LABEL'},
{name : 'CASES_COUNT', type:'float'},
{name : 'APP_TYPE'},
{name : 'DEL_FINISH_DATE'},
{name : 'DEL_FINISH_DATE_LABEL'},
{name : 'APP_ENABLE_ACTION_DATE'},
{name : 'APP_DISABLE_ACTION_DATE'}
]
@@ -282,9 +282,9 @@
color = r.get('PRO_STATUS') == 'ACTIVE'? 'green': 'red';
return String.format("<font color='{0}'>{1}</font>", color, v);
}},*/
{header: _("ID_TASK_TRANSFER"), dataIndex: 'DEL_DELEGATE_DATE', width: 60, renderer:startDateRender},
{header: _("ID_START_DATE"), dataIndex: 'DEL_INIT_DATE', width: 60, renderer: startDateRender},
{header: _("ID_END_DATE"), dataIndex: 'DEL_FINISH_DATE', width: 60, renderer:startDateRender},
{header: _("ID_TASK_TRANSFER"), dataIndex: 'DEL_DELEGATE_DATE_LABEL', width: 60},
{header: _("ID_START_DATE"), dataIndex: 'DEL_INIT_DATE_LABEL', width: 60},
{header: _("ID_END_DATE"), dataIndex: 'DEL_FINISH_DATE_LABEL', width: 60},
{header: _("ID_ACTION"), dataIndex: 'APP_TYPE', width: 50, renderer: actionRenderingTranslation},
{header: _("ID_ENABLE_ACTION"), dataIndex: 'APP_ENABLE_ACTION_DATE', width: 70, renderer:startDateRender},
{header: _("ID_DISABLE_ACTION"), dataIndex: 'APP_DISABLE_ACTION_DATE', width: 70, renderer:startDateRender}

View File

@@ -325,7 +325,7 @@ function caseMessageHistory_RSP (response, id) {
fields: [
{name: 'ID_MESSAGE'},
{name: 'APP_MSG_TYPE'},
{name: 'APP_MSG_DATE'},
{name: 'APP_MSG_DATE_LABEL'},
{name: 'APP_MSG_SUBJECT'},
{name: 'APP_MSG_FROM'},
{name: 'APP_MSG_TO'},
@@ -404,7 +404,7 @@ function caseMessageHistory_RSP (response, id) {
columns: [
{id:'ID_MESSAGE', dataIndex: 'ID_MESSAGE', hidden:true, hideable:false},
{header: _("ID_TYPE"), dataIndex: 'APP_MSG_TYPE', width: 70},
{header: _("ID_DATE_LABEL"), dataIndex: 'APP_MSG_DATE', width: 60, renderer: startDateRender},
{header: _("ID_DATE_LABEL"), dataIndex: 'APP_MSG_DATE_LABEL', width: 60},
{header: _("ID_SUBJECT"), dataIndex: 'APP_MSG_SUBJECT', width: 60},
{header: _("ID_FROM"), dataIndex: 'APP_MSG_FROM', width: 60, renderer: escapeHtml},
{header: _("ID_TO"), dataIndex: 'APP_MSG_TO', width: 60, renderer: escapeHtml},

View File

@@ -233,7 +233,7 @@
{name : 'OUTDOCTITLE'},
{name : 'ORIGIN'},
{name : 'CREATED_BY'},
{name : 'CREATE_DATE'},
{name : 'CREATE_DATE_LABEL'},
{name : 'FILEDOCLABEL'},
{name : 'FILEPDFLABEL'},
{name : 'DELETE_FILE'},
@@ -329,7 +329,7 @@
{dataIndex: "OUTDOCTITLE", header: _("ID_OUTPUT_DOCUMENT"), sortable: true, width: 70},
{dataIndex: "ORIGIN", header: _("ID_ORIGIN_TASK"), sortable: true, width: 70},
{dataIndex: "CREATED_BY", header: _("ID_CREATED_BY"), sortable: true, width: 70},
{dataIndex: "CREATE_DATE", header: _("ID_CREATE_DATE"), sortable: true, width: 70, renderer: startDateRender},
{dataIndex: "CREATE_DATE_LABEL", header: _("ID_CREATE_DATE"), sortable: true, width: 70},
{dataIndex: "DELETE_FILE", header: _("ID_ACTIONS"), sortable: false, menuDisabled: true, hideable: false, width: 30, align: "center", renderer: renderDeleteFile}
]
}),

View File

@@ -325,7 +325,7 @@
{name : 'DOC_VERSION'},
{name : 'ORIGIN'},
{name : 'CREATED_BY'},
{name : 'CREATE_DATE'}
{name : 'CREATE_DATE_LABEL'}
]
}
)
@@ -408,7 +408,7 @@
{header: _("ID_VERSION"), dataIndex: 'DOC_VERSION', width: 70},
{header: _("ID_ORIGIN_TASK"), dataIndex: 'ORIGIN', width: 70},
{header: _("ID_CREATED_BY"), dataIndex: 'CREATED_BY', width: 70},
{header: _("ID_CREATE_DATE"), dataIndex: 'CREATE_DATE', width: 70,renderer:startDateRender}
{header: _("ID_CREATE_DATE"), dataIndex: 'CREATE_DATE_LABEL', width: 70}
]
}),

View File

@@ -767,8 +767,8 @@ Ext.onReady(function(){
items : [
{fieldLabel: _('ID_TITLE'), text: data.TAS_TITLE},
{fieldLabel: _('ID_DESCRIPTION'), text: data.TAS_DESCRIPTION},
{fieldLabel: _('ID_INIT_DATE'), text: data.INIT_DATE},
{fieldLabel: _('ID_DUE_DATE'), text: data.DUE_DATE},
{fieldLabel: _('ID_INIT_DATE'), text: data.INIT_DATE_LABEL},
{fieldLabel: _('ID_DUE_DATE'), text: data.DUE_DATE_LABEL},
{fieldLabel: _('ID_FINISH_DATE'), text: data.FINISH},
{fieldLabel: _('ID_TASK_DURATION'), text: data.DURATION}
]