From eb6c25f64d67788a11d54ce0036eb8c2054cc035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 1 Feb 2023 22:06:22 +0100 Subject: [PATCH 1/2] fix https://github.com/Dolibarr/dolibarr/issues/23753 --- .../doc/doc_generic_invoice_odt.modules.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index fc73460bd1b..53f1e6f9619 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -334,15 +334,19 @@ class doc_generic_invoice_odt extends ModelePDFFactures $object->fetchObjectLinked('', '', '', ''); //print_r($object->linkedObjects['propal']); exit; - $propal_object = $object->linkedObjects['propal'][0]; + if (isset($object->linkedObjects['propal'][0])) { + $propal_object = $object->linkedObjects['propal'][0]; + } else { + $propal_object = null; + } // Make substitution $substitutionarray = array( - '__FROM_NAME__' => $this->emetteur->name, - '__FROM_EMAIL__' => $this->emetteur->email, - '__TOTAL_TTC__' => $object->total_ttc, - '__TOTAL_HT__' => $object->total_ht, - '__TOTAL_VAT__' => $object->total_tva + '__FROM_NAME__' => $this->emetteur->name, + '__FROM_EMAIL__' => $this->emetteur->email, + '__TOTAL_TTC__' => $object->total_ttc, + '__TOTAL_HT__' => $object->total_ht, + '__TOTAL_VAT__' => $object->total_tva ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook @@ -433,8 +437,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { + // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { From 9cf71e7d1cd2af810923e93a2342bb09bf824468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Fri, 3 Feb 2023 16:34:36 +0100 Subject: [PATCH 2/2] FIX: Cannot import find type_fees with cgenericdic.class because its have id and not rowid --- htdocs/core/class/cgenericdic.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/class/cgenericdic.class.php b/htdocs/core/class/cgenericdic.class.php index ab1023b81f5..250fb3ec569 100644 --- a/htdocs/core/class/cgenericdic.class.php +++ b/htdocs/core/class/cgenericdic.class.php @@ -82,6 +82,8 @@ class CGenericDic $fieldlabel = 'label'; if ($this->table_element == 'c_stcomm') { $fieldlabel = 'libelle'; + } elseif ($this->table_element == 'c_type_fees') { + $fieldrowid = 'id'; } $error = 0; @@ -162,6 +164,8 @@ class CGenericDic if ($this->table_element == 'c_stcomm') { $fieldrowid = 'id'; $fieldlabel = 'libelle'; + } elseif ($this->table_element == 'c_type_fees') { + $fieldrowid = 'id'; } $sql = "SELECT"; @@ -233,6 +237,8 @@ class CGenericDic if ($this->table_element == 'c_stcomm') { $fieldrowid = 'id'; $fieldlabel = 'libelle'; + } elseif ($this->table_element == 'c_type_fees') { + $fieldrowid = 'id'; } $sql = "SELECT"; @@ -303,6 +309,8 @@ class CGenericDic if ($this->table_element == 'c_stcomm') { $fieldrowid = 'id'; $fieldlabel = 'libelle'; + } elseif ($this->table_element == 'c_type_fees') { + $fieldrowid = 'id'; } // Clean parameters