Skip to content

Commit

Permalink
FIX Fatal Error PHP 8 : division by 0 (#25384)
Browse files Browse the repository at this point in the history
* FIX Fatal Error PHP 8 : division by 0

* Update objectline_view.tpl.php

---------

Co-authored-by: atm-lena <lena.papazian@atm-consulting.fr>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
  • Loading branch information
3 people authored Jul 28, 2023
1 parent e4cc073 commit 5997ae4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions htdocs/bom/tpl/objectline_view.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,11 @@
$resql_supplier_price = $object->db->query($sql_supplier_price);
if ($resql_supplier_price) {
$obj = $object->db->fetch_object($resql_supplier_price);
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;

if (!empty($obj->qty) && !empty($sub_bom_line->qty) && !empty($line->qty)) {
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
} else {
$line_cost = $obj->min_price;
}
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price2num($line_cost, 'MT').'</span></td>';
$total_cost+= $line_cost;
}
Expand Down

0 comments on commit 5997ae4

Please sign in to comment.