Skip to content

Commit c6a4497

Browse files
committed
Merge branch 'craft-4' of https://github.com/verbb/gift-voucher into craft-5
# Conflicts: # CHANGELOG.md # composer.json
2 parents e302a14 + 66ad0d1 commit c6a4497

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
- Now requires Craft `5.0.0+`.
5858
- Now requires Craft Commerce `5.0.0+`.
5959

60+
## 3.0.17 - 2025-05-02
61+
62+
### Fixed
63+
- Fix an error when generating PDFs for vouchers with no orders.
64+
6065
## 3.0.16 - 2025-05-01
6166

6267
### Changed

src/controllers/DownloadsController.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function actionPdf(): Response|string
3232
$code = [];
3333

3434
$codes = [];
35-
$order = [];
35+
$order = null;
3636
$lineItem = null;
3737

3838
$number = $this->request->getParam('number');
@@ -75,10 +75,6 @@ public function actionPdf(): Response|string
7575

7676
Locale::switchAppLanguage($site->language);
7777

78-
if (!$order) {
79-
throw new HttpException('No Order Found');
80-
}
81-
8278
$pdf = GiftVoucher::$plugin->getPdf()->renderPdf($codes, $order, $lineItem, $option);
8379

8480
// Set previous language back

src/services/Pdf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getPdfUrlForCode(Code $code, mixed $option = null): string
6565
]));
6666
}
6767

68-
public function renderPdf(array $codes, Order $order = null, $lineItem = null, mixed $option = '', mixed $templatePath = null): string
68+
public function renderPdf(array $codes, ?Order $order = null, ?LineItem $lineItem = null, mixed $option = '', mixed $templatePath = null): string
6969
{
7070
$settings = GiftVoucher::$plugin->getSettings();
7171
$format = null;

0 commit comments

Comments
 (0)