Am a newbie trying to teach myself Dolibarr for my own business. Have a new installation of Dolibarr 7.0.3 running on Ubuntu 18.04 LTS.
All is good except trying to use an ODT template to generate a contract. The azur template works fine, but I’d like to use a my own template, use Dolibarr to enter data in fileds and create a PDF. I’ve tested using my own template, the default templates and all combinations. Each time Dolibarr generates an ODT template, not a pdf. All of these generated ODT file are seen as corrupt and not repairable by OpenOffice 4.1.5.
Yet if I rename the output file to *.zip and unzip it, the file “content.xml” contains the correct information. It seems that Dolibarr can insert the correct information in the ODT template and create a new document, but there is something else going on which corrupts the new document/output file.
Attached is a very simple, one field, input template (1nameonly.odt) and the matching “Corrupt” output file ((PROV26)_1nameonly.odt) along with the error message (screenshot). If anyone could help that would be fantastic, I’m going out of my mind!
I’d start with the corresponding ODT template located in /documents/doctemplates. Be sure to use OpenOffice as some of the others seem to have compatibility issues.
Hi, Thanks for the quick answer. Yes I’ve tried the standard documents: the corresponding ODT template. Both without any editing and editing them with OpenOffice to reduce the template down to just a single field in order to reduce the number of variables.
No matter what I try I keep getting the ODT corrupt error…
No worries. I had the same problems starting out too. Here is a working work order sample we use /documents/doctemplates/orders. feel free to use/modify. Let me know if it this works.
Thanks for this! When I tried to use this ODT template I got the exact same problem. The (corrupt) ODT file generated is attached. By renaming the (corrupt) ODT file as a .ZIP file and unzipping it, I can see that the logo at least ended up in the correct place.
What setting or option in Dolibarr am I not setting correctly, or even better is there a log file or what can I do to debug this one?
By any chance are you just dropping my example template unmodified in to the doctemplates/order directory or are you unzipping or editing it first? Leaving it unedited will help to rule out other issues. Also, Dolibarr ODT templates do not need to be unzipped and should be edited directly with OpenOffice.
As for debugging, I’m not sure a ODT template issues will generate an error.log so you will need to
Open /htdocs/conf/conf.php
Find this line $dolibarr_main_prod=‘1’;
Change 1 to 0. This is a security issue and you’ll want to change it back ASAP.
Your Order template file was downloaded and stored here:
var/lib/dolibarr/documents/doctemplates/orders/Work_Order_2018-07-23.odt When I checked it has file permissions in octal mode of 644.
I can open it, using read only mode, (just to make sure nothing changes) in OpenOffice and it seems fine. So the template reaches the correct directory without any problem.
As suggested I also edited: etc/dolibarr/conf.php
to change $dolibarr_main_prod='1’; to =‘0’;
I can double check in Admin Tools / About Dolibarr / Parameters Configuration file (conf.php) / Production mode (Hide all error messages)
and see that the value of dolibarr_main_prod goes between 0 & 1 as I edit the conf.php file
But I cant detect any difference. It appears that this parameter “controls if information will be reported by Dolibarr when an internal error occurs”. Nothing appeared to change.
I even created two Dolibarr log files when Creating a Work Order which are laid out side by side in the attached ods file. Log file shows an order with a *.ODT template the other using the Einstein PHP template. As you can see both log files have very similar outputs.
I apologize, I forgot to mention you need to go to Home > Setup > Modules/Application setup and enable Debug Logs. After enabling Debug logs, go in to the configuration and make sure it’s set to LOG DEBUG (7) .
Attached is a log file covering the 15 seconds between: 17:20:41to 17:20:56
This is very much not my comfort zone, but I can see several references to the file you send me to test with “Work_Order_2018-07-23.odt”
You can see from the log file that the correct template is being used as an input:'generic_order_odt:/var/lib/dolibarr/documents/doctemplates/orders/Work_Order_2018-07-23.odt’ at 17:20:41
At 17:20:49 This line looks as if it should create a PDF: SET model_pdf = 'generic_order_odt:/var/lib/dolibarr/documents/doctemplates/orders/Work_Order_2018-07-23.odt’
Just two lines later with the same time stamp it creates a new directory called PROV11 - which works ok.
The 10 lines later also sharing a 17:20:49 timestamp: This code looks as if its deciding to create an ODT file as output: t.filepath = ‘commande/(PROV11)’ AND t.filename = ‘(PROV11)_Work_Order_2018-07-23.odt’
Notice
Failed to upload file ‘dolibarr-4.log’: You need to use an allowed file extension (for images: jpg, jpeg, gif, png and other files: zip, txt, doc, gz, tgz, pdf, odt, tar, rar, png, jpg, jpeg).
Thanks for this. I’ve been away for a week, hence my delay in getting back to the problem. I’ll have one more go at it and see if returning to the problem fresh after a week will help.
If that doesn’t work I’ll take your advice, unless there is some there helpful guru out there?