diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index fc0bf94d832..48e31235476 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -144,6 +144,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='') if (empty($objectname)) return -1; if (empty($readdir)) $readdir=$destdir; + $pathoffiletoclasssrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; + // Edit .sql file $pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($objectname).'.sql'; $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : ''); @@ -156,7 +158,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='') try { - include_once $pathoffiletoeditsrc; + include_once $pathoffiletoclasssrc; if (class_exists($objectname)) $object=new $objectname($db); else return -1; } @@ -168,7 +170,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='') // Backup old file dol_copy($pathoffiletoedittarget, $pathoffiletoedittarget.'.back', $newmask, 1); - $contentsql = file_get_contents(dol_os_encode($pathoffiletoeditsrc), 'r'); + $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); $i=0; $texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n"; @@ -197,7 +199,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='') $pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'; $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : ''); - $contentsql = file_get_contents(dol_os_encode($pathoffiletoeditsrc), 'r'); + $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); $i=0; $texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n"; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 12e74cc81db..0ba9bbaa071 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -132,7 +132,6 @@ if ($dirins && $action == 'initmodule' && $modulename) dol_delete_file($destdir.'/img/object_myobject.png'); dol_delete_file($destdir.'/class/myobject.class.php'); dol_delete_file($destdir.'/class/api_myobject.class.php'); - dol_delete_file($destdir.'/class/MyObject.txt'); } // Edit PHP files @@ -215,8 +214,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', - 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php', - 'class/MyObject.txt'=>'class/'.$objectname.'.txt' + 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php' ); foreach($filetogenerate as $srcfile => $destfile) @@ -418,8 +416,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', - 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php', - 'class/MyObject.txt'=>'class/'.$objectname.'.txt' + 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php' ); $resultko = 0;