From 2bd0e82745cdf97e21848002b800372b94b30384 Mon Sep 17 00:00:00 2001 From: Devops Date: Tue, 30 May 2017 12:01:26 +0100 Subject: [PATCH] fix bug for extras --- lib/php/db/table.php | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/lib/php/db/table.php b/lib/php/db/table.php index fed26d64..bfa963e3 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -701,14 +701,9 @@ Class Table extends nb { $v = $this->db()->quote($v); $equal = ' '.($not ? 'NOT ' : '').$regexp.' '; - // Text -# NB 16.03.17 } elseif (preg_match('/text|char|blob|date/',$field->type) -# NB 16.03.17 or ($v!='null' and !preg_match('/^\d+(\.\d*)?$/',$v)) # text criteria value -# NB 16.03.17 ) { } elseif ($field->string()) { if (strtolower($v)=='null') $v = ''; - #$k = "COLAESCE($k,'')"; // * -> % $v = str_replace('*','%',$v); @@ -738,7 +733,6 @@ Class Table extends nb { } if (preg_match("/(LIKE|$regexp) ..$/","$equal$v") and $field->null) { -# NB 20.12.16 $k = "COALESCE($k,".$this->db()->quote('').")"; $k = 'COALESCE('.$field->sql_name().','.$this->db()->quote('').")"; } elseif ($field->extras) { @@ -756,28 +750,12 @@ Class Table extends nb { } # having, denorm, EMPTY - /* - $extra_where = (string)$this->db()->conf_type('extra_where'); - if ($extra_where == 'having' and $field->extras) { - $having[] = $this->extras[$k]->sql_name()."$equal$v"; - - } elseif ($extra_where == 'denorm' and $field->extras) { - $where[] = $this->extras[$k]->sql_name()."$equal$v"; - - } elseif ($field->extras) { - $where[] = $this->extras[$k]->sql_name()."$equal$v"; - - } else { - $where[] = $field->sql_name()."$equal$v"; - } - */ - if ($field->extras) { $extra_where = (string)$this->db()->conf_type('extra_where'); if ($extra_where == 'having') { - $having[] = $k->sql_name()."$equal$v"; + $having[] = "$k$equal$v"; } else { - $where[] = $k->sql_name()."$equal$v"; + $where[] = "$k$equal$v"; } } else { $where[] = "$k$equal$v"; @@ -1129,11 +1107,8 @@ Class Table extends nb { # $count_fields = 0; -# NB 19.11.16 foreach ($this->fields() as $f => $field) { -# NB 19.11.16 $row[$f] = $field->out(isset($row[$f]) ? $row[$f] : ''); foreach ($fields as $f => $field) { $row[$f] = $field->out(isset($row[$f]) ? $row[$f] : ''); -# NB 19.11.16 $row[$f] = $this->field($f)->out(isset($row[$f]) ? $row[$f] : ''); $count_fields++; } @@ -1181,7 +1156,6 @@ Class Table extends nb { $tot = $query->fetch(PDO::FETCH_COLUMN); $this->tot = $opt['tot'] = $tot; - #if (!$tot) return; } # < is_html -- 2.47.3