Skip to content

Commit

Permalink
Merge pull request #82 from slub/fix-81
Browse files Browse the repository at this point in the history
Fix email name in cancellation mails to subscriber
  • Loading branch information
Alexander Bigga authored Sep 27, 2021
2 parents f808cc1 + 73f91a2 commit a3c27f6
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Classes/Helper/EmailHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 5 additions & 11 deletions Classes/Task/CheckeventsTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Language/de.locallang.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
</trans-unit>
<trans-unit id="tx_slubevents_domain_model_location" approved="yes">
<source><![CDATA[Location]]></source>
<target><![CDATA[Ort]]></target>
<target><![CDATA[Veranstaltungsort]]></target>
</trans-unit>
<trans-unit id="tx_slubevents_domain_model_subscriber" approved="yes">
<source><![CDATA[Subscriber Details]]></source>
Expand Down
6 changes: 3 additions & 3 deletions Resources/Private/Templates/Email/CancellEvent.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

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

<p><b>{event.title}</b></p>
<p><strong>{event.title}</strong></p>

<p>
<se:format.oneLine htmlString="<f:render partial='Event/DateFromTo' arguments='{event : event}' />"/>
</p>

<f:if condition="{helper.location}">
<f:then>
<p><b>Veranstaltungsort:</b><br/>{helper.location}</p>
<p><strong>{f:translate(key: 'tx_slubevents_domain_model_location')}:</strong><br/>{helper.location}</p>
<f:format.html parseFuncTSPath="">{event.location.description}</f:format.html>
</f:then>
</f:if>
Expand All @@ -27,7 +27,7 @@
</f:then>
</f:if>

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

<p>
<f:translate key='text.closing'/>
Expand Down
27 changes: 27 additions & 0 deletions Resources/Private/Templates/Email/CancellEventSubscriber.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{namespace se=Slub\SlubEvents\ViewHelpers}
<p>{f:translate(key: 'text.salutation')} {subscriber.name},</p>

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

<p><strong>{event.title}</strong></p>

<p>
<se:format.oneLine htmlString="<f:render partial='Event/DateFromTo' arguments='{event : event}' />"/>
</p>

<f:if condition="{helper.location}">
<f:then>
<p><strong>{f:translate(key: 'tx_slubevents_domain_model_location')}:</strong><br/>{helper.location}</p>
<f:format.html parseFuncTSPath="">{event.location.description}</f:format.html>
</f:then>
</f:if>

<p>Anmeldungen sind nicht mehr möglich.</p>

<p>
<f:translate key='text.closing'/>
</p>
<p>&nbsp;</p>
<p>{event.contact.name} <br/>
<f:translate key='text.signature'/>
</p>
43 changes: 43 additions & 0 deletions Resources/Private/Templates/Email/CancellEventSubscriber.ics
Original file line number Diff line number Diff line change
@@ -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
<f:if condition="{helper.allDay} == 1"><f:then>
DTSTART;VALUE=DATE:<f:format.date date="@{helper.start}" format="Ymd" />
<f:if condition="{helper.end} == 1"><f:then>
DTEND;VALUE=DATE:<f:format.date date="@{helper.end}" format="Ymd" />
</f:then></f:if>
X-MICROSOFT-CDO-ALLDAYEVENT</f:then><f:else>
DTSTART:<f:format.date date="@{helper.start}" format="Ymd\THis" />
DTEND:<f:format.date date="@{helper.end}" format="Ymd\THis" /></f:else></f:if>
DTSTAMP:<f:format.date date="@{helper.now}" format="Ymd\THis" />
LAST-MODIFIED:<f:format.date date="@{helper.now}" format="Ymd\THis" />
SEQUENCE:0
CLASS:PUBLIC
LOCATION:{helper.locationics}
TRANSP:OPAQUE
STATUS:CANCELLED
END:VEVENT
END:VCALENDAR
4 changes: 2 additions & 2 deletions Resources/Private/Templates/Email/DeadlineReached.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

<p>für folgende Veranstaltung ist die Anmeldefrist abgelaufen.</p>

<p><b>{event.title}</b></p>
<p><strong>{event.title}</strong></p>

<p>
<se:format.oneLine htmlString="<f:render partial='Event/DateFromTo' arguments='{event : event}' />"/>
</p>

<f:if condition="{helper.location}">
<f:then>
<p><b>Veranstaltungsort:</b><br/>{helper.location}</p>
<p><strong>{f:translate(key: 'tx_slubevents_domain_model_location')}:</strong><br/>{helper.location}</p>
<f:format.html parseFuncTSPath="">{event.location.description}</f:format.html>
</f:then>
</f:if>
Expand Down
4 changes: 2 additions & 2 deletions Resources/Private/Templates/Email/Invitation.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
{event.contact.name},
</p>

<p><b>{event.title}</b></p>
<p><strong>{event.title}</strong></p>

<p>
<se:format.oneLine htmlString="<f:render partial='Event/DateFromTo' arguments='{event : event}' />"/>
</p>

<f:if condition="{helper.location}">
<f:then>
<p><b>Veranstaltungsort: </b><br/>{helper.location}</p>
<p><strong>{f:translate(key: 'tx_slubevents_domain_model_location')}:</strong><br/>{helper.location}</p>
<f:format.html>{event.location.description}</f:format.html>
</f:then>
</f:if>
Expand Down
5 changes: 2 additions & 3 deletions Resources/Private/Templates/Email/Maximumreached.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<p>die folgende Veranstaltung hat die maximale Teilnehmerzahl von {event.maxSubscriber} erreicht und ist jetzt
ausgebucht:</p>

