Changed naming convention in purchase order class (orig_order_date ->tran_date)
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 3 Jul 2019 11:19:09 +0000 (13:19 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 19 Aug 2019 10:41:57 +0000 (12:41 +0200)
purchasing/includes/db/grn_db.inc
purchasing/includes/db/po_db.inc
purchasing/includes/po_class.inc
purchasing/includes/purchasing_db.inc
purchasing/includes/ui/grn_ui.inc
purchasing/includes/ui/invoice_ui.inc
purchasing/includes/ui/po_ui.inc
purchasing/po_entry_items.php
purchasing/po_receive_items.php

index 740ef18ca4713c06480b085f330781324a5ae86d..e66c0910a4fe722d8b8abc21a08c70d6df7d0aaa 100644 (file)
@@ -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;
index c11e7b9b903622227cb9c47bbc2299e3db9f3c5f..75da89da6eb83c0cf7fb26abe8b09b23437421d0 100644 (file)
@@ -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"];
index b7f15ac5307b5864aa6e3ea13590e7eea723d4ad..970cce200f72a34a81aa165858084004048bf1d3 100644 (file)
@@ -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;
index c963fa4a221c5f557e9860b501db58116d3ad436..745b175b2ec375260be392d531303f1f5aa253db 100644 (file)
@@ -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;
index 8fb7568a523c43f2fe6b73100f56ef8b4e273d6b..370687ab71760af9f567ff15299ddfec94da716b 100644 (file)
@@ -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);
 }
 
index fc779227793c7c0497f8a73933df2665fca5de8a..04a008793e1ecdadb60715260777de43c6ce72bd 100644 (file)
@@ -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))
        {
index 88385649307122e43961df37c0f61557ed92497c..34252f3427a325df1302e5ec08a2986b195e02c9 100644 (file)
@@ -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)
     {
index b562e7cfa9e77cbdc725804e76740bafc026cdc0..0a79185514aaf447e884076caa84fc0204b12cd5 100644 (file)
@@ -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) {
index 2850496dca12f55cadc6c2fe25ae69ed52beeca6..5d3bff5d6c1f7b3ff61305dd63849618f3ae6f47 100644 (file)
@@ -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);