diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 795483b08ba..37920ed1ebc 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -219,6 +219,7 @@ if ($action == 'presend') if (!empty($origin) && !empty($origin_id)) { $element = $subelement = $origin; + $regs = array(); if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { $element = $regs[1]; $subelement = $regs[2]; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index b67508cf08b..0827d38a2f7 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -887,8 +887,10 @@ if ($dirins && $action == 'initobject' && $module && $objectname) // Edit the setup file and the card page if (GETPOST('includedocgeneration', 'aZ09')) { - // TODO - // dolReplaceInFile(); + // Replace '$includedocgeneration = 0;' into '$includedocgeneration = 1;' into files + $arrayreplacement = array('$includedocgeneration = 0;', '$includedocgeneration = 1;'); + dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1); + } // Scan for object class files diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 596e47e12c0..8e1f6a945c9 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -982,6 +982,9 @@ class MyObject extends CommonObject { global $conf, $langs; + $result = 0; + $includedocgeneration = 0; + $langs->load("mymodule@mymodule"); if (!dol_strlen($modele)) { @@ -996,7 +999,11 @@ class MyObject extends CommonObject $modelpath = "core/modules/mymodule/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + if ($includedocgeneration) { + $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } + + return $result; } /**