Mysqli errors: Trying to access array offset on value of type bool. Fixed. Please...
[fa-stable.git] / sales / includes / db / sales_delivery_db.inc
index 9f0ecbca9c11675234348171c88d3e9a336b5d6b..ebb04860299d45042031b5e2ba1eee61f06efe8e 100644 (file)
@@ -210,7 +210,7 @@ function adjust_shipping_charge(&$delivery, $trans_no)
        $sql = "SELECT sum(ov_freight) as freight FROM ".TB_PREF."debtor_trans WHERE order_ = $trans_no AND type = " . ST_CUSTDELIVERY . " AND debtor_no = " . $delivery->customer_id;
        $result = db_query($sql, "Can not find delivery notes");
        $row = db_fetch_row($result);
-       if (!$row[0]) $freight = 0;
+       if (!is_array($row)) $freight = 0;
        else $freight = $row[0];
        if ($freight < $delivery->freight_cost) $delivery->freight_cost = $delivery->freight_cost - $freight;
        else $delivery->freight_cost = 0;