simplify function

This commit is contained in:
Frédéric FRANCE 2020-11-28 23:41:44 +01:00
parent fb871daf14
commit 11a978ca08
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
2 changed files with 16 additions and 17 deletions

View File

@ -204,11 +204,9 @@ abstract class ModeleProductCode
if ($type == -1) {
$s .= $langs->trans("Name").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
}
if ($type == 0) {
} elseif ($type == 0) {
$s .= $langs->trans("ProductCodeDesc").'<br>';
}
if ($type == 1) {
} elseif ($type == 1) {
$s .= $langs->trans("ServiceCodeDesc").'<br>';
}
if ($type != -1) {

View File

@ -197,6 +197,12 @@ abstract class ModeleThirdPartyCode
global $conf;
$langs->load("admin");
$strikestart = '';
$strikeend = '';
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) {
$strikestart = '<strike>';
$strikeend = '</strike> '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
}
$s = '';
if ($type == -1) {
@ -207,28 +213,23 @@ abstract class ModeleThirdPartyCode
$s .= $langs->trans("CustomerCodeDesc").'<br>';
} elseif ($type == 1) {
$s .= $langs->trans("SupplierCodeDesc").'<br>';
} elseif ($type != -1) {
}
if ($type != -1) {
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
}
$s .= '<br>';
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';
if ($type == 0) {
$s .= $langs->trans("RequiredIfCustomer").': ';
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '<strike>';
$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")).')';
$s .= $langs->trans("RequiredIfCustomer").': '.$strikestart;
$s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= '<br>';
} elseif ($type == 1) {
$s .= $langs->trans("RequiredIfSupplier").': ';
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '<strike>';
$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")).')';
$s .= $langs->trans("RequiredIfSupplier").': '.$strikestart;
$s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= '<br>';
} elseif ($type == -1) {
$s .= $langs->trans("Required").': ';
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '<strike>';
$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")).')';
$s .= $langs->trans("Required").': '.$strikestart;
$s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= '<br>';
}
$s .= $langs->trans("CanBeModifiedIfOk").': ';