Skip to content

Commit

Permalink
🔨 #104 create addFilterFields
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Oct 7, 2023
1 parent 9547c9c commit d051f21
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion app/control/controllers/TCreateFormList.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,41 @@ public function addGetWhereGridParametersFields($qtdTabs)
$this->addGetWhereGridParameters_fied(false, $value, $qtdTabs);
}
}
//--------------------------------------------------------------------------------------
public function getSqlOperatorsByType($formDinType)
{
$restult = null;
switch ($formDinType) {
case TCreateFormGeneric::FORMDIN_TYPE_DATE:
$restult = '=';
break;
case TCreateFormGeneric::FORMDIN_TYPE_DATETIME:
$restult = '=';
break;
case TCreateFormGeneric::FORMDIN_TYPE_NUMBER:
$restult = '=';
break;
case TCreateFormGeneric::FORMDIN_TYPE_TEXT:
$restult = 'like';
break;
default:
$restult = '=';
}
return $restult;
}
public function addFilterFieldType($qtdTabs,$key, $fieldName, $notPK = true)
{
$formDinType = $this->getColumnsPropertieFormDinType($key);
$conector = $this->getSqlOperatorsByType($formDinType);
$this->addLine($qtdTabs.'$this->addFilterField(\''.$fieldName.'\', \''.$conector.'\', \''.$fieldName.'\'); //campo, operador, campo do form');
}
public function addFilterFields($qtdTabs)
{
$this->addLine($qtdTabs.'$this->filter_criteria = new TCriteria;');
$this->addLine($qtdTabs.'$this->addFilterField(self::$primaryKey, \'=\', self::$primaryKey); //campo, operador, campo do form');
$listColumnsName = $this->getListColunnsName();
foreach ($listColumnsName as $key => $value) {
$this->addGetWhereGridParameters_fied(false, $value, $qtdTabs);
$this->addGetWhereGridParameters_fied($qtdTabs,$key, $value);
}
}
//--------------------------------------------------------------------------------------
Expand Down

0 comments on commit d051f21

Please sign in to comment.