Fixed a bug when adding lines during Payments to suppliers, the supplier was set...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 6 Dec 2007 21:03:06 +0000 (21:03 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 6 Dec 2007 21:03:06 +0000 (21:03 +0000)
CHANGELOG.txt
config.php
gl/gl_payment.php
gl/includes/ui/gl_payment_ui.inc

index cad5cd43068e920ba8d69edebf4d7139051cdf37..b250d5268008b71e0add315c140eb6a43abdca01 100644 (file)
@@ -19,6 +19,14 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+06-Dec-2007 Joe Hunt
+ # Fixed a bug when adding lines during Payments to suppliers, the supplier was set back to the first.
+ $ /gl/gl_payment.php
+   /gl/includes/ui/gl_payment_ui.inc
+   
+ ! Changed $loc_notification to be set to 0 instead of 1.
+ $ config.php
 -------------------- 1.15 Stable Released ----------------------
 05-Dec-2007 Joe Hunt
  + Added email notification to stock location when available stock is below reorder level
index 44e0b706773a0bf8326b60c2b900e47d6e513e2f..3a86c9409ffbc66e5bd31bb359e0d45488a5ed92 100644 (file)
@@ -85,7 +85,7 @@
        $date_system = 0;
 
        /* email stock location if order below reorder-level */
-       $loc_notification = 1;
+       $loc_notification = 0;
 
        $dateformats    = array("MMDDYYYY", "DDMMYYYY", "YYYYMMDD");
        $dateseps               = array("/", ".", "-", " ");
index a1cf3d16d222b79a2c9b9b35badeb57405d0c99e..c1771cdf6ec5fecf1d191e8e89a17422779f1930 100644 (file)
@@ -3,7 +3,6 @@
 $page_security = 3;
 $path_to_root="..";
 include_once($path_to_root . "/includes/ui/items_cart.inc");
-
 include_once($path_to_root . "/includes/session.inc");
 
 include_once($path_to_root . "/includes/date_functions.inc");
@@ -19,7 +18,6 @@ if ($use_popup_windows)
 if ($use_date_picker)
        $js .= get_js_date_picker();
 $js .= get_js_set_focus('CodeID2');
-
 page(_("Bank Account Payment Entry"), false, false, "setFocus()", $js);
 
 //-----------------------------------------------------------------------------------------------
@@ -30,7 +28,7 @@ check_db_has_bank_trans_types(_("There are no bank payment types defined in the
 
 //-----------------------------------------------------------------------------------------------
 
-if (isset($_GET['AddedID'])) 
+if (isset($_GET['AddedID']))
 {
        $trans_no = $_GET['AddedID'];
        $trans_type = systypes::bank_payment();
@@ -52,11 +50,11 @@ function copy_to_py()
        $_SESSION['pay_items']->tran_date = $_POST['date_'];
        $_SESSION['pay_items']->transfer_type = $_POST['type'];
        $_SESSION['pay_items']->increase = $_POST['PayType'];
-       if (isset($_POST['person_id']))
-               $_POST['person_id'] = 0;        
+       if (!isset($_POST['person_id']))
+               $_POST['person_id'] = "";
        $_SESSION['pay_items']->person_id = $_POST['person_id'];
        if (!isset($_POST['PersonDetailID']))
-               $_POST['PersonDetailID'] = 0;
+               $_POST['PersonDetailID'] = "";
        $_SESSION['pay_items']->branch_id = $_POST['PersonDetailID'];
        $_SESSION['pay_items']->memo_ = $_POST['memo_'];
 }
@@ -91,7 +89,7 @@ function handle_new_order()
        $_POST['date_'] = Today();
        if (!is_date_in_fiscalyear($_POST['date_']))
                $_POST['date_'] = end_fiscalyear();
-       $_SESSION['pay_items']->tran_date = $_POST['date_'];    
+       $_SESSION['pay_items']->tran_date = $_POST['date_'];
 }
 
 //-----------------------------------------------------------------------------------------------
@@ -101,22 +99,22 @@ if (isset($_POST['Process']))
 
        $input_error = 0;
 
-       if (!references::is_valid($_POST['ref'])) 
+       if (!references::is_valid($_POST['ref']))
        {
                display_error( _("You must enter a reference."));
                $input_error = 1;
-       } 
-       elseif (!is_new_reference($_POST['ref'], systypes::bank_payment())) 
+       }
+       elseif (!is_new_reference($_POST['ref'], systypes::bank_payment()))
        {
                display_error( _("The entered reference is already in use."));
                $input_error = 1;
-       } 
-       elseif (!is_date($_POST['date_'])) 
+       }
+       elseif (!is_date($_POST['date_']))
        {
                display_error(_("The entered date for the payment is invalid."));
                $input_error = 1;
-       } 
-       elseif (!is_date_in_fiscalyear($_POST['date_'])) 
+       }
+       elseif (!is_date_in_fiscalyear($_POST['date_']))
        {
                display_error(_("The entered date is not in fiscal year."));
                $input_error = 1;
@@ -160,13 +158,13 @@ function check_item_data()
                return false;
        }
 
