Commit c54f5aea authored by Claude's avatar Claude

Fix branch leaks in the two receptionist wizards

The enrolment wizard looked up a programme's base price without any
branch filter, so with per-branch pricing across 7 branches the
receptionist could be quoted another branch's price.

The registration wizard's printed receipt resolved the branch with
Branch::first(), so every receipt printed the first branch's details
regardless of where the registration actually happened.
Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
parent f282f7bc
......@@ -226,6 +226,7 @@ class="inline-flex items-center gap-2 px-6 py-3 min-h-16 bg-emerald-600 text-whi
$programFee = \App\Domain\Pricing\Models\BasePrice::where('priceable_type', \App\Domain\Training\Models\TrainingProgram::class)
->where('priceable_id', $program->id)
->where('is_active', true)
->forBranch(session('active_branch_id') ?? auth()->user()->branch_id)
->where('effective_from', '<=', now())
->where(fn ($q) => $q->whereNull('effective_to')->orWhere('effective_to', '>=', now()))
->orderByDesc('priority')
......
......@@ -1355,7 +1355,10 @@ class="flex-1 sm:flex-none inline-flex items-center justify-center gap-2 px-8 py
$branding = app(\App\Domain\Shared\Services\SettingsService::class);
$brandLogo = $branding->get('branding.logo');
$academyName = app('current_academy')->name_ar ?? '';
$branch = \App\Domain\Identity\Models\Branch::where('academy_id', app('current_academy')?->id)->first();
$activeBranchId = session('active_branch_id') ?? auth()->user()->branch_id;
$branch = \App\Domain\Identity\Models\Branch::where('academy_id', app('current_academy')?->id)
->when($activeBranchId, fn ($q) => $q->where('id', $activeBranchId))
->first();
$receiptFooter = $branding->get('branding.receipt_footer_text', '');
@endphp
<div id="printable-invoice" class="bg-white border border-gray-300 rounded-xl p-4 sm:p-6 max-w-2xl mx-auto print:border-0 print:shadow-none print:rounded-none print:p-0 print:max-w-full">
......
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