From 3e1e37211b90d5b4645ddf919944b4b4b6f0f866 Mon Sep 17 00:00:00 2001
From: ksar <35605507+ksar-ksar@users.noreply.github.com>
Date: Mon, 5 Sep 2022 15:48:40 +0200
Subject: [PATCH 1/2] Update mod_codeclient_elephant.php
---
.../societe/mod_codeclient_elephant.php | 22 ++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php
index 6079120a305..4186905f9f6 100644
--- a/htdocs/core/modules/societe/mod_codeclient_elephant.php
+++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php
@@ -161,31 +161,39 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
*/
public function getExample($langs, $objsoc = 0, $type = -1)
{
+ $error = 0;
$examplecust = '';
$examplesup = '';
$errmsg = array(
"ErrorBadMask",
"ErrorCantUseRazIfNoYearInMask",
"ErrorCantUseRazInStartedYearIfNoYearMonthInMask",
+ "ErrorCounterMustHaveMoreThan3Digits",
+ "ErrorBadMaskBadRazMonth",
+ "ErrorCantUseRazWithYearOnOneDigit",
);
if ($type != 1) {
$examplecust = $this->getNextValue($objsoc, 0);
if (!$examplecust) {
- $examplecust = $langs->trans('NotConfigured');
+ $examplecust = '
'.$langs->trans('NotConfigured').'
';
+ $error = 1;
}
if (in_array($examplecust, $errmsg)) {
$langs->load("errors");
- $examplecust = $langs->trans($examplecust);
+ $examplecust = ''.$langs->trans($examplecust).'
';
+ $error = 1;
}
}
if ($type != 0) {
$examplesup = $this->getNextValue($objsoc, 1);
if (!$examplesup) {
- $examplesup = $langs->trans('NotConfigured');
+ $examplesup = ''.$langs->trans('NotConfigured').'
';
+ $error = 1;
}
if (in_array($examplesup, $errmsg)) {
$langs->load("errors");
- $examplesup = $langs->trans($examplesup);
+ $examplesup = ''.$langs->trans($examplesup).'
';
+ $error = 1;
}
}
@@ -194,7 +202,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
} elseif ($type == 1) {
return $examplesup;
} else {
- return $examplecust.'
'.$examplesup;
+ if ($error == 1) {
+ return $examplecust.' '.$examplesup;
+ }else{
+ return $examplecust.'
'.$examplesup;
+ }
}
}
From 46dab68dd0bf9d276defd33ecff5376b475625af Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Mon, 5 Sep 2022 13:56:41 +0000
Subject: [PATCH 2/2] Fixing style errors.
---
htdocs/core/modules/societe/mod_codeclient_elephant.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php
index 4186905f9f6..e779504edd6 100644
--- a/htdocs/core/modules/societe/mod_codeclient_elephant.php
+++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php
@@ -170,7 +170,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
"ErrorCantUseRazInStartedYearIfNoYearMonthInMask",
"ErrorCounterMustHaveMoreThan3Digits",
"ErrorBadMaskBadRazMonth",
- "ErrorCantUseRazWithYearOnOneDigit",
+ "ErrorCantUseRazWithYearOnOneDigit",
);
if ($type != 1) {
$examplecust = $this->getNextValue($objsoc, 0);
@@ -204,7 +204,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
} else {
if ($error == 1) {
return $examplecust.' '.$examplesup;
- }else{
+ } else {
return $examplecust.'
'.$examplesup;
}
}