[0000313] Fixed multiply vulnerabilities.
[fa-stable.git] / sales / manage / customer_branches.php
index 91973cc6c1b7c9411818ccc3b4093f02c2a29d76..5ab27166df15c9213085aa2b1e7653602e6d2edd 100644 (file)
@@ -177,8 +177,7 @@ function branch_settings($selected_id) {
        $_POST['email'] = "";
        if ($selected_id != -1)
        {
-               if ($Mode == 'Edit') {
-
+               if ($Mode == 'Edit' || !isset($_POST['br_name'])) {
                        //editing an existing branch
                        $myrow = get_cust_branch($_POST['customer_id'], $_POST['branch_code']);
                        set_focus('br_name');
@@ -217,7 +216,6 @@ function branch_settings($selected_id) {
                        $_POST['br_ref'] = $myrow["debtor_ref"];
                        $_POST['contact_name'] = _('Main Branch');
                        $_POST['br_address'] = $_POST['br_post_address'] = $myrow["address"];
-                       $_POST['email'] = $myrow['email'];
                }
                $_POST['branch_code'] = "";
                if (!isset($_POST['sales_account']) || !isset($_POST['sales_discount_account']))
@@ -251,7 +249,7 @@ function branch_settings($selected_id) {
        // 2006-06-14. Changed gl_al_accounts_list to have an optional all_option 'Use Item Sales Accounts'
        gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', null, false, false, true);
        gl_all_accounts_list_row(_("Sales Discount Account:"), 'sales_discount_account');
-       gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'receivables_account');
+       gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'receivables_account', null, true);
        gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'payment_discount_account');
 
        table_section(2);
@@ -316,10 +314,13 @@ $table->set_inactive_ctrl('cust_branch', 'branch_code');
 
 //$table->width = "85%";
 display_db_pager($table);
+}
+else
+       display_note(_("The selected customer does not have any branches. Please create at least one branch."));
 
 tabbed_content_start('tabs', array(
-               'settings' => array('&General settings', $selected_id!=-1),
-               'contacts' => array('&Contacts', $selected_id!=-1),
+               'settings' => array(_('&General settings'), $selected_id!=-1),
+               'contacts' => array(_('&Contacts'), $selected_id!=-1),
 //             'orders' => array('S&ales orders', $selected_id!=-1) // not implemented
        ));
        
@@ -338,9 +339,6 @@ tabbed_content_start('tabs', array(
        hidden('selected_id', $selected_id);
 br();
 tabbed_content_end();
-}
-else
-       display_note(_("The selected customer does not have any branches. Please create at least one branch."));
 
 
 end_form();