From c8dfc3d9fc85515de1b40105f0fef6180a97681c Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Tue, 24 Dec 2019 16:09:29 +0100 Subject: [PATCH] FIX: error 500 when getting margin info for objects other than invoices --- htdocs/core/class/html.formmargin.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 6b7ba7348ff..8485afecec9 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -98,7 +98,7 @@ class FormMargin $pv = $line->total_ht; $pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign - if ($object->type == Facture::TYPE_SITUATION) { + if ($object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) { $pa = $line->qty * $pa_ht * ($line->situation_percent / 100); } else { $pa = $line->qty * $pa_ht;