Fix import

This commit is contained in:
Luca 2021-02-26 13:23:06 +01:00
parent 522043b7b0
commit 91aec2d651
2 changed files with 5 additions and 6 deletions

View File

@ -37,16 +37,15 @@ class CSV extends CSVImporter
'label' => 'Codice',
'primary_key' => true,
'names' => [
'Codice',
'Codice interno',
'Numero',
'Codice',
],
],
[
'field' => 'ragione_sociale',
'label' => 'Ragione sociale',
'names' => [
'Nome',
'Denominazione',
'Ragione sociale',
],

View File

@ -40,12 +40,12 @@ if (empty($id_record)) {
$campi_disponibili = [];
foreach ($fields as $key => $value) {
$campi_disponibili[] = [
'id' => $key,
'id' => $key+1,
'text' => $value['label'],
];
if ($value['primary_key']) {
$primary_key = $value['field'];
$primary_key = $key+1;
}
}
@ -100,8 +100,8 @@ if (empty($id_record)) {
$nome = trim(string_lowercase($prima_riga[$column]));
if (in_array($nome, $nomi_disponibili[$key])) {
$escludi_prima_riga = 1;
$selezionato = $key;
break;
$selezionato = $key+1;
break;
}
}