Skip to content

Fix: Creation of Factur XML is also triggered for uploaded pdf files

Hi Eric,

during some file uploads an error occured in your module facturx. This leads to an 500 server error. The priority is not high, as the file is uploaded but only the ECM database entries are not made and this occures only if there is a not supported compression is used: error "This PDF document probably uses a compression technique which is not supported by the free parser shipped with FPDI" in the logs.

The main thing is that the trigger for ECMFILES_CREATE and MODIFY is always triggered, also if there is an uploaded file where an attached xml is not needed.

Explanation: In file interface_99_modFacturx_FacturxTriggers.class.php in line 324 it checks if the object type is 'facture':

if ($object->src_object_type == 'facture') {

This can be extended to check also if it is a generated file, as customer invoices are always generated:

if ($object->src_object_type == 'facture' && $object->gen_or_uploaded == "generated") {

What do you think? I think it would also improve the upload for file attached to invoices.

Steps to reproduce: Upload an pdf document to an existing invoice and check if fx->makePDF(filename) is triggered. Expected: the function makePDF is not triggered as this is only needed for generated invoices. Current behaviour: the function is triggered.

Regards, Sven

Merge request reports

Loading