In the process of adding a custom pdf invoice to dolibarr. We have been following all the steps from the various guides and got to the point where we copied and renamded the ‘sponge’ template in the same directory (in our case: Computer/srv/dolibarr/htdocs/core/modules/facture/doc/)
We renamed it ‘diamond’ and made suggested changes, but as it doesn’t show up, we also copied the ‘pdf_anaxagoraswt.modules.php’ file from this discussion: 4 alternative invoice pdf templates - This just to make sure that the reason for the new template not showing up in Home > Setup > Modules/Applications > Invoices > is not related to our PHP skills…
Any ideas as to why the templates are not showing? does anyone have some pointers as to how to troubleshoot an issue like this?
Greatly appreciate any feedback or shared expediences with this issue.
Check if your web server configuration denies access to doc directories.
The path to your Dolibarr installation seems a bit unusual. Has your web server proper access to the /srv/dolibarr directory and all its content ? In my case, all the Dolibarr files are placed directly in a directory located in /var/www. I also moved all the content of the htdocs directory to the Dolibarr root directory, which is in your case dolibarr. So, your invoice directory can be /var/www/dolibarr/core/modules/facture/doc, without htdocs. You don’t need htdocs. In the sense that you move all the content of htdocs to the parent directory.
Also, the web server user, usually www-data, has to have read access to all the files in the facture/doc directory.
Also, on the ‘Invoices Module Setup’ page that you show above, try making the crabe template the default, by unchecking the sponge ‘Default’ checkbox and checking it for crabe, then disable the sponge template by using the switch on the Status column. Then restart your web server and clear any cache in your browser and refresh, to see if the Anaxagoras template shows up. In Dolibarr 12, which I’m using, it surely shows up. If it doesn’t show up for you, it might be an odd bug in Dolibarr 15 or other odd issue that you might have in your installation. Please let me know how you solved the problem.
Many thanks for your reply! You surely put us on the right track. We checked the dolibarr status from the ‘admin tools’ and we noticed that indeed we should be looking at another directory all toghether:
We needed to be at: ‘computer/usr/share/dolibarr/htdocs/core/modules/facture/doc/’ not in ‘srv/dolibarr…/etc’
Beginners mistake I guess, but would you be able to shed some light as to why there are 2 exactly the same file structures on both srv/ and usr/ ?
The ‘diamond’ template showed up right after we uploaded it to the correct folder this time. The Anaxgoras however only showed up when we manually added it to the the 'llx_document_model" table.
So not only thanks for creating a highly usable template file, but also helping us in getting it to work!
The paths for ‘Web server’s root directory’, ‘Data files directory’, etc. that can be seen in ‘Admin Tools’ > ‘About Dolibarr’ are listed there automatically by Dolibarr when it is installed and they depend on the directory where the admin has chosen to install Dolibarr. Therefore, Dolibarr can be installed in /var/www, like in my case, or in another location, like in your case. The only problem is that the web server has to have proper access to all the directories of Dolibarr. This can be checked by inspecting the ownership and permissions of those directories and by verifying the configuration of the web server.
In Dolibarr version 12, the Anaxagoras invoice template is added automatically to the llx_document_model table when the pdf_anaxagoraswt.modules.php file is added to the core/modules/facture/doc directory and the proper ownership and permissions are set for the newly added file and the ‘Invoices Module Setup’ page is refreshed. If in Dolibarr version 15 you say you needed to add it manually to the llx_document_model table, this is a bit problematic. I’ll have to install Dolibarr 15 and check if I can replicate that.
Anyway, after the Anaxagoras template showed up and you enabled it, have you been able to generate a pdf invoice using this template in Dolibarr 15 ?