From 21a5a2d4ef78408295e70c8f78a30039bdbb7277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Mon, 25 Jun 2018 09:59:36 +0000 Subject: [PATCH] =?UTF-8?q?N=C2=B01522=20-=20Dashlet=20group=20by=20on=20s?= =?UTF-8?q?topwatch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:trunk[5904] --- application/dashboard.class.inc.php | 6 ++++-- application/dashlet.class.inc.php | 18 +++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/application/dashboard.class.inc.php b/application/dashboard.class.inc.php index aa9632012..fcc1cd478 100644 --- a/application/dashboard.class.inc.php +++ b/application/dashboard.class.inc.php @@ -256,9 +256,11 @@ abstract class Dashboard { $sDashletClass = $aDashletParams['dashlet_class']; $sId = $aDashletParams['dashlet_id']; - $sType = $aDashletParams['dashlet_type']; $oNewDashlet = new $sDashletClass($this->oMetaModel, $sId); - $oNewDashlet->SetDashletType($sType); + if (isset($aDashletParams['dashlet_type'])) + { + $oNewDashlet->SetDashletType($aDashletParams['dashlet_type']); + } $oForm = $oNewDashlet->GetForm(); $oForm->SetParamsContainer($sId); $oForm->SetPrefix(''); diff --git a/application/dashlet.class.inc.php b/application/dashlet.class.inc.php index 0b3237178..39687e4aa 100644 --- a/application/dashlet.class.inc.php +++ b/application/dashlet.class.inc.php @@ -827,14 +827,17 @@ abstract class DashletGroupBy extends Dashlet if (empty($this->aProperties['order_direction'])) { $aAttributeTypes = $this->oModelReflection->ListAttributes($this->sClass); - $sAttributeType = $aAttributeTypes[$this->sGroupByAttCode]; - if (is_subclass_of($sAttributeType, 'AttributeDateTime') || $sAttributeType == 'AttributeDateTime') + if (isset($aAttributeTypes[$this->sGroupByAttCode])) { - $this->sOrderDirection = 'asc'; - } - else - { - $this->sOrderDirection = 'desc'; + $sAttributeType = $aAttributeTypes[$this->sGroupByAttCode]; + if (is_subclass_of($sAttributeType, 'AttributeDateTime') || $sAttributeType == 'AttributeDateTime') + { + $this->sOrderDirection = 'asc'; + } + else + { + $this->sOrderDirection = 'desc'; + } } } else @@ -1199,6 +1202,7 @@ abstract class DashletGroupBy extends Dashlet case 'AttributeDuration': case 'AttributeInteger': case 'AttributePercentage': + case 'AttributeSubItem': // TODO: Known limitation: no unit displayed (values in sec) $sLabel = $this->oModelReflection->GetLabel($sClass, $sAttCode); $aFunctionAttributes[$sAttCode] = $sLabel; break;