Open j-moser-sap opened 3 months ago
I'm very surprised that zugferd 2.0.1 specifies "zugferd-invoice.xml" as attachment filename. It is really written that way in the ZUGFeRD 2.0.1 specifications ?
@alexis-via Yes, it is.
Download the ZIP here: https://www.ferd-net.de/standards/zugferd-versionsarchiv/zugferd-2.0.1.html
The file ZUGFeRD201/Dokumentation/ZUGFeRD-2.0.1-Spezifikation.pdf
on page 23 contains the sentence:
Die XML-Datei wird stets mit dem Namen "zugferd-invoice.xml" eingebettet.
(translation: "The XML file is always embedded with the name "zugferd-invoice.xml")
I am also a bit surprised by that, but apparently, this is how 2.0.1 is specified.
Hi @alexis-via,
Is there anything I can do to help get this merged? I can prepare demos/examples/etc. if needed, just let me know. Thanks!
I'm ok for the change ; we need to be more flexible. I'll take care of that in a few days/weeks and make a new release
Thank you, that is great!
Steps to reproduce
ZUGFeRD201/Beispiele/EXTENDED/zugferd_2p0_EXTENDED_Warenrechnung.pdf
This will produce the following error:
"Mitigation"
Downgrade to
factur-x
in version 1.12. This is the last version that processes this file completely fine.Cause
The cause for this bug is the following snippet in
get_xml_from_pdf
:The file name of the XML embedded in ZUGFeRD 2.0.1 files is
zugferd-invoice.xml
. This leads the script to detect the flavor"zugferd"
and pass this on toxml_check_xsd
, which then automatically loads an incompatible XSD for ZUGFeRD 1.0; causing the validation to fail.Funny enough, when just leaving the flavor at
"autodetect"
,xml_check_xsd
will do its own detection based on the XML inside usingget_flavor
. This would detect"factur-x"
as flavor for the ZUGFeRD 2.0.1 file, which it can then correctly parse.Proposed fix
The fastest fix I could imagine is to remove the snippet above from the
get_xml_from_pdf
method. Asxml_check_xsd
does its own check anyway, this should be fine?