Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
To simulate the problem:-
1. Add rule action 'Send commerce billy invoice mail.' to rule 'Set order to invoiced' from commerce_billy module.
2. A PDF will be generated and mailed when an order status changed to 'invoiced'.
3. The PDF received in the mailbox are rendered with the admin theme instead of the default theme.
Comments
Comment #1
AnybodyPlease try the latest versions of this and commerce_billy. It looks like an older problem.
I added the following for that some releases ago:
Comment #2
khayong CreditAttribution: khayong commentedYes, I saw that function. The function was called as theme callback from menu item 'admin/commerce/orders/%commerce_order/resend-pdf-invoice'. Unfortunately, the rule action 'Send commerce billy invoice mail.' couldn't utilise that function. It was still use admin theme when the rule action was trigger in the backend.
Comment #3
AnybodyWell I see your point.
The problem is that I currently have no idea how to set the theme for the (indirect) rules request.
What we need is to set the base theme before
is called in line 220.
Perhaps this should even happen in commerce_billy_pdf.module, but it doesn't have to.
Can someone help in implementation?
Comment #4
AnybodyI still have no more idea than what we already did. Please reopen if there is new information.
Comment #5
Watergate CreditAttribution: Watergate at Sicse commentedI think this problem is related to #2153169: Pdf differs in styling when streamed and saved.
I've suggested a solution where the admin is able to set the (default) template files to use by the Commerce Billy PDF module. As long as the custom theme doens't overwrite the particular .tpl.php files, generating the pdf will be done with the specified (custom) template (files).
So, if the provided patch gets accepted, your problem should be fixed and there won't be any need to force Drupal to use the default theme.
Comment #6
Anybody#5 you are right. The problems are related. I finally decided to implement a more specific solution via a new configuration option. In the latest .dev version you may now select the .tpl.php files you have overridden in your default template and these will be loaded from there instead of changing the whole directory source as in #2153169: Pdf differs in styling when streamed and saved.
Please test the latest .dev version. It works for me in all conditions.
Comment #7
AnybodyComment #10
japerryThis overrides all custom_theme hooks, causing other site customizations to fail.
There should be a conditional wrapped around this hook.
Comment #11
AnybodyThank you for your feedback. Do you have a code snippet or patch for me?
Comment #12
AnybodyStill no idea how we can fix these problems completely. Is there any related core issue targeting this problem?