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 class mod_codeclient_elephant extends ModeleThirdPartyCode
{ {
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Elephant';
/** /**
* @var string model name * @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 * 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 * @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 class mod_codeclient_monkey extends ModeleThirdPartyCode
{ {
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Monkey';
/** /**
* @var string model name * @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 class mod_codecompta_aquarium extends ModeleAccountancyCode
{ {
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Aquarium';
/** /**
* @var string model name * @var string model name
*/ */
@ -53,6 +46,8 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
public $prefixsupplieraccountancycode; public $prefixsupplieraccountancycode;
public $position = 20;
/** /**
* Constructor * Constructor
@ -93,11 +88,11 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$texte.=$langs->trans("ModuleCompanyCodeCustomer".$this->name, $s2)."<br>\n"; $texte.=$langs->trans("ModuleCompanyCodeCustomer".$this->name, $s2)."<br>\n";
$texte.=$langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1)."<br>\n"; $texte.=$langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1)."<br>\n";
$texte.="<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_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"; 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>';
$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.= '</tr></table>';
$texte.= '</form>'; $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 class mod_codecompta_digitaria extends ModeleAccountancyCode
{ {
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Digitaria';
/** /**
* @var string model name * @var string model name
*/ */
@ -53,6 +46,9 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
public $prefixsupplieraccountancycode; public $prefixsupplieraccountancycode;
public $position = 30;
/** /**
* Constructor * Constructor
*/ */
@ -98,13 +94,13 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$texte.= $langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1, $s3)."<br>\n"; $texte.= $langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1, $s3)."<br>\n";
$texte.= "<br>\n"; $texte.= "<br>\n";
// Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default) // 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. // 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"; 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) // 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"; 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>';
$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.= '</tr></table>';
$texte.= '</form>'; $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 class mod_codecompta_panicum extends ModeleAccountancyCode
{ {
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Panicum';
/** /**
* @var string model name * @var string model name
*/ */
@ -48,6 +41,8 @@ class mod_codecompta_panicum extends ModeleAccountancyCode
*/ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $position = 10;
/** /**
* Constructor * Constructor

View File

@ -83,18 +83,18 @@ abstract class ModeleThirdPartyCode
return $langs->trans("NoDescription"); return $langs->trans("NoDescription");
} }
/** Renvoi nom module /** Return name of module
* *
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @return string Nom du module * @return string Nom du module
*/ */
public function getNom($langs) 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 * @param Translate $langs Object langs
* @return string Example * @return string Example
@ -261,8 +261,7 @@ abstract class ModeleThirdPartyCode
/** /**
* \class ModeleAccountancyCode * Parent class for third parties accountancy code generators
* \brief Parent class for third parties accountancy code generators
*/ */
abstract class ModeleAccountancyCode abstract class ModeleAccountancyCode
{ {
@ -340,7 +339,7 @@ abstract class ModeleAccountancyCode
$langs->load("admin"); $langs->load("admin");
$s=''; $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>'; if ($type == -1) $s.=$langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
//$s.='<br>'; //$s.='<br>';
//$s.='<u>'.$langs->trans("ThisIsModuleRules").':</u><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 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') EnterCalculationRuleIfPreviousFieldIsYes=Enter calculation rule if previous field was set to Yes (For example 'CODEGRP1+CODEGRP2')
SeveralLangugeVariatFound=Several language variants found 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_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_CLEAN_REGEX=Regex filter to clean value (COMPANY_DIGITARIA_CLEAN_REGEX)
COMPANY_DIGITARIA_UNIQUE_CODE=Unauthorized double COMPANY_DIGITARIA_UNIQUE_CODE=Unauthorized double
GDPRContact=Data Protection Officer (DPO, Data Privacy or GDPR contact) 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 ' <td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\n"; print "</tr>\n";
$arrayofmodules = array();
foreach ($dirsociete as $dirroot) foreach ($dirsociete as $dirroot)
{ {
$dir = dol_buildpath($dirroot, 0); $dir = dol_buildpath($dirroot, 0);
@ -388,6 +390,17 @@ foreach ($dirsociete as $dirroot)
if ($modCodeTiers->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($modCodeTiers->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
$arrayofmodules[$file] = $modCodeTiers;
}
}
closedir($handle);
}
}
$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
foreach($arrayofmodules as $file => $modCodeTiers)
{
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
print '<td width="140">'.$modCodeTiers->name.'</td>'."\n"; print '<td width="140">'.$modCodeTiers->name.'</td>'."\n";
print '<td>'.$modCodeTiers->info($langs).'</td>'."\n"; print '<td>'.$modCodeTiers->info($langs).'</td>'."\n";
@ -401,8 +414,7 @@ foreach ($dirsociete as $dirroot)
} }
else else
{ {
$disabled = false; $disabled = (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
print '<td class="center">'; print '<td class="center">';
if (! $disabled) print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">'; if (! $disabled) print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
@ -416,10 +428,6 @@ foreach ($dirsociete as $dirroot)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
}
}
closedir($handle);
}
} }
print '</table>'; print '</table>';
print '</div>'; 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 '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\n"; print "</tr>\n";
$arrayofmodules = array();
foreach ($dirsociete as $dirroot) foreach ($dirsociete as $dirroot)
{ {
$dir = dol_buildpath($dirroot, 0); $dir = dol_buildpath($dirroot, 0);
@ -464,6 +474,18 @@ foreach ($dirsociete as $dirroot)
$modCodeCompta = new $file; $modCodeCompta = new $file;
$arrayofmodules[$file] = $modCodeCompta;
}
}
}
closedir($handle);
}
$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
foreach($arrayofmodules as $file => $modCodeCompta)
{
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$modCodeCompta->name."</td><td>\n"; print '<td>'.$modCodeCompta->name."</td><td>\n";
print $modCodeCompta->info($langs); print $modCodeCompta->info($langs);
@ -487,10 +509,6 @@ foreach ($dirsociete as $dirroot)
print $form->textwithpicto('', $s, 1); print $form->textwithpicto('', $s, 1);
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
}
}
closedir($handle);
}
} }
print "</table>\n"; print "</table>\n";
print '</div>'; print '</div>';