From d4c20a919d5f1f4843382efb8706cd51c4a4ddb0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 8 Sep 2017 12:52:56 +0200 Subject: [PATCH 1/2] Fix: avoid warning --- .../user/doc/doc_generic_user_odt.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index b7079dde30e..1a9074fbedf 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -313,7 +313,7 @@ class doc_generic_user_odt extends ModelePDFUser { $socobject=$object->client; } - + // Open and load template require_once ODTPHP_PATH.'odf.php'; try { @@ -332,7 +332,7 @@ class doc_generic_user_odt extends ModelePDFUser $this->error=$e->getMessage(); return -1; } - + // Make substitutions into odt $array_user=$this->get_substitutionarray_user($object,$outputlangs); $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); @@ -366,7 +366,7 @@ class doc_generic_user_odt extends ModelePDFUser { } } - + // Replace labels translated $tmparray=$outputlangs->get_translations_for_substitutions(); foreach($tmparray as $key=>$value) @@ -420,12 +420,12 @@ class doc_generic_user_odt extends ModelePDFUser return -1; } - function get_substitutionarray_object($object,$outputlangs) { + function get_substitutionarray_object($object,$outputlangs,$array_key='object') { foreach($object as $key => $value) { - if(!is_array($value) && !is_object($value)) { - $array_other['object_'.$key] = $value; + if (!is_array($value) && !is_object($value)) { + $array_other['object_'.$key] = $value; } - } + } return $array_other; } From 67e9b65a2e1fc6ed3c9e6c4c6a37b862384c4423 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 9 Sep 2017 17:07:08 +0200 Subject: [PATCH 2/2] Fix: use $array_key value instead --- htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 1a9074fbedf..11ae5729b3b 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -421,9 +421,10 @@ class doc_generic_user_odt extends ModelePDFUser } function get_substitutionarray_object($object,$outputlangs,$array_key='object') { + $array_other=array(); foreach($object as $key => $value) { if (!is_array($value) && !is_object($value)) { - $array_other['object_'.$key] = $value; + $array_other[$array_key.'_'.$key] = $value; } } return $array_other;