From 9f908971eae3d56a79dae4745111201eb5f37a48 Mon Sep 17 00:00:00 2001 From: loviuz Date: Mon, 10 Jan 2022 13:09:50 +0100 Subject: [PATCH] Fix problema divisione per 0 nel calcolo margine --- src/Common/Document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Common/Document.php b/src/Common/Document.php index d376e1460..ea48a0b00 100755 --- a/src/Common/Document.php +++ b/src/Common/Document.php @@ -226,7 +226,7 @@ abstract class Document extends Model implements ReferenceInterface, DocumentInt */ public function getMarginePercentualeAttribute() { - return $this->imponibile ? (($this->totale_imponibile / $this->spesa) - 1) * 100 : 100; + return ($this->imponibile && $this->spesa) ? (($this->totale_imponibile / $this->spesa) - 1) * 100 : 100; } public function delete()