-       if ($_POST['code_id'] == $_POST['bank_account']) 
+       if ($_POST['code_id'] == $_POST['bank_account'])
        {
                display_error( _("The source and destination accouts cannot be the same."));
                return false;
        }
 
-       if (is_bank_account($_POST['code_id'])) 
+       if (is_bank_account($_POST['code_id']))
        {
                display_error( _("You cannot make a payment to a bank account. Please use the transfer funds facility for this."));
                return false;
@@ -181,7 +179,7 @@ function handle_update_item()
 {
     if($_POST['UpdateItem'] != "" && check_item_data())
     {
-       $_SESSION['pay_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'], 
+       $_SESSION['pay_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'],
                $_POST['dimension2_id'], $_POST['amount'], $_POST['LineMemo']);
     }
 }
@@ -200,7 +198,7 @@ function handle_new_item()
        if (!check_item_data())
                return;
 
-       $_SESSION['pay_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'], 
+       $_SESSION['pay_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'],
                $_POST['dimension2_id'], $_POST['amount'], $_POST['LineMemo']);
 }
 
@@ -214,7 +212,7 @@ if (isset($_GET['Delete']))
 
 if (isset($_POST['AddItem']) || isset($_POST['UpdateItem']))
        copy_to_py();
-       
+
 if (isset($_POST['AddItem']))
        handle_new_item();
 
index 2a4e9f41efdd8720aa9dfdef97f6f6bf51a3fc44..13fc5c6b701e52b9c2c6d9fca02eb206699e079f 100644 (file)
@@ -9,7 +9,7 @@ function display_order_header(&$order)
 {
        global $table_style2;
        start_table("width=90% $table_style2"); // outer table
-       echo "<tr><td valign=top width=33%>"; 
+       echo "<tr><td valign=top width=33%>";
 
        echo "<table>"; // inner table
 
@@ -19,7 +19,7 @@ function display_order_header(&$order)
 
        echo "</table>"; // inner table
 
-       echo "</td><td width=33%>"; 
+       echo "</td><td width=33%>";
 
        echo "<table>"; // inner table
 
@@ -27,9 +27,9 @@ function display_order_header(&$order)
        {
                if (isset($_GET['PayType']))
                        $_POST['PayType'] = $_GET['PayType'];
-               else    
+               else
                        $_POST['PayType'] = "";
-       }               
+       }
        if (!isset($_POST['person_id']))
        {
                if (isset($_GET['PayPerson']))
@@ -53,11 +53,11 @@ function display_order_header(&$order)
                case payment_person_types::customer() :
                customer_list_row(_("Customer:"), 'person_id', null, false, true);
 
-               if (db_customer_has_branches($_POST['person_id'])) 
+               if (db_customer_has_branches($_POST['person_id']))
                {
                        customer_branches_list_row(_("Branch:"), $_POST['person_id'], 'PersonDetailID', null, false, true, true);
-               } 
-               else 
+               }
+               else
                {
                        hidden('BranchID', reserved_words::get_any_numeric());
                }
@@ -71,14 +71,14 @@ function display_order_header(&$order)
        $person_currency = payment_person_types::person_currency($_POST['PayType'], $_POST['person_id']);
        $bank_currency = get_bank_account_currency($_POST['bank_account']);
 
-       if ($bank_currency != "" && $bank_currency != $person_currency) 
+       if ($bank_currency != "" && $bank_currency != $person_currency)
        {
                exchange_rate_display($bank_currency, $person_currency, $_POST['date_']);
        }
 
        echo "</table>"; // inner table
 
-       echo "</td><td>"; 
+       echo "</td><td>";
 
        echo "<table>"; // inner table
 
@@ -88,7 +88,7 @@ function display_order_header(&$order)
 
        echo "</table>"; // inner table
 
-       echo "</td></tr>"; 
+       echo "</td></tr>";
 
        end_table(1); // outer table
 }
