Unable to load the requested class: Zugferdxml


#1

Hello and congatulations for this awesome work. Yesterday I updated to 1.5.0 but bumped onto this problem when go to download an invoice. I see my settings at Settings>Invoices>Invoice Template are set correct, at least are set as with the previous version.
Is there any way to fix this?

Thanx in advance for any replies. :slight_smile:


#2

This is quite interesting. This error should only appear if the wrong version of mPDF is loaded. However, it is working without problems for me. Could you please verify that the setting “Enable Zugferd XML” in the invoice settings is turned off (if you don’t need it)?


#3

Hi again, the Zugferd XML was set to on, I set it to off and was able to download the invoice but the template was quite strange :slight_smile: it was not a nice to see invoice, just a listing with numbers :slight_smile:
Kovah, do you think I should try to make a clean installation or there is a point to look this up; To be honest Iam not in a hurry to invoice.
Thnx


#4

You may send me an example of the output or post it here. Maybe it contains mor information about the cause for this problem.


#5

I have the same error too and disabling it stops the error but it would be nice to have the option turned on so my clients can make use of the additional metadata this class provides :slight_smile:


#6

PDF download is able only when I have Zugferd disabled, when I enable Zugferd then it shows this nice red page with the error description.
While Zugferd disabled here is a screenshot of the PDF

And here is a web Guest URL screenshot which also shows some php errors inside the invoice,

A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$invoice_item_total

Filename: public/InvoicePlane_Web.php

Line Number: 185

Backtrace:

File: /var/www/invoiceplane/html/application/views/invoice_templates/public/InvoicePlane_Web.php
Line: 185
Function: _error_handler

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

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

File: /var/www/invoiceplane/html/application/modules/guest/controllers/View.php
Line: 58
Function: view

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

#7

Please update your web template. The variable does not exist anymore.


#8

I updated the …/views directory with a fresh one, now is ok with the web view. Still some problems with the .pdf but it seems its something between my hardcoded templates and the new version (compatibility;)…maybe;
I will try to fix it and post results.
Thank you for your support and such a great and neat work!


#9

Well I found that there was a problem using my invoice templates from the old installation with the new one. Using the 1.5.0 templates solved the problem also with the pdf view.
Thank you for supporting :slight_smile:


#10

Cannot reproduce thie error regarding the Zugferdxml class as the file should not exist in any version > 1.5.0. Also, testing the feature does not throw this error.


#11

I am running invoiceplane 1.5.4 on ubuntu 16.04 and I also have the zugferd problem.
It worked when I used 1.4.x.

This is how my log file looks like:

DEBUG - 2017-10-26 21:05:40 --> UTF-8 Support Enabled
DEBUG - 2017-10-26 21:05:40 --> Global POST, GET and COOKIE data sanitized
DEBUG - 2017-10-26 21:05:40 --> Invoices MX_Controller Initialized
DEBUG - 2017-10-26 21:05:40 --> Config file loaded: /var/www/iplane152/application/config/invoice_plane.php
DEBUG - 2017-10-26 21:05:40 --> Encryption: Auto-configured driver 'openssl'.
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/settings/models/Mdl_settings.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/controllers/../modules/layout/controllers/Layout.php
DEBUG - 2017-10-26 21:05:40 --> Layout MX_Controller Initialized
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/invoices/models/Mdl_invoices.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/invoices/models/Mdl_items.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/invoices/models/Mdl_invoice_tax_rates.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/custom_fields/models/Mdl_custom_fields.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/payment_methods/models/Mdl_payment_methods.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/payments/models/Mdl_payments.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/custom_fields/models/Mdl_invoice_custom.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/custom_values/models/Mdl_custom_values.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/custom_fields/models/Mdl_client_custom.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/custom_fields/models/Mdl_user_custom.php
DEBUG - 2017-10-26 21:05:40 --> File loaded: /var/www/iplane152/application/modules/custom_fields/models/Mdl_quote_custom.php
ERROR - 2017-10-26 21:05:40 --> Unable to load the requested class: Zugferdxml

When I take a look at “zugferdxml” in my installation, I find this:

# grep -ir Zugferdxml /var/www/iplane152/
/var/www/iplane152/application/helpers/zugferd_helper.php:    $CI->load->library('zugferdxml', array('invoice' => $invoice, 'items' => $items));
/var/www/iplane152/application/helpers/zugferd_helper.php:    write_file($path, $CI->zugferdxml->xml());
/var/www/iplane152/application/logs/log-2017-05-09.php:ERROR - 2017-05-09 17:10:37 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/logs/log-2017-05-09.php:ERROR - 2017-05-09 17:12:00 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/logs/log-2017-05-09.php:ERROR - 2017-05-09 17:14:38 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/logs/log-2017-05-09.php:ERROR - 2017-05-09 17:15:09 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/logs/log-2017-05-09.php:ERROR - 2017-05-09 17:15:12 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/logs/log-2017-05-09.php:ERROR - 2017-05-09 17:15:20 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/logs/log-2017-10-26.php:ERROR - 2017-10-26 20:46:28 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/logs/log-2017-10-26.php:ERROR - 2017-10-26 20:59:56 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/logs/log-2017-10-26.php:ERROR - 2017-10-26 21:05:02 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/logs/log-2017-10-26.php:ERROR - 2017-10-26 21:05:40 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/logs/log-2017-09-08.php:ERROR - 2017-09-08 07:55:19 --> Unable to load the requested class: Zugferdxml
/var/www/iplane152/application/libraries/ZugferdXml.php: * Class ZugferdXml
/var/www/iplane152/application/libraries/ZugferdXml.php:class ZugferdXml
/var/www/iplane152/application/modules/invoices/controllers/Invoices.php:        $this->load->library('ZugferdXml', array(
/var/www/iplane152/application/modules/invoices/controllers/Invoices.php:        $this->output->set_output($this->zugferdxml->xml());

Any hint would be appreciated.
Thanks a lot
Cornelius


#12

I still can’t reproduce this error either in version 1.5.4 or 1.5.5 which will be released in a few days.


#13

Is the name of the class correct? “Zugferdxml”?
Where is it called?
Where is it defined?

Could it be that I am missing some PHP-pdf library in the correct version?
Is there a way to increase the debug?

Which version of PHP are you running? (I am running 7.0)

Thanks a lot
Cornelius


#14

There is a library called ZugferdXml.php.
It is called in the helpers/zugferd_helper.php file.

I tested this with PHP 5.6, 7.0 and 7.1 and the library was loaded without any problems and the PDF got the XML attached.
Also, it does not make any difference for me if I change the libary call from zugferdxml to ZugferdXml and also changing the class name from ZugferdXml to Zugferdxml does not affect the PDF generation.

Is there kind of a PHP config that requires class calls to be case sensitive? You may try to change the call in the helper file to ZugferdXml.


#15

Thanks for you reply.
After changing the filename

mv application/libraries/ZugferdXml.php application/libraries/Zugferdxml.php

the pdf generating with the Zugferd data works fine.

Can we either change the name of the file or the call of the class upstream?
I am running on ubuntu 16.04 LTS; maybe this is a reason.


#16

Assed a ticket for this: https://development.invoiceplane.com/browse/IP-609