diff --git a/application/dashlet.class.inc.php b/application/dashlet.class.inc.php index a1672ee21..7a861b520 100644 --- a/application/dashlet.class.inc.php +++ b/application/dashlet.class.inc.php @@ -781,7 +781,7 @@ class DashletObjectList extends Dashlet { $aQueryParams = $aExtraParams['query_params']; } - elseif (isset($aExtraParams['this->class'])) + elseif (isset($aExtraParams['this->class']) && isset($aExtraParams['this->id'])) { $oObj = MetaModel::GetObject($aExtraParams['this->class'], $aExtraParams['this->id']); $aQueryParams = $oObj->ToArgsForQuery(); @@ -1035,7 +1035,7 @@ abstract class DashletGroupBy extends Dashlet { $aQueryParams = $aExtraParams['query_params']; } - elseif (isset($aExtraParams['this->class'])) + elseif (isset($aExtraParams['this->class']) && isset($aExtraParams['this->id'])) { $oObj = MetaModel::GetObject($aExtraParams['this->class'], $aExtraParams['this->id']); $aQueryParams = $oObj->ToArgsForQuery(); diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index e984b8b30..94d6f329a 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -226,7 +226,17 @@ class DisplayBlock } else { - $aQueryParams = array(); + if (isset($aExtraParams['this->id']) && isset($aExtraParams['this->class'])) + { + $sClass = $aExtraParams['this->class']; + $iKey = $aExtraParams['this->id']; + $oObj = MetaModel::GetObject($sClass, $iKey); + $aQueryParams = array('this->object()' => $oObj); + } + else + { + $aQueryParams = array(); + } } $sFilter = $this->m_oFilter->serialize(false, $aQueryParams); // Used either for asynchronous or auto_reload @@ -326,13 +336,24 @@ class DisplayBlock $sHtml = ''; // Add the extra params into the filter if they make sense for such a filter $bDoSearch = utils::ReadParam('dosearch', false); + $aQueryParams = array(); + if (isset($aExtraParams['query_params'])) + { + $aQueryParams = $aExtraParams['query_params']; + } + else + { + if (isset($aExtraParams['this->id']) && isset($aExtraParams['this->class'])) + { + $sClass = $aExtraParams['this->class']; + $iKey = $aExtraParams['this->id']; + $oObj = MetaModel::GetObject($sClass, $iKey); + $aQueryParams = array('this->object()' => $oObj); + } + } if ($this->m_oSet == null) { - $aQueryParams = array(); - if (isset($aExtraParams['query_params'])) - { - $aQueryParams = $aExtraParams['query_params']; - } + // In case of search, the context filtering is done by the search itself if (($this->m_sStyle != 'links') && ($this->m_sStyle != 'search')) { @@ -931,7 +952,7 @@ class DisplayBlock $sHtml = "$sTitle
\n"; $sGroupBy = isset($aExtraParams['group_by']) ? $aExtraParams['group_by'] : ''; $sGroupByExpr = isset($aExtraParams['group_by_expr']) ? '¶ms[group_by_expr]='.$aExtraParams['group_by_expr'] : ''; - $sFilter = $this->m_oFilter->serialize(); + $sFilter = $this->m_oFilter->serialize(false, $aQueryParams); $oContext = new ApplicationContext(); $sContextParam = $oContext->GetForLink(); $sAggregationFunction = isset($aExtraParams['aggregation_function']) ? $aExtraParams['aggregation_function'] : '';