Nicer combo of companies for external modules

This commit is contained in:
Laurent Destailleur
2024-04-03 13:20:26 +02:00
parent 5acdcac75d
commit f03eb260de
5 changed files with 41 additions and 13 deletions

View File

@@ -361,13 +361,17 @@ llxHeader('', $langs->trans("Setup"), $help_url, '', '', '', $morejs, $morecss,
// Search modules dirs // Search modules dirs
$modulesdir = dolGetModulesDirs(); $modulesdir = dolGetModulesDirs();
$arrayofnatures = array('core' => $langs->transnoentitiesnoconv("NativeModules"), 'external' => $langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']'); $arrayofnatures = array(
'core' => array('label' => $langs->transnoentitiesnoconv("NativeModules")),
'external' => array('label' => $langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']')
);
$arrayofwarnings = array(); // Array of warning each module want to show when activated $arrayofwarnings = array(); // Array of warning each module want to show when activated
$arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module $arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module
$filename = array(); $filename = array();
$modules = array(); $modules = array();
$orders = array(); $orders = array();
$categ = array(); $categ = array();
$publisherlogoarray = array();
$i = 0; // is a sequencer of modules found $i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined. $j = 0; // j is module number. Automatically affected if module number not defined.
@@ -427,9 +431,16 @@ foreach ($modulesdir as $dir) {
$external = ($objMod->isCoreOrExternalModule() == 'external'); $external = ($objMod->isCoreOrExternalModule() == 'external');
if ($external) { if ($external) {
if ($publisher) { if ($publisher) {
$arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher; // Check if there is a logo forpublisher
/* Do not show the company logo in combo. Make combo list dirty.
if (!empty($objMod->editor_squarred_logo)) {
$publisherlogoarray['external_'.$publisher] = img_picto('', $objMod->editor_squarred_logo, 'class="publisherlogoinline"');
}
$publisherlogo = empty($publisherlogoarray['external_'.$publisher]) ? '' : $publisherlogoarray['external_'.$publisher];
*/
$arrayofnatures['external_'.$publisher] = array('label' => $langs->trans("External").' - '.$publisher, 'data-html' => $langs->trans("External").' - <span class="opacitymedium inine-block valignmiddle">'.$publisher.'</span>');
} else { } else {
$arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers"); $arrayofnatures['external_'] = array('label' => $langs->trans("External").' - ['.$langs->trans("UnknownPublishers").']');
} }
} }
ksort($arrayofnatures); ksort($arrayofnatures);

View File

@@ -38,30 +38,33 @@
class DolibarrModules // Can not be abstract, because we need to instantiate it into unActivateModule to be able to disable a module whose files were removed. class DolibarrModules // Can not be abstract, because we need to instantiate it into unActivateModule to be able to disable a module whose files were removed.
{ {
/** /**
* @var DoliDB Database handler * @var DoliDB Database handler
*/ */
public $db; public $db;
/** /**
* @var int Module unique ID * @var int Module unique ID
* @see https://wiki.dolibarr.org/index.php/List_of_modules_id * @see https://wiki.dolibarr.org/index.php/List_of_modules_id
*/ */
public $numero; public $numero;
/** /**
* @var string Publisher name * @var string Publisher name
* @since 4.0.0
*/ */
public $editor_name; public $editor_name;
/** /**
* @var string URL of module at publisher site * @var string URL of module at publisher site
* @since 4.0.0
*/ */
public $editor_url; public $editor_url;
/** /**
* @var string Family * @var string URL of logo of the publisher. Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@mymodule'.
*/
public $editor_squarred_logo;
/**
* @var string Family
* @see $familyinfo * @see $familyinfo
* *
* Native values: 'crm', 'financial', 'hr', 'projects', 'products', 'ecm', 'technic', 'other'. * Native values: 'crm', 'financial', 'hr', 'projects', 'products', 'ecm', 'technic', 'other'.
@@ -84,12 +87,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
public $familyinfo; public $familyinfo;
/** /**
* @var string Module position on 2 digits * @var string Module position on 2 digits
*/ */
public $module_position = '50'; public $module_position = '50';
/** /**
* @var string Module name * @var string Module name
* *
* Only used if Module[ID]Name translation string is not found. * Only used if Module[ID]Name translation string is not found.
* *

View File

@@ -42,6 +42,7 @@ class modMyModule extends DolibarrModules
public function __construct($db) public function __construct($db)
{ {
global $langs, $conf; global $langs, $conf;
$this->db = $db; $this->db = $db;
// Id for module (must be unique). // Id for module (must be unique).
@@ -70,7 +71,8 @@ class modMyModule extends DolibarrModules
// Author // Author
$this->editor_name = 'Editor name'; $this->editor_name = 'Editor name';
$this->editor_url = 'https://www.example.com'; $this->editor_url = 'https://www.example.com'; // Must be an external online web site
$this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@mymodule'
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z' // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z'
$this->version = '1.0'; $this->version = '1.0';

View File

@@ -1095,6 +1095,12 @@ i.fa-mars::before, i.fa-venus::before, i.fa-genderless::before, i.fa-transgender
.stockmovement { .stockmovement {
font-size: 1.4em; font-size: 1.4em;
} }
.publisherlogoinline {
vertical-align: middle;
height: 14px;
width: 14px;
margin-left: 5px;
}
body[class*="colorblind-"] .text-warning{ body[class*="colorblind-"] .text-warning{
color : <?php print $colorblind_deuteranopes_textWarning; ?> color : <?php print $colorblind_deuteranopes_textWarning; ?>

View File

@@ -1273,6 +1273,12 @@ i.fa-mars::before, i.fa-venus::before, i.fa-genderless::before, i.fa-transgender
.stockmovement { .stockmovement {
font-size: 1.4em; font-size: 1.4em;
} }
.publisherlogoinline {
vertical-align: middle;
height: 14px;
width: 14px;
margin-left: 5px;
}
.text-warning{ .text-warning{
color : <?php print $textWarning; ?> color : <?php print $textWarning; ?>