Skip to content

Commit

Permalink
Fix #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 authored and Dillon-Brown committed Aug 26, 2021
1 parent 5bd7ab8 commit 61f18eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Api/V8/JsonApi/Repository/Filter.php
Expand Up @@ -60,11 +60,14 @@ public function parseWhere(\SugarBean $bean, array $params)
throw new \InvalidArgumentException(sprintf('Filter field %s must be an array', $field));
}

$isCustom = isset($bean->field_defs[$field]['source']) && ($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 61f18eb

Please sign in to comment.