diff --git a/locale.xml b/locale.xml index 4d3531e0c1c7aab08f6c2aeca1a49dfbd534d071..a59164218f6fe5b10a22acbabc7b7499f8c94a36 100644 --- a/locale.xml +++ b/locale.xml @@ -1024,6 +1024,10 @@ <de><![CDATA[Sie haben Ihre Mitgliedschaft am [addedDate] abgeschlossen und können diese jederzeit kündigen.]]></de> <en><![CDATA[You subscribed to your membership at [addedDate] and can cancel it at any time.]]></en> </locale> + <locale name="MembershipUser.cancel.info_text.period_of_notice_expired"> + <de><![CDATA[Die Kündigungsfrist für den aktuellen Turnus ([cycleBeginDate] bis [cycleEndDate]) ist am [cancelUntilDate] abgelaufen. Ihre Mitgliedschaft wird daher am [cycleEndDate] automatisch bis zum [nextCycleEndDate] verlängert.]]></de> + <en><![CDATA[The period of notice for the current membership period ([cycleBeginDate] to [cycleEndDate]) expired at [cancelUntilDate]. Thus your membership will be automatically extended to [nextCycleEndDate] at [cycleEndDate].]]></en> + </locale> <!-- Templates --> <locale name="templates.mail.startcancel.subject"> diff --git a/src/QUI/Memberships/Users/MembershipUser.php b/src/QUI/Memberships/Users/MembershipUser.php index be2de08c280e48910800739331f66d00780af217..cb4f4e9bfb231232e51795449e3a488049686b16 100644 --- a/src/QUI/Memberships/Users/MembershipUser.php +++ b/src/QUI/Memberships/Users/MembershipUser.php @@ -936,14 +936,14 @@ public function getFrontendViewData() try { if (!$Contract->isInPeriodOfNotice()) { $cancelAllowed = false; - } else { - $PeriodOfNoticeInterval = $Contract->getPeriodOfNoticeInterval(); - $EndBaseDate = clone $CurrentCancelEndDate; - $EndBaseDate->setTime(0, 0, 0); - $EndBaseDate->sub(\date_interval_create_from_date_string('1 second')); - - $CancelUntilDate = $EndBaseDate->sub($PeriodOfNoticeInterval); } + + $PeriodOfNoticeInterval = $Contract->getPeriodOfNoticeInterval(); + $EndBaseDate = clone $CurrentCancelEndDate; + $EndBaseDate->setTime(0, 0, 0); + $EndBaseDate->sub(\date_interval_create_from_date_string('1 second')); + + $CancelUntilDate = $EndBaseDate->sub($PeriodOfNoticeInterval); } catch (\Exception $Exception) { QUI\System\Log::writeException($Exception); } @@ -952,22 +952,37 @@ public function getFrontendViewData() $addedDate = $this->formatDate($this->getAttribute('addedDate')); $CycleEndDate = $this->getCycleEndDate(); $cycleEndDate = $CycleEndDate ? $this->formatDate($CycleEndDate) : '-'; + $cycleBeginDate = $this->formatDate($this->getCycleBeginDate()); $NextCycleEndDate = $this->getNextCycleEndDate(); $nextCycleEndDate = $NextCycleEndDate ? $this->formatDate($NextCycleEndDate) : '-'; // Determine cancel info text if ($Contract) { - if ($CancelUntilDate) { - $cancelInfoText = QUI::getLocale()->get( - 'quiqqer/memberships', - 'MembershipUser.cancel.info_text.cancel_until_date', - [ - 'addedDate' => $addedDate, - 'cancelUntilDate' => $this->formatDate($CancelUntilDate), - 'cycleEndDate' => $cycleEndDate, - 'nextCycleEndDate' => $nextCycleEndDate - ] - ); + if ($Contract->getPeriodOfNoticeInterval()) { + if ($Contract->isInPeriodOfNotice()) { + $cancelInfoText = QUI::getLocale()->get( + 'quiqqer/memberships', + 'MembershipUser.cancel.info_text.cancel_until_date', + [ + 'addedDate' => $addedDate, + 'cancelUntilDate' => $this->formatDate($CancelUntilDate), + 'cycleEndDate' => $cycleEndDate, + 'nextCycleEndDate' => $nextCycleEndDate + ] + ); + } else { + $cancelInfoText = QUI::getLocale()->get( + 'quiqqer/memberships', + 'MembershipUser.cancel.info_text.period_of_notice_expired', + [ + 'addedDate' => $addedDate, + 'cancelUntilDate' => $this->formatDate($CancelUntilDate), + 'cycleBeginDate' => $cycleBeginDate, + 'cycleEndDate' => $cycleEndDate, + 'nextCycleEndDate' => $nextCycleEndDate + ] + ); + } } else { $cancelInfoText = QUI::getLocale()->get( 'quiqqer/memberships', @@ -1006,7 +1021,7 @@ public function getFrontendViewData() 'username' => $QuiqqerUser->getUsername(), 'fullName' => $QuiqqerUser->getName(), 'addedDate' => $addedDate, - 'beginDate' => $this->formatDate($this->getCycleBeginDate()), + 'beginDate' => $cycleBeginDate, 'endDate' => $cycleEndDate, 'cancelEndDate' => $this->formatDate($CurrentCancelEndDate), 'cancelDate' => $this->formatDate($this->getAttribute('cancelDate')),