Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.3.1]: email template + pdf not being sent if field fileNameFormat is empty #3309

Closed
jarheadcore opened this issue Oct 20, 2023 · 2 comments
Assignees
Labels
bug commerce4 Issues related to Commerce v4

Comments

@jarheadcore
Copy link

What happened?

Description

If a commerce order has a email template + order pdf attached, the empty field "Order PDF Filename Format" / field id: fileNameFormat generates the following error when trying to send the order mails:

craft\web\View::renderObjectTemplate(): Argument #1 ($template) must be of type string, null given, called in /app/vendor/craftcms/commerce/src/services/Emails.php on line 694

Steps to reproduce

  1. place an order
  2. use html email template
  3. attach order pdf to it
  4. set pdf name, handle + path but leave fileNameFormat field empty

Expected behavior

As in craftcms/commerce/src/services/email.php line 696 -> $fileName = $pdf->handle . '-' . $order->number; fallback if !filename, the pdf's handle + ordernumber should be set as filename.

Actual behavior

the queue job runs into a timeout and emails (+ pdf attachments) are not sent.

code: https://share.cleanshot.com/79TCrNFL
actual issue / timeout queue: https://share.cleanshot.com/KyfxJCf2
queue error: https://share.cleanshot.com/rq0G7KDv

Not having the issue if providing a nameformat for the pdf.
Would it be possible to make it a required field?

Craft CMS version

4.5.7

Craft Commerce version

4.3.1

PHP version

8.2

Operating system and version

bento/debian-11

Database type and version

mysql 8.0

Image driver and version

No response

Installed plugins and versions

No response

@jarheadcore jarheadcore added commerce4 Issues related to Commerce v4 bug labels Oct 20, 2023
@lukeholder lukeholder self-assigned this Oct 24, 2023
@lukeholder
Copy link
Member

Thanks for reporting. This has been fixed for the next release.

To get the fix early, change your craftcms/commerce requirement in composer.json to:

"require": {
  "craftcms/commerce": "dev-develop#9748053478f4bc32905c1536e73ce112def7a91e as 4.3.1",
  "...": "..."
}

Then run composer update.

@lukeholder
Copy link
Member

This is now fixed in 4.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commerce4 Issues related to Commerce v4
Projects
None yet
Development

No branches or pull requests

2 participants