Fix import of accounting account from ref in import profiles

This commit is contained in:
Laurent Destailleur 2019-05-24 17:09:18 +02:00
parent 63824861a6
commit 49991eabf8
2 changed files with 10 additions and 4 deletions

View File

@ -443,11 +443,14 @@ class ImportCsv extends ModeleImports
}
$classinstance=new $class($this->db);
// Try the fetch from code or ref
call_user_func_array(array($classinstance, $method),array('', $newval));
$param_array = array('', $newval);
if ($class == 'AccountingAccount') $param_array = array('', $newval, 1);
call_user_func_array(array($classinstance, $method), $param_array);
// If not found, try the fetch from label
if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel')
{
call_user_func_array(array($classinstance, $method),array('', '', $newval));
$param_array = array('', '', $newval);
call_user_func_array(array($classinstance, $method), $param_array);
}
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id;
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';

View File

@ -470,11 +470,14 @@ class ImportXlsx extends ModeleImports
}
$classinstance=new $class($this->db);
// Try the fetch from code or ref
call_user_func_array(array($classinstance, $method),array('', $newval));
$param_array = array('', $newval);
if ($class == 'AccountingAccount') $param_array = array('', $newval, 1);
call_user_func_array(array($classinstance, $method), $param_array);
// If not found, try the fetch from label
if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel')
{
call_user_func_array(array($classinstance, $method),array('', '', $newval));
$param_array = array('', '', $newval);
call_user_func_array(array($classinstance, $method), $param_array);
}
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id;
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';