Bugfix minore FE

This commit is contained in:
Thomas Zilio 2019-02-21 11:51:03 +01:00
parent e78c6fc185
commit 9ff4107d57
3 changed files with 12 additions and 9 deletions

View File

@ -28,7 +28,7 @@ switch (filter('op')) {
$result = Interaction::sendXML($id_record);
// Aggiornamento dello stato
if ($result) {
if ($result['code'] == 200) {
database()->update('co_documenti', [
'codice_stato_fe' => 'WAIT',
'data_stato_fe' => date('Y-m-d H:i:s'),

View File

@ -25,11 +25,12 @@ $iva = $database->fetchOne('SELECT * FROM `co_iva` WHERE `id` IN (SELECT idiva F
$fields = [
'codice_natura_fe' => 'Natura IVA',
];
$missing = [];
foreach ($fields as $key => $name) {
if (empty($iva[$key])) {
$missing[] = $name;
if (!empty($iva)) {
$missing = [];
foreach ($fields as $key => $name) {
if (empty($iva[$key])) {
$missing[] = $name;
}
}
}

View File

@ -899,7 +899,9 @@ class FatturaElettronica
$result = [];
// Righe del documento
$iva_descrizioni = $righe->first()->aliquota;
$iva_descrizioni = $righe->first(function ($item, $key) {
return $item->aliquota != null;
})->aliquota;
foreach ($righe as $numero => $riga) {
$dettaglio = [
'NumeroLinea' => $numero + 1,
@ -1004,7 +1006,7 @@ class FatturaElettronica
// Riepiloghi per IVA per percentuale
$riepiloghi_percentuale = $righe->filter(function ($item, $key) {
return $item->aliquota->codice_natura_fe == null;
return $item->aliquota != null && $item->aliquota->codice_natura_fe == null;
})->groupBy(function ($item, $key) {
return $item->aliquota->percentuale;
});
@ -1040,7 +1042,7 @@ class FatturaElettronica
// Riepiloghi per IVA per natura
$riepiloghi_natura = $righe->filter(function ($item, $key) {
return $item->aliquota->codice_natura_fe != null;
return $item->aliquota != null && $item->aliquota->codice_natura_fe != null;
})->groupBy(function ($item, $key) {
return $item->aliquota->codice_natura_fe;
});