mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
FIX: Change $key into $tmpkey
This commit is contained in:
parent
b7419ff73f
commit
5d165fb726
|
|
@ -778,26 +778,26 @@ class ImportCsv extends ModeleImports
|
|||
// Previously we processed the ->import_fields_array.
|
||||
if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) {
|
||||
// Loop on each hidden fields to add them into listfields/listvalues
|
||||
foreach ($objimport->array_import_fieldshidden[0] as $key => $val) {
|
||||
if (!preg_match('/^'.preg_quote($alias, '/').'\./', $key)) {
|
||||
foreach ($objimport->array_import_fieldshidden[0] as $tmpkey => $tmpval) {
|
||||
if (!preg_match('/^'.preg_quote($alias, '/').'\./', $tmpkey)) {
|
||||
continue; // Not a field of current table
|
||||
}
|
||||
if ($val == 'user->id') {
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
if ($tmpval == 'user->id') {
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $tmpkey);
|
||||
$listvalues[] = ((int) $user->id);
|
||||
} elseif (preg_match('/^lastrowid-/', $val)) {
|
||||
$tmp = explode('-', $val);
|
||||
} elseif (preg_match('/^lastrowid-/', $tmpval)) {
|
||||
$tmp = explode('-', $tmpval);
|
||||
$lastinsertid = (isset($last_insert_id_array[$tmp[1]])) ? $last_insert_id_array[$tmp[1]] : 0;
|
||||
$keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
$keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $tmpkey);
|
||||
$listfields[] = $keyfield;
|
||||
$listvalues[] = $lastinsertid;
|
||||
//print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit;
|
||||
} elseif (preg_match('/^const-/', $val)) {
|
||||
$tmp = explode('-', $val, 2);
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
//print $tmpkey."-".$tmpval."-".$listfields."-".$listvalues."<br>";exit;
|
||||
} elseif (preg_match('/^const-/', $tmpval)) {
|
||||
$tmp = explode('-', $tmpval, 2);
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $tmpkey);
|
||||
$listvalues[] = "'".$this->db->escape($tmp[1])."'";
|
||||
} elseif (preg_match('/^rule-/', $val)) {
|
||||
$fieldname = $key;
|
||||
} elseif (preg_match('/^rule-/', $tmpval)) {
|
||||
$fieldname = $tmpkey;
|
||||
if (!empty($objimport->array_import_convertvalue[0][$fieldname])) {
|
||||
if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') {
|
||||
$file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']);
|
||||
|
|
@ -809,7 +809,7 @@ class ImportCsv extends ModeleImports
|
|||
break;
|
||||
}
|
||||
$classinstance = new $class($this->db);
|
||||
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $listfields, $key));
|
||||
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $listfields, ($key - 1)));
|
||||
$fieldArr = explode('.', $fieldname);
|
||||
if (count($fieldArr) > 0) {
|
||||
$fieldname = $fieldArr[1];
|
||||
|
|
@ -819,7 +819,7 @@ class ImportCsv extends ModeleImports
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden';
|
||||
$this->errors[$error]['lib'] = 'Bad value of profile setup '.$tmpval.' for array_import_fieldshidden';
|
||||
$this->errors[$error]['type'] = 'Import profile setup';
|
||||
$error++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user