diff --git a/helm/chart/templates/cronjobs/cronjobEndPlatformMembership.yaml b/helm/chart/templates/cronjobs/cronjobEndPlatformMembership.yaml index dce38e1..b199f09 100644 --- a/helm/chart/templates/cronjobs/cronjobEndPlatformMembership.yaml +++ b/helm/chart/templates/cronjobs/cronjobEndPlatformMembership.yaml @@ -6,7 +6,7 @@ metadata: labels: {{- include "plateforme-ebs.labels" . | nindent 4 }} spec: - schedule: '30 14 * * *' + schedule: '17 1 * * *' timeZone: "Europe/Paris" jobTemplate: metadata: diff --git a/src/Command/EndPlatformMembershipCommand.php b/src/Command/EndPlatformMembershipCommand.php index 374706f..580c0c7 100644 --- a/src/Command/EndPlatformMembershipCommand.php +++ b/src/Command/EndPlatformMembershipCommand.php @@ -77,6 +77,9 @@ class EndPlatformMembershipCommand extends Command $user->getEmail(), )); + // save it here for the mail before setting it back to null + $endAt = $user->getEndAt(); + $user->setMembershipPaid(false) ->setEndAt(null) ->setPayedAt(null) @@ -85,7 +88,7 @@ class EndPlatformMembershipCommand extends Command $this->userManager->save($user, true); - $this->appMailer->send(EndPlatformMembershipMail::class, compact('user', 'platform')); + $this->appMailer->send(EndPlatformMembershipMail::class, compact('user', 'platform', 'endAt')); $this->sendSms($user, EndPlatformMembershipMail::class, ['%platform%' => $platform]); ++$count; } diff --git a/templates/email/command/end_platform_membership.html.twig b/templates/email/command/end_platform_membership.html.twig index 26212ad..c4ad9c2 100644 --- a/templates/email/command/end_platform_membership.html.twig +++ b/templates/email/command/end_platform_membership.html.twig @@ -4,7 +4,7 @@
{{ (i18n_prefix ~ '.h1')|trans }}
-{{ (i18n_prefix ~ '.p1')|trans({'%endAt%': user.endAt, '%platform%': platform}) }}
+{{ (i18n_prefix ~ '.p1')|trans({'%endAt%': endAt|date('d-m-Y H:i:s'), '%platform%': platform}) }}
{{ (i18n_prefix ~ '.loginLink')|trans }}