Skip to content

Commit

Permalink
salesagility#7285: allow filter of custom fields on V8 API Get Modules
Browse files Browse the repository at this point in the history
  • Loading branch information
YonatanRosemarin committed May 18, 2020
1 parent bb8e0cc commit 6141c13
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Api/V8/JsonApi/Repository/Filter.php
Expand Up @@ -59,11 +59,14 @@ public function parseWhere(\SugarBean $bean, array $params)
throw new \InvalidArgumentException(sprintf('Filter field %s must be an array', $field));
}

$isCustom = $bean->field_defs[$field]['source'] == 'custom_fields';
$tableName = $isCustom ? $bean->get_custom_table_name() : $bean->getTableName();

foreach ($expr as $op => $value) {
$this->checkOperator($op);
$where[] = sprintf(
'%s.%s %s %s',
$bean->getTableName(),
$tableName,
$field,
constant(sprintf('%s::OP_%s', self::class, strtoupper($op))),
$this->db->quoted($value)
Expand Down

0 comments on commit 6141c13

Please sign in to comment.