From 9fef9400427820b0dfe57ef2ee9c689e1ccada27 Mon Sep 17 00:00:00 2001 From: Alexander Bigga Date: Fri, 24 Sep 2021 16:45:17 +0200 Subject: [PATCH 1/2] Fix email name in cancellation mails to subscriber --- Classes/Task/CheckeventsTask.php | 16 +++---- .../Private/Templates/Email/CancellEvent.html | 6 +-- .../Email/CancellEventSubscriber.html | 27 ++++++++++++ .../Email/CancellEventSubscriber.ics | 43 +++++++++++++++++++ 4 files changed, 78 insertions(+), 14 deletions(-) create mode 100755 Resources/Private/Templates/Email/CancellEventSubscriber.html create mode 100755 Resources/Private/Templates/Email/CancellEventSubscriber.ics diff --git a/Classes/Task/CheckeventsTask.php b/Classes/Task/CheckeventsTask.php index 1eb3c464..619b22b6 100644 --- a/Classes/Task/CheckeventsTask.php +++ b/Classes/Task/CheckeventsTask.php @@ -182,29 +182,25 @@ public function execute() // check if we have to cancel the event if ($this->subscriberRepository->countAllByEvent($event) < $event->getMinSubscriber()) { // --> ok, we have to cancel the event because not enough subscriber were found - + $out = true; // email to all subscribers foreach ($event->getSubscribers() as $subscriber) { - $cronLog .= 'Absage an Teilnehmer: ' . $event->getTitle() . ': ' . strftime('%x %H:%M', - $event->getStartDateTime()->getTimestamp()) . ' --> ' . $subscriber->getEmail() . "\n"; - $out = EmailHelper::sendTemplateEmail( + $out = $out && EmailHelper::sendTemplateEmail( [$subscriber->getEmail() => $subscriber->getName()], [$event->getContact()->getEmail() => $event->getContact()->getName()], 'Absage der Veranstaltung: ' . $event->getTitle(), - 'CancellEvent', + 'CancellEventSubscriber', [ 'event' => $event, - 'subscribers' => '', + 'subscriber' => $subscriber, 'helper' => $helper, 'attachIcs' => true, ] ); } - $cronLog .= 'Absage an Veranstalter: ' . $event->getTitle() . ': ' . strftime('%x %H:%M', - $event->getStartDateTime()->getTimestamp()) . ' --> ' . $event->getContact()->getEmail() . "\n"; // email to event owner - $out = EmailHelper::sendTemplateEmail( + $out = $out && EmailHelper::sendTemplateEmail( [$event->getContact()->getEmail() => $event->getContact()->getName()], [$this->senderEmailAddress => 'SLUB Veranstaltungen - noreply'], 'Absage der Veranstaltung: ' . $event->getTitle(), @@ -225,8 +221,6 @@ public function execute() } else { // event takes place but subscription is not possible anymore... // email to event owner - $cronLog .= 'Anmeldefrist abgelaufen an Veranstalter: ' . $event->getTitle() . ': ' . strftime('%x %H:%M', - $event->getStartDateTime()->getTimestamp()) . ' --> ' . $event->getContact()->getEmail() . "\n"; $out = EmailHelper::sendTemplateEmail( [$event->getContact()->getEmail() => $event->getContact()->getName()], [$this->senderEmailAddress => 'SLUB Veranstaltungen - noreply'], diff --git a/Resources/Private/Templates/Email/CancellEvent.html b/Resources/Private/Templates/Email/CancellEvent.html index aa5f0719..5a6336dd 100755 --- a/Resources/Private/Templates/Email/CancellEvent.html +++ b/Resources/Private/Templates/Email/CancellEvent.html @@ -6,7 +6,7 @@

leider müssen wir folgende Veranstaltung absagen, da die Mindestteilnehmerzahl nicht erreicht wurde:

-

{event.title}

+

{event.title}

@@ -14,7 +14,7 @@ -

Veranstaltungsort:
{helper.location}

+

{f:translate(key: 'tx_slubevents_domain_model_location')}:
{helper.location}

{event.location.description} @@ -27,7 +27,7 @@ -

Anmeldungen sind nicht mehr möglich.

+

Anmeldungen sind nicht mehr möglich. Die Teilnehmer wurden gleichzeitig über die Absage informiert.

diff --git a/Resources/Private/Templates/Email/CancellEventSubscriber.html b/Resources/Private/Templates/Email/CancellEventSubscriber.html new file mode 100755 index 00000000..5c728fe4 --- /dev/null +++ b/Resources/Private/Templates/Email/CancellEventSubscriber.html @@ -0,0 +1,27 @@ +{namespace se=Slub\SlubEvents\ViewHelpers} +

{f:translate(key: 'text.salutation')} {subscriber.name},

+ +

