I’m trying to get the extrafields of the thirdparty (the sender in my case) printed on the invoice.
I created a second template based on the existing one (pdf_crabe), did the required modifications and it works, I can generate pdfs with it without any conflict.
My problem is when I try to get the extrafields based on the instructions from the wiki (https://wiki.dolibarr.org/index.php/Extrafields). I can get the invoice’s extrafields but I have no luck figuring out how to get the extrafields from the thirdparty.
This is indeed more complexe.
What you need to do is to get the thirdparty id from the invoice.
Create a new thirdparty object in the invoice, with the id
then load the thirdparty extrafield
I have done like that to load extrafield of products on invoice, never trided with thirdparty but it should be the same.
Firstly, thank you very much for the tips!
While messing around following your instructions I stumble upon the fact that the extrafields are already loaded in the thirdparty object in the invoice, but I was lacking the knowledge required for accesing the information. The extrafields can simply be accesed with
$thirdparty->array_options['options_XXX'], where XXX is the code of the extrafield.
After figuring this out, I was able to print on the invoice the extrafields that I needed.