Fixed tags filter on Tree tags

This commit is contained in:
fermin831 2018-10-16 13:29:00 +02:00
parent 2f61ba70df
commit 0ca34c744d
2 changed files with 9 additions and 5 deletions

View File

@ -41,6 +41,8 @@ class Tree {
protected $L2conditionInside = '';
protected $L2inner = '';
protected $L3forceTagCondition = false;
const TV_DEFAULT_AGENT_STATUS = -1;
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
@ -891,7 +893,9 @@ class Tree {
$module_status_filter = $this->getModuleStatusFilterFromTestado();
$agent_filter = "AND ta.id_agente = " . $this->id;
$tag_condition = $this->getTagCondition();
$tag_join = empty($tag_condition) ? '' : $this->getTagJoin();
$tag_join = empty($tag_condition) && (!$this->L3forceTagCondition)
? ''
: $this->getTagJoin();
$condition = $this->L2condition;
$inner = $this->L2inner;
@ -922,6 +926,8 @@ class Tree {
$module_search_filter
$tag_condition
ORDER BY tam.nombre ASC, tam.id_agente_modulo ASC";
html_debug($sql, true);
html_debug($sql, true, true);
return $sql;
}

View File

@ -37,6 +37,8 @@ class TreeTag extends Tree {
$this->L2condition = "AND ttm.id_tag = " . $this->rootID;
$this->L2inner = $this->L1innerInside;
$this->L3forceTagCondition = true;
}
protected function getData() {
@ -52,10 +54,6 @@ class TreeTag extends Tree {
protected function getTagJoin () {
return '';
}
protected function getTagCondition () {
return '';
}
}
?>