|
@@ -1539,6 +1539,18 @@ if ($resql) {
|
|
|
$totalarray['val'] = array();
|
|
|
$totalarray['val']['f.total_ht'] = 0;
|
|
|
$totalarray['val']['f.total_ttc'] = 0;
|
|
|
+
|
|
|
+ $with_margin_info = false;
|
|
|
+ if (!empty($conf->margin->enabled) && (
|
|
|
+ !empty($arrayfields['total_pa']['checked'])
|
|
|
+ || !empty($arrayfields['total_margin']['checked'])
|
|
|
+ || !empty($arrayfields['total_margin_rate']['checked'])
|
|
|
+ || !empty($arrayfields['total_mark_rate']['checked'])
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ $with_margin_info = true;
|
|
|
+ }
|
|
|
+
|
|
|
while ($i < min($num, $limit)) {
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
|
@@ -1624,7 +1636,7 @@ if ($resql) {
|
|
|
$facturestatic->alreadypaid = $paiement;
|
|
|
|
|
|
$marginInfo = array();
|
|
|
- if (!empty($conf->margin->enabled)) {
|
|
|
+ if ($with_margin_info === true) {
|
|
|
$facturestatic->fetch_lines();
|
|
|
$marginInfo = $formmargin->getMarginInfosArray($facturestatic);
|
|
|
}
|