NEW Accountancy - Add a way to clean some words when you generate thirdparty accounting account
This commit is contained in:
parent
194df584b9
commit
b9423bb532
@ -102,7 +102,8 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
|
||||
$texte .= '<input type="hidden" name="param2" value="COMPANY_DIGITARIA_MASK_CUSTOMER">';
|
||||
$texte .= '<input type="hidden" name="param3" value="COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER">';
|
||||
$texte .= '<input type="hidden" name="param4" value="COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
$texte .= '<input type="hidden" name="param5" value="COMPANY_DIGITARIA_CLEAN_WORDS">';
|
||||
$texte .= '<table class="nobordernopadding centpercent">';
|
||||
$s1 = $form->textwithpicto('<input type="text" class="flat" size="4" name="value1" value="'.$conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER.'">', $tooltip, 1, 1);
|
||||
$s2 = $form->textwithpicto('<input type="text" class="flat" size="4" name="value2" value="'.$conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER.'">', $tooltip, 1, 1);
|
||||
$s3 = $form->textwithpicto('<input type="text" class="flat" size="2" name="value3" value="'.$conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER.'">', $tooltip, 1, 1);
|
||||
@ -127,7 +128,23 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
|
||||
}
|
||||
$texte .= '</td>';
|
||||
$texte .= '<td class="right"><input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'"></td>';
|
||||
$texte .= '</tr>';
|
||||
|
||||
$texte .= '<tr><td>';
|
||||
$texte .= "<br>\n";
|
||||
|
||||
$texthelp = $langs->trans("RemoveSpecialWordsHelp");
|
||||
$texttitle = $langs->trans("RemoveSpecialWords");
|
||||
|
||||
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
|
||||
$texte .= "<br>\n";
|
||||
$texte .= '<textarea class="flat" cols="60" name="value5">';
|
||||
if (!empty($conf->global->COMPANY_DIGITARIA_CLEAN_WORDS)) {
|
||||
$texte .= $conf->global->COMPANY_DIGITARIA_CLEAN_WORDS;
|
||||
}
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</tr></table>';
|
||||
|
||||
$texte .= '</form>';
|
||||
|
||||
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) {
|
||||
|
||||
@ -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
|
||||
DesktopsAndSmartphones=Desktops et smartphones
|
||||
|
||||
Loading…
Reference in New Issue
Block a user