From e4d167b33ed777fe8a73ddbfa8c875cf8d452f16 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 12 Dec 2022 12:56:09 -0500 Subject: [PATCH] Fix returning periods for sql when no attr --- web/includes/FilterTerm.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/web/includes/FilterTerm.php b/web/includes/FilterTerm.php index 121f5f626..8315020ab 100644 --- a/web/includes/FilterTerm.php +++ b/web/includes/FilterTerm.php @@ -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 ?>