From: Janusz Dobrowolski Date: Wed, 3 Jul 2019 11:19:09 +0000 (+0200) Subject: Changed naming convention in purchase order class (orig_order_date ->tran_date) X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=71d682a4c6063256396a3d8fe15f0c534b4cf46f Changed naming convention in purchase order class (orig_order_date ->tran_date) --- diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index 740ef18c..e66c0910 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -85,7 +85,7 @@ function write_grn(&$po) { global $Refs; - $date_ = $po->orig_order_date; + $date_ = $po->tran_date; $grn = $po->grn_id; begin_transaction(); @@ -404,7 +404,7 @@ function read_grn($grn_batch, &$order) { $order->trans_type = ST_SUPPRECEIVE; - $order->orig_order_date = sql2date($row["delivery_date"]); + $order->tran_date = sql2date($row["delivery_date"]); $order->Location = $row["loc_code"]; $order->reference = $row["reference"]; $order->grn_id = $grn_batch; diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index c11e7b9b..75da89da 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -74,7 +74,7 @@ function add_po(&$po_obj) requisition_no, into_stock_location, delivery_address, total, tax_included, prep_amount) VALUES("; $sql .= db_escape($po_obj->supplier_id) . "," . db_escape($po_obj->Comments) . ",'" . - date2sql($po_obj->orig_order_date) . "', " . + date2sql($po_obj->tran_date) . "', " . db_escape($po_obj->reference) . ", " . db_escape($po_obj->supp_ref) . ", " . db_escape($po_obj->Location) . ", " . @@ -103,7 +103,7 @@ function add_po(&$po_obj) $Refs->save(ST_PURCHORDER, $po_obj->order_no, $po_obj->reference); - add_audit_trail(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date); + add_audit_trail(ST_PURCHORDER, $po_obj->order_no, $po_obj->tran_date); hook_db_postwrite($po_obj, ST_PURCHORDER); commit_transaction(); @@ -121,7 +121,7 @@ function update_po(&$po_obj) $sql = "UPDATE ".TB_PREF."purch_orders SET Comments=" . db_escape($po_obj->Comments) . ", requisition_no= ". db_escape( $po_obj->supp_ref). ", into_stock_location=" . db_escape($po_obj->Location). ", - ord_date='" . date2sql($po_obj->orig_order_date) . "', + ord_date='" . date2sql($po_obj->tran_date) . "', delivery_address=" . db_escape($po_obj->delivery_address).", total=". db_escape($po_obj->get_trans_total()).", prep_amount=". db_escape($po_obj->prep_amount).", @@ -149,7 +149,7 @@ function update_po(&$po_obj) db_query($sql, "One of the purchase order detail records could not be updated"); } - reallocate_payments($po_obj->order_no, ST_PURCHORDER, $po_obj->orig_order_date, $po_obj->get_trans_total(), $po_obj->prepayments, $po_obj->supplier_id); + reallocate_payments($po_obj->order_no, ST_PURCHORDER, $po_obj->tran_date, $po_obj->get_trans_total(), $po_obj->prepayments, $po_obj->supplier_id); add_audit_trail($po_obj->trans_type, $po_obj->order_no, Today(), _("Updated.")); hook_db_postwrite($po_obj, ST_PURCHORDER); @@ -185,7 +185,7 @@ function read_po_header($order_no, &$order) $order->credit = get_current_supp_credit($order->supplier_id); - $order->orig_order_date = sql2date($myrow["ord_date"]); + $order->tran_date = sql2date($myrow["ord_date"]); $order->Comments = $myrow["comments"]; $order->Location = $myrow["into_stock_location"]; $order->supp_ref = $myrow["requisition_no"]; diff --git a/purchasing/includes/po_class.inc b/purchasing/includes/po_class.inc index b7f15ac5..970cce20 100644 --- a/purchasing/includes/po_class.inc +++ b/purchasing/includes/po_class.inc @@ -24,7 +24,7 @@ class purch_order var $Location; var $supplier_id; var $supplier_name; - var $orig_order_date; + var $tran_date; var $due_date; var $order_no; /*Only used for modification of existing orders otherwise only established when order committed */ var $lines_on_order = 0; diff --git a/purchasing/includes/purchasing_db.inc b/purchasing/includes/purchasing_db.inc index c963fa4a..745b175b 100644 --- a/purchasing/includes/purchasing_db.inc +++ b/purchasing/includes/purchasing_db.inc @@ -153,7 +153,7 @@ function add_direct_supp_trans($cart) if ($cart->trans_type != ST_PURCHORDER) { // for direct grn/invoice set same dates for lines as for whole document foreach ($cart->line_items as $line_no =>$line) - $cart->line_items[$line_no]->req_del_date = $cart->orig_order_date; + $cart->line_items[$line_no]->req_del_date = $cart->tran_date; } $ref = $cart->reference; @@ -182,7 +182,7 @@ function add_direct_supp_trans($cart) $inv = new supp_trans(ST_SUPPINVOICE); $inv->Comments = $cart->Comments; $inv->supplier_id = $cart->supplier_id; - $inv->tran_date = $cart->orig_order_date; + $inv->tran_date = $cart->tran_date; $inv->due_date = $cart->due_date; $inv->dimension = $cart->dimension; $inv->dimension2 = $cart->dimension2; diff --git a/purchasing/includes/ui/grn_ui.inc b/purchasing/includes/ui/grn_ui.inc index 8fb7568a..370687ab 100644 --- a/purchasing/includes/ui/grn_ui.inc +++ b/purchasing/includes/ui/grn_ui.inc @@ -25,7 +25,7 @@ function display_grn_summary(&$po) label_cells(_("For Purchase Order"), get_trans_view_str(ST_PURCHORDER, $po->order_no), "class='tableheader2'"); - label_cells(_("Delivery Date"), $po->orig_order_date, "class='tableheader2'"); // FIXME: delivery date + label_cells(_("Delivery On"), $po->tran_date, "class='tableheader2'"); end_row(); start_row(); @@ -56,7 +56,7 @@ function edit_grn_summary(&$po) label_row(_("For Purchase Order"), get_trans_view_str(ST_PURCHORDER, $po->order_no)); - label_row(_("Ordered On"), $po->orig_order_date); + label_row(_("Ordered On"), $po->tran_date); table_section(2); if (!isset($_POST['ref'])) @@ -67,10 +67,10 @@ function edit_grn_summary(&$po) locations_list_row(_("Deliver Into Location"), "Location", $_POST['Location']); - if (!isset($_POST['DefaultReceivedDate'])) - $_POST['DefaultReceivedDate'] = new_doc_date(); + if (!isset($_POST['tran_date'])) + $_POST['tran_date'] = new_doc_date(); - date_row(_("Date Items Received"), 'DefaultReceivedDate', '', true, 0, 0, 0, '', true); + date_row(_("Date Items Received"), 'tran_date', '', true, 0, 0, 0, '', true); table_section(3); label_row(_("Supplier's Reference"), $po->supp_ref); @@ -81,7 +81,7 @@ function edit_grn_summary(&$po) label_row(_("Order Comments"), $po->Comments, "class='tableheader2'", "colspan=9"); if (!is_company_currency($po->curr_code)) - exchange_rate_display(get_company_currency(), $po->curr_code, get_post('DefaultReceivedDate')); + exchange_rate_display(get_company_currency(), $po->curr_code, get_post('tran_date')); end_outer_table(1); } diff --git a/purchasing/includes/ui/invoice_ui.inc b/purchasing/includes/ui/invoice_ui.inc index fc779227..04a00879 100644 --- a/purchasing/includes/ui/invoice_ui.inc +++ b/purchasing/includes/ui/invoice_ui.inc @@ -596,7 +596,7 @@ function display_grn_items(&$supp_trans, $mode=0) //-------------------------------------------------------------------------------------------------- function get_duedate_from_terms(&$trans) { - $date = get_class($trans) == 'purch_order' ? $trans->orig_order_date : $trans->tran_date; + $date = $trans->tran_date; if (!is_date($date)) { diff --git a/purchasing/includes/ui/po_ui.inc b/purchasing/includes/ui/po_ui.inc index 88385649..34252f34 100644 --- a/purchasing/includes/ui/po_ui.inc +++ b/purchasing/includes/ui/po_ui.inc @@ -18,7 +18,7 @@ function copy_from_cart() $cart = &$_SESSION['PO']; $_POST['supplier_id'] = $cart->supplier_id; - $_POST['OrderDate'] = $cart->orig_order_date; + $_POST['OrderDate'] = $cart->tran_date; if ($cart->trans_type == ST_SUPPINVOICE) $_POST['due_date'] = $cart->due_date; $_POST['supp_ref'] = $cart->supp_ref; @@ -40,7 +40,7 @@ function copy_to_cart() $cart = &$_SESSION['PO']; $cart->supplier_id = $_POST['supplier_id']; - $cart->orig_order_date = $_POST['OrderDate']; + $cart->tran_date = $_POST['OrderDate']; if ($cart->trans_type == ST_SUPPINVOICE) { $cart->due_date = $_POST['due_date']; @@ -85,7 +85,7 @@ function create_cart($trans_type, $trans_no) $_POST['OrderDate'] = new_doc_date(); if (!is_date_in_fiscalyear($_POST['OrderDate'])) $_POST['OrderDate'] = end_fiscalyear(); - $cart->due_date = $cart->orig_order_date = $_POST['OrderDate']; + $cart->due_date = $cart->tran_date = $_POST['OrderDate']; /* read in all the selected order into the Items cart */ if ($trans_no) { read_po($trans_no, $cart); @@ -145,7 +145,7 @@ function display_po_header(&$order) 'OrderDate', '', true, 0, 0, 0, null, true); if (isset($_POST['_OrderDate_changed'])) { - $order->orig_order_date = $_POST['OrderDate']; + $order->tran_date = $_POST['OrderDate']; get_duedate_from_terms($order); $_POST['due_date'] = $order->due_date; $Ajax->activate('due_date'); @@ -321,7 +321,7 @@ function display_po_summary(&$po, $is_self=false, $editable=false) } end_row(); start_row(); - label_cells(_("Date"), $po->orig_order_date, "class='tableheader2'"); + label_cells(_("Date"), $po->tran_date, "class='tableheader2'"); if ($editable) { diff --git a/purchasing/po_entry_items.php b/purchasing/po_entry_items.php index b562e7cf..0a791855 100644 --- a/purchasing/po_entry_items.php +++ b/purchasing/po_entry_items.php @@ -418,7 +418,7 @@ function handle_commit_order() if (can_commit()) { copy_to_cart(); - new_doc_date($cart->orig_order_date); + new_doc_date($cart->tran_date); if ($cart->order_no == 0) { // new po/grn/invoice $trans_no = add_direct_supp_trans($cart); if ($trans_no) { diff --git a/purchasing/po_receive_items.php b/purchasing/po_receive_items.php index 2850496d..5d3bff5d 100644 --- a/purchasing/po_receive_items.php +++ b/purchasing/po_receive_items.php @@ -202,15 +202,15 @@ function can_process() return false; } - if (!is_date($_POST['DefaultReceivedDate'])) + if (!is_date($_POST['tran_date'])) { display_error(_("The entered date is invalid.")); - set_focus('DefaultReceivedDate'); + set_focus('tran_date'); return false; } - if (!is_date_in_fiscalyear($_POST['DefaultReceivedDate'])) { + if (!is_date_in_fiscalyear($_POST['tran_date'])) { display_error(_("The entered date is out of fiscal year or is closed for further data entry.")); - set_focus('DefaultReceivedDate'); + set_focus('tran_date'); return false; } @@ -291,7 +291,7 @@ function process_receive_po() } $grn = &$_SESSION['PO']; - $grn->orig_order_date = $_POST['DefaultReceivedDate']; + $grn->tran_date = $_POST['tran_date']; $grn->reference = $_POST['ref']; $grn->Location = $_POST['Location']; $grn->ex_rate = input_num('_ex_rate', null); @@ -299,7 +299,7 @@ function process_receive_po() $trans_no = write_grn($grn); $new = $grn->grn_id == 0; - new_doc_date($_POST['DefaultReceivedDate']); + new_doc_date($_POST['tran_date']); unset($_SESSION['PO']->line_items); unset($_SESSION['PO']); @@ -322,8 +322,8 @@ if (isset($_POST['Update']) || isset($_POST['ProcessGoodsReceived'])) if (!check_num($line->line_no)) $_POST[$line->line_no] = number_format2(0, get_qty_dec($line->stock_id)); - if (!isset($_POST['DefaultReceivedDate']) || $_POST['DefaultReceivedDate'] == "") - $_POST['DefaultReceivedDate'] = new_doc_date(); + if (!isset($_POST['tran_date']) || $_POST['tran_date'] == "") + $_POST['tran_date'] = new_doc_date(); $_SESSION['PO']->line_items[$line->line_no]->quantity = input_num($line->line_no);