Improved design in Suppliers form.
[fa-stable.git] / purchasing / manage / suppliers.php
index 287849ff9d765c980a9fb1d73fa9da04aa6cff6c..058f2bc1b2789fc18611d8fba65e8c3575d503b4 100644 (file)
@@ -16,7 +16,7 @@ include_once($path_to_root . "/includes/session.inc");
 $js = "";
 if ($use_popup_windows)
        $js .= get_js_open_window(900, 500);
-if ($use_date_picker)
+if (user_use_date_picker())
        $js .= get_js_date_picker();
 
 page(_($help_context = "Suppliers"), @$_REQUEST['popup'], false, "", $js);
@@ -95,7 +95,8 @@ function supplier_settings(&$supplier_id)
 
        text_row(_("GSTNo:"), 'gst_no', null, 42, 40);
        link_row(_("Website:"), 'website', null, 35, 55);
-       if ($supplier_id && !is_new_supplier($supplier_id)) 
+       if ($supplier_id && !is_new_supplier($supplier_id) && (key_in_foreign_table($_POST['supplier_id'], 'supp_trans', 'supplier_id') ||
+               key_in_foreign_table($_POST['supplier_id'], 'purch_orders', 'supplier_id'))) 
        {
                label_row(_("Supplier's Currency:"), $_POST['curr_code']);
                hidden('curr_code', $_POST['curr_code']);
@@ -132,6 +133,7 @@ function supplier_settings(&$supplier_id)
        gl_all_accounts_list_row(_("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
        if (!$supplier_id) {
                table_section_title(_("Contact Data"));
+               text_row(_("Contact Person:"), 'contact', null, 42, 40);
                text_row(_("Phone Number:"), 'phone', null, 32, 30);
                text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
                table_section_title(_("Contact Data"));
@@ -139,6 +141,8 @@ function supplier_settings(&$supplier_id)
                email_row(_("E-mail:"), 'email', null, 35, 55);
                languages_list_row(_("Document Language:"), 'rep_lang', null, _('System default'));
        }
+       else
+               table_section(2);
        $dim = get_company_pref('use_dimension');
        if ($dim >= 1)
        {
@@ -151,8 +155,8 @@ function supplier_settings(&$supplier_id)
                hidden('dimension_id', 0);
        if ($dim < 2)
                hidden('dimension2_id', 0);
-       table_section(2);
-
+       if (!$supplier_id)      
+               table_section(2);
 
        table_section_title(_("Addresses"));
        textarea_row(_("Mailing Address:"), 'address', null, 35, 5);
@@ -216,7 +220,7 @@ if (isset($_POST['submit']))
                                $_POST['website'], $_POST['supp_account_no'], $_POST['bank_account'], 
                                input_num('credit_limit', 0), $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['curr_code'],
                                $_POST['payment_terms'], $_POST['payable_account'], $_POST['purchase_account'], $_POST['payment_discount_account'],
-                               $_POST['notes'], $_POST['tax_group_id'], @$_POST['tax_included'], get_post('tax_algorithm'));
+                               $_POST['notes'], $_POST['tax_group_id'], get_post('tax_included', 0), get_post('tax_algorithm'));
                        update_record_status($_POST['supplier_id'], $_POST['inactive'],
                                'suppliers', 'supplier_id');
 
@@ -338,4 +342,3 @@ end_form();
 
 end_page(@$_REQUEST['popup']);
 
-?>