NEW Can defined a position of numbering submodules for thirdparties

This commit is contained in:
Laurent Destailleur 2019-09-03 15:58:20 +02:00
parent 106938168f
commit bd47bd096b
9 changed files with 91 additions and 110 deletions

View File

@ -34,13 +34,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'
*/
class mod_codeclient_elephant extends ModeleThirdPartyCode
{
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Elephant';
/**
* @var string model name
*/

View File

@ -38,13 +38,6 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
* Le fonctionnement de celui-ci doit donc rester le plus ouvert possible
*/
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Leopard';
/**
* @var string model name
*/

View File

@ -32,13 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'
*/
class mod_codeclient_monkey extends ModeleThirdPartyCode
{
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Monkey';
/**
* @var string model name
*/

View File

@ -31,13 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'
*/
class mod_codecompta_aquarium extends ModeleAccountancyCode
{
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Aquarium';
/**
* @var string model name
*/
@ -49,9 +42,11 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefixcustomeraccountancycode;
public $prefixcustomeraccountancycode;
public $prefixsupplieraccountancycode;
public $prefixsupplieraccountancycode;
public $position = 20;
/**
@ -93,11 +88,11 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$texte.=$langs->trans("ModuleCompanyCodeCustomer".$this->name, $s2)."<br>\n";
$texte.=$langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1)."<br>\n";
$texte.="<br>\n";
if (! isset($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL) || ! empty($conf->global->$conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL)) $texte.=$langs->trans('COMPANY_AQUARIUM_REMOVE_SPECIAL').' = '.yn(1)."<br>\n";
if (! isset($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL) || ! empty($conf->global->$conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL)) $texte.=$langs->trans('RemoveSpecialChars').' = '.yn(1)."<br>\n";
//if (! empty($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)) $texte.=$langs->trans('COMPANY_AQUARIUM_REMOVE_ALPHA').' = '.yn($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)."<br>\n";
if (! empty($conf->global->COMPANY_AQUARIUM_CLEAN_REGEX)) $texte.=$langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."<br>\n";
$texte.= '</td>';
$texte.= '<td class="left">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '</tr></table>';
$texte.= '</form>';

View File

@ -31,13 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'
*/
class mod_codecompta_digitaria extends ModeleAccountancyCode
{
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Digitaria';
/**
* @var string model name
*/
@ -49,9 +42,12 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
*/
public $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefixcustomeraccountancycode;
public $prefixcustomeraccountancycode;
public $prefixsupplieraccountancycode;
public $position = 30;
public $prefixsupplieraccountancycode;
/**
* Constructor
@ -98,13 +94,13 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$texte.= $langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1, $s3)."<br>\n";
$texte.= "<br>\n";
// Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default)
if (! isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || ! empty($conf->global->$conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $texte.= $langs->trans('COMPANY_DIGITARIA_REMOVE_SPECIAL').' = '.yn(1)."<br>\n";
if (! isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || ! empty($conf->global->$conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $texte.= $langs->trans('RemoveSpecialChars').' = '.yn(1)."<br>\n";
// Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed.
if (! empty($conf->global->COMPANY_DIGITARIA_CLEAN_REGEX)) $texte.= $langs->trans('COMPANY_DIGITARIA_CLEAN_REGEX').' = '.$conf->global->COMPANY_DIGITARIA_CLEAN_REGEX."<br>\n";
// Unique index on code if COMPANY_DIGITARIA_UNIQUE_CODE is set to 1 or not set (default)
if (! isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || ! empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE)) $texte.= $langs->trans('COMPANY_DIGITARIA_UNIQUE_CODE').' = '.yn(1)."<br>\n";
$texte.= '</td>';
$texte.= '<td class="left">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '</tr></table>';
$texte.= '</form>';

View File

@ -30,13 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'
*/
class mod_codecompta_panicum extends ModeleAccountancyCode
{
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Panicum';
/**
* @var string model name
*/
@ -48,6 +41,8 @@ class mod_codecompta_panicum extends ModeleAccountancyCode
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $position = 10;
/**
* Constructor

View File

@ -83,18 +83,18 @@ abstract class ModeleThirdPartyCode
return $langs->trans("NoDescription");
}
/** Renvoi nom module
/** Return name of module
*
* @param Translate $langs Object langs
* @return string Nom du module
*/
public function getNom($langs)
{
return $this->nom;
return $this->name;
}
/** Renvoi un exemple de numerotation
/** Return an example of numbering
*
* @param Translate $langs Object langs
* @return string Example
@ -261,8 +261,7 @@ abstract class ModeleThirdPartyCode
/**
* \class ModeleAccountancyCode
* \brief Parent class for third parties accountancy code generators
* Parent class for third parties accountancy code generators
*/
abstract class ModeleAccountancyCode
{
@ -340,7 +339,7 @@ abstract class ModeleAccountancyCode
$langs->load("admin");
$s='';
if ($type == -1) $s.=$langs->trans("Name").': <b>'.$this->nom.'</b><br>';
if ($type == -1) $s.=$langs->trans("Name").': <b>'.$this->name.'</b><br>';
if ($type == -1) $s.=$langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
//$s.='<br>';
//$s.='<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';

View File

@ -1848,9 +1848,8 @@ NothingToSetup=There is no specific setup required for this module.
SetToYesIfGroupIsComputationOfOtherGroups=Set this to yes if this group is a computation of other groups
EnterCalculationRuleIfPreviousFieldIsYes=Enter calculation rule if previous field was set to Yes (For example 'CODEGRP1+CODEGRP2')
SeveralLangugeVariatFound=Several language variants found
COMPANY_AQUARIUM_REMOVE_SPECIAL=Remove special characters
RemoveSpecialChars=Remove special characters
COMPANY_AQUARIUM_CLEAN_REGEX=Regex filter to clean value (COMPANY_AQUARIUM_CLEAN_REGEX)
COMPANY_DIGITARIA_REMOVE_SPECIAL=Remove special characters
COMPANY_DIGITARIA_CLEAN_REGEX=Regex filter to clean value (COMPANY_DIGITARIA_CLEAN_REGEX)
COMPANY_DIGITARIA_UNIQUE_CODE=Unauthorized double
GDPRContact=Data Protection Officer (DPO, Data Privacy or GDPR contact)

View File

@ -360,6 +360,8 @@ print ' <td class="center" width="80">'.$langs->trans("Status").'</td>';
print ' <td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\n";
$arrayofmodules = array();
foreach ($dirsociete as $dirroot)
{
$dir = dol_buildpath($dirroot, 0);
@ -388,39 +390,45 @@ foreach ($dirsociete as $dirroot)
if ($modCodeTiers->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
print '<tr class="oddeven">'."\n";
print '<td width="140">'.$modCodeTiers->name.'</td>'."\n";
print '<td>'.$modCodeTiers->info($langs).'</td>'."\n";
print '<td class="nowrap">'.$modCodeTiers->getExample($langs).'</td>'."\n";
if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
{
print '<td class="center">'."\n";
print img_picto($langs->trans("Activated"), 'switch_on');
print "</td>\n";
}
else
{
$disabled = false;
if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
print '<td class="center">';
if (! $disabled) print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
if (! $disabled) print '</a>';
print '</td>';
}
print '<td class="center">';
$s=$modCodeTiers->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1);
print '</td>';
print '</tr>';
$arrayofmodules[$file] = $modCodeTiers;
}
}
closedir($handle);
}
}
$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
foreach($arrayofmodules as $file => $modCodeTiers)
{
print '<tr class="oddeven">'."\n";
print '<td width="140">'.$modCodeTiers->name.'</td>'."\n";
print '<td>'.$modCodeTiers->info($langs).'</td>'."\n";
print '<td class="nowrap">'.$modCodeTiers->getExample($langs).'</td>'."\n";
if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
{
print '<td class="center">'."\n";
print img_picto($langs->trans("Activated"), 'switch_on');
print "</td>\n";
}
else
{
$disabled = (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
print '<td class="center">';
if (! $disabled) print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
if (! $disabled) print '</a>';
print '</td>';
}
print '<td class="center">';
$s=$modCodeTiers->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1);
print '</td>';
print '</tr>';
}
print '</table>';
print '</div>';
@ -441,6 +449,8 @@ print '<td class="center" width="80">'.$langs->trans("Status").'</td>';
print '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\n";
$arrayofmodules = array();
foreach ($dirsociete as $dirroot)
{
$dir = dol_buildpath($dirroot, 0);
@ -464,33 +474,41 @@ foreach ($dirsociete as $dirroot)
$modCodeCompta = new $file;
print '<tr class="oddeven">';
print '<td>'.$modCodeCompta->name."</td><td>\n";
print $modCodeCompta->info($langs);
print '</td>';
print '<td class="nowrap">'.$modCodeCompta->getExample($langs)."</td>\n";
if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file")
{
print '<td class="center">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</td>';
}
else
{
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodecompta&value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '<td class="center">';
$s=$modCodeCompta->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1);
print '</td>';
print "</tr>\n";
$arrayofmodules[$file] = $modCodeCompta;
}
}
closedir($handle);
}
closedir($handle);
}
$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
foreach($arrayofmodules as $file => $modCodeCompta)
{
print '<tr class="oddeven">';
print '<td>'.$modCodeCompta->name."</td><td>\n";
print $modCodeCompta->info($langs);
print '</td>';
print '<td class="nowrap">'.$modCodeCompta->getExample($langs)."</td>\n";
if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file")
{
print '<td class="center">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</td>';
}
else
{
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodecompta&value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '<td class="center">';
$s=$modCodeCompta->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1);
print '</td>';
print "</tr>\n";
}
print "</table>\n";
print '</div>';