Fix option to not generate doc in modulebuilder.

This commit is contained in:
Laurent Destailleur 2020-04-03 14:02:37 +02:00
parent 71910b2181
commit f7b6895dc6
3 changed files with 13 additions and 3 deletions

View File

@ -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];

View File

@ -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

View File

@ -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;
}
/**