extending entity-print-styling library through theme not working whenever "Email the customer" checkbox is ticked.

Created on 20 August 2021, almost 3 years ago
Updated 5 September 2023, 10 months ago

Problem/Motivation

Now. I've seen some weird bugs, but this one really takes the cake.
And already made me spend 4 hours running in circles until I pinpointed the issue @_@.

TLDR: 2.0-Beta4 whenever "Email the customer a confirmation when an invoice is "confirmed" or paid." checkbox is ticked then somehow the styling from libraries-extend:... commerce_invoice/entity-print-styling: gets ignored.

And as soon as I uncheck that box and regenerate the invoice then the styling works fine again. I check it again, regenerate, the styling is taken from module instead of theme (as in, not working). I uncheck... and so on.

Deep Dive:

I am using this code to extend the library (CSS) of commerce invoice so that I can style it directly from a css file inside my theme instead of having to put the CSS in the module itself.

my template.info.yml includes these lines:

libraries-extend:
  commerce_invoice/entity-print-styling:
    - mytheme/print-styling

entity_print: // Not that this part is related to Commerce Invoice, but let's include it here to give a bigger picture.
  node:
    all: 'mytheme/print-styling'

my template.libraries.yml includes these lines:

print-styling:
  css:
    theme:
      css/print-style.css: { minified: false, preprocess: false }

and of course I have a print-style.css in my theme/css dir.

Note, that this all worked completely fine until today, when I have decided to update to Beta4 of Commerce Invoice, thinking maybe that would help me with another issue related to permissions (it didn't...).

So I run the update straight from Drupal Admin interface, thinking hey, this is going to be a breeze.
After the update from Beta3 to Beta4. Styling stopped working. Basically the code I listed above, gets ignored.

My first thought: Botched update.

So I have reverted to the pre-update backup, and this time I took a different route.

This time I have first uninstalled Commerce Invoice, removed the directory from modules and installed a fresh Beta4.

Nice, the styling works again! That's what I thought... until I started bringing back the previous configuration, by hand, by filling out the various options.

And then I have discovered, that every time that the "Email the customer a confirmation when an invoice is "confirmed" or paid." is ticked, the styling stops working (the library extend, is getting ignored). As soon as I untick it, regenerate the invoices and press download, the styling is fine. So, for some completely weird reason, this checkbox is giving problems. Below are steps to recreate the issue:

Steps to reproduce

1. Install fresh Beta4 of Commerce Invoice (this issue is not present in Beta3).
2. Use the code to extend library and make a .css file with some wacky styling:

my template.info.yml includes these lines:

libraries-extend:
  commerce_invoice/entity-print-styling:
    - mytheme/print-styling

entity_print: // Not that this part is related to Commerce Invoice, but let's include it here to give a bigger picture.
  node:
    all: 'mytheme/print-styling'

my template.libraries.yml includes these lines:

print-styling:
  css:
    theme:
      css/print-style.css: { minified: false, preprocess: false }

3. Maybe you want to add a logo to the invoice type, maybe footer, don't think that matters. And I also haven't touched the "views" section after fresh install.

The crux of the matter: tick the box saying "Email the customer a confirmation when an invoice is "confirmed" or paid." (I tried with and without giving an email in the field below it, same result).

4. Go to an order that doesn't have an invoice generated yet.
5. Click "add invoice" and generate it.
6. Click [download] to download the invoice PDF.

πŸ› Bug report
Status

Active

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024