This commit is contained in:
bagtaib 2022-07-06 07:56:42 +02:00
parent 1d3181ea9f
commit 377e079a6e
3 changed files with 36 additions and 24 deletions

View File

@ -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 <a href="%s" target="_blank" rel="noopener noreferrer">manual development is here</a>.
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.

View File

@ -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 '<input type="hidden" name="action" value="initmodule">';
print '<input type="hidden" name="module" value="initmodule">';
//print '<span class="opacitymedium">'.$langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'</span><br>';
//print '<span class="opacitymedium">'.$langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'</span><br>';
print '<br>';
print '<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'">';
print ' '.$form->textwithpicto('', $langs->trans("EnterNameOfModuleDesc")).'<br>';
print '<input type="text" name="companyname" value="'.$mysoc->name.'" placeholder="'.dol_escape_htmltag($langs->trans("Name of company")).'"><br>';
print '<input type="text" name="companyurl" value="'.$mysoc->url.'" placeholder="'.dol_escape_htmltag($langs->trans("URL of company")).'"><br>';
print '<input type="text" name="version" value="1.0.0" placeholder="'.dol_escape_htmltag($langs->trans("Version")).'"><br>';
print '<input type="text" name="idmodule" value="500000" placeholder="'.dol_escape_htmltag($langs->trans("The number ID of module")).'"><br>';
//print '<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("Familly")).'"><br>';
print $langs->trans("Family").' <select>';
print '<input type="text" name="editorname" value="'.$mysoc->name.'" placeholder="'.dol_escape_htmltag($langs->trans("EditorName")).'"><br>';
print '<input type="text" name="editorurl" value="'.$mysoc->url.'" placeholder="'.dol_escape_htmltag($langs->trans("EditorUrl")).'"><br>';
print '<input type="text" name="version" value="1.0" placeholder="'.dol_escape_htmltag($langs->trans("Version")).'"><br>';
print '<input type="text" name="idmodule" value="500000" placeholder="'.dol_escape_htmltag($langs->trans("IdModule")).'"><br>';
print $langs->trans("Family").' <select name="family">';
print '<option value="hr">'.$langs->trans("ModuleFamilyHr").'</option>';
print '<option value="crm">'.$langs->trans("ModuleFamilyCrm").'</option>';
print '<option value="srm">'.$langs->trans("ModuleFamilySrm").'</option>';
print '<option value="financial">'.$langs->trans("ModuleFamilyFinancial").'</option>';
print '<option value="products">'.$langs->trans("ModuleFamilyProducts").'</option>';
print '<option value="projects">'.$langs->trans("ModuleFamilyProjects").'</option>';
print '<option value="ecm">'.$langs->trans("ModuleFamilyECM").'</option>';
print '<option value="technic">'.$langs->trans("ModuleFamilyTechnic").'</option>';
print '<option value="portal">'.$langs->trans("ModuleFamilyPortal").'</option>';
print '<option value="interface">'.$langs->trans("ModuleFamilyInterface").'</option>';
print '<option value="base">'.$langs->trans("ModuleFamilyBase").'</option>';
print '<option value="other" selected="">'.$langs->trans("ModuleFamilyOther").'</option>';
print '<option value="crm">'.$langs->trans("ModuleFamilyCrm").'</option>';
print '<option value="srm">'.$langs->trans("ModuleFamilySrm").'</option>';
print '<option value="financial">'.$langs->trans("ModuleFamilyFinancial").'</option>';
print '<option value="products">'.$langs->trans("ModuleFamilyProducts").'</option>';
print '<option value="projects">'.$langs->trans("ModuleFamilyProjects").'</option>';
print '<option value="ecm">'.$langs->trans("ModuleFamilyECM").'</option>';
print '<option value="technic">'.$langs->trans("ModuleFamilyTechnic").'</option>';
print '<option value="portal">'.$langs->trans("ModuleFamilyPortal").'</option>';
print '<option value="interface">'.$langs->trans("ModuleFamilyInterface").'</option>';
print '<option value="base">'.$langs->trans("ModuleFamilyBase").'</option>';
print '<option value="other" selected="">'.$langs->trans("ModuleFamilyOther").'</option>';
print '</select><br>';
print '<input type="text" name="idpicto" value="generic" placeholder="'.dol_escape_htmltag($langs->trans("Picto ID")).'"><br>';
print '<input type="text" name="idpicto" value="generic" placeholder="'.dol_escape_htmltag($langs->trans("Picto")).'"><br>';
print '<br><input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '</form>';

View File

@ -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(