From 1893a2c7fe2e27777de3e7b679ff96cb72e2ac58 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 3 Mar 2022 14:14:26 -0700 Subject: [PATCH] Fix duration in infolog list --- api/js/etemplate/Et2Date/Et2DateDuration.ts | 12 ++++++--- infolog/inc/class.infolog_ui.inc.php | 4 +-- infolog/templates/default/index.xet | 29 +++++++++++++-------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/api/js/etemplate/Et2Date/Et2DateDuration.ts b/api/js/etemplate/Et2Date/Et2DateDuration.ts index 7e58523ddb..afa54fd435 100644 --- a/api/js/etemplate/Et2Date/Et2DateDuration.ts +++ b/api/js/etemplate/Et2Date/Et2DateDuration.ts @@ -263,11 +263,17 @@ export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement) transformAttributes(attrs) { - // Clean formats - if(typeof attrs.display_format === 'string') + // Clean formats, but avoid things that need to be expanded like $cont[display_format] + const check = new RegExp('[\$\@' + Object.keys(Et2DateDuration.time_formats).join('') + ']'); + for(let attr in ["display_format", "data_format"]) { - attrs.display_format = attrs.display_format.replace(/[^dhms]/g, ''); + if(typeof attrs[attrs] === 'string' && !check.test(attrs[attr])) + { + console.warn("Invalid format for " + attr + "'" + attrs[attr] + "'", this); + attrs[attr] = attrs[attr].replace(/[^dhms]/g, ''); + } } + super.transformAttributes(attrs); } diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index e6623090c2..08b57ba56b 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -55,7 +55,7 @@ class infolog_ui * * @var string */ - var $duration_format = ','; // comma is necessary! + var $duration_format = ''; var $icons = array( 'type' => array( @@ -1009,7 +1009,7 @@ class infolog_ui $values['action'] = $persist['action'] = $values['nm']['action'] = $action; $values['action_id'] = $persist['action_id'] = $values['nm']['action_id'] = $action_id; $values['action_title'] = $persist['action_title'] = $values['nm']['action_title'] = $action_title; - $values['duration_format'] = ','.$this->duration_format; + $values['duration_format'] = $this->duration_format; $persist['called_as'] = $called_as; $persist['own_referer'] = $own_referer; diff --git a/infolog/templates/default/index.xet b/infolog/templates/default/index.xet index 2fea7b8d9c..0dac18f865 100644 --- a/infolog/templates/default/index.xet +++ b/infolog/templates/default/index.xet @@ -103,26 +103,33 @@ - - - + + + - + - - - - - + + + + + - + - +