Rimozione errore in caso di importazione FE per nuova anagrafica

This commit is contained in:
Dasc3er 2021-03-04 14:01:14 +01:00
parent 1e1bc85290
commit ed5a3d4618
1 changed files with 8 additions and 0 deletions

View File

@ -192,6 +192,7 @@ switch (filter('op')) {
break;
case 'compile':
// Gestione del caso di anagrafica inesistente
if (empty($anagrafica)) {
echo json_encode([]);
@ -211,6 +212,13 @@ switch (filter('op')) {
}
$righe = $righe->flatten();
// Gestione del caso di anagrafica senza fatture o con fatture senza righe
if ($fatture->isEmpty() || $righe->isEmpty()) {
echo json_encode([]);
return;
}
// Ricerca del tipo di documento più utilizzato
$tipi = $fatture->groupBy(function ($item, $key) {
return $item->tipo->id;