mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-12 19:02:35 +01:00
Fixing style errors.
This commit is contained in:
@@ -342,8 +342,7 @@ if ($dirins && $action == 'initmodule' && $modulename) {
|
||||
|
||||
|
||||
// init API
|
||||
if ($dirins && $action == 'initapi' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'initapi' && !empty($module)) {
|
||||
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||
$objectname = $tabobj;
|
||||
|
||||
@@ -354,8 +353,7 @@ if ($dirins && $action == 'initapi' && !empty($module))
|
||||
//var_dump($srcfile);var_dump($destfile);
|
||||
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
//var_dump($phpfileval['fullname']);
|
||||
$arrayreplacement = array(
|
||||
'mymodule'=>strtolower($modulename),
|
||||
@@ -373,9 +371,7 @@ if ($dirins && $action == 'initapi' && !empty($module))
|
||||
);
|
||||
|
||||
dolReplaceInFile($destfile, $arrayreplacement);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||
}
|
||||
@@ -383,8 +379,7 @@ if ($dirins && $action == 'initapi' && !empty($module))
|
||||
|
||||
|
||||
// init PHPUnit
|
||||
if ($dirins && $action == 'initphpunit' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'initphpunit' && !empty($module)) {
|
||||
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||
$objectname = $tabobj;
|
||||
|
||||
@@ -394,8 +389,7 @@ if ($dirins && $action == 'initphpunit' && !empty($module))
|
||||
$destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($objectname).'Test.php';
|
||||
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
//var_dump($phpfileval['fullname']);
|
||||
$arrayreplacement = array(
|
||||
'mymodule'=>strtolower($modulename),
|
||||
@@ -413,9 +407,7 @@ if ($dirins && $action == 'initphpunit' && !empty($module))
|
||||
);
|
||||
|
||||
dolReplaceInFile($destfile, $arrayreplacement);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||
}
|
||||
@@ -423,8 +415,7 @@ if ($dirins && $action == 'initphpunit' && !empty($module))
|
||||
|
||||
|
||||
// init ExtraFields
|
||||
if ($dirins && $action == 'initsqlextrafields' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'initsqlextrafields' && !empty($module)) {
|
||||
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||
$objectname = $tabobj;
|
||||
|
||||
@@ -439,8 +430,7 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module))
|
||||
//var_dump($srcfile);var_dump($destfile);
|
||||
$result2 = dol_copy($srcfile2, $destfile2, 0, 0);
|
||||
|
||||
if ($result1 > 0 && $result2 > 0)
|
||||
{
|
||||
if ($result1 > 0 && $result2 > 0) {
|
||||
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||
|
||||
//var_dump($phpfileval['fullname']);
|
||||
@@ -462,9 +452,7 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module))
|
||||
|
||||
dolReplaceInFile($destfile1, $arrayreplacement);
|
||||
dolReplaceInFile($destfile2, $arrayreplacement);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFailToCreateFile', ''), null, 'errors');
|
||||
}
|
||||
@@ -473,8 +461,7 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module))
|
||||
|
||||
|
||||
// init Hook
|
||||
if ($dirins && $action == 'inithook' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'inithook' && !empty($module)) {
|
||||
dol_mkdir($dirins.'/'.strtolower($module).'/class');
|
||||
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
|
||||
$srcfile = $srcdir.'/class/actions_mymodule.class.php';
|
||||
@@ -482,8 +469,7 @@ if ($dirins && $action == 'inithook' && !empty($module))
|
||||
//var_dump($srcfile);var_dump($destfile);
|
||||
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||
|
||||
//var_dump($phpfileval['fullname']);
|
||||
@@ -500,9 +486,7 @@ if ($dirins && $action == 'inithook' && !empty($module))
|
||||
);
|
||||
|
||||
dolReplaceInFile($destfile, $arrayreplacement);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||
}
|
||||
@@ -510,8 +494,7 @@ if ($dirins && $action == 'inithook' && !empty($module))
|
||||
|
||||
|
||||
// init Trigger
|
||||
if ($dirins && $action == 'inittrigger' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'inittrigger' && !empty($module)) {
|
||||
dol_mkdir($dirins.'/'.strtolower($module).'/core/triggers');
|
||||
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
|
||||
$srcfile = $srcdir.'/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php';
|
||||
@@ -519,8 +502,7 @@ if ($dirins && $action == 'inittrigger' && !empty($module))
|
||||
//var_dump($srcfile);var_dump($destfile);
|
||||
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||
|
||||
//var_dump($phpfileval['fullname']);
|
||||
@@ -537,9 +519,7 @@ if ($dirins && $action == 'inittrigger' && !empty($module))
|
||||
);
|
||||
|
||||
dolReplaceInFile($destfile, $arrayreplacement);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||
}
|
||||
@@ -547,8 +527,7 @@ if ($dirins && $action == 'inittrigger' && !empty($module))
|
||||
|
||||
|
||||
// init Widget
|
||||
if ($dirins && $action == 'initwidget' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'initwidget' && !empty($module)) {
|
||||
dol_mkdir($dirins.'/'.strtolower($module).'/core/boxes');
|
||||
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
|
||||
$srcfile = $srcdir.'/core/boxes/mymodulewidget1.php';
|
||||
@@ -556,8 +535,7 @@ if ($dirins && $action == 'initwidget' && !empty($module))
|
||||
//var_dump($srcfile);var_dump($destfile);
|
||||
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||
|
||||
//var_dump($phpfileval['fullname']);
|
||||
@@ -574,9 +552,7 @@ if ($dirins && $action == 'initwidget' && !empty($module))
|
||||
);
|
||||
|
||||
dolReplaceInFile($destfile, $arrayreplacement);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||
}
|
||||
@@ -584,8 +560,7 @@ if ($dirins && $action == 'initwidget' && !empty($module))
|
||||
|
||||
|
||||
// init CSS
|
||||
if ($dirins && $action == 'initcss' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'initcss' && !empty($module)) {
|
||||
dol_mkdir($dirins.'/'.strtolower($module).'/css');
|
||||
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
|
||||
$srcfile = $srcdir.'/css/mymodule.css.php';
|
||||
@@ -593,8 +568,7 @@ if ($dirins && $action == 'initcss' && !empty($module))
|
||||
//var_dump($srcfile);var_dump($destfile);
|
||||
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||
|
||||
//var_dump($phpfileval['fullname']);
|
||||
@@ -616,9 +590,7 @@ if ($dirins && $action == 'initcss' && !empty($module))
|
||||
$srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
$arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/css/'.strtolower($module).'.css.php', '/').'\'/' => '\'/'.strtolower($module).'/css/'.strtolower($module).'.css.php\'');
|
||||
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||
}
|
||||
@@ -626,8 +598,7 @@ if ($dirins && $action == 'initcss' && !empty($module))
|
||||
|
||||
|
||||
// init JS
|
||||
if ($dirins && $action == 'initjs' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'initjs' && !empty($module)) {
|
||||
dol_mkdir($dirins.'/'.strtolower($module).'/js');
|
||||
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
|
||||
$srcfile = $srcdir.'/js/mymodule.js.php';
|
||||
@@ -635,8 +606,7 @@ if ($dirins && $action == 'initjs' && !empty($module))
|
||||
//var_dump($srcfile);var_dump($destfile);
|
||||
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||
|
||||
//var_dump($phpfileval['fullname']);
|
||||
@@ -658,9 +628,7 @@ if ($dirins && $action == 'initjs' && !empty($module))
|
||||
$srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
$arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/js/'.strtolower($module).'.js.php', '/').'\'/' => '\'/'.strtolower($module).'/js/'.strtolower($module).'.js.php\'');
|
||||
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||
}
|
||||
@@ -668,8 +636,7 @@ if ($dirins && $action == 'initjs' && !empty($module))
|
||||
|
||||
|
||||
// init CLI
|
||||
if ($dirins && $action == 'initcli' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'initcli' && !empty($module)) {
|
||||
dol_mkdir($dirins.'/'.strtolower($module).'/scripts');
|
||||
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
|
||||
$srcfile = $srcdir.'/scripts/mymodule.php';
|
||||
@@ -699,9 +666,7 @@ if ($dirins && $action == 'initcli' && !empty($module))
|
||||
);
|
||||
|
||||
dolReplaceInFile($destfile, $arrayreplacement);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||
}
|
||||
@@ -709,8 +674,7 @@ if ($dirins && $action == 'initcli' && !empty($module))
|
||||
|
||||
|
||||
// init Doc
|
||||
if ($dirins && $action == 'initdoc' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'initdoc' && !empty($module)) {
|
||||
dol_mkdir($dirins.'/'.strtolower($module).'/doc');
|
||||
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
|
||||
$srcfile = $srcdir.'/doc/Documentation.asciidoc';
|
||||
@@ -718,8 +682,7 @@ if ($dirins && $action == 'initdoc' && !empty($module))
|
||||
//var_dump($srcfile);var_dump($destfile);
|
||||
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||
$modulelowercase = strtolower($module);
|
||||
|
||||
@@ -753,9 +716,7 @@ if ($dirins && $action == 'initdoc' && !empty($module))
|
||||
|
||||
dol_delete_file($outputfiledoc, 0, 0, 0, null, false, 0);
|
||||
dol_delete_file($outputfiledocpdf, 0, 0, 0, null, false, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||
}
|
||||
@@ -763,8 +724,7 @@ if ($dirins && $action == 'initdoc' && !empty($module))
|
||||
|
||||
|
||||
// add Language
|
||||
if ($dirins && $action == 'addlanguage' && !empty($module))
|
||||
{
|
||||
if ($dirins && $action == 'addlanguage' && !empty($module)) {
|
||||
$newlangcode = GETPOST('newlangcode', 'aZ09');
|
||||
$srcfile = $dirins.'/'.strtolower($module).'/langs/en_US';
|
||||
$destfile = $dirins.'/'.strtolower($module).'/langs/'.$newlangcode;
|
||||
@@ -772,31 +732,24 @@ if ($dirins && $action == 'addlanguage' && !empty($module))
|
||||
}
|
||||
|
||||
|
||||
// remove/delete File
|
||||
if ($dirins && $action == 'confirm_removefile' && !empty($module))
|
||||
{
|
||||
// remove/delete File
|
||||
if ($dirins && $action == 'confirm_removefile' && !empty($module)) {
|
||||
$relativefilename = dol_sanitizePathName(GETPOST('file', 'none'));
|
||||
if ($relativefilename)
|
||||
{
|
||||
if ($relativefilename) {
|
||||
$dirnametodelete = dirname($relativefilename);
|
||||
$filetodelete = $dirins.'/'.$relativefilename;
|
||||
$dirtodelete = $dirins.'/'.$dirnametodelete;
|
||||
|
||||
$result = dol_delete_file($filetodelete);
|
||||
if (!$result)
|
||||
{
|
||||
if (!$result) {
|
||||
setEventMessages($langs->trans("ErrorFailToDeleteFile", basename($filetodelete)), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dol_is_dir_empty($dirtodelete))
|
||||
{
|
||||
} else {
|
||||
if (dol_is_dir_empty($dirtodelete)) {
|
||||
dol_delete_dir($dirtodelete);
|
||||
}
|
||||
|
||||
// Update descriptor file to comment file
|
||||
if (in_array($tab, array('css', 'js')))
|
||||
{
|
||||
if (in_array($tab, array('css', 'js'))) {
|
||||
$srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
$arrayreplacement = array('/^\s*\''.preg_quote('/'.$relativefilename, '/').'\',*/m'=>' // \'/'.$relativefilename.'\',');
|
||||
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
|
||||
|
||||
Reference in New Issue
Block a user