From c973faf9a918777c05fcf2cfd7cefe1af6f55b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 1 Nov 2020 23:06:35 +0100 Subject: [PATCH 1/3] Update mod_codeclient_elephant.php --- .../societe/mod_codeclient_elephant.php | 55 +++++++------------ 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 6fca19e40fd..8dd530402e1 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -138,56 +138,39 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode */ public function getExample($langs, $objsoc = 0, $type = -1) { - if ($type == 0 || $type == -1) - { + $errmsg = array( + "ErrorBadMask", + "ErrorCantUseRazIfNoYearInMask", + "ErrorCantUseRazInStartedYearIfNoYearMonthInMask", + ); + if ($type == 0 || $type == -1) { $examplecust = $this->getNextValue($objsoc, 0); - if (!$examplecust) - { + if (!$examplecust) { $examplecust = $langs->trans('NotConfigured'); } - if ($examplecust == "ErrorBadMask") - { - $langs->load("errors"); - $examplecust = $langs->trans($examplecust); - } - if ($examplecust == "ErrorCantUseRazIfNoYearInMask") - { - $langs->load("errors"); - $examplecust = $langs->trans($examplecust); - } - if ($examplecust == "ErrorCantUseRazInStartedYearIfNoYearMonthInMask") - { + if (in_array($examplecust, $errmsg)) { $langs->load("errors"); $examplecust = $langs->trans($examplecust); } } - if ($type == 1 || $type == -1) - { + if ($type == 1 || $type == -1) { $examplesup = $this->getNextValue($objsoc, 1); - if (!$examplesup) - { + if (!$examplesup) { $examplesup = $langs->trans('NotConfigured'); } - if ($examplesup == "ErrorBadMask") - { + if (in_array($examplesup, $errmsg)) { $langs->load("errors"); - $examplesup = $langs->trans($examplesup); - } - if ($examplesup == "ErrorCantUseRazIfNoYearInMask") - { - $langs->load("errors"); - $examplesup = $langs->trans($examplesup); - } - if ($examplesup == "ErrorCantUseRazInStartedYearIfNoYearMonthInMask") - { - $langs->load("errors"); - $examplesup = $langs->trans($examplesup); + $examplesup = $langs->trans($examplecust); } } - if ($type == 0) return $examplecust; - if ($type == 1) return $examplesup; - return $examplecust.'
'.$examplesup; + if ($type == 0) { + return $examplecust; + } elseif ($type == 1) { + return $examplesup; + } else { + return $examplecust.'
'.$examplesup; + } } /** From 1ccb5cb2d7d8b46249458c13ae604170f463d4f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 1 Nov 2020 23:09:30 +0100 Subject: [PATCH 2/3] Update mod_codeclient_elephant.php --- htdocs/core/modules/societe/mod_codeclient_elephant.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 8dd530402e1..3f6d31dbb0b 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -160,7 +160,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode } if (in_array($examplesup, $errmsg)) { $langs->load("errors"); - $examplesup = $langs->trans($examplecust); + $examplesup = $langs->trans($examplesup); } } From 802efbe6a712d424dceaca4bc997d622502beb12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 1 Nov 2020 23:30:15 +0100 Subject: [PATCH 3/3] Update mod_codeclient_elephant.php --- 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 3f6d31dbb0b..083c3b57024 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -143,7 +143,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode "ErrorCantUseRazIfNoYearInMask", "ErrorCantUseRazInStartedYearIfNoYearMonthInMask", ); - if ($type == 0 || $type == -1) { + if ($type != 1) { $examplecust = $this->getNextValue($objsoc, 0); if (!$examplecust) { $examplecust = $langs->trans('NotConfigured'); @@ -153,7 +153,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode $examplecust = $langs->trans($examplecust); } } - if ($type == 1 || $type == -1) { + if ($type != 0) { $examplesup = $this->getNextValue($objsoc, 1); if (!$examplesup) { $examplesup = $langs->trans('NotConfigured');