include email_id in group membership

This commit is contained in:
Marc Koch 2025-03-31 17:58:01 +02:00
parent 8dab2377f5
commit 5a424771fd
Signed by: marc.koch
GPG key ID: 12406554CFB028B9
5 changed files with 86 additions and 13 deletions

View file

@ -340,8 +340,7 @@ class ADGroupMailingList extends GroupMailingList {
* @throws \Civi\Mailinglistsync\Exceptions\MailinglistException
*/
public
static function syncContacts($recipients
): array {
static function syncContacts($recipients): array {
$results = [];
foreach ($recipients as $contact) {
@ -471,12 +470,13 @@ class ADGroupMailingList extends GroupMailingList {
* @return array|array[]
*/
private
function addRecipient(int $contactId
): array {
function addRecipient(int $contactId): array {
$result = [];
// Add the contact to the group
try {
$this->addContactToGroup($contactId);
$contactEmail = MailingListRecipient::getContactById($contactId)
->getEmailId(self::LOCATION_TYPE);
$this->addContactToGroup($contactId, $contactEmail);
$result['added'] = TRUE;
}
catch (MailinglistException $e) {
@ -496,8 +496,7 @@ class ADGroupMailingList extends GroupMailingList {
* @return array
*/
public
function removeRecipient(MailingListRecipient $recipient
): array {
function removeRecipient(MailingListRecipient $recipient): array {
$result = [
'sid' => $recipient->getSid(),
'contact_id' => $recipient->getContactId(),