leider müssen wir folgende Veranstaltung absagen, da die Mindestteilnehmerzahl nicht erreicht wurde:

+ +

{event.title}

+ +

+ +

+ + + +

{f:translate(key: 'tx_slubevents_domain_model_location')}:
{helper.location}

+ {event.location.description} +
+
+ +

Anmeldungen sind nicht mehr möglich.

+ +

+ +

+

 

+

{event.contact.name}
+ +

diff --git a/Resources/Private/Templates/Email/CancellEventSubscriber.ics b/Resources/Private/Templates/Email/CancellEventSubscriber.ics new file mode 100755 index 00000000..320966c3 --- /dev/null +++ b/Resources/Private/Templates/Email/CancellEventSubscriber.ics @@ -0,0 +1,43 @@ +BEGIN:VCALENDAR +METHOD:CANCEL +PRODID:-//CALENDAR SLUB//DE +VERSION:2.0 +BEGIN:VTIMEZONE +TZID:Europe/Berlin +BEGIN:DAYLIGHT +DTSTART:20130331T020000 +RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU +TZNAME:CEST +TZOFFSETFROM:+0100 +TZOFFSETTO:+0200 +END:DAYLIGHT +BEGIN:STANDARD +DTSTART:20131027T030000 +RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU +TZNAME:CET +TZOFFSETFROM:+0200 +TZOFFSETTO:+0100 +END:STANDARD +END:VTIMEZONE +BEGIN:VEVENT +ORGANIZER;CN="{event.contact.name}":MAILTO:{event.contact.email} +DESCRIPTION:{helper.description} +SUMMARY:{event.title} +UID:{event.uid}-event-slub-dresden + +DTSTART;VALUE=DATE: + +DTEND;VALUE=DATE: + +X-MICROSOFT-CDO-ALLDAYEVENT +DTSTART: +DTEND: +DTSTAMP: +LAST-MODIFIED: +SEQUENCE:0 +CLASS:PUBLIC +LOCATION:{helper.locationics} +TRANSP:OPAQUE +STATUS:CANCELLED +END:VEVENT +END:VCALENDAR From 73f91a2b6b96f5609368394fa79e8552c4937648 Mon Sep 17 00:00:00 2001 From: Alexander Bigga Date: Fri, 24 Sep 2021 16:45:45 +0200 Subject: [PATCH 2/2] Add at least one language label... tbc. --- Classes/Helper/EmailHelper.php | 2 +- Resources/Private/Language/de.locallang.xlf | 2 +- Resources/Private/Templates/Email/DeadlineReached.html | 4 ++-- Resources/Private/Templates/Email/Invitation.html | 4 ++-- Resources/Private/Templates/Email/Maximumreached.html | 5 ++--- Resources/Private/Templates/Email/Minimumreachedagain.html | 5 ++--- Resources/Private/Templates/Email/Newsubscriber.html | 5 ++--- Resources/Private/Templates/Email/OnlineSurvey.html | 3 +-- Resources/Private/Templates/Email/Subscribe.html | 5 ++--- Resources/Private/Templates/Email/Unsubscribe.html | 5 ++--- 10 files changed, 17 insertions(+), 23 deletions(-) diff --git a/Classes/Helper/EmailHelper.php b/Classes/Helper/EmailHelper.php index 8373dc31..0ce4e397 100755 --- a/Classes/Helper/EmailHelper.php +++ b/Classes/Helper/EmailHelper.php @@ -47,7 +47,7 @@ class EmailHelper * @param array $variables variables to be passed to the Fluid view * @param ConfigurationManagerInterface $configurationManager * - * @return boolean TRUE on success, otherwise false + * @return boolean true on success, otherwise false */ public static function sendTemplateEmail( array $recipient, diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 23db7479..bc2833ed 100755 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -383,7 +383,7 @@ - + diff --git a/Resources/Private/Templates/Email/DeadlineReached.html b/Resources/Private/Templates/Email/DeadlineReached.html index ef3136fb..0f8573a9 100755 --- a/Resources/Private/Templates/Email/DeadlineReached.html +++ b/Resources/Private/Templates/Email/DeadlineReached.html @@ -6,7 +6,7 @@

für folgende Veranstaltung ist die Anmeldefrist abgelaufen.

-

{event.title}

+

{event.title}

@@ -14,7 +14,7 @@ -

Veranstaltungsort:
{helper.location}

+

{f:translate(key: 'tx_slubevents_domain_model_location')}:
{helper.location}

{event.location.description} diff --git a/Resources/Private/Templates/Email/Invitation.html b/Resources/Private/Templates/Email/Invitation.html index 8c2d376a..6948570e 100755 --- a/Resources/Private/Templates/Email/Invitation.html +++ b/Resources/Private/Templates/Email/Invitation.html @@ -4,7 +4,7 @@ {event.contact.name},

-

