diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php
index 308f98d7828..8b3c359a562 100644
--- a/htdocs/core/modules/product/modules_product.class.php
+++ b/htdocs/core/modules/product/modules_product.class.php
@@ -137,10 +137,18 @@ abstract class ModeleProductCode
global $langs;
$langs->load("admin");
- if ($this->version == 'development') return $langs->trans("VersionDevelopment");
- if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
- if ($this->version == 'dolibarr') return DOL_VERSION;
- if ($this->version) return $this->version;
+ if ($this->version == 'development') {
+ return $langs->trans("VersionDevelopment");
+ }
+ if ($this->version == 'experimental') {
+ return $langs->trans("VersionExperimental");
+ }
+ if ($this->version == 'dolibarr') {
+ return DOL_VERSION;
+ }
+ if ($this->version) {
+ return $this->version;
+ }
return $langs->trans("NotAvailable");
}
@@ -159,12 +167,10 @@ abstract class ModeleProductCode
$sql = "";
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
- while ($i < $num)
- {
+ while ($i < $num) {
$row = $db->fetch_row($resql);
$liste[$row[0]] = $row[1];
$i++;
@@ -188,37 +194,39 @@ abstract class ModeleProductCode
global $conf;
$langs->load("admin");
-
+ $strikestart = '';
+ $strikeend = '';
+ if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) {
+ $strikestart = '';
+ $strikeend = ' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
+ }
$s = '';
if ($type == -1) {
$s .= $langs->trans("Name").': '.$this->getNom($langs).'
';
$s .= $langs->trans("Version").': '.$this->getVersion().'
';
}
- if ($type == 0) $s .= $langs->trans("ProductCodeDesc").'
';
- if ($type == 1) $s .= $langs->trans("ServiceCodeDesc").'
';
- if ($type != -1) $s .= $langs->trans("ValidityControledByModule").': '.$this->getNom($langs).'
';
+ if ($type == 0) {
+ $s .= $langs->trans("ProductCodeDesc").'
';
+ }
+ if ($type == 1) {
+ $s .= $langs->trans("ServiceCodeDesc").'
';
+ }
+ if ($type != -1) {
+ $s .= $langs->trans("ValidityControledByModule").': '.$this->getNom($langs).'
';
+ }
$s .= '
';
$s .= ''.$langs->trans("ThisIsModuleRules").':
';
- if ($type == 0)
- {
- $s .= $langs->trans("RequiredIfProduct").': ';
- if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '';
- $s .= yn(!$this->code_null, 1, 2);
- if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= ' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
+ if ($type == 0) {
+ $s .= $langs->trans("RequiredIfProduct").': '.$strikestart;
+ $s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= '
';
- } elseif ($type == 1)
- {
- $s .= $langs->trans("RequiredIfService").': ';
- if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '';
- $s .= yn(!$this->code_null, 1, 2);
- if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= ' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
+ } elseif ($type == 1) {
+ $s .= $langs->trans("RequiredIfService").': '.$strikestart;
+ $s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= '
';
- } elseif ($type == -1)
- {
- $s .= $langs->trans("Required").': ';
- if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= '';
- $s .= yn(!$this->code_null, 1, 2);
- if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) $s .= ' '.yn(1, 1, 2).' ('.$langs->trans("ForcedToByAModule", $langs->transnoentities("yes")).')';
+ } elseif ($type == -1) {
+ $s .= $langs->trans("Required").': '.$strikestart;
+ $s .= yn(!$this->code_null, 1, 2).$strikeend;
$s .= '
';
}
$s .= $langs->trans("CanBeModifiedIfOk").': ';
@@ -227,16 +235,18 @@ abstract class ModeleProductCode
$s .= $langs->trans("CanBeModifiedIfKo").': '.yn($this->code_modifiable_invalide, 1, 2).'
';
$s .= $langs->trans("AutomaticCode").': '.yn($this->code_auto, 1, 2).'
';
$s .= '
';
- if ($type == 0 || $type == -1)
- {
+ if ($type == 0 || $type == -1) {
$nextval = $this->getNextValue($product, 0);
- if (empty($nextval)) $nextval = $langs->trans("Undefined");
+ if (empty($nextval)) {
+ $nextval = $langs->trans("Undefined");
+ }
$s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Product").')' : '').': '.$nextval.'
';
}
- if ($type == 1 || $type == -1)
- {
+ if ($type == 1 || $type == -1) {
$nextval = $this->getNextValue($product, 1);
- if (empty($nextval)) $nextval = $langs->trans("Undefined");
+ if (empty($nextval)) {
+ $nextval = $langs->trans("Undefined");
+ }
$s .= $langs->trans("NextValue").($type == -1 ? ' ('.$langs->trans("Service").')' : '').': '.$nextval.'';
}
return $s;