forked from Wavyzz/dolibarr
# WARNING: head commit changed in the meantime
Removed uselesss files (replaced by DebugBar)
This commit is contained in:
@@ -443,11 +443,29 @@ 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')
|
||||
{
|
||||
//var_dump($arrayrecord[0]['val']);
|
||||
/*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php';
|
||||
$tmpchartofaccount = new AccountancySystem($this->db);
|
||||
$tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS);
|
||||
var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']);
|
||||
if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val'])
|
||||
{
|
||||
$this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref);
|
||||
$this->errors[$error]['type']='RESTRICTONCURRENCTCHART';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
}*/
|
||||
$param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart.
|
||||
}
|
||||
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.'. ';
|
||||
@@ -459,7 +477,7 @@ class ImportCsv extends ModeleImports
|
||||
{
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
|
||||
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
|
||||
else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile';
|
||||
$this->errors[$error]['type']='FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
|
||||
@@ -470,11 +470,29 @@ 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')
|
||||
{
|
||||
//var_dump($arrayrecord[0]['val']);
|
||||
/*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php';
|
||||
$tmpchartofaccount = new AccountancySystem($this->db);
|
||||
$tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS);
|
||||
var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']);
|
||||
if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val'])
|
||||
{
|
||||
$this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref);
|
||||
$this->errors[$error]['type']='RESTRICTONCURRENCTCHART';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
}*/
|
||||
$param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart.
|
||||
}
|
||||
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.'. ';
|
||||
@@ -486,7 +504,7 @@ class ImportXlsx extends ModeleImports
|
||||
{
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
|
||||
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
|
||||
else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile';
|
||||
$this->errors[$error]['type']='FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
|
||||
@@ -301,11 +301,12 @@ class modAccounting extends DolibarrModules
|
||||
$this->import_tables_array[$r]=array('aa'=>MAIN_DB_PREFIX.'accounting_account');
|
||||
$this->import_tables_creator_array[$r]=array('aa'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r]=array('aa.fk_pcg_version'=>"Chartofaccounts*",'aa.account_number'=>"AccountAccounting*",'aa.label'=>"Label*",'aa.account_parent'=>"Accountparent","aa.fk_accounting_category"=>"AccountingCategory","aa.pcg_type"=>"Pcgtype*",'aa.pcg_subtype'=>'Pcgsubtype*','aa.active'=>'Status*','aa.datec'=>"DateCreation");
|
||||
$this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^\d{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^\d{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
|
||||
$this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^.{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^.{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'),
|
||||
'aa.account_parent'=>array('rule'=>'zeroifnull'),
|
||||
'aa.account_parent'=>array('rule'=>'fetchidfromref','classfile'=>'/accountancy/class/accountingaccount.class.php','class'=>'AccountingAccount','method'=>'fetch','element'=>'AccountingAccount'),
|
||||
'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'),
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28");
|
||||
$this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"ref:7 or id:1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28");
|
||||
$this->import_updatekeys_array[$r]=array('aa.fk_pcg_version'=>'Chartofaccounts','aa.account_number'=>'AccountAccounting');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user