{event.title}

+

{event.title}

@@ -12,7 +12,7 @@ -

Veranstaltungsort:
{helper.location}

+

{f:translate(key: 'tx_slubevents_domain_model_location')}:
{helper.location}

{event.location.description} diff --git a/Resources/Private/Templates/Email/Maximumreached.html b/Resources/Private/Templates/Email/Maximumreached.html index 312dc105..d6d2e0a1 100755 --- a/Resources/Private/Templates/Email/Maximumreached.html +++ b/Resources/Private/Templates/Email/Maximumreached.html @@ -4,7 +4,7 @@

die folgende Veranstaltung hat die maximale Teilnehmerzahl von {event.maxSubscriber} erreicht und ist jetzt ausgebucht:

-

{event.title}

+

{event.title}

@@ -12,7 +12,7 @@ -

Veranstaltungsort:
{helper.location}

+

{f:translate(key: 'tx_slubevents_domain_model_location')}:
{helper.location}

{event.location.description} @@ -45,4 +45,3 @@

 

{f:translate(key: 'text.signature')}

- diff --git a/Resources/Private/Templates/Email/Minimumreachedagain.html b/Resources/Private/Templates/Email/Minimumreachedagain.html index e0c85a48..f26ac39c 100755 --- a/Resources/Private/Templates/Email/Minimumreachedagain.html +++ b/Resources/Private/Templates/Email/Minimumreachedagain.html @@ -4,7 +4,7 @@

die folgende Veranstaltung hat nur noch {subscriberCount} und liegt damit unter der minimalen Teilnehmerzahl von {event.minSubscriber}:

-

{event.title}

+

{event.title}

@@ -12,7 +12,7 @@ -

Veranstaltungsort:
{helper.location}

+

{f:translate(key: 'tx_slubevents_domain_model_location')}:
{helper.location}

{event.location.description} @@ -45,4 +45,3 @@

 

{f:translate(key: 'text.signature')}

- diff --git a/Resources/Private/Templates/Email/Newsubscriber.html b/Resources/Private/Templates/Email/Newsubscriber.html index 9166949b..18d2da7c 100755 --- a/Resources/Private/Templates/Email/Newsubscriber.html +++ b/Resources/Private/Templates/Email/Newsubscriber.html @@ -3,7 +3,7 @@

die folgende Veranstaltung wurde soeben von {newsubscriber.name} gebucht:

-

{event.title}

+

{event.title}

@@ -11,7 +11,7 @@ -

Veranstaltungsort:
{helper.location}

+

{f:translate(key: 'tx_slubevents_domain_model_location')}:
{helper.location}

{event.location.description} @@ -44,4 +44,3 @@

 

{f:translate(key: 'text.signature')}

- diff --git a/Resources/Private/Templates/Email/OnlineSurvey.html b/Resources/Private/Templates/Email/OnlineSurvey.html index 3c0e72e9..a30e0c71 100755 --- a/Resources/Private/Templates/Email/OnlineSurvey.html +++ b/Resources/Private/Templates/Email/OnlineSurvey.html @@ -6,7 +6,7 @@

Sie haben kürzlich an folgender Veranstaltung teilgenommen:

-

{event.title}
+

{event.title}

@@ -34,4 +34,3 @@

- diff --git a/Resources/Private/Templates/Email/Subscribe.html b/Resources/Private/Templates/Email/Subscribe.html index 737e582e..7d672121 100755 --- a/Resources/Private/Templates/Email/Subscribe.html +++ b/Resources/Private/Templates/Email/Subscribe.html @@ -10,7 +10,7 @@

vielen Dank für Ihre Anmeldung zu folgender Veranstaltung:

-

{event.title}

+

{event.title}

@@ -18,7 +18,7 @@ -

Veranstaltungsort:
{helper.location}

+

{f:translate(key: 'tx_slubevents_domain_model_location')}:
{helper.location}

{event.location.description} @@ -79,4 +79,3 @@

 

{event.contact.name}
{f:translate(key: 'text.signature')}

- diff --git a/Resources/Private/Templates/Email/Unsubscribe.html b/Resources/Private/Templates/Email/Unsubscribe.html index fafb9e8e..c6696cb9 100755 --- a/Resources/Private/Templates/Email/Unsubscribe.html +++ b/Resources/Private/Templates/Email/Unsubscribe.html @@ -3,7 +3,7 @@

Sie haben sich erfolgreich von der folgenden Veranstaltung abgemeldet:

-

{event.title}

+

{event.title}

@@ -11,7 +11,7 @@ -

Veranstaltungsort:
{helper.location}

+

{f:translate(key: 'tx_slubevents_domain_model_location')}:
{helper.location}

{event.location.description} @@ -33,4 +33,3 @@

 

{event.contact.name}
{f:translate(key: 'text.signature')}

-