Ticket labels are not replaced in the odt file

Hi!

I’m experiencing a strange issue with version 22.0.3. Even in the example ODT template, only tags starting with “mycompany” are being replaced, while all others are ignored.

I performed a couple of clean test installations on Linux and Windows, and it does the same thing.

Has anyone else experienced this?

Check the translations to see if there’s a translation for the word.

Hi!

Thanks for the tip.

I found the solution. In the file that processes the ODT format: doc_generic_ticket_odt.modules.php, the object substitution wasn’t being called. This file contained a procedure to generate the substitution array (similar to the one in commondocgenerator.class.php).

The line to call the method is:
$array_object = $this->get_substitutionarray_object($object, $outputlangs);

The code I left in the doc_generic_ticket_odt.modules.php file for the replacement is as follows:

public function get_substitutionarray_object($object, $outputlangs, $array_key = ‘object’)
{
//This is the code copied from commondocgenerator.class.php
// phpcs:enable
global $extrafields;

$resarray = array(
$array_key.‘_id’ => $object->id,
$array_key.‘_ref’ => (property_exists($object, ‘ref’) ? $object->ref : ‘’),
$array_key.‘_subject’ => (property_exists($object, ‘subject’) ? $object->subject : ‘’),
$array_key.‘_message’ => (property_exists($object, ‘message’) ? $object->message : ‘’),
$array_key.‘_progress’ => (property_exists($object, ‘progress’) ? $object->progress : ‘’),
$array_key.‘_type’ => (property_exists($object, ‘type_code’) ? $object->type_code : ‘’),
$array_key.‘_severity_code’ => (property_exists($object, ‘severity_code’) ? $object->severity_code : ‘’),
$array_key.‘_date_creation’ => (!empty($object->datec) ? dol_print_date($object->datec, ‘dayhour’) : ‘’),
$array_key.‘_date_close’ => (!empty($object->date_close) ? dol_print_date($object->date_close, ‘dayhour’) : ‘’),
$array_key.‘_user_assign’ => (property_exists($object, ‘fk_user_assign’) ? $object->fk_user_assign : ‘’),
$array_key.‘_category’ => (property_exists($object, ‘category_code’) ? $object->category_code : ‘’),
);

// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options)) {
$object->fetch_optionals();

$resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
}
return $resarray;
}

hola, tengo el mismo problema, realice lo que indica, de agregar el codigo pero igual no me funciona me podria orientar un poco mas sobre el tema

Hola

¿Qué error te marca o que información te presenta?
tu archivo doc_generic_ticket_odt.modules.php, en que carpeta está y que contenido tiene?

hola, gracias por contestar, no recuerdo el error, pero lo meti en geminis y me ayudo, hasta las imagenes adjuntas del ticket me las trae y las muestro

muchas gracias