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') { } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval); $newval = price2num($newval);
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') { } 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>'; //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') { } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval); $newval = price2num($newval);
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') { } 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>'; //print 'Val to use as insert is '.$newval.'<br>';

View File

@ -573,6 +573,12 @@ class modProduct extends DolibarrModules
'method' => 'fetch', 'method' => 'fetch',
'dict' => 'DictionaryProductNature' '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( $this->import_regex_array[$r] = array(