From 377e079a6efd7219dbdb23506d7480167a9786e3 Mon Sep 17 00:00:00 2001 From: bagtaib Date: Wed, 6 Jul 2022 07:56:42 +0200 Subject: [PATCH] backend --- htdocs/langs/en_US/modulebuilder.lang | 1 + htdocs/modulebuilder/index.php | 55 +++++++++++-------- .../core/modules/modMyModule.class.php | 4 +- 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index b17ab4fdeb2..792070e3d43 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -1,4 +1,5 @@ # Dolibarr language file - Source file is en_US - loan +IdModule= Module id ModuleBuilderDesc=This tool must be used only by experienced users or developers. It provides utilities to build or edit your own module. Documentation for alternative manual development is here. EnterNameOfModuleDesc=Enter the name of the module/application to create with no spaces. Use uppercase to separate words (For example: MyModule, EcommerceForShop, SyncWithMySystem...) EnterNameOfObjectDesc=Enter the name of the object to create with no spaces. Use uppercase to separate words (For example: MyObject, Student, Teacher...). The CRUD class file, but also API file, pages to list/add/edit/delete object and SQL files will be generated. diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index ac0ed014699..b6bcf74cc9e 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -71,6 +71,12 @@ $file = GETPOST('file', 'alpha'); $modulename = dol_sanitizeFileName(GETPOST('modulename', 'alpha')); $objectname = dol_sanitizeFileName(GETPOST('objectname', 'alpha')); $dicname = dol_sanitizeFileName(GETPOST('dicname', 'alpha')); +$editorname= GETPOST('editorname', 'alpha'); +$editorurl= GETPOST('editorurl', 'alpha'); +$version= GETPOST('version', 'alpha'); +$family= GETPOST('family', 'alpha'); +$picto= GETPOST('idpicto', 'alpha'); +$idmodule= GETPOST('idmodule', 'alpha'); // Security check if (!isModEnabled('modulebuilder')) { @@ -334,7 +340,13 @@ if ($dirins && $action == 'initmodule' && $modulename) { 'Mon module'=>$modulename, 'mon module'=>$modulename, 'htdocs/modulebuilder/template'=>strtolower($modulename), - '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : ''), + 'Editor name'=>$editorname, + 'https://www.example.com'=>$editorurl, + '1.0'=>$version, + 'idpicto'=>$picto, + "modulefamily" =>$family, + 500000=>$idmodule ); if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) { @@ -350,7 +362,7 @@ if ($dirins && $action == 'initmodule' && $modulename) { $arrayreplacement['1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION; } if (!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) { - $arrayreplacement['other'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY; + $arrayreplacement['modulefamily'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY; } $result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); @@ -2074,34 +2086,33 @@ if ($module == 'initmodule') { print ''; print ''; - //print ''.$langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'
'; + //print ''.$langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'
'; print '
'; print ''; print ' '.$form->textwithpicto('', $langs->trans("EnterNameOfModuleDesc")).'
'; - - print '
'; - print '
'; - print '
'; - print '
'; - //print '
'; - print $langs->trans("Family").'
'; + print '
'; + print '
'; + print '
'; + print $langs->trans("Family").'
'; - print '
'; + print '
'; print '
'; print ''; diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 8ea8a575eca..0c99c0fb46d 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -52,7 +52,7 @@ class modMyModule extends DolibarrModules // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' // It is used to group modules by family in module setup page - $this->family = "other"; + $this->family = "modulefamily"; // Module position in the family on 2 digits ('01', '10', '20', ...) $this->module_position = '90'; @@ -83,7 +83,7 @@ class modMyModule extends DolibarrModules // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' // To use a supported fa-xxx css style of font awesome, use this->picto='xxx' - $this->picto = 'generic'; + $this->picto = 'idpicto'; // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) $this->module_parts = array(