Compare commits

...

2 Commits

Author SHA1 Message Date
valentina 632b801d29 Fix import 2024-07-18 18:21:22 +02:00
valentina b716ef8fc6 RImozione script di ricalcolo completo dello scadenzario 2024-07-18 12:52:50 +02:00
5 changed files with 7 additions and 17 deletions

View File

@ -296,7 +296,7 @@ class CSV extends CSVImporter
$database->insert('an_settori_lang', [
'id_lang' => \Models\Locale::getDefault()->id,
'id_record' => $id_settore,
'name' => $settore,
'title' => $settore,
])['id'];
}
unset($record['id_settore']);

View File

@ -277,7 +277,7 @@ class CSV extends CSVImporter
$sottocategoria = null;
if (!empty($record['categoria'])) {
// Categoria
$categoria = Categoria::where('id', '=', (new Categoria())->getByField('title', strtolower((string) $record['categoria'])))->orWhere('name', strtolower((string) $record['categoria']))->first();
$categoria = Categoria::where('id', '=', (new Categoria())->getByField('title', strtolower((string) $record['categoria'])))->first();
if (empty($categoria)) {
$categoria = Categoria::build();
@ -287,7 +287,7 @@ class CSV extends CSVImporter
// Sotto-categoria
if (!empty($record['sottocategoria'])) {
$sottocategoria = Categoria::where('id', '=', (new Categoria())->getByField('title', strtolower((string) $record['sottocategoria'])))->orWhere('name', strtolower((string) $record['sottocategoria']))->first();
$sottocategoria = Categoria::where('id', '=', (new Categoria())->getByField('title', strtolower((string) $record['sottocategoria'])))->first();
if (empty($sottocategoria)) {
$sottocategoria = Categoria::build();

View File

@ -115,7 +115,7 @@ class CSV extends CSVImporter
$sottocategoria = null;
if (!empty($record['categoria'])) {
// Categoria
$categoria = Categoria::where('id', '=', (new Categoria())->getByField('title', strtolower((string) $record['categoria'])))->orWhere('name', strtolower((string) $record['categoria']))->get()->id;
$categoria = Categoria::where('id', '=', (new Categoria())->getByField('title', strtolower((string) $record['categoria'])))->first();
if (empty($categoria)) {
$categoria = Categoria::build();
@ -125,7 +125,7 @@ class CSV extends CSVImporter
// Sotto-categoria
if (!empty($record['sottocategoria'])) {
$sottocategoria = Categoria::where('id', '=', (new Categoria())->getByField('title', strtolower((string) $record['sottocategoria'])))->orWhere('name', strtolower((string) $record['sottocategoria']))->get()->id;
$sottocategoria = Categoria::where('id', '=', (new Categoria())->getByField('title', strtolower((string) $record['sottocategoria'])))->first();
if (empty($sottocategoria)) {
$sottocategoria = Categoria::build();
$sottocategoria->setTranslation('title', $record['sottocategoria']);
@ -168,7 +168,7 @@ class CSV extends CSVImporter
$impianto->idanagrafica = $anagrafica->idanagrafica;
$impianto->id_marca = $id_marca;
$impianto->modello = $record['modello'];
$impianto->id_modello = $record['modello'];
$impianto->save();
if (!empty($record['sede'])) {

View File

@ -126,7 +126,7 @@ class CSV extends CSVImporter
if (empty($record['stato'])) {
$stato = Stato::where('name', 'Completato')->first();
} else {
$stato = Stato::where('name', $record['stato'])->first()->id;
$stato = Stato::where('name', $record['stato'])->first();
}
unset($record['stato']);

View File

@ -1,10 +0,0 @@
<?php
include_once __DIR__.'/core.php';
use Modules\PrimaNota\Mastrino;
$mastrini = Mastrino::where('primanota', 1)->where('id_scadenza', '!=', null)->where('iddocumento', '!=', null)->groupBy('idmastrino')->get();
foreach ($mastrini as $mastrino) {
$mastrino->aggiornaScadenzario();
}