diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9b3385e832a..7951ea8a4bb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8109,7 +8109,7 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id * Return yes or no in current language * * @param int<0, 1>|'yes'|'true'|'no'|'false' $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false') - * @param integer|string $format 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No, 4 or Text=Use picto + * @param integer|string $format 1=Yes/No, 0=yes/no, 2=Disabled/enabled checkbox, 3=Disabled/enabled checkbox + Yes/No, 4 or Text=Use picto * @param int $color 0=texte only, 1=Text is formatted with a color font style ('ok' or 'error'), 2=Text is formatted with 'ok' color. * @return string HTML string */ diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 91334930e13..f5c812c815c 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -66,6 +66,9 @@ DatabaseIndex=Database index FileAlreadyExists=File %s already exists TriggersFile=File for triggers code HooksFile=File for hooks code +Tabs=Tabs +IsExtraFieldManaged=Does this object must support extrafields ? +IsMultiEntityManaged=Does this object must support multicompany ? ArrayOfKeyValues=Array of key-val ArrayOfKeyValuesDesc=Array of keys and values if field is a combo list with fixed values WidgetFile=Widget file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 2b8b6a6c832..e8cf04427aa 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3541,16 +3541,16 @@ if ($module == 'initmodule') { $head2[$h][2] = 'languages'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = ($countDictionaries == 0 ? $langs->trans("Dictionaries") : $langs->trans('Dictionaries').''.$countDictionaries.""); - $head2[$h][2] = 'dictionaries'; - $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = ($countRights <= 0 ? $langs->trans("Permissions") : $langs->trans("Permissions").''.$countRights.""); $head2[$h][2] = 'permissions'; $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''); + $head2[$h][1] = ($countDictionaries == 0 ? $langs->trans("Dictionaries") : $langs->trans('Dictionaries').''.$countDictionaries.""); + $head2[$h][2] = 'dictionaries'; + $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=tabs&module='.$module.($forceddirread ? '@'.$dirread : ''); $head2[$h][1] = $langs->trans("Tabs"); $head2[$h][2] = 'tabs'; @@ -3616,7 +3616,7 @@ if ($module == 'initmodule') { $head2[$h][2] = 'buildpackage'; $h++; - $MAXTABFOROBJECT = 15; + $MAXTABFOROBJECT = 12; print ''; @@ -4371,21 +4371,27 @@ if ($module == 'initmodule') { $objs = array(); + // Image + $htmltooltip = ''; + if ($realpathtopicto && dol_is_file($realpathtopicto)) { + $htmltooltip .= ' '.$langs->trans("Image").' : '.(dol_is_file($realpathtopicto) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).(dol_is_file($realpathtopicto) ? '' : '').''; + $htmltooltip .= '
'; + } elseif (!empty($tmpobject)) { + $htmltooltip .= ' '.$langs->trans("Image").' : '.img_picto('', $tmpobject->picto, 'class="pictofixedwidth valignmiddle"').$tmpobject->picto; + $htmltooltip .= '
'; + } + $htmltooltip .= ' '.$langs->trans("IsExtraFieldManaged").' : '.yn(empty($tmpobject->isextrafieldmanaged) ? 0 : 1, 1, 2); + $htmltooltip .= '
'; + $htmltooltip .= ' '.$langs->trans("IsMultiEntityManaged").' : '.yn(empty($tmpobject->ismultientitymanaged) ? 0 : 1, 1, 2); + $htmltooltip .= '
'; + print ''; print '
'; // Main DAO class file print ' '.$langs->trans("ClassFile").' : '.(dol_is_file($realpathtoclass) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).(dol_is_file($realpathtoclass) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print $form->textwithpicto('', $htmltooltip, 1, 'help', 'valignmiddle', 1); print '
'; - // Image - if ($realpathtopicto && dol_is_file($realpathtopicto)) { - print ' '.$langs->trans("Image").' : '.(dol_is_file($realpathtopicto) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).(dol_is_file($realpathtopicto) ? '' : '').''; - //print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - } elseif (!empty($tmpobject)) { - print ' '.$langs->trans("Image").' : '.img_picto('', $tmpobject->picto, 'class="pictofixedwidth valignmiddle"').$tmpobject->picto; - print '
'; - } // API file print '
'; @@ -4441,27 +4447,30 @@ if ($module == 'initmodule') { print ' '.img_picto($langs->trans("Edit"), 'edit').''; //print '   '.$langs->trans("RunSql").''; print '
'; - print ' '.$langs->trans("SqlFileExtraFields").' : '.(dol_is_file($realpathtosqlextra) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextra).(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '').''; - if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) { - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; - print '   '; - print ''.$langs->trans("DropTableIfEmpty").''; - } else { - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + if (!empty($tmpobject->isextrafieldmanaged)) { + print ' '.$langs->trans("SqlFileExtraFields").' : '.(dol_is_file($realpathtosqlextra) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextra).(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '').''; + if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) { + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '; + print ''.img_picto($langs->trans("Delete"), 'delete').''; + print '   '; + print ''.$langs->trans("DropTableIfEmpty").''; + } else { + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + } + + //print '   '.$langs->trans("RunSql").''; + print '
'; + print ' '.$langs->trans("SqlFileKeyExtraFields").' : '.(dol_is_file($realpathtosqlextrakey) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextrakey).(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '').''; + if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) { + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '; + print ''.img_picto($langs->trans("Delete"), 'delete').''; + } else { + print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; + } + print '
'; } - //print '   '.$langs->trans("RunSql").''; - print '
'; - print ' '.$langs->trans("SqlFileKeyExtraFields").' : '.(dol_is_file($realpathtosqlextrakey) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextrakey).(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '').''; - if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) { - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print ' '; - print ''.img_picto($langs->trans("Delete"), 'delete').''; - } else { - print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; - } - print '
'; print '
'; print '
'; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 91c55f118d7..dc758a57cc8 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -1276,6 +1276,18 @@ class MyObjectLine extends CommonObjectLine */ public $fk_parent_attribute = ''; // Example: '' or 'fk_myobject' + /** + * @var int<0,1> Does object support extrafields ? 0=No, 1=Yes + */ + public $isextrafieldmanaged = 0; + + /** + * @var int<0,1>|string|null Does this object support multicompany module ? + * 0=No test on entity, 1=Test with field entity in local table, 'field@table'=Test entity into the field@table (example 'fk_soc@societe') + */ + public $ismultientitymanaged = 0; + + /** * Constructor * @@ -1284,7 +1296,5 @@ class MyObjectLine extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = $db; - - $this->isextrafieldmanaged = 0; } }