Variables missing when generating PDFs

Hi again!

Finally had some time to give this a try again.
Built my own docker image base on mhzawadi/invoiceplane, but with the files from my “public_html” web version that is currently running. Docker compose with mariaDB and PHPmyadmin and I imported the database from the web version, and everything seems to run fine until I try to generate a PDF, I get a web page with the quotes lines for articles but then these PHP errors:

A PHP Error was encountered
Severity: Warning

Message: Undefined variable $legacy_calculation

Filename: pdf/InvoicePlane.php

Line Number: 208

Backtrace:

File: /var/www/html/application/views/quote_templates/pdf/InvoicePlane.php
Line: 208
Function: _error_handler

File: /var/www/html/application/third_party/MX/Loader.php
Line: 480
Function: include

File: /var/www/html/application/third_party/MX/Loader.php
Line: 431
Function: _ci_load

File: /var/www/html/application/helpers/pdf_helper.php
Line: 258
Function: view

File: /var/www/html/application/modules/quotes/controllers/Quotes.php
Line: 195
Function: generate_quote_pdf

File: /var/www/html/index.php
Line: 329
Function: require_once
An uncaught Exception was encountered
Type: Error

Message: Call to undefined function discount_global_print_in_pdf()

Filename: /var/www/html/application/views/quote_templates/pdf/InvoicePlane.php

Line Number: 209

Backtrace:

File: /var/www/html/application/third_party/MX/Loader.php
Line: 480
Function: include

File: /var/www/html/application/third_party/MX/Loader.php
Line: 431
Function: _ci_load

File: /var/www/html/application/helpers/pdf_helper.php
Line: 258
Function: view

File: /var/www/html/application/modules/quotes/controllers/Quotes.php
Line: 195
Function: generate_quote_pdf

File: /var/www/html/index.php
Line: 329
Function: require_once

Any idea what it could be? TIA!

Compare your quote_templates/pdf/InvoicePlane.php with one from the .zip or the github repository.

You have some missing variables

1 Like

Got it.

My dockerfile copies over all the files from my web instance, but the apparently the assigned volume directories get locked so it wasn’t copying over those files, which includes the PDF template stuff.

I hadn’t realised I was actually running version 1.6.2, so I’ll try to update while I’m at it. Thanks!

1 Like

Did you make your own Dockerfile or are you using one of the files available from GitHub?

Copying over an entire directory into the container (as i believe it) and then assigning volumes is very tricky.

Made my own dockerfiles using https://hub.docker.com/r/mhzawadi/invoiceplane as the start image as the starting point.

FROM mhzawadi/invoiceplane:latest
COPY public_html/ /var/www/html/
RUN chmod -R 777 /var/www/html/application/logs/

The volume directories in the original image must have different permissions as this COPY command wasn’t copying the files in those directories.
I did have the volumes mapped to the same directory I was trying to copy over but that didn’t seem to work either, so I commented out the volumes, rebuilt the image and it worked.

Then docker compose I made runs this along along with MariaDB and phpMyAdmin so I can restore the database too.

1 Like

Just keep in mind that he keeps maintaining that image.

He maintains that image really nicely.

And yes, i would make it work with those extra volumes (the uploads directory and i think some other volumes as well).

Handling volumes after the files have been copied is a nightmare.
if you succeed, i would still make a volume towards application/views/ since that’s where the templates for quotes and invoices live.

Yes, you are right of course. But I wanted a local running backup of my current web instance. I think I might setup a new clean install when the next release comes out. Thanks again for all the help!

1 Like

It’s very smart!
If you want you can maintain the Docker variation of InvoicePlane.

2 versions are on their way:

  • 1.6.4 <<<=== purely bugfixing
  • 1.7.0 <<<=== PHP 8.2+ compatibility AND it’s still compatible with PHP 8.1 :wink:
1 Like