If setting the delivered items in PO Receive Items to 0 the value is not updated
[fa-stable.git] / purchasing / includes / purchasing_db.inc
index da038358b1faf5fb95d3cf13e42f1745a6112f88..dc9ceccd20293ae65ef70634d37428d1daf61ee3 100644 (file)
@@ -32,12 +32,12 @@ include_once($path_to_root . "/purchasing/includes/db/suppliers_db.inc");
 // $amount is in SUPPLIERS'S currency
 
 function add_gl_trans_supplier($type, $type_no, $date_, $account, $dimension, $dimension2,  
-       $amount, $supplier_id, $err_msg="", $rate=0)
+       $amount, $supplier_id, $err_msg="", $rate=0, $memo="")
 {
        if ($err_msg == "")
                $err_msg = "The supplier GL transaction could not be inserted"; 
                
-       return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, ""
+       return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, $memo
                $amount, get_supplier_currency($supplier_id), 
                payment_person_types::supplier(), $supplier_id, $err_msg, $rate);
 }
@@ -98,7 +98,7 @@ function add_or_update_purchase_data($supplier_id, $stock_id, $price, $descripti
        {
                $sql = "INSERT INTO ".TB_PREF."purch_data (supplier_id, stock_id, price, suppliers_uom,
                        conversion_factor, supplier_description) VALUES ('$supplier_id', '$stock_id', 
-                       $price, '$uom', 1, '$description')";
+                       $price, '$uom', 1, ".db_escape($description).")";
                db_query($sql,"The supplier purchasing details could not be added");
                return;
        }       
@@ -107,7 +107,7 @@ function add_or_update_purchase_data($supplier_id, $stock_id, $price, $descripti
        if ($uom != "")
                $sql .= ",suppliers_uom='$uom'";
        if ($description != "") 
-               $sql .= ",supplier_description='$description'";
+               $sql .= ",supplier_description=".db_escape($description);
        $sql .= " WHERE stock_id='$stock_id' AND supplier_id='$supplier_id'";
        db_query($sql,"The supplier purchasing details could not be updated");
        return true;