Bugfix [0000080] - BOM line was not editable.
[fa-stable.git] / sales / includes / sales_db.inc
index f1892e32155a47d0ef8ecb5eff3903fe55100b41..1f5e0f31f7dc93c7e1c126b517566ddcd5769bd4 100644 (file)
@@ -35,14 +35,14 @@ function add_stock_move_customer($type, $stock_id, $trans_id, $location, $date_,
 // $amount is in CUSTOMER'S currency
 
 function add_gl_trans_customer($type, $type_no, $date_, $account, $dimension, $dimension2,
-       $amount, $customer_id, $err_msg="")
+       $amount, $customer_id, $err_msg="", $rate=0)
 {
        if ($err_msg == "")
                $err_msg = "The customer GL transaction could not be inserted";
 
        return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, "", $amount,
                get_customer_currency($customer_id),
-               payment_person_types::customer(), $customer_id, $err_msg);
+               payment_person_types::customer(), $customer_id, $err_msg, $rate);
 }
 
 //----------------------------------------------------------------------------------------
@@ -54,7 +54,7 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu
 
        if ($factor === null) 
        {
-               $myrow = get_sales_type(get_post('sales_type_id'));
+               $myrow = get_sales_type($sales_type_id);
                $factor = $myrow['factor'];
        }
            
@@ -125,7 +125,7 @@ function set_document_parent($cart)
        if (count($cart->src_docs) == 1) {
 
        // if this child document has only one parent - update child link
-       $del_no = reset($cart->src_docs);
+       $del_no = reset(array_keys($cart->src_docs));
 
        $sql = 'UPDATE '.TB_PREF.'debtor_trans SET trans_link = ' . $del_no .
                ' WHERE type='.$cart->trans_type.' AND trans_no='. $inv_no ;