From 97ebf7867bd59cbd742a5ee3a7a341292bc7633b Mon Sep 17 00:00:00 2001 From: valentina <pek5892@gmail.com> Date: Thu, 26 Sep 2024 16:38:19 +0200 Subject: [PATCH] Fix fatture scadute --- modules/fatture/actions.php | 8 ++++---- modules/fatture/src/Fattura.php | 2 +- src/Traits/ReferenceTrait.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/fatture/actions.php b/modules/fatture/actions.php index bdfe6bde3..c7938ca66 100755 --- a/modules/fatture/actions.php +++ b/modules/fatture/actions.php @@ -315,7 +315,7 @@ switch ($op) { // Elenco fatture in stato Bozza per il cliente case 'fatture_bozza': $id_anagrafica = post('id_anagrafica'); - $stato = Stato::where('name', 'Bozza')->first()->id; + $stato = Stato::where('name', 'Bozza')->first(); $fatture = Fattura::vendita() ->where('idanagrafica', $id_anagrafica) @@ -334,12 +334,12 @@ switch ($op) { // Elenco fatture Scadute per il cliente case 'fatture_scadute': $id_anagrafica = post('id_anagrafica'); - $stato1 = Stato::where('name', 'Emessa')->first()->id; - $stato2 = Stato::where('name', 'Parzialmente pagato')->first()->id; + $stato1 = Stato::where('name', 'Emessa')->first(); + $stato2 = Stato::where('name', 'Parzialmente pagato')->first(); $fatture = Fattura::vendita() ->select('*', 'co_documenti.id AS id', 'co_documenti.data AS data') - ->where('co_documenti.idanagrafica', $id_anagrafica) + ->where('co_documenti.idanagrafica', "=", $id_anagrafica) ->whereIn('idstatodocumento', [$stato1->id, $stato2->id]) ->join('co_scadenziario', 'co_documenti.id', '=', 'co_scadenziario.iddocumento') ->join('co_tipidocumento', 'co_tipidocumento.id', '=', 'co_documenti.idtipodocumento') diff --git a/modules/fatture/src/Fattura.php b/modules/fatture/src/Fattura.php index 1176ef2dc..7cb82e6e5 100755 --- a/modules/fatture/src/Fattura.php +++ b/modules/fatture/src/Fattura.php @@ -895,7 +895,7 @@ class Fattura extends Document public function getReferenceName() { - return $this->tipo->getTranslation('title'); + return $this->tipo; } public function getReferenceNumber() diff --git a/src/Traits/ReferenceTrait.php b/src/Traits/ReferenceTrait.php index a0261fd4b..ed201db75 100755 --- a/src/Traits/ReferenceTrait.php +++ b/src/Traits/ReferenceTrait.php @@ -32,7 +32,7 @@ trait ReferenceTrait public function getReference($show_ragione_sociale = null) { // Informazioni disponibili - $name = $this->getReferenceName(); + $name = $this->getReferenceName()->name ?? $this->getReferenceName(); $number = $this->getReferenceNumber(); $date = $this->getReferenceDate();