mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-12 10:52:37 +01:00
FIX ODT tags for subobjects {object_subobject_yyy} was not working.
This commit is contained in:
@@ -809,26 +809,38 @@ abstract class CommonDocGenerator
|
||||
*
|
||||
* @param Object $object Dolibarr Object
|
||||
* @param Translate $outputlangs Language object for output
|
||||
* @param boolean $recursive Want to fetch child array or child object
|
||||
* @param boolean|int $recursive Want to fetch child array or child object.
|
||||
* @return array Array of substitution key->code
|
||||
*/
|
||||
public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = true)
|
||||
public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = 1)
|
||||
{
|
||||
// phpcs:enable
|
||||
$array_other = array();
|
||||
if (!empty($object)) {
|
||||
foreach ($object as $key => $value) {
|
||||
if (in_array($key, array('db', 'fields', 'lines', 'modelpdf', 'model_pdf'))) { // discard some properties
|
||||
continue;
|
||||
}
|
||||
if (!empty($value)) {
|
||||
if (!is_array($value) && !is_object($value)) {
|
||||
$array_other['object_'.$key] = $value;
|
||||
} elseif (is_array($value) && $recursive) {
|
||||
$array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value, $outputlangs, false);
|
||||
$tmparray = $this->get_substitutionarray_each_var_object($value, $outputlangs, 0);
|
||||
foreach ($tmparray as $key2 => $value2) {
|
||||
$array_other['object_'.$key.'_'.preg_replace('/^object_/', '', $key2)] = $value2;
|
||||
}
|
||||
} elseif (is_object($value) && $recursive) {
|
||||
$array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value, $outputlangs, false);
|
||||
$tmparray = $this->get_substitutionarray_each_var_object($value, $outputlangs, 0);
|
||||
foreach ($tmparray as $key2 => $value2) {
|
||||
$array_other['object_'.$key.'_'.preg_replace('/^object_/', '', $key2)] = $value2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($array_other);
|
||||
|
||||
return $array_other;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,6 +246,7 @@ class doc_generic_bom_odt extends ModelePDFBom
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
$object->fetch_product();
|
||||
|
||||
$dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
|
||||
Reference in New Issue
Block a user