diff --git a/application/dashlet.class.inc.php b/application/dashlet.class.inc.php index 42eeca069..8ae3c5464 100644 --- a/application/dashlet.class.inc.php +++ b/application/dashlet.class.inc.php @@ -919,24 +919,28 @@ class DashletObjectList extends Dashlet */ public function Render($oPage, $bEditMode = false, $aExtraParams = array()) { - $sTitle = $this->aProperties['title']; - $sShowMenu = $this->aProperties['menu'] ? '1' : '0'; + try { + $sTitle = $this->aProperties['title']; + $sShowMenu = $this->aProperties['menu'] ? '1' : '0'; - $oPage->add('
'.Dict::S('UI:DashletGroupBy:MissingGroupBy').'
'); - } - else - { - switch($sStyle) + // First perform the query - if the OQL is not ok, it will generate an exception : no need to go further + if (isset($aExtraParams['query_params'])) { - case 'bars': - $sType = 'chart'; - $aParams = array( - 'chart_type' => 'bars', - 'chart_title' => $sTitle, - 'group_by' => $this->sGroupByExpr, - 'group_by_label' => $this->sGroupByLabel, - 'aggregation_function' => $this->sAggregationFunction, - 'aggregation_attribute' => $this->sAggregationAttribute, - 'limit' => $this->sLimit, - 'order_direction' => $this->sOrderDirection, - 'order_by' => $this->sOrderBy, - ); - $sHtmlTitle = ''; // done in the itop block - break; - - case 'pie': - $sType = 'chart'; - $aParams = array( - 'chart_type' => 'pie', - 'chart_title' => $sTitle, - 'group_by' => $this->sGroupByExpr, - 'group_by_label' => $this->sGroupByLabel, - 'aggregation_function' => $this->sAggregationFunction, - 'aggregation_attribute' => $this->sAggregationAttribute, - 'limit' => $this->sLimit, - 'order_direction' => $this->sOrderDirection, - 'order_by' => $this->sOrderBy, - ); - $sHtmlTitle = ''; // done in the itop block - break; - - case 'table': - default: - $sHtmlTitle = utils::HtmlEntities(Dict::S($sTitle)); // done in the itop block - $sType = 'count'; - $aParams = array( - 'group_by' => $this->sGroupByExpr, - 'group_by_label' => $this->sGroupByLabel, - 'aggregation_function' => $this->sAggregationFunction, - 'aggregation_attribute' => $this->sAggregationAttribute, - 'limit' => $this->sLimit, - 'order_direction' => $this->sOrderDirection, - 'order_by' => $this->sOrderBy, - ); - break; + $aQueryParams = $aExtraParams['query_params']; } - - $oPage->add(''.Dict::S('UI:DashletGroupBy:MissingGroupBy').'
'); + } else { + switch ($sStyle) { + case 'bars': + $sType = 'chart'; + $aParams = array( + 'chart_type' => 'bars', + 'chart_title' => $sTitle, + 'group_by' => $this->sGroupByExpr, + 'group_by_label' => $this->sGroupByLabel, + 'aggregation_function' => $this->sAggregationFunction, + 'aggregation_attribute' => $this->sAggregationAttribute, + 'limit' => $this->sLimit, + 'order_direction' => $this->sOrderDirection, + 'order_by' => $this->sOrderBy, + ); + $sHtmlTitle = ''; // done in the itop block + break; + + case 'pie': + $sType = 'chart'; + $aParams = array( + 'chart_type' => 'pie', + 'chart_title' => $sTitle, + 'group_by' => $this->sGroupByExpr, + 'group_by_label' => $this->sGroupByLabel, + 'aggregation_function' => $this->sAggregationFunction, + 'aggregation_attribute' => $this->sAggregationAttribute, + 'limit' => $this->sLimit, + 'order_direction' => $this->sOrderDirection, + 'order_by' => $this->sOrderBy, + ); + $sHtmlTitle = ''; // done in the itop block + break; + + case 'table': + default: + $sHtmlTitle = utils::HtmlEntities(Dict::S($sTitle)); // done in the itop block + $sType = 'count'; + $aParams = array( + 'group_by' => $this->sGroupByExpr, + 'group_by_label' => $this->sGroupByLabel, + 'aggregation_function' => $this->sAggregationFunction, + 'aggregation_attribute' => $this->sAggregationAttribute, + 'limit' => $this->sLimit, + 'order_direction' => $this->sOrderDirection, + 'order_by' => $this->sOrderBy, + ); + break; + } + + $oPage->add('