Compare commits
7 commits
1.0.0-beta
...
main
Author | SHA1 | Date | |
---|---|---|---|
2d7fae39ce | |||
361c2ba00f | |||
927029c1fd | |||
60dd218688 | |||
aa8d25d5ed | |||
773cf827a3 | |||
c748847442 |
6 changed files with 26 additions and 22 deletions
|
@ -95,7 +95,7 @@ abstract class BaseMailingList
|
|||
*/
|
||||
static protected function getCustomFields(): array
|
||||
{
|
||||
return CustomField::get()
|
||||
return CustomField::get(FALSE)
|
||||
->addSelect('*')
|
||||
->addWhere('custom_group_id:name', '=', static::CUSTOM_GROUP_NAME)
|
||||
->execute()
|
||||
|
|
|
@ -53,7 +53,7 @@ class EventMailingList extends BaseMailingList {
|
|||
->addJoin('Participant AS participant', 'INNER',
|
||||
['id', '=', 'participant.contact_id'],
|
||||
['participant.event_id', '=', $this->event['id']],
|
||||
['participant.status', 'IN', self::getEnabledParticipantStatus()],
|
||||
['participant.status_id', 'IN', self::getEnabledParticipantStatus()],
|
||||
)
|
||||
->addGroupBy('id')
|
||||
->execute()
|
||||
|
@ -93,6 +93,6 @@ class EventMailingList extends BaseMailingList {
|
|||
* @return ?array
|
||||
*/
|
||||
public static function getEnabledParticipantStatus(): ?array {
|
||||
return MailingListSettings::get(E::SHORT_NAME . '_participant_status');
|
||||
return MailingListSettings::get('participant_status');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,21 +29,21 @@ class QueueHelper {
|
|||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
$this->eventQueue = \Civi::queue(
|
||||
'propeace-mailinglist-event-queue', [
|
||||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
$this->emailQueue = \Civi::queue(
|
||||
'propeace-mailinglist-email-queue', [
|
||||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
|
||||
$this->groups = [];
|
||||
|
@ -106,12 +106,14 @@ class QueueHelper {
|
|||
* Stores an email address in the queue helper singleton.
|
||||
*
|
||||
* @param \CRM_Queue_TaskContext $context
|
||||
* @param string $email
|
||||
* @param string|null $email
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Package: de.propeace.mailinglistsync
|
||||
Copyright (C) 2025, FIXME <FIXME>
|
||||
Copyright (C) 2025, Pro Peace <info@propeace.de>
|
||||
Licensed under the GNU Affero Public License 3.0 (below).
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
4
info.xml
4
info.xml
|
@ -7,12 +7,12 @@
|
|||
<authors>
|
||||
<author>
|
||||
<name>Marc Koch</name>
|
||||
<email>koch@forumZFD.de</email>
|
||||
<email>marc.koch@propeace.de</email>
|
||||
<role>Maintainer</role>
|
||||
</author>
|
||||
</authors>
|
||||
<urls>
|
||||
<!-- <url desc="Main Extension Page">https://FIXME</url>-->
|
||||
<url desc="Main Extension Page">https://git.propeace.de/ProPeace/de.propeace.mailinglistsync</url>-->
|
||||
<!-- <url desc="Documentation">https://FIXME</url>-->
|
||||
<!-- <url desc="Support">https://FIXME</url>-->
|
||||
<url desc="Licensing">https://www.gnu.org/licenses/agpl-3.0.html</url>
|
||||
|
|
|
@ -129,7 +129,7 @@ function mailinglistsync_civicrm_validateForm($formName, &$fields, &$files, &$fo
|
|||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
$queue->createItem(new CRM_Queue_Task(
|
||||
// callback
|
||||
|
@ -145,7 +145,7 @@ function mailinglistsync_civicrm_validateForm($formName, &$fields, &$files, &$fo
|
|||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
$queue->createItem(new CRM_Queue_Task(
|
||||
// callback
|
||||
|
@ -225,8 +225,10 @@ function mailinglistsync_civicrm_post(string $op, string $objectName, int $objec
|
|||
->first()['event_id'];
|
||||
$mailingList = new EventMailingList($eventId);
|
||||
|
||||
// Check permission to alter event mailing list
|
||||
if ($mailingList->isEnabled() && !CRM_Core_Permission::check('manage_event_mailinglists')) {
|
||||
// Check permission to alter event mailing list if it is not a deletion
|
||||
if ($op !== 'delete'
|
||||
&& $mailingList->isEnabled()
|
||||
&& !CRM_Core_Permission::check('manage_event_mailinglists')) {
|
||||
CRM_Core_Session::setStatus(
|
||||
E::ts('You do not have permission to manage event mailing lists.'),
|
||||
E::ts('Permission Denied'),
|
||||
|
@ -324,7 +326,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
|
|||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
$queue->createItem(new CRM_Queue_Task(
|
||||
// callback
|
||||
|
@ -345,7 +347,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
|
|||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
$queue->createItem(new CRM_Queue_Task(
|
||||
// callback
|
||||
|
@ -372,7 +374,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
|
|||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
$queue->createItem(new CRM_Queue_Task(
|
||||
// callback
|
||||
|
@ -393,7 +395,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
|
|||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
$queue->createItem(new CRM_Queue_Task(
|
||||
// callback
|
||||
|
@ -414,7 +416,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
|
|||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
$queue->createItem(new CRM_Queue_Task(
|
||||
// callback
|
||||
|
@ -449,7 +451,7 @@ function mailinglistsync_civicrm_postCommit(string $op, string $objectName, int
|
|||
'type' => 'SqlParallel',
|
||||
'is_autorun' => FALSE,
|
||||
'reset' => FALSE,
|
||||
'error' => 'drop',
|
||||
'error' => 'abort',
|
||||
]);
|
||||
$queue->createItem(new CRM_Queue_Task(
|
||||
// callback
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue