diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 77a620e9256..0ce99f75a19 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2777,15 +2777,21 @@ if ($dirins && $action == "update_props_module" && !empty(GETPOST('keydescriptio if (isset($propertyToUpdate) && !empty(GETPOST('propsmodule'))) { $newValue = GETPOST('propsmodule'); - $lineToReplace = "\$this->$propertyToUpdate = '".$moduleobj->$propertyToUpdate."';"; - $newLine = "\$this->$propertyToUpdate = '$newValue';"; + $lineToReplace = "\t\t\$this->$propertyToUpdate = "; + $newLine = "\t\t\$this->$propertyToUpdate = '$newValue';\n"; //for change version in log file if ($propertyToUpdate === 'version') { dolReplaceInFile($modulelogfile, array("## ".$moduleobj->$propertyToUpdate => $newValue)); } - dolReplaceInFile($moduledescriptorfile, array($lineToReplace => $newLine)); + $fileLines = file($moduledescriptorfile); + foreach ($fileLines as &$line) { + if (strpos($line, $lineToReplace) === 0) { + dolReplaceInFile($moduledescriptorfile, array($line => $newLine)); + break; + } + } clearstatcache(true); if (function_exists('opcache_invalidate')) { @@ -3297,7 +3303,7 @@ if ($module == 'initmodule') { print $langs->trans("Description"); print '