mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-05-18 11:35:15 -04:00
Fix returning periods for sql when no attr
This commit is contained in:
@@ -32,7 +32,8 @@ class FilterTerm {
|
||||
|
||||
$this->index = $index;
|
||||
if ($term) {
|
||||
$this->attr = $term['attr'];
|
||||
Debug(print_r($term, true));
|
||||
$this->attr = isset($term['attr']) ? $term['attr'] : '';
|
||||
$this->op = $term['op'];
|
||||
$this->val = $term['val'];
|
||||
if ( isset($term['cnj']) ) {
|
||||
@@ -64,7 +65,7 @@ class FilterTerm {
|
||||
}
|
||||
} else {
|
||||
Warning("No term in FilterTerm constructor");
|
||||
Warning(print_r(debug_backtrace(), true));
|
||||
#Warning(print_r(debug_backtrace(), true));
|
||||
}
|
||||
} # end function __construct
|
||||
|
||||
@@ -72,7 +73,7 @@ class FilterTerm {
|
||||
public function sql_values() {
|
||||
$values = array();
|
||||
if ( !isset($this->val) ) {
|
||||
Logger::Warning('No value in term'.$this->attr);
|
||||
Warning('No value in term'.$this->attr);
|
||||
return $values;
|
||||
}
|
||||
|
||||
@@ -206,6 +207,9 @@ class FilterTerm {
|
||||
|
||||
/* Some terms don't have related SQL */
|
||||
public function sql() {
|
||||
if (!$this->attr) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sql = '';
|
||||
if ( isset($this->cnj) ) {
|
||||
@@ -507,6 +511,8 @@ class FilterTerm {
|
||||
|
||||
public function valid() {
|
||||
switch ($this->attr) {
|
||||
case 'EndDate' :
|
||||
case 'StartDate' :
|
||||
case 'EndDateTime' :
|
||||
case 'StartDateTime' :
|
||||
if (!$this->val)
|
||||
@@ -520,6 +526,9 @@ class FilterTerm {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public function to_string() {
|
||||
return print_r($this, true);
|
||||
}
|
||||
} # end class FilterTerm
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user