Skip to content

Commit

Permalink
altered the way the prefilter published element check works. As prefi…
Browse files Browse the repository at this point in the history
…lters can be assigned to the menu item, you may have prefilters which do not relate to the list being shown (e.g. when list is rendered as a content plugin or with related data), Altered things so that we check first if element is loaded and then if specifically its unpublished
  • Loading branch information
pollen8 committed Feb 18, 2014
1 parent f7df6c5 commit 3c9eacc
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions components/com_fabrik/models/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -1813,8 +1813,6 @@ public function getRecordCounts(&$element, $pks = array())
// Ensure that the faceted list's "require filters" option is set to false
$fparams->set('require-filter', false);

$fparams->set('ignore_prefilter_msg', true);

// Ignore faceted lists session filters
$origIncSesssionFilters = $input->get('fabrik_incsessionfilters', true);
$input->set('fabrik_incsessionfilters', false);
Expand Down Expand Up @@ -5314,7 +5312,7 @@ public function getPrefilterArray(&$filters)
{
if (!isset($this->prefilters))
{
$elements = $this->getElements('filtername');
$elements = $this->getElements('filtername', false, false);
$params = $this->getParams();
list($afilterFields, $afilterConditions, $afilterValues, $afilterAccess, $afilterEval, $afilterJoins, $afilterGrouped) = $this->prefilterSetting();
$join = 'WHERE';
Expand Down Expand Up @@ -5345,7 +5343,7 @@ public function getPrefilterArray(&$filters)
{
continue;
}
// $tmpfilter = strstr($filter, '_raw') ? FabrikString::rtrimword( $filter, '_raw') : $filter;

$raw = preg_match("/_raw$/", $filter) > 0;
$tmpfilter = $raw ? FabrikString::rtrimword($filter, '_raw') : $filter;
$elementModel = JArrayHelper::getValue($elements, FabrikString::safeColName($tmpfilter), false);
Expand All @@ -5362,10 +5360,7 @@ public function getPrefilterArray(&$filters)
$elementModel = JArrayHelper::getValue($elements, FabrikString::safeColName($tmpfilter), false);
}

// List related data links - if prefilter set on main list menu item, we wont find the element in the related list, so don't raise error
$ignore = $params->get('ignore_prefilter_msg', false);

if ($elementModel === false && $condition !== 'exists' && $ignore === false)
if ($elementModel && $elementModel->getElement()->published == 0)
{
// Include the JLog class.
jimport('joomla.log.log');
Expand Down

0 comments on commit 3c9eacc

Please sign in to comment.