<p><b>{event.title}</b></p>
<p><strong>{event.title}</strong></p>

<p>
<se:format.oneLine htmlString="<f:render partial='Event/DateFromTo' arguments='{event : event}' />"/>
</p>

<f:if condition="{helper.location}">
<f:then>
<p><b>Veranstaltungsort: </b><br/>{helper.location}</p>
<p><strong>{f:translate(key: 'tx_slubevents_domain_model_location')}:</strong><br/>{helper.location}</p>
<f:format.html>{event.location.description}</f:format.html>
</f:then>
</f:if>
Expand Down Expand Up @@ -45,4 +45,3 @@
<p>&nbsp;</p>

<p>{f:translate(key: 'text.signature')}</p>

5 changes: 2 additions & 3 deletions Resources/Private/Templates/Email/Minimumreachedagain.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<p>die folgende Veranstaltung hat nur noch {subscriberCount} und liegt damit unter der minimalen Teilnehmerzahl von
{event.minSubscriber}:</p>

<p><b>{event.title}</b></p>
<p><strong>{event.title}</strong></p>

<p>
<se:format.oneLine htmlString="<f:render partial='Event/DateFromTo' arguments='{event : event}' />"/>
</p>

<f:if condition="{helper.location}">
<f:then>
<p><b>Veranstaltungsort: </b><br/>{helper.location}</p>
<p><strong>{f:translate(key: 'tx_slubevents_domain_model_location')}:</strong><br/>{helper.location}</p>
<f:format.html>{event.location.description}</f:format.html>
</f:then>
</f:if>
Expand Down Expand Up @@ -45,4 +45,3 @@
<p>&nbsp;</p>

<p>{f:translate(key: 'text.signature')}</p>

5 changes: 2 additions & 3 deletions Resources/Private/Templates/Email/Newsubscriber.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

<p>die folgende Veranstaltung wurde soeben von <b>{newsubscriber.name}</b> gebucht:</p>

<p><b>{event.title}</b></p>
<p><strong>{event.title}</strong></p>

<p>
<se:format.oneLine htmlString="<f:render partial='Event/DateFromTo' arguments='{event : event}' />"/>
</p>

<f:if condition="{helper.location}">
<f:then>
<p><b>Veranstaltungsort: </b><br/>{helper.location}</p>
<p><strong>{f:translate(key: 'tx_slubevents_domain_model_location')}:</strong><br/>{helper.location}</p>
<f:format.html>{event.location.description}</f:format.html>
</f:then>
</f:if>
Expand Down Expand Up @@ -44,4 +44,3 @@
<p>&nbsp;</p>

<p>{f:translate(key: 'text.signature')}</p>

3 changes: 1 addition & 2 deletions Resources/Private/Templates/Email/OnlineSurvey.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<p>Sie haben kürzlich an folgender Veranstaltung teilgenommen:</p>

<p><b>{event.title}</b> <br/>
<p><strong>{event.title}</strong> <br/>
<se:format.oneLine htmlString="<f:render partial='Event/DateFromTo' arguments='{event : event}' />"/>
</p>

Expand Down Expand Up @@ -34,4 +34,3 @@
<p>
<f:translate key='text.signature'/>
</p>

5 changes: 2 additions & 3 deletions Resources/Private/Templates/Email/Subscribe.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

<p>vielen Dank für Ihre Anmeldung zu folgender Veranstaltung:</p>

<p><b>{event.title}</b></p>
<p><strong>{event.title}</strong></p>

<p>
<se:format.oneLine htmlString="<f:render partial='Event/DateFromTo' arguments='{event : event}' />"/>
</p>

<f:if condition="{helper.location}">
<f:then>
<p><b>Veranstaltungsort: </b><br/>{helper.location}</p>
<p><strong>{f:translate(key: 'tx_slubevents_domain_model_location')}:</strong><br/>{helper.location}</p>
<f:format.html>{event.location.description}</f:format.html>
</f:then>
</f:if>
Expand Down Expand Up @@ -79,4 +79,3 @@
<p>&nbsp;</p>

<p>{event.contact.name} <br/>{f:translate(key: 'text.signature')}</p>

5 changes: 2 additions & 3 deletions Resources/Private/Templates/Email/Unsubscribe.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

<p>Sie haben sich erfolgreich von der folgenden Veranstaltung abgemeldet:</p>

<p><b>{event.title}</b></p>
<p><strong>{event.title}</strong></p>

<p>
<se:format.oneLine htmlString="<f:render partial='Event/DateFromTo' arguments='{event : event}' />"/>
</p>

<f:if condition="{helper.location}">
<f:then>
<p><b>Veranstaltungsort: </b><br/>{helper.location}</p>
<p><strong>{f:translate(key: 'tx_slubevents_domain_model_location')}:</strong><br/>{helper.location}</p>
<f:format.html>{event.location.description}</f:format.html>
</f:then>
</f:if>
Expand All @@ -33,4 +33,3 @@
<p>&nbsp;</p>

<p>{event.contact.name} <br/>{f:translate(key: 'text.signature')}</p>

0 comments on commit a3c27f6

Please sign in to comment.