1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-05 10:17:30 +01:00

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', 'label' => 'Codice',
'primary_key' => true, 'primary_key' => true,
'names' => [ 'names' => [
'Codice',
'Codice interno', 'Codice interno',
'Numero', 'Numero',
'Codice',
], ],
], ],
[ [
'field' => 'ragione_sociale', 'field' => 'ragione_sociale',
'label' => 'Ragione sociale', 'label' => 'Ragione sociale',
'names' => [ 'names' => [
'Nome',
'Denominazione', 'Denominazione',
'Ragione sociale', 'Ragione sociale',
], ],

View File

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