Merge pull request #15257 from frederic34/patch-10

Update modules_societe.class.php
This commit is contained in:
Laurent Destailleur 2020-11-02 09:30:54 +01:00 committed by GitHub
commit 94753f4678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,12 +140,18 @@ abstract class ModeleThirdPartyCode
global $langs; global $langs;
$langs->load("admin"); $langs->load("admin");
if ($this->version == 'development') return $langs->trans("VersionDevelopment"); if ($this->version == 'development') {
if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); return $langs->trans("VersionDevelopment");
if ($this->version == 'dolibarr') return DOL_VERSION; } elseif ($this->version == 'experimental') {
if ($this->version) return $this->version; return $langs->trans("VersionExperimental");
} elseif ($this->version == 'dolibarr') {
return DOL_VERSION;
} elseif ($this->version) {
return $this->version;
} else {
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
@ -153,7 +159,7 @@ abstract class ModeleThirdPartyCode
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show * @param integer $maxfilenamelength Max length of value to show
* @return array List of numbers * @return array|int List of numbers
*/ */
public static function liste_modeles($db, $maxfilenamelength = 0) public static function liste_modeles($db, $maxfilenamelength = 0)
{ {
@ -193,31 +199,32 @@ abstract class ModeleThirdPartyCode
$langs->load("admin"); $langs->load("admin");
$s = ''; $s = '';
if ($type == -1) $s .= $langs->trans("Name").': <b>'.$this->getNom($langs).'</b><br>'; if ($type == -1) {
if ($type == -1) $s .= $langs->trans("Version").': <b>'.$this->getVersion().'</b><br>'; $s .= $langs->trans("Name").': <b>'.$this->getNom($langs).'</b><br>';
if ($type == 0) $s .= $langs->trans("CustomerCodeDesc").'<br>'; } elseif ($type == -1) {
if ($type == 1) $s .= $langs->trans("SupplierCodeDesc").'<br>'; $s .= $langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
if ($type != -1) $s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>'; } elseif ($type == 0) {
$s .= $langs->trans("CustomerCodeDesc").'<br>';
} elseif ($type == 1) {
$s .= $langs->trans("SupplierCodeDesc").'<br>';
} elseif ($type != -1) {
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
}
$s .= '<br>'; $s .= '<br>';
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>'; $s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';
if ($type == 0) if ($type == 0) {
{
$s .= $langs->trans("RequiredIfCustomer").': '; $s .= $langs->trans("RequiredIfCustomer").': ';
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '<strike>'; if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '<strike>';
$s .= yn(!$this->code_null, 1, 2); $s .= yn(!$this->code_null, 1, 2);
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '</strike> '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')'; if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '</strike> '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
$s .= '<br>'; $s .= '<br>';
} } elseif ($type == 1) {
if ($type == 1)
{
$s .= $langs->trans("RequiredIfSupplier").': '; $s .= $langs->trans("RequiredIfSupplier").': ';
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '<strike>'; if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '<strike>';
$s .= yn(!$this->code_null, 1, 2); $s .= yn(!$this->code_null, 1, 2);
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '</strike> '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')'; if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '</strike> '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
$s .= '<br>'; $s .= '<br>';
} } elseif ($type == -1) {
if ($type == -1)
{
$s .= $langs->trans("Required").': '; $s .= $langs->trans("Required").': ';
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '<strike>'; if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '<strike>';
$s .= yn(!$this->code_null, 1, 2); $s .= yn(!$this->code_null, 1, 2);
@ -230,14 +237,12 @@ abstract class ModeleThirdPartyCode
$s .= $langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide, 1, 2).'<br>'; $s .= $langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide, 1, 2).'<br>';
$s .= $langs->trans("AutomaticCode").': '.yn($this->code_auto, 1, 2).'<br>'; $s .= $langs->trans("AutomaticCode").': '.yn($this->code_auto, 1, 2).'<br>';
$s .= '<br>'; $s .= '<br>';
if ($type == 0 || $type == -1) if ($type == 0 || $type == -1) {
{
$nextval = $this->getNextValue($soc, 0); $nextval = $this->getNextValue($soc, 0);
if (empty($nextval)) $nextval = $langs->trans("Undefined"); if (empty($nextval)) $nextval = $langs->trans("Undefined");
$s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Customer").')' : '').': <b>'.$nextval.'</b><br>'; $s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Customer").')' : '').': <b>'.$nextval.'</b><br>';
} }
if ($type == 1 || $type == -1) if ($type == 1 || $type == -1) {
{
$nextval = $this->getNextValue($soc, 1); $nextval = $this->getNextValue($soc, 1);
if (empty($nextval)) $nextval = $langs->trans("Undefined"); if (empty($nextval)) $nextval = $langs->trans("Undefined");
$s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Supplier").')' : '').': <b>'.$nextval.'</b>'; $s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Supplier").')' : '').': <b>'.$nextval.'</b>';
@ -317,12 +322,18 @@ abstract class ModeleAccountancyCode
global $langs; global $langs;
$langs->load("admin"); $langs->load("admin");
if ($this->version == 'development') return $langs->trans("VersionDevelopment"); if ($this->version == 'development') {
if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); return $langs->trans("VersionDevelopment");
if ($this->version == 'dolibarr') return DOL_VERSION; } elseif ($this->version == 'experimental') {
if ($this->version) return $this->version; return $langs->trans("VersionExperimental");
} elseif ($this->version == 'dolibarr') {
return DOL_VERSION;
} elseif ($this->version) {
return $this->version;
} else {
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
}
/** /**
* Return description of module parameters * Return description of module parameters
@ -339,20 +350,20 @@ abstract class ModeleAccountancyCode
$langs->load("admin"); $langs->load("admin");
$s = ''; $s = '';
if ($type == -1) $s .= $langs->trans("Name").': <b>'.$this->name.'</b><br>'; if ($type == -1) {
if ($type == -1) $s .= $langs->trans("Version").': <b>'.$this->getVersion().'</b><br>'; $s .= $langs->trans("Name").': <b>'.$this->name.'</b><br>';
$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>';
$s .= '<br>'; $s .= '<br>';
if ($type == 0 || $type == -1) if ($type == 0 || $type == -1) {
{
$result = $this->get_code($db, $soc, 'customer'); $result = $this->get_code($db, $soc, 'customer');
$nextval = $this->code; $nextval = $this->code;
if (empty($nextval)) $nextval = $langs->trans("Undefined"); if (empty($nextval)) $nextval = $langs->trans("Undefined");
$s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Customer").')' : '').': <b>'.$nextval.'</b><br>'; $s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Customer").')' : '').': <b>'.$nextval.'</b><br>';
} }
if ($type == 1 || $type == -1) if ($type == 1 || $type == -1) {
{
$result = $this->get_code($db, $soc, 'supplier'); $result = $this->get_code($db, $soc, 'supplier');
$nextval = $this->code; $nextval = $this->code;
if (empty($nextval)) $nextval = $langs->trans("Undefined"); if (empty($nextval)) $nextval = $langs->trans("Undefined");