diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
index 860e07d7d36..57c175a0112 100644
--- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
+++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
@@ -175,7 +175,7 @@ class doc_generic_mo_odt extends ModelePDFMo
$texte .= '
';
}
@@ -284,7 +284,7 @@ class doc_generic_mo_odt extends ModelePDFMo
//print "file=".$file;
//print "conf->societe->dir_temp=".$conf->societe->dir_temp;
- dol_mkdir($conf->bom->dir_temp);
+ dol_mkdir($conf->mrp->dir_temp);
// If CUSTOMER contact defined on order, we use it
@@ -379,14 +379,15 @@ class doc_generic_mo_odt extends ModelePDFMo
foreach ($tmparray as $key => $value) {
try {
- if (preg_match('/logo$/', $key)) { // Image
+ if (preg_match('/logo$/', $key)) {
+ // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
- } else // Text
- {
+ } else {
+ // Text
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
} catch (OdfException $e) {
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
index d64c80c9355..3836381e5cc 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
@@ -86,7 +86,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$this->marge_basse = 0;
$this->option_logo = 1; // Affiche logo
- $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
+ $this->option_tva = 0; // Gere option tva
$this->option_modereg = 0; // Affiche mode reglement
$this->option_condreg = 0; // Affiche conditions reglement
$this->option_codeproduitservice = 0; // Affiche code produit-service
@@ -135,7 +135,8 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$tmpdir = trim($tmpdir);
$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
if (!$tmpdir) {
- unset($listofdir[$key]); continue;
+ unset($listofdir[$key]);
+ continue;
}
if (!is_dir($tmpdir)) {
$texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
@@ -173,7 +174,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
if ($nbofiles) {
$texte .= '';
}
@@ -195,7 +196,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
/**
* Function to build a document on disk using the generic odt module.
*
- * @param Commande $object Object source to build document
+ * @param MyObject $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@@ -229,11 +230,11 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
- if ($conf->commande->dir_output) {
+ if ($conf->mymodule->dir_output) {
// If $object is id instead of object
if (!is_object($object)) {
$id = $object;
- $object = new Commande($this->db);
+ $object = new MyObject($this->db);
$result = $object->fetch($id);
if ($result < 0) {
dol_print_error($this->db, $object->error);
@@ -241,7 +242,9 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
}
}
- $dir = $conf->commande->multidir_output[isset($object->entity) ? $object->entity : 1];
+ $object->fetch_thirdparty();
+
+ $dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1];
$objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/".$objectref;
@@ -331,7 +334,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$odfHandler = new odf(
$srctemplatepath,
array(
- 'PATH_TO_TMP' => $conf->commande->dir_temp,
+ 'PATH_TO_TMP' => $conf->mymodule->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'