4863: Dimension not defaulted on po entry, po modify. @Braath Waate and @joe fixed
[fa-stable.git] / purchasing / includes / db / grn_db.inc
index d5efafdb21ca86d2fc6157cfa57af0830d908682..065b2c7d04fa0162df19529e402d9282c09d5fa4 100644 (file)
@@ -141,15 +141,15 @@ function add_grn(&$po)
                        $po->line_items[$line_no]->grn_item_id = $grn_item;
                        /* Update location stock records - NB  a po cannot be entered for a service/kit parts done automatically */
                        add_stock_move(ST_SUPPRECEIVE, $order_line->stock_id, $grn, $po->Location, $date_, "",
-                               $order_line->receive_qty, $order_line->standard_cost,           
-                               $po->supplier_id, 1, $order_line->taxfree_charge_value($po)/$order_line->receive_qty);
+                               $order_line->receive_qty, $order_line->standard_cost, $order_line->taxfree_charge_value($po)/$order_line->receive_qty);         
 
                } /*quantity received is != 0 */
        } /*end of order_line loop */
 
        if ($clearing_act && $total != 0.0) {
+               $accs = get_supplier_accounts($po->supplier_id);
                $total += add_gl_trans_supplier(ST_SUPPRECEIVE, $grn, $date_, $clearing_act,
-                       0, 0, -$total, null);
+                       $accs['dimension_id'], $accs['dimension2_id'], -$total, null);
        }
        $Refs->save(ST_SUPPRECEIVE, $grn, $po->reference);