';
+
$texte .= '';
return $texte;
@@ -192,6 +209,11 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
return -1;
}
+ // Clean declared words
+ if (!empty($conf->global->COMPANY_DIGITARIA_CLEAN_WORDS)) {
+ $cleanWords = explode(";", $conf->global->COMPANY_DIGITARIA_CLEAN_WORDS);
+ $codetouse = str_replace($cleanWords, "", $codetouse);
+ }
// Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default)
if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || !empty($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) {
$codetouse = preg_replace('/([^a-z0-9])/i', '', $codetouse);
@@ -202,7 +224,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
}
$this->code = $prefix.strtoupper(substr($codetouse, 0, $width));
- dol_syslog("mod_codecompta_digitaria::get_code search code proposed=".$this->code);
+ dol_syslog("mod_codecompta_digitaria::get_code search code proposed=".$this->code, LOG_DEBUG);
// Unique index on code if COMPANY_DIGITARIA_UNIQUE_CODE is set to 1 or not set (default)
if (!isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || !empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE)) {
@@ -279,6 +301,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$sql = "SELECT " . $typethirdparty . " FROM " . MAIN_DB_PREFIX . "societe";
$sql .= " WHERE " . $typethirdparty . " = '" . $db->escape($code) . "'";
}
+ $sql .= " AND entity IN (".getEntity('societe').")";
$resql = $db->query($sql);
if ($resql) {
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 0555906768c..305bd003be2 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -2059,6 +2059,8 @@ RemoveSpecialChars=Remove special characters
COMPANY_AQUARIUM_CLEAN_REGEX=Regex filter to clean value (COMPANY_AQUARIUM_CLEAN_REGEX)
COMPANY_DIGITARIA_CLEAN_REGEX=Regex filter to clean value (COMPANY_DIGITARIA_CLEAN_REGEX)
COMPANY_DIGITARIA_UNIQUE_CODE=Duplicate not allowed
+RemoveSpecialWords=Clean certain words when generating sub-accounts for customers or suppliers
+RemoveSpecialWordsHelp=Specify the words to be cleaned before calculating the customer or supplier account. Use a ";" between each word
GDPRContact=Data Protection Officer (DPO, Data Privacy or GDPR contact)
GDPRContactDesc=If you store personal data in your Information System, you can name the contact who is responsible for the General Data Protection Regulation here
HelpOnTooltip=Help text to show on tooltip
@@ -2333,4 +2335,4 @@ MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT=Show the price on the generated documents f
WarningDisabled=Warning disabled
LimitsAndMitigation=Access limits and mitigation
DesktopsOnly=Desktops only
-DesktopsAndSmartphones=Desktops et smartphones
\ No newline at end of file
+DesktopsAndSmartphones=Desktops et smartphones