Commit 2cb74b78 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix: set membership_type to 'member' on enrollment

Participants were staying as 'non_member' after enrollment, causing
renewals to be priced at 900 (non-member) instead of 650 (member).
EnrollmentService now sets membership_type='member' on enrollment.

DB fix: updated 178 participants to 'member', corrected 124 unpaid
renewal invoices from 90000 to 65000 piasters.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 158ba901
...@@ -95,9 +95,16 @@ public function enroll(Participant $participant, TrainingGroup $group, User $act ...@@ -95,9 +95,16 @@ public function enroll(Participant $participant, TrainingGroup $group, User $act
// Update group count // Update group count
$this->groupService->incrementCount($group); $this->groupService->incrementCount($group);
// Activate participant if still in registered status // Activate participant and set as member on first enrollment
$updates = [];
if ($participant->status->value === 'registered') { if ($participant->status->value === 'registered') {
$participant->update(['status' => 'active']); $updates['status'] = 'active';
}
if (($participant->membership_type?->value ?? $participant->membership_type) === 'non_member') {
$updates['membership_type'] = 'member';
}
if ($updates) {
$participant->update($updates);
} }
// Auto-create invoice if program has a price (skip if invoice already provided via options) // Auto-create invoice if program has a price (skip if invoice already provided via options)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment