Skip to content

Commit

Permalink
fix(QueryGenerator) support field names with spaces in conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
joebordes committed Feb 23, 2024
1 parent 0d006d7 commit d7da5b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/QueryGenerator/QueryGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ public function getWhereClause() {
$groupSql = $this->groupInfo;
$fieldSqlList = array();
foreach ($this->conditionals as $index => $conditionInfo) {
$fieldName = $conditionInfo['name'];
$fieldName = trim($conditionInfo['name']);
if ($fieldName=='id') {
if (empty($conditionInfo['value'])) {
$conditionInfo['value'] = '0';
Expand Down Expand Up @@ -1595,6 +1595,7 @@ public function addCondition($fieldname, $value, $operator, $glue = null, $newGr
}

$this->groupInfo .= "$conditionNumber ";
$fieldname = trim($fieldname);
$this->whereFields[] = $fieldname;
$this->reset();
$this->conditionals[$conditionNumber] = $this->getConditionalArray($fieldname, $value, $operator);
Expand All @@ -1618,7 +1619,7 @@ public function addReferenceModuleFieldCondition($relatedModule, $referenceField
$this->referenceModuleField[$conditionNumber] = array(
'relatedModule'=> $relatedModule,
'referenceField'=> $referenceField,
'fieldName'=>$fieldName,
'fieldName'=>trim($fieldName),
'value'=>$value,
'SQLOperator'=>$SQLOperator,
);
Expand Down

0 comments on commit d7da5b0

Please sign in to comment.