Fix regression

This commit is contained in:
Laurent Destailleur 2022-09-15 01:35:54 +02:00
parent 094c2c3027
commit 9881e7753d

View File

@ -172,27 +172,32 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
"ErrorBadMaskBadRazMonth", "ErrorBadMaskBadRazMonth",
"ErrorCantUseRazWithYearOnOneDigit", "ErrorCantUseRazWithYearOnOneDigit",
); );
$cssforerror = (getDolGlobalString('SOCIETE_CODECLIENT_ADDON') == 'mod_codeclient_elephant' ? 'error' : 'opacitymedium');
if ($type != 1) { if ($type != 1) {
$examplecust = $this->getNextValue($objsoc, 0); $examplecust = $this->getNextValue($objsoc, 0);
if (!$examplecust) { if (!$examplecust && ($cssforerror == 'error' || $this->error != 'NotConfigured')) {
$examplecust = '<div class="error">'.$langs->trans('NotConfigured').'</div>'; $langs->load("errors");
$examplecust = '<span class="'.$cssforerror.'">'.$langs->trans('ErrorBadMask').'</span>';
$error = 1; $error = 1;
} }
if (in_array($examplecust, $errmsg)) { if (in_array($examplecust, $errmsg)) {
$langs->load("errors"); $langs->load("errors");
$examplecust = '<div class="error">'.$langs->trans($examplecust).'</div>'; $examplecust = '<span class="'.$cssforerror.'">'.$langs->trans($examplecust).'</span>';
$error = 1; $error = 1;
} }
} }
if ($type != 0) { if ($type != 0) {
$examplesup = $this->getNextValue($objsoc, 1); $examplesup = $this->getNextValue($objsoc, 1);
if (!$examplesup) { if (!$examplesup && ($cssforerror == 'error' || $this->error != 'NotConfigured')) {
$examplesup = '<div class="error">'.$langs->trans('NotConfigured').'</div>'; $langs->load("errors");
$examplesup = '<span class="'.$cssforerror.'">'.$langs->trans('ErrorBadMask').'</span>';
$error = 1; $error = 1;
} }
if (in_array($examplesup, $errmsg)) { if (in_array($examplesup, $errmsg)) {
$langs->load("errors"); $langs->load("errors");
$examplesup = '<div class="error">'.$langs->trans($examplesup).'</div>'; $examplesup = '<span class="'.$cssforerror.'">'.$langs->trans($examplesup).'</span>';
$error = 1; $error = 1;
} }
} }
@ -202,11 +207,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
} elseif ($type == 1) { } elseif ($type == 1) {
return $examplesup; return $examplesup;
} else { } else {
if ($error == 1) { return $examplecust.'<br>'.$examplesup;
return $examplecust.' '.$examplesup;
} else {
return $examplecust.'<br>'.$examplesup;
}
} }
} }