Handle missing cnj on terms
parent
a7a8681344
commit
704b3b2a80
|
@ -53,7 +53,11 @@ class Filter extends ZM_Object {
|
||||||
$this->_sql = '';
|
$this->_sql = '';
|
||||||
foreach ( $this->FilterTerms() as $term ) {
|
foreach ( $this->FilterTerms() as $term ) {
|
||||||
if ($term->valid()) {
|
if ($term->valid()) {
|
||||||
if (!$this->_sql and $term->cnj) unset($term->cnj);
|
if (!$this->_sql) {
|
||||||
|
if ($term->cnj) unset($term->cnj);
|
||||||
|
} else {
|
||||||
|
if (!$term->cnj) $term->cnj = 'and';
|
||||||
|
}
|
||||||
$this->_sql .= $term->sql();
|
$this->_sql .= $term->sql();
|
||||||
} else {
|
} else {
|
||||||
Debug('Term is not valid '.$term->to_string());
|
Debug('Term is not valid '.$term->to_string());
|
||||||
|
@ -694,11 +698,6 @@ class Filter extends ZM_Object {
|
||||||
else if ( $position < 0 )
|
else if ( $position < 0 )
|
||||||
$position = 0;
|
$position = 0;
|
||||||
|
|
||||||
if ( $term && ($position == 0) ) {
|
|
||||||
# if only 1 term, don't need AND or OR
|
|
||||||
unset($term['cnj']);
|
|
||||||
}
|
|
||||||
|
|
||||||
array_splice($terms, $position, 0, array($term ? $term : array()));
|
array_splice($terms, $position, 0, array($term ? $term : array()));
|
||||||
$this->terms($terms);
|
$this->terms($terms);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue