I am currently setting up the interventions module. For our usecase, we need to know who did the intervention, as multiple people can do one intervention and we need to know how many were involved.
So I added a new extrafied of type Dropdownlist DB (multiple options) in the module options with following db select:
user:CONCAT(firstname, ' ', lastname):rowid::
this works great and I can now select the Users that did the intervention.
The problem occurs when I try to print these names on the PDF.
first I tried to get the name as I did with other extrafields:
$outputlangs->convToOutputCharset($object->array_options['options_users']);
But this only prints
3, 2
on the pdf, But I need the names. So I found this article and the section Special Case for Extrafields type “Select list”
So I tried to get the names like this:
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
[...]
$extrafields = new ExtraFields($this->db);
$extrafields->showOutputField('users', $object->array_options['options_users'], '', $object->table_element)
But this only results in multiple errors when creating the pdf:
**Warning**: Undefined array key "fichinter" in **C:\xampp\htdocs\dolibarr_stable\htdocs\core\class\extrafields.class.php** on line **1908**
**Warning**: Trying to access array offset on value of type null in **C:\xampp\htdocs\dolibarr_stable\htdocs\core\class\extrafields.class.php** on line **1908**
**Warning**: Trying to access array offset on value of type null in **C:\xampp\htdocs\dolibarr_stable\htdocs\core\class\extrafields.class.php** on line **1908**
The PDF is created fine after that. But the names are not available to print. So how can I get the names to print on the PDF?