Rerun. Tabbed dialogs allowed non access pages.
[fa-stable.git] / sales / manage / customers.php
index 93768344ec214fa20eec1d5bf4d0c56c3fe3478c..a14bd2058bb09bbed4295be9a04a2210985408e8 100644 (file)
@@ -117,7 +117,7 @@ function handle_submit(&$selected_id)
                 
                $selected_branch = db_insert_id();
         
-                       add_crm_person($_POST['CustName'], $_POST['cust_ref'], '', $_POST['address'], 
+                       add_crm_person($_POST['cust_ref'], $_POST['CustName'], '', $_POST['address'], 
                                $_POST['phone'], $_POST['phone2'], $_POST['fax'], $_POST['email'], '', '');
 
                        $pers_id = db_insert_id();
@@ -236,7 +236,8 @@ function customer_settings($selected_id)
        text_row(_("GSTNo:"), 'tax_id', null, 40, 40);
 
 
-       if (!$selected_id || is_new_customer($selected_id)) 
+       if (!$selected_id || is_new_customer($selected_id) || (!key_in_foreign_table($selected_id, 'debtor_trans', 'debtor_no') &&
+               !key_in_foreign_table($selected_id, 'sales_orders', 'debtor_no'))) 
        {
                currencies_list_row(_("Customer's Currency:"), 'curr_code', $_POST['curr_code']);
        } 
@@ -346,8 +347,10 @@ if (!$selected_id || list_updated('customer_id'))
 tabbed_content_start('tabs', array(
                'settings' => array(_('&General settings'), $selected_id),
                'contacts' => array(_('&Contacts'), $selected_id),
-               'transactions' => array(_('&Transactions'), $selected_id),
-               'orders' => array(_('Sales &Orders'), $selected_id),
+               'transactions' => array(_('&Transactions'), 
+                       ($_SESSION["wa_current_user"]->can_access_page('SA_SALESTRANSVIEW') ? $selected_id : null)),
+               'orders' => array(_('Sales &Orders'), 
+                       ($_SESSION["wa_current_user"]->can_access_page('SA_SALESTRANSVIEW') ? $selected_id : null)),
        ));
        
        switch (get_post('_tabs_sel')) {