@@ -100,24 +100,24 @@ function display_gl_items($title, &$order)
        global $table_style, $path_to_root;
 
        $dim = get_company_pref('use_dimension');
-       $colspan = ($dim == 2 ? 4 : ($dim == 1 ? 3 : 2));       
+       $colspan = ($dim == 2 ? 4 : ($dim == 1 ? 3 : 2));
        display_heading($title);
 
        start_table("$table_style colspan=7 width=95%");
 
        if ($dim == 2)
-               $th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1", 
+               $th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1",
                        _("Dimension")." 2", _("Amount"), _("Memo"));
        else if ($dim == 1)
-               $th = array(_("Account Code"), _("Account Description"), _("Dimension"), 
+               $th = array(_("Account Code"), _("Account Description"), _("Dimension"),
                        _("Amount"), _("Memo"));
-       else    
-               $th = array(_("Account Code"), _("Account Description"),  
+       else
+               $th = array(_("Account Code"), _("Account Description"),
                        _("Amount"), _("Memo"));
        table_header($th);
        $k = 0;  //row colour counter
 
-       foreach ($order->gl_items as $item) 
+       foreach ($order->gl_items as $item)
        {
                if (!isset($_GET['Edit']) || $_GET['Edit'] != $item->index)
                {
@@ -131,12 +131,12 @@ function display_gl_items($title, &$order)
                                label_cell(get_dimension_string($item->dimension2_id, true));
                        amount_cell($item->amount);
                        label_cell($item->reference);
-                       
+
                        edit_link_cell("Edit=$item->index");
                        delete_link_cell("Delete=$item->index");
                end_row();
-               } 
-               else 
+               }
+               else
                {
                        gl_edit_item_controls($order, $dim, $item->index);
                }
@@ -157,7 +157,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
 {
        start_row();
 
-       if (isset($_GET['Edit']) and $Index!=null)
+       if (isset($_GET['Edit']) && $Index != null)
        {
                if (!isset($_POST['code_id']))
                        $_POST['code_id'] = $order->gl_items[$Index]->code_id;
@@ -165,11 +165,11 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
                        $_POST['dimension_id'] = $order->gl_items[$Index]->dimension_id;
                if (!isset($_POST['dimension2_id']))
                        $_POST['dimension2_id'] = $order->gl_items[$Index]->dimension2_id;
-               if (!isset($_POST['amount']) OR ($_POST['amount']==""))
+               if (!isset($_POST['amount']) || ($_POST['amount'] == ""))
                        $_POST['amount'] = $order->gl_items[$Index]->amount;
-               if (!isset($_POST['description']) OR ($_POST['description']==""))
+               if (!isset($_POST['description']) || ($_POST['description'] == ""))
                        $_POST['description'] = $order->gl_items[$Index]->description;
-               if (!isset($_POST['LineMemo']) OR ($_POST['LineMemo']==""))
+               if (!isset($_POST['LineMemo']) || ($_POST['LineMemo'] == ""))
                        $_POST['LineMemo'] = $order->gl_items[$Index]->reference;
 
                hidden('Index', $order->gl_items[$Index]->index);
@@ -187,7 +187,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
                $_POST['dimension_id'] = 0;
                $_POST['dimension2_id'] = 0;
                $_POST['LineMemo'] = "";
-               
+
                if ($_POST['PayType'] == payment_person_types::customer())
                {
                        $acc = get_branch_accounts($_POST['PersonDetailID']);
@@ -200,7 +200,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
                }
                elseif ($_POST['PayType'] == payment_person_types::WorkOrder())
                        $_POST['code_id'] = get_company_pref('default_assembly_act');
-               else    
+               else
                        $_POST['code_id'] = get_company_pref('default_cogs_act');
                text_cells(null, "CodeID2", $_POST['code_id'], 12, 10, "", "", "onkeyup='recalcAccounts()' onblur='return setAccount(0, false)'");
                gl_all_accounts_list_cells(null, 'code_id', $_POST['code_id'], true, false, "return setAccount(1, false)");
@@ -217,12 +217,12 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
        amount_cells(null, 'amount');
        text_cells_ex(null, 'LineMemo', 35, 50);
 
-       if (isset($_GET['Edit'])) 
+       if (isset($_GET['Edit']))
        {
        submit_cells('UpdateItem', _("Update"));
        submit_cells('CancelItemChanges', _("Cancel"));
-       } 
-       else 
+       }
+       else
                submit_cells('AddItem', _("Add Item"), "colspan=2");
 
        end_row();