Allow unknown columns in filters. Allow specifying the table name in FilterTerm.

This commit is contained in:
Isaac Connor 2021-03-12 10:52:10 -05:00
parent 9504d8be61
commit b50916e02a
2 changed files with 10 additions and 2 deletions

View File

@ -635,7 +635,7 @@ class Filter extends ZM_Object {
if ( !FilterTerm::is_valid_attr($term['attr']) ) {
Error('Unsupported filter attribute ' . $term['attr']);
return $this;
//return $this;
}
$terms = $this->terms();

View File

@ -41,6 +41,11 @@ class FilterTerm {
Warning('Invalid cnj ' . $term['cnj'].' in '.print_r($term, true));
}
}
if ( isset($term['tablename']) ) {
$this->tablename = $term['tablename'];
} else {
$this->tablename = 'E';
}
if ( isset($term['obr']) ) {
if ( (string)(int)$term['obr'] == $term['obr'] ) {
@ -288,7 +293,10 @@ class FilterTerm {
case 'Notes':
case 'StateId':
case 'Archived':
$sql .= 'E.'.$this->attr;
$sql .= $this->tablename.'.'.$this->attr;
break;
default :
$sql .= $this->tablename.'.'.$this->attr;
}
$sql .= $this->sql_operator();
$values = $this->sql_values();