diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 8f8480a03cb..31e0d5a1c8d 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -174,6 +174,7 @@ SaveAndStay=Save and stay SaveAndNew=Save and new TestConnection=Test connection ToClone=Clone +ConfirmCloneAsk=Are you sure you want to clone the object %s? ConfirmClone=Choose data you want to clone: NoCloneOptionsSpecified=No data to clone defined. Of=of diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 16684fc36e4..65f6f4b3643 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -791,6 +791,12 @@ if ($dirins && $action == 'initobject' && $module && $objectname) setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); $tabobj = 'newobject'; } + if (class_exists($objectname)) { + // TODO Add a more efficient detection. Scan disk ? + $error++; + setEventMessages($langs->trans("AnObjectWithThisClassNameAlreadyExists"), null, 'errors'); + $tabobj = 'newobject'; + } $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; $destdir = $dirins.'/'.strtolower($module); @@ -891,7 +897,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) // Edit the setup file and the card page if (GETPOST('includedocgeneration', 'aZ09')) { // Replace '$includedocgeneration = 0;' into '$includedocgeneration = 1;' into files - $arrayreplacement = array('$includedocgeneration = 0;', '$includedocgeneration = 1;'); + $arrayreplacement = array('/\$includedocgeneration = 0;/' => '$includedocgeneration = 1;'); dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1); } @@ -2609,6 +2615,7 @@ elseif (! empty($module)) print ''; print ''; + // List of existing properties foreach ($properties as $propkey => $propval) { /* If from Reflection @@ -2680,7 +2687,7 @@ elseif (! empty($module)) print $propenabled?$propenabled:''; print ''; print '