FIX Accountancy - Clean virtual zero on the import

This commit is contained in:
Alexandre SPANGARO 2021-06-30 04:55:22 +02:00
parent 6f12812329
commit f95b5be971
4 changed files with 20 additions and 6 deletions

View File

@ -624,7 +624,11 @@ class ImportCsv extends ModeleImports
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval);
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') {
$newval = rtrim($newval, "0");
if (empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
$newval = rtrim(trim($newval), "0");
} else {
$newval = trim($newval);
}
}
//print 'Val to use as insert is '.$newval.'<br>';

View File

@ -665,7 +665,11 @@ class ImportXlsx extends ModeleImports
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval);
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') {
$newval = rtrim($newval, "0");
if (empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
$newval = rtrim(trim($newval), "0");
} else {
$newval = trim($newval);
}
}
//print 'Val to use as insert is '.$newval.'<br>';

View File

@ -297,9 +297,9 @@ class modAccounting extends DolibarrModules
);
$this->import_fieldshidden_array[$r] = array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r] = array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_convertvalue_array[$r]=array(
'b.numero_compte'=>array('rule'=>'accountingaccount'),
'b.subledger_account'=>array('rule'=>'accountingaccount')
$this->import_convertvalue_array[$r] = array(
'b.numero_compte' => array('rule' => 'accountingaccount'),
'b.subledger_account' => array('rule' => 'accountingaccount')
);
$this->import_examplevalues_array[$r] = array(
'b.piece_num'=>'123 (!!! use next value not already used)',

View File

@ -572,7 +572,13 @@ class modProduct extends DolibarrModules
'class' => 'CProductNature',
'method' => 'fetch',
'dict' => 'DictionaryProductNature'
),
),
'p.accountancy_code_sell'=>array('rule'=>'accountingaccount'),
'p.accountancy_code_sell_intra'=>array('rule'=>'accountingaccount'),
'p.accountancy_code_sell_export'=>array('rule'=>'accountingaccount'),
'p.accountancy_code_buy'=>array('rule'=>'accountingaccount'),
'p.accountancy_code_buy_intra'=>array('rule'=>'accountingaccount'),
'p.accountancy_code_buy_export'=>array('rule'=>'accountingaccount'),
);
$this->import_regex_array[$r] = array(