Compare commits

..

No commits in common. "main" and "1.0.0-beta2" have entirely different histories.

6 changed files with 22 additions and 26 deletions

View file

@ -95,7 +95,7 @@ abstract class BaseMailingList
*/ */
static protected function getCustomFields(): array static protected function getCustomFields(): array
{ {
return CustomField::get(FALSE) return CustomField::get()
->addSelect('*') ->addSelect('*')
->addWhere('custom_group_id:name', '=', static::CUSTOM_GROUP_NAME) ->addWhere('custom_group_id:name', '=', static::CUSTOM_GROUP_NAME)
->execute() ->execute()

View file

@ -53,7 +53,7 @@ class EventMailingList extends BaseMailingList {
->addJoin('Participant AS participant', 'INNER', ->addJoin('Participant AS participant', 'INNER',
['id', '=', 'participant.contact_id'], ['id', '=', 'participant.contact_id'],
['participant.event_id', '=', $this->event['id']], ['participant.event_id', '=', $this->event['id']],
['participant.status_id', 'IN', self::getEnabledParticipantStatus()], ['participant.status', 'IN', self::getEnabledParticipantStatus()],
) )
->addGroupBy('id') ->addGroupBy('id')
->execute() ->execute()
@ -93,6 +93,6 @@ class EventMailingList extends BaseMailingList {
* @return ?array * @return ?array
*/ */
public static function getEnabledParticipantStatus(): ?array { public static function getEnabledParticipantStatus(): ?array {
return MailingListSettings::get('participant_status'); return MailingListSettings::get(E::SHORT_NAME . '_participant_status');
} }
} }

View file

@ -29,21 +29,21 @@ class QueueHelper {
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$this->eventQueue = \Civi::queue( $this->eventQueue = \Civi::queue(
'propeace-mailinglist-event-queue', [ 'propeace-mailinglist-event-queue', [
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$this->emailQueue = \Civi::queue( $this->emailQueue = \Civi::queue(
'propeace-mailinglist-email-queue', [ 'propeace-mailinglist-email-queue', [
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$this->groups = []; $this->groups = [];
@ -106,14 +106,12 @@ class QueueHelper {
* Stores an email address in the queue helper singleton. * Stores an email address in the queue helper singleton.
* *
* @param \CRM_Queue_TaskContext $context * @param \CRM_Queue_TaskContext $context
* @param string|null $email * @param string $email
* *
* @return bool * @return bool
*/ */
public static function storeEmail(\CRM_Queue_TaskContext $context, ?string $email): bool { public static function storeEmail(\CRM_Queue_TaskContext $context, string $email): bool {
if (!empty($email)) { self::getInstance()->addToEmails($email);
self::getInstance()->addToEmails($email);
}
return TRUE; return TRUE;
} }

View file

@ -1,5 +1,5 @@
Package: de.propeace.mailinglistsync Package: de.propeace.mailinglistsync
Copyright (C) 2025, Pro Peace <info@propeace.de> Copyright (C) 2025, FIXME <FIXME>
Licensed under the GNU Affero Public License 3.0 (below). Licensed under the GNU Affero Public License 3.0 (below).
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

View file

@ -7,12 +7,12 @@
<authors> <authors>
<author> <author>
<name>Marc Koch</name> <name>Marc Koch</name>
<email>marc.koch@propeace.de</email> <email>koch@forumZFD.de</email>
<role>Maintainer</role> <role>Maintainer</role>
</author> </author>
</authors> </authors>
<urls> <urls>
<url desc="Main Extension Page">https://git.propeace.de/ProPeace/de.propeace.mailinglistsync</url>--> <!-- <url desc="Main Extension Page">https://FIXME</url>-->
<!-- <url desc="Documentation">https://FIXME</url>--> <!-- <url desc="Documentation">https://FIXME</url>-->
<!-- <url desc="Support">https://FIXME</url>--> <!-- <url desc="Support">https://FIXME</url>-->
<url desc="Licensing">https://www.gnu.org/licenses/agpl-3.0.html</url> <url desc="Licensing">https://www.gnu.org/licenses/agpl-3.0.html</url>

View file

@ -129,7 +129,7 @@ function mailinglistsync_civicrm_validateForm($formName, &$fields, &$files, &$fo
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$queue->createItem(new CRM_Queue_Task( $queue->createItem(new CRM_Queue_Task(
// callback // callback
@ -145,7 +145,7 @@ function mailinglistsync_civicrm_validateForm($formName, &$fields, &$files, &$fo
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$queue->createItem(new CRM_Queue_Task( $queue->createItem(new CRM_Queue_Task(
// callback // callback
@ -225,10 +225,8 @@ function mailinglistsync_civicrm_post(string $op, string $objectName, int $objec
->first()['event_id']; ->first()['event_id'];
$mailingList = new EventMailingList($eventId); $mailingList = new EventMailingList($eventId);
// Check permission to alter event mailing list if it is not a deletion // Check permission to alter event mailing list
if ($op !== 'delete' if ($mailingList->isEnabled() && !CRM_Core_Permission::check('manage_event_mailinglists')) {
&& $mailingList->isEnabled()
&& !CRM_Core_Permission::check('manage_event_mailinglists')) {
CRM_Core_Session::setStatus( CRM_Core_Session::setStatus(
E::ts('You do not have permission to manage event mailing lists.'), E::ts('You do not have permission to manage event mailing lists.'),
E::ts('Permission Denied'), E::ts('Permission Denied'),
@ -326,7 +324,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$queue->createItem(new CRM_Queue_Task( $queue->createItem(new CRM_Queue_Task(
// callback // callback
@ -347,7 +345,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$queue->createItem(new CRM_Queue_Task( $queue->createItem(new CRM_Queue_Task(
// callback // callback
@ -374,7 +372,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$queue->createItem(new CRM_Queue_Task( $queue->createItem(new CRM_Queue_Task(
// callback // callback
@ -395,7 +393,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$queue->createItem(new CRM_Queue_Task( $queue->createItem(new CRM_Queue_Task(
// callback // callback
@ -416,7 +414,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$queue->createItem(new CRM_Queue_Task( $queue->createItem(new CRM_Queue_Task(
// callback // callback
@ -451,7 +449,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
'type' => 'SqlParallel', 'type' => 'SqlParallel',
'is_autorun' => FALSE, 'is_autorun' => FALSE,
'reset' => FALSE, 'reset' => FALSE,
'error' => 'abort', 'error' => 'drop',
]); ]);
$queue->createItem(new CRM_Queue_Task( $queue->createItem(new CRM_Queue_Task(
// callback // callback