default:
if (!empty($data[$key])) {
$item = $this->getSelectExpression($key);
- if ($item['expr'] instanceof SqlField && $item['fields'][$key]['fk_entity'] === 'File') {
+ if ($item['expr'] instanceof SqlField && isset($item['fields'][$key]) && $item['fields'][$key]['fk_entity'] === 'File') {
return $this->generateFileUrl($data[$key]);
}
}
use Civi\API\Exception\UnauthorizedException;
use Civi\Api4\Contact;
use Civi\Api4\MockBasicEntity;
+use Civi\Api4\EntitySet;
use Civi\Api4\SavedSearch;
use Civi\Core\Event\GenericHookEvent;
use Civi\Test\HookInterface;
$this->assertNotContains($cid, $result->column('id'));
}
+ public function testMailingAutocompleteNoDisabledGroups(): void {
+ $this->createTestRecord('Group', [
+ 'title' => 'Second Star',
+ 'frontend_title' => 'Second Star',
+ 'name' => 'Second_Star',
+ 'group_type:name' => 'Mailing List',
+ ]);
+ $this->createTestRecord('Group', [
+ 'title' => 'Second',
+ 'frontend_title' => 'Second',
+ 'name' => 'Second',
+ 'group_type:name' => 'Mailing List',
+ 'is_active' => 0,
+ ]);
+
+ $result = EntitySet::autocomplete()
+ ->setInput('')
+ ->setFieldName('Mailing.recipients_include')
+ ->setFormName('crmMailing.1')
+ ->execute();
+ $this->assertCount(1, $result);
+ $this->assertEquals('Second Star', $result[0]['label']);
+ }
+
}