mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4b3655b287
@ -82,7 +82,7 @@ class CSV extends CSVImporter
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'field' => 'categoria',
|
'field' => 'id_categoria',
|
||||||
'label' => 'Categoria',
|
'label' => 'Categoria',
|
||||||
'names' => [
|
'names' => [
|
||||||
'Categoria',
|
'Categoria',
|
||||||
@ -91,7 +91,7 @@ class CSV extends CSVImporter
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'field' => 'sottocategoria',
|
'field' => 'id_sottocategoria',
|
||||||
'label' => 'Sottocategoria',
|
'label' => 'Sottocategoria',
|
||||||
'names' => [
|
'names' => [
|
||||||
'Sottocategoria',
|
'Sottocategoria',
|
||||||
@ -147,29 +147,29 @@ class CSV extends CSVImporter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gestione categoria e sottocategoria
|
// Gestione categoria e sottocategoria
|
||||||
if (!empty($record['categoria'])) {
|
if (!empty($record['id_categoria'])) {
|
||||||
// Categoria
|
// Categoria
|
||||||
$categoria = Categoria::where('nome', $record['categoria'])->first();
|
$categoria = Categoria::where('nome', $record['id_categoria'])->first();
|
||||||
if (empty($categoria)) {
|
if (empty($categoria)) {
|
||||||
$categoria = Categoria::build($record['categoria']);
|
$categoria = Categoria::build($record['id_categoria']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sotto-categoria
|
// Sotto-categoria
|
||||||
$sottocategoria = null;
|
$sottocategoria = null;
|
||||||
if (!empty($record['sottocategoria'])) {
|
if (!empty($record['id_sottocategoria'])) {
|
||||||
$sottocategoria = Categoria::where('nome', $record['sottocategoria'])
|
$sottocategoria = Categoria::where('nome', $record['id_sottocategoria'])
|
||||||
->where('parent', $categoria->id)
|
->where('parent', $categoria->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (empty($sottocategoria)) {
|
if (empty($sottocategoria)) {
|
||||||
$sottocategoria = Categoria::build($record['categoria']);
|
$sottocategoria = Categoria::build($record['id_categoria']);
|
||||||
$sottocategoria->parent()->associate($categoria);
|
$sottocategoria->parent()->associate($categoria);
|
||||||
$sottocategoria->save();
|
$sottocategoria->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($record['categoria']);
|
unset($record['id_categoria']);
|
||||||
unset($record['sottocategoria']);
|
unset($record['id_sottocategoria']);
|
||||||
|
|
||||||
// Individuazione dell'IVA di vendita tramite il relativo Codice
|
// Individuazione dell'IVA di vendita tramite il relativo Codice
|
||||||
$aliquota = null;
|
$aliquota = null;
|
||||||
@ -191,6 +191,10 @@ class CSV extends CSVImporter
|
|||||||
$qta = $record['qta'];
|
$qta = $record['qta'];
|
||||||
unset($record['qta']);
|
unset($record['qta']);
|
||||||
|
|
||||||
|
//Prezzo di vendita
|
||||||
|
$articolo->setPrezzoVendita($record['prezzo_vendita'], ($aliquota->id ? $aliquota->id : setting('Iva predefinita')));
|
||||||
|
unset($record['prezzo_vendita']);
|
||||||
|
|
||||||
// Salvataggio delle informazioni generali
|
// Salvataggio delle informazioni generali
|
||||||
$articolo->fill($record);
|
$articolo->fill($record);
|
||||||
$articolo->save();
|
$articolo->save();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user