From 3cf9ab70d79ebd01b13b6cc0c9366ccb5b8c496a Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Sun, 13 Jun 2010 18:47:13 +0000 Subject: [PATCH] Smaller technical fixes. --- purchasing/includes/db/grn_db.inc | 4 ++-- purchasing/includes/db/po_db.inc | 11 +++++++---- purchasing/po_entry_items.php | 3 +-- purchasing/po_receive_items.php | 2 +- purchasing/supplier_credit.php | 3 +-- purchasing/supplier_invoice.php | 3 +-- sales/includes/db/sales_credit_db.inc | 3 +-- sales/includes/sales_db.inc | 9 +-------- 8 files changed, 15 insertions(+), 23 deletions(-) diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index 51ebcba5..2e705357 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -288,12 +288,12 @@ function read_grn_items_to_order($grn_batch, &$order) $units = $myrow["units"]; } - $order->add_to_order($order->lines_on_order+1, $myrow["item_code"], + $order->add_to_order($order->lines_on_order, $myrow["item_code"], 1,$myrow["description"], $myrow["unit_price"],$units, sql2date($myrow["delivery_date"]), $myrow["quantity_inv"], $myrow["qty_recd"]); - $order->line_items[$order->lines_on_order]->po_detail_rec = $myrow["po_detail_item"]; + $order->line_items[$order->lines_on_order-1]->po_detail_rec = $myrow["po_detail_item"]; } /* line po from purchase order details */ } //end of checks on returned data set } diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index a9cb9327..d401f5e6 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -103,7 +103,7 @@ function update_po(&$po_obj) // add_comments(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments); - add_audit_trail($po_obj->trans_type, $po_obj->order_no, $po_obj->document_date, _("Updated.")); + add_audit_trail($po_obj->trans_type, $po_obj->order_no, Today(), _("Updated.")); commit_transaction(); return $po_obj->order_no; @@ -186,12 +186,15 @@ function read_po_items($order_no, &$order, $open_items_only=false) $units = $myrow["units"]; } - if ($order->add_to_order($order->lines_on_order+1, $myrow["item_code"], + if ($order->add_to_order($order->lines_on_order, $myrow["item_code"], $myrow["quantity_ordered"],$myrow["description"], $myrow["unit_price"],$units, sql2date($myrow["delivery_date"]), $myrow["qty_invoiced"], $myrow["quantity_received"])) { - $order->line_items[$order->lines_on_order]->po_detail_rec = $myrow["po_detail_item"]; - $order->line_items[$order->lines_on_order]->standard_cost = $myrow["std_cost_unit"]; /*Needed for receiving goods and GL interface */ + $newline = &$order->line_items[$order->lines_on_order-1]; + $newline->po_detail_rec = $myrow["po_detail_item"]; + $newline->standard_cost = $myrow["std_cost_unit"]; /*Needed for receiving goods and GL interface */ + // set for later GRN edition +// $newline->receive_qty = $newline->quantity - $newline->qty_dispatched; } } /* line po from purchase order details */ } //end of checks on returned data set diff --git a/purchasing/po_entry_items.php b/purchasing/po_entry_items.php index 83923ccb..756add4d 100644 --- a/purchasing/po_entry_items.php +++ b/purchasing/po_entry_items.php @@ -413,8 +413,7 @@ function handle_commit_order() meta_forward($_SERVER['PHP_SELF'], "AddedGRN=$grn_no"); } // Direct Purchase Invoice - $inv = new supp_trans; - $inv->is_invoice = true; + $inv = new supp_trans(ST_SUPPINVOICE); $inv->Comments = $cart->Comments; $inv->supplier_id = $cart->supplier_id; $inv->tran_date = $cart->orig_order_date; diff --git a/purchasing/po_receive_items.php b/purchasing/po_receive_items.php index 90a9ffe5..b536ba82 100644 --- a/purchasing/po_receive_items.php +++ b/purchasing/po_receive_items.php @@ -120,7 +120,7 @@ function check_po_changed() // Otherwise if you try to fullfill item quantities separately will give error. $result = get_po_items($_SESSION['PO']->order_no); - $line_no = 1; + $line_no = 0; while ($myrow = db_fetch($result)) { $ln_item = $_SESSION['PO']->line_items[$line_no]; diff --git a/purchasing/supplier_credit.php b/purchasing/supplier_credit.php index 9b62ec4d..bd480710 100644 --- a/purchasing/supplier_credit.php +++ b/purchasing/supplier_credit.php @@ -62,8 +62,7 @@ if (isset($_GET['New'])) unset ($_SESSION['supp_trans']); } - $_SESSION['supp_trans'] = new supp_trans; - $_SESSION['supp_trans']->is_invoice = false; + $_SESSION['supp_trans'] = new supp_trans(ST_SUPPCREDIT); if (isset($_GET['invoice_no'])) { $_SESSION['supp_trans']->supp_reference = $_POST['invoice_no'] = $_GET['invoice_no']; diff --git a/purchasing/supplier_invoice.php b/purchasing/supplier_invoice.php index ce561487..48b79d69 100644 --- a/purchasing/supplier_invoice.php +++ b/purchasing/supplier_invoice.php @@ -65,8 +65,7 @@ if (isset($_GET['New'])) unset ($_SESSION['supp_trans']); } - $_SESSION['supp_trans'] = new supp_trans; - $_SESSION['supp_trans']->is_invoice = true; + $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE); } //-------------------------------------------------------------------------------------------------- diff --git a/sales/includes/db/sales_credit_db.inc b/sales/includes/db/sales_credit_db.inc index 1018f28a..40e67191 100644 --- a/sales/includes/db/sales_credit_db.inc +++ b/sales/includes/db/sales_credit_db.inc @@ -13,7 +13,7 @@ // if ($writeoff_acc==0) return goods into $cart->Location // if src_docs!=0 => credit invoice else credit note // -function write_credit_note($credit_note, $write_off_acc) +function write_credit_note(&$credit_note, $write_off_acc) { global $Refs; @@ -176,7 +176,6 @@ function write_credit_note($credit_note, $write_off_acc) if ($trans_no == 0) { $Refs->save(ST_CUSTCREDIT, $credit_no, $credit_note->reference); } - commit_transaction(); return $credit_no; diff --git a/sales/includes/sales_db.inc b/sales/includes/sales_db.inc index 3638ae0f..0503abd3 100644 --- a/sales/includes/sales_db.inc +++ b/sales/includes/sales_db.inc @@ -238,13 +238,6 @@ function set_document_parent($cart) return 0; // batch or complete invoice } -//-------------------------------------------------------------------------------------------------- -function get_parent_type($type) -{ - $parent_types = array( ST_CUSTCREDIT => ST_SALESINVOICE, ST_SALESINVOICE => ST_CUSTDELIVERY, ST_CUSTDELIVERY => ST_SALESORDER ); - return isset($parent_types[$type]) ? $parent_types[$type] : 0; -} - //-------------------------------------------------------------------------------------------------- function update_parent_line($doc_type, $line_id, $qty_dispatched, $auto=false) { @@ -317,7 +310,7 @@ function read_sales_trans($doc_type, $trans_no, &$cart) $myrow["curr_code"], $myrow["discount"], $myrow["payment_terms"]); $cart->set_branch($myrow["branch_code"], $myrow["tax_group_id"], - $myrow["tax_group_name"], $myrow["phone"], $myrow["email"]); + $myrow["tax_group_name"]); $cart->reference = $myrow["reference"]; $cart->order_no = $myrow["order_"]; -- 2.30.2