Skip to content

Commit

Permalink
Fix salesagility#7285 - Allow filter of custom fields on V8 API Get M…
Browse files Browse the repository at this point in the history
…odules
  • Loading branch information
YonatanRosemarin authored and Dillon-Brown committed Aug 27, 2021
1 parent 55dab76 commit 45a6527
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 45a6527

Please sign in to comment.