Skip to content

Commit

Permalink
Fix missing end date
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Apr 27, 2024
1 parent 091b192 commit 430d34a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions galette/lib/Galette/Entity/Contribution.php
Expand Up @@ -284,13 +284,10 @@ private function retrieveEndDate(): void
}
}

// Caution : the end_date to retrieve is the day before the next_begin_date.
$end_date = clone $next_begin_date;
$end_date->sub(new DateInterval('P1D'));
} else {
$dext = new DateInterval('P' . $this->type->extension . 'M');
$end_date = $begin_date->add($dext);
$end_date->sub(new DateInterval('P1D')); //-1 day
}
} elseif ($preferences->pref_membership_ext != '') {
//case membership extension
Expand All @@ -301,13 +298,15 @@ private function retrieveEndDate(): void
// Caution : the end_date to retrieve is the day before the next_begin_date.
$next_begin_date = $begin_date->add($dext);
$end_date = clone $next_begin_date;
$end_date->sub(new DateInterval('P1D'));
$this->end_date = $end_date->format('Y-m-d');
} else {
throw new \RuntimeException(
'Unable to define end date; none of pref_beg_membership nor pref_membership_ext are defined!'
);
}

// Caution : the end_date to retrieve is the day before the next_begin_date.
$end_date->sub(new DateInterval('P1D'));
$this->end_date = $end_date->format('Y-m-d');
}

/**
Expand Down

0 comments on commit 430d34a

Please sign in to comment.