Skip to content
Code-Schnipsel Gruppen Projekte
Commit 12ffb9cc erstellt von Patrick Müller's avatar Patrick Müller
Dateien durchsuchen

refactor: merge conflict

Übergeordnete 14bf338d 8d35672a
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -20,7 +20,7 @@
"url": "http://www.pcsg.de"
},
"require": {
"quiqqer/verification": "1.*|dev-master"
"quiqqer/verification": "^1.3|*@dev"
},
"autoload": {
"psr-4": {
......
......@@ -7,4 +7,6 @@
<event on="onQuiqqerContractsCreateFromOrder" fire="\QUI\Memberships\Events::onQuiqqerContractsCreateFromOrder"/>
<event on="onQuiqqerContractsDelete" fire="\QUI\Memberships\Events::onQuiqqerContractsDelete"/>
<event on="onQuiqqerVerificationDeleteUnverified" fire="\QUI\Memberships\Events::onQuiqqerVerificationDeleteUnverified"/>
</events>
\ No newline at end of file
......@@ -122,6 +122,14 @@
<de><![CDATA[Mitgliedschaften, die aus derselben Bestellung erstellt werden, aus der auch ein Vertrag erstellt wird, werden mit diesem Vertrag verknüpft. Dies bewirkt, dass bei Kündigung der Mitgliedschaft u.U. auch der Vertrag gekündigt wird (abhängig von Einstellung im Vertrags-Modul). Setzt voraus, dass <b>quiqqer/contracts</b> installiert ist.]]></de>
<en><![CDATA[Memberships created from the same purchase order from which a contract is created are linked to this contract. This means that if the membership is cancelled, the contract may also be cancelled (depending on the setting in the contract module). Requires <b>quiqqer/contracts</b> to be installed.]]></en>
</locale>
<locale name="settings.cancelReminderDays.title">
<de><![CDATA[Kündigungserinnerung nach X Tagen]]></de>
<en><![CDATA[Cancel confirmation reminder after X days]]></en>
</locale>
<locale name="settings.cancelReminderDays.description" html="true">
<de><![CDATA[Anzahl an <b>Tagen</b>, nach denen Mitgliedschafts-Benutzer eine Erinnerung an ausstehende Kündigungs-Bestätigungen per E-Mail erhalten. Nicht gekündigte Mitgliedschafen laufen nach Ablauf der Gültigkeit des Bestätigungs-Links automatisch weiter.<br/><br/>Ein Wert von <b>0</b> bedeutet, dass <b>keine</b> Erinnerung verschickt wird.]]></de>
<en><![CDATA[Memberships created from the same purchase order from which a contract is created are linked to this contract. This means that if the membership is cancelled, the contract may also be cancelled (depending on the setting in the contract module). Requires <b>quiqqer/contracts</b> to be installed.<br/><br/>A value of <b>0</b> means that <b>no</b> reminder will be sent.]]></en>
</locale>
<locale name="settings.dateformat.title">
<de><![CDATA[Datumsformatierung]]></de>
......@@ -336,8 +344,8 @@
<en><![CDATA[(Cancellation requested - Please click the confirmation link in the e-mail)]]></en>
</locale>
<locale name="controls.profile.userprofile.status.modifier.abortcancel_confirm">
<de><![CDATA[(Kündigung zurückgezogen - Bestätigung ausstehend)]]></de>
<en><![CDATA[(Cancellation withdrawn - confirmation pending)]]></en>
<de><![CDATA[(Kündigung zurückgezogen - Bitte Bestätigungslink in E-Mail anklicken)]]></de>
<en><![CDATA[(Cancellation withdrawn - Please click the confirmation link in the e-mail)]]></en>
</locale>
<!-- Control: MembershipsSearchPopup -->
......@@ -902,8 +910,8 @@
<en><![CDATA[The cancellation of the membership could not be withdrawn:<br><br>[error]]]></en>
</locale>
<locale name="message.ajax.memberships.users.abortCancel.success" html="true">
<de><![CDATA[Die Kündigung der Mitgliedschaft wurde erfolgreich aufgehoben.]]></de>
<en><![CDATA[The cancellation of the membership was withdrawn successfully.]]></en>
<de><![CDATA[Die Aufhebung der Kündigung Ihrer Mitgliedschaft wurde erfolgreich beantragt. <b>Sie erhalten eine E-Mail mit weiteren Anweisung zur Bestätigung dieses Vorgangs!</b>]]></de>
<en><![CDATA[The recission of the cancellation of your membership has been successfully applied for. <b>You will receive an e-mail with further instructions to confirm this process!</b>]]></en>
</locale>
<locale name="message.ajax.memberships.products.createMembershipProducts.error" html="true">
<de><![CDATA[Das Produkt konnte nicht erstellt werden:<br><br>[error]]]></de>
......@@ -1045,11 +1053,20 @@
<de><![CDATA[Zurückziehen der Kündigung Ihrer Mitgliedschaft]]></de>
<en><![CDATA[Withdrawal of your membership termination]]></en>
</locale>
<locale name="templates.mail.startabortcancel.body" html="true">
<locale name="templates.mail.confirmcancel_reminder.subject">
<de><![CDATA[Kündigung Ihrer Mitgliedschaft - Bestätigung ausstehend]]></de>
<en><![CDATA[Termination of your membership - Confirmation pending]]></en>
</locale>
<locale name="templates.mail.confirmcancel_reminder.body">
<de><![CDATA[<h1>Hallo [name]!</h1>
<p>Es wurde beantragt, die Kündigung Ihrer Mitgliedschaft <b>[membershipTitle]</b> vom <b>[cancelDate]</b> zurückzuziehen. Um diese Vorgang zu bestätigen, besuchen Sie bitte folgenden Link:<br><br><a href="[abortCancelUrl]">[abortCancelUrl]</a></p>]]></de>
<p>Am <b>[cancelDate]</b> wurde die Kündigung Ihrer Mitgliedschaft <b>[membershipTitle]</b> beantragt. Wir haben bisher keine Bestätigung dieser Kündigung erhalten.</p>
<p>Um die Kündigung Ihrer Mitgliedschaft zu bestätigen, besuchen Sie bitte folgenden Link:<br><br><a href="[cancelUrl]">[cancelUrl]</a>
<p>Sollten keine Kündigung wünschen, können Sie diese E-Mail ignorieren. Ihre Mitgliedschaft läuft dann automatisch wie gewohnt weiter.</p>]]></de>
<en><![CDATA[<h1>Hello [name]!</h1>
<p>It was requests to withdraw the termination of your membership <b>[membershipTitle]</b> from <b>[cancelDate]</b>. To confirm this process please visit the following link:<br><br><a href="[abortCancelUrl]">[abortCancelUrl]</a></p>]]></en>
<p>At <b>[cancelDate]</b> the cancellation of your membership <b>[membershipTitle]</b> was requested. We did not receive a confirmation of this cancellation yet.</p>
<p>To confirm the cancellation please visit the following link:<br><br><a href="[cancelUrl]">[cancelUrl]</p>
<p>If you do not wish to cancel your membership you can just ignore this email. Your membership will then automatically continue as usual.</p>
]]></en>
</locale>
<!-- CancelVerification -->
......@@ -1090,6 +1107,11 @@
<en><![CDATA[The membership cancellation has already been withdrawn.]]></en>
</locale>
<locale name="history.misc.cancel_abort_unverified">
<de><![CDATA[Kündigung der Mitgliedschaft automatisch zurückgezogen, da die Kündigung durch den Benutzer nicht bestätigt wurde.]]></de>
<en><![CDATA[Cancellation of membership automatically withdrawn, as the cancellation was not confirmed by the user.]]></en>
</locale>
</groups>
<groups name="quiqqer/products" datatype="php,js">
......
......@@ -40,6 +40,10 @@
<type><![CDATA[bool]]></type>
<defaultvalue>1</defaultvalue>
</conf>
<conf name="cancelReminderDays">
<type><![CDATA[integer]]></type>
<defaultvalue>3</defaultvalue>
</conf>
</section>
<section name="date_formats_short">
......@@ -177,6 +181,15 @@
</description>
</input>
<input conf="membershipusers.cancelReminderDays" type="number" min="0">
<text>
<locale group="quiqqer/memberships" var="settings.cancelReminderDays.title"/>
</text>
<description>
<locale group="quiqqer/memberships" var="settings.cancelReminderDays.description"/>
</description>
</input>
</settings>
<settings title="dateformat" name="dateformat">
......
......@@ -27,7 +27,9 @@ public static function checkMembershipUsers()
]
]);
$now = time();
$now = time();
$cancelConfirmReminderAfterDays = (int)MembershipUsersHandler::getSetting('cancelReminderDays');
$Now = date_create();
foreach ($result as $row) {
try {
......@@ -46,6 +48,21 @@ public static function checkMembershipUsers()
continue;
}
// Check if cancellation of membership has been started but NOT yet confirmed.
// Send reminder e-mail after X days of unconfirmed cancellation.
if (!empty($cancelConfirmReminderAfterDays)
&& (int)$MembershipUser->getAttribute('cancelStatus') === MembershipUsersHandler::CANCEL_STATUS_CANCEL_CONFIRM_PENDING) {
$CancelDate = \date_create($MembershipUser->getAttribute('cancelDate'));
if ($CancelDate) {
$RemindDate = $CancelDate->add(new \DateInterval('P'.$cancelConfirmReminderAfterDays.'D'));
// if ($Now > $RemindDate) {
$MembershipUser->sendConfirmCancelReminderMail();
// }
}
}
// never expire a membership with infinite duration
if ($Membership->isInfinite()) {
continue;
......
......@@ -446,6 +446,36 @@ public static function onQuiqqerProductsFieldDeleteBefore(ProductField $Field)
}
}
/**
* quiqqer/verification: onQuiqqerVerificationDeleteUnverified
*
* Send message to a membership user if he has not verified a cancellation.
*
* @param int $membershipUserId
* @return void
*/
public static function onQuiqqerVerificationDeleteUnverified($membershipUserId)
{
try {
/** @var QUI\Memberships\Users\MembershipUser $MembershipUser */
$MembershipUser = MembershipUsersHandler::getInstance()->getChild($membershipUserId);
} catch (\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
return;
}
if ((int)$MembershipUser->getAttribute('cancelStatus') !== MembershipUsersHandler::CANCEL_STATUS_CANCEL_CONFIRM_PENDING) {
return;
}
$MembershipUser->addHistoryEntry(
QUI\Memberships\Users\Handler::HISTORY_TYPE_MISC,
QUI::getLocale()->get('quiqqer/memberships', 'history.misc.cancel_abort_unverified')
);
$MembershipUser->confirmAbortCancel();
}
/**
* Create a product category for memberships
*
......
......@@ -275,7 +275,7 @@ public function startManualCancel()
}
/**
* Start to abort a manually stared cancellation process
* Start to abort a manually started cancellation process
*
* @return void
* @throws QUI\Memberships\Exception
......@@ -343,13 +343,21 @@ public function confirmAbortCancel()
'cancelEndDate' => null
]);
Verifier::removeVerification($this->getAbortCancelVerification());
try {
Verifier::removeVerification($this->getAbortCancelVerification());
} catch (\Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
$this->addHistoryEntry(MembershipUsersHandler::HISTORY_TYPE_CANCEL_ABORT_CONFIRM);
$this->setEditUser(QUI::getUsers()->getSystemUser());
$this->update();
QUI::getEvents()->fireEvent('quiqqerMembershipsCancelAbort', [$this]);
try {
$this->update();
QUI::getEvents()->fireEvent('quiqqerMembershipsCancelAbort', [$this]);
} catch (\Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
}
/**
......@@ -399,6 +407,31 @@ public function sendConfirmCancelMail()
}
}
/**
* Send e-mail to remind user of an outstanding cancellation confirmation.
*
* @return void
*/
public function sendConfirmCancelReminderMail()
{
try {
$subject = $this->getUser()->getLocale()->get(
'quiqqer/memberships',
'templates.mail.confirmcancel_reminder.subject'
);
$this->sendMail(
$subject,
dirname(__FILE__, 5).'/templates/mail_confirmcancel_reminder.html',
[
'cancelUrl' => Verifier::getVerificationUrl($this->getCancelVerification())
]
);
} catch (\Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
}
/**
* Cancel membership
*
......@@ -801,7 +834,7 @@ protected function getAbortCancelVerification()
*
* @throws \QUI\Exception
*/
protected function sendMail($subject, $templateFile, $templateVars = [])
public function sendMail($subject, $templateFile, $templateVars = [])
{
$User = $this->getUser();
$email = $User->getAttribute('email');
......@@ -811,6 +844,8 @@ protected function sendMail($subject, $templateFile, $templateVars = [])
'Could not send mail to user #'.$User->getId().' because the user has'
.' no email address!'
);
return;
}
$Engine = QUI::getTemplateManager()->getEngine();
......
<p>
{locale group="quiqqer/memberships" value="templates.mail.confirmcancel_reminder.body" Locale=$Locale
name=$MembershipUser->getUser()->getName()
membershipTitle=$data['membershipTitle']
endDate=$data['cancelEndDate']
cancelDate=$data['cancelDate']
cancelUrl=$cancelUrl
}
</p>
\ No newline at end of file
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren