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

Merge branch 'dev'

Übergeordnete 12c78f5d 9c09c6f6
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -94,6 +94,10 @@ public static function checkMembershipUsers()
}
}
if ($MembershipUser->getId() == 84) {
\QUI\System\Log::writeRecursive(1);
}
// extend if membership is extended automatically
if ($Membership->isAutoExtend()) {
// Only extend if not extended by contract
......
......@@ -332,7 +332,13 @@ public static function onQuiqqerContractsExtend(Contract $Contract, \DateTime $E
try {
/** @var QUI\Memberships\Users\MembershipUser $MembershipUser */
$MembershipUser = $MembershipUsers->getChild($row['id']);
$MembershipUser->extend();
// Calculate new cylce begin date
$NextBeginDate = clone $EndDate;
$NextBeginDate->add(\date_interval_create_from_date_string('1 day'));
$NextBeginDate->setTime(0, 0, 0);
$MembershipUser->extend(true, $NextBeginDate, $NewEndDate);
} catch (\Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
......
......@@ -113,14 +113,21 @@ public function update()
*
* @param bool $auto (optional) - Used if the membership is automatically extended.
* If set to false, the setting membershipusers.extendMode is used [default: true]
* @param \DateTime $NextBeginDate (optional) - New cycle begin date
* @param \DateTime $NextEndDate (optional) - New cycle end date
* @return void
* @throws QUI\Exception
*/
public function extend($auto = true)
public function extend($auto = true, \DateTime $NextBeginDate = null, \DateTime $NextEndDate = null)
{
// Calculate new start and/or end time
$NextBeginDate = $this->getNextCycleBeginDate();
$NextEndDate = $this->getNextCycleEndDate();
if (empty($NextBeginDate)) {
$NextBeginDate = $this->getNextCycleBeginDate();
}
if (empty($NextEndDate)) {
$NextEndDate = $this->getNextCycleEndDate();
}
if ($auto) {
$extendCounter = $this->getAttribute('extendCounter');
......
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