Extra Fields in ODT

Hi everybody,

first of all, I´m a very newbie in Dolibarr and also not very good in PHP.

I want to create a report of my customers in the thirdparties ODT Template. I will give a overview about customer datas and needs (for that I created some extrafields), also about appointmens and projects with that contact. You can see the ODT in attachment.

Bericht.odt (17.8 KB)

Bericht18.pdf (60.8 KB)

The problem is, when I create the ODT with the ODT Modul, I only get results for the main tags, given by the systems. I don´t get results for the extrafields and even not for the projetcs and appointments, I only get the tags in the ODT. You can see the result in the pdf in attachment.

I searched the german and the english forums, but I don´t find the rigth solution. Even I don´t want to destroy something ;-).

I think I have to set the setting in one of the PHP Moduls to global, but I don´t know where and how. Or, do I have to do the Other personalized tags modul, like its writen here:

https://wiki.dolibarr.org/index.php/Create_an_ODT_document_template as its writen down there?

But then I don´t know what values I need to but in the PHP. Could anybody help my with that? I would be very thankful!!!

I Use Dolibarr 9.0.3.

Thanks to everyone for your help!

If you want to add a field that is not predefined, this is the solution:

Create a file into the location:
htdocs/mymodule/core/substitutions/functions_mymodule.lib.php

Inside this file, just write one function like this:
/** Function called to complete substitution array (before generating on ODT, or a personalized email)
* functions xxx_completesubstitutionarray are called by make_substitutions() if file
* is inside directory htdocs/core/substitutions
*

  •  @param	array		$substitutionarray	Array with substitution key=\>val
    
  •  @param	Translate	$langs			Output langs
    
  •  @param	Object		$object			Object to use to get values
    

* @return void The entry parameter $substitutionarray is modified
*/
function mymodule_completesubstitutionarray(&$substitutionarray,$langs,$object)
{
global $conf,$db;

$myvalue=‘Put here calculated value to insert’;
$substitutionarray[‘myowntag’]=$myvalue;
}

Hi,

A lot of questions in one topic!

First thing that you need to understand is that if you are generating the thiparty ODT, you will not have access to Project or tasks !
You will have in the ODT only the phirdparty tings.

Regarding the compagny extrafields could you share your configuration of it ?

What you are trying to do it is a al in one document that would need access to a lot of differents modules (thirparty/project/etc…) that would require and external module.
If you would like to do, you need first to follow that : https://wiki.dolibarr.org/index.php/Module_development
Then you can load your aditional substitutions

1 Like

Thank you for your reply!!! : :cheer:

Ok, than I will read me into this, that should work with a little time :wink:

In attachment you can see the configuration of the extra fields. Maybe I did something wrong, thats possible!

But first of all thank you very much! I became a bit desperately about it this week!