Skip to content

Commit

Permalink
Merge pull request #177 from bcgov/dev
Browse files Browse the repository at this point in the history
Fixed issue with hardcoded year in Attestation PDF
  • Loading branch information
m7amad-github authored Jan 27, 2025
2 parents 2f76940 + d8cdf31 commit 892782e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
5 changes: 1 addition & 4 deletions Modules/Ministry/resources/views/pdf.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
Expiry date: {{ $attestation->expiry_date }}<br/>
<br/><br/>
Dear {{ $attestation->first_name }} {{ $attestation->last_name }},<br/><br/>
This provincial attestation letter confirms that you have a space within British Columbia’s 2024 allocation period for study permit applications, based on the information that you provided:<br/>
This provincial attestation letter confirms that you have a space within British Columbia’s {{ $year }} allocation period for study permit applications, based on the information that you provided:<br/>
<strong>Student:</strong>
<ul>
<li>Student Name: {{ $attestation->last_name }}, {{ $attestation->first_name }}</li>
Expand Down Expand Up @@ -103,9 +103,6 @@
<td style="width: 30%;">
Mailing Address:<br/>
{!! $utils['Ministry Mailing Address'][0]->field_name !!}<br/>
{{ $utils['Ministry Tele Victoria'][0]->field_name }}<br/>
{{ $utils['Ministry Tele Toll-free'][0]->field_name }} (Toll-free in Canada/USA)<br/>
{{ $utils['Ministry Tele Toll-free'][0]->field_name }} (B.C. Lower Mainland)<br/>
</td>
<td style="width: 25%;">
Courier Address:<br/>
Expand Down
7 changes: 6 additions & 1 deletion app/Listeners/RebuildPdfAttestation.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ private function storePdf($atteId)
$utils = Util::getSortedUtils();
$draft = env('APP_ENV') !== 'production';

$html = view('ministry::pdf', compact('attestation', 'now_d', 'now_t', 'utils', 'draft'))->render();
// Get cap linked to the attestation to extract year
$cap = $attestation->cap;
$capStartDate = $cap ? $cap->start_date : null;
$year = date('Y', strtotime($capStartDate));

$html = view('ministry::pdf', compact('attestation', 'now_d', 'now_t', 'utils', 'draft', 'year'))->render();
$pdfContent = base64_encode($html);
AttestationPdf::create(['guid' => Str::orderedUuid()->getHex(),
'attestation_guid' => $attestation->guid,
Expand Down
7 changes: 6 additions & 1 deletion app/Listeners/VerifyIssuedAttestation.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ private function storePdf($atteId)
$utils = Util::getSortedUtils();
$draft = env('APP_ENV') !== 'production';

$html = view('ministry::pdf', compact('attestation', 'now_d', 'now_t', 'utils', 'draft'))->render();
// Get cap linked to the attestation to extract year
$cap = $attestation->cap;
$capStartDate = $cap ? $cap->start_date : null;
$year = date('Y', strtotime($capStartDate));

$html = view('ministry::pdf', compact('attestation', 'now_d', 'now_t', 'utils', 'draft', 'year'))->render();
$pdfContent = base64_encode($html);
AttestationPdf::create(['guid' => Str::orderedUuid()->getHex(),
'attestation_guid' => $attestation->guid,
Expand Down
7 changes: 6 additions & 1 deletion app/Listeners/VerifyUpdatedAttestation.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ private function storePdf($atteId)
$utils = Util::getSortedUtils();
$draft = env('APP_ENV') !== 'production';

$html = view('ministry::pdf', compact('attestation', 'now_d', 'now_t', 'utils', 'draft'))->render();
// Get cap linked to the attestation to extract year
$cap = $attestation->cap;
$capStartDate = $cap ? $cap->start_date : null;
$year = date('Y', strtotime($capStartDate));

$html = view('ministry::pdf', compact('attestation', 'now_d', 'now_t', 'utils', 'draft', 'year'))->render();
$pdfContent = base64_encode($html);
AttestationPdf::create(['guid' => Str::orderedUuid()->getHex(),
'attestation_guid' => $attestation->guid,
Expand Down

0 comments on commit 892782e

Please sign in to comment.