Api: Fix customfield field attribute was not always applied

If attribute was set, sometimes it was overwritten and all cf were used.
Happened trying to get only some addressbook custom fields showing on registration page
This commit is contained in:
nathan 2023-10-16 11:05:44 -06:00
parent 1b552cd9c2
commit 5d4fdd67c6

View File

@ -176,7 +176,7 @@ class Customfields extends Transformer
}
// Remove filtered fields
if (!empty($field_filters) && in_array($key, $negate_fields) && in_array($key, $field_filters))
if(!empty($field_filters) && !in_array($key, $field_filters) || !empty($negate_fields) && in_array($key, $negate_fields))
{
unset($fields[$key]);
}