|
@@ -782,26 +782,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']);
|
|
@@ -823,7 +823,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++;
|
|
|
}
|