New customer/supplier currency can be changed as long as no transaction is entered.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 18 Jul 2010 16:39:20 +0000 (16:39 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 18 Jul 2010 16:39:20 +0000 (16:39 +0000)
purchasing/includes/db/suppliers_db.inc
purchasing/manage/suppliers.php
sales/includes/db/customers_db.inc
sales/manage/customers.php

index b0fae283637a4ccf5cae54c73cd8595b1dd01c4a..be6eb5b3cd88d37339d8502330d3b421a0b52398 100644 (file)
@@ -164,4 +164,10 @@ function get_current_supp_credit($supplier_id)
 
 }
 
+function is_new_supplier($id)
+{
+       $tables = array('supp_trans', 'grn_batch', 'purch_orders', 'purch_data');
+
+       return !key_in_foreign_table($id, $tables, 'supplier_id');
+}
 ?>
\ No newline at end of file
index b2ad33c7f47d370fbef07571f553fe9a32f3bf0b..a7336240a737247b4236a63790d67638ebb75e8e 100644 (file)
@@ -85,7 +85,7 @@ function supplier_settings(&$supplier_id)
 
        text_row(_("GSTNo:"), 'gst_no', null, 42, 40);
        link_row(_("Website:"), 'website', null, 35, 55);
-       if ($supplier_id) 
+       if ($supplier_id && !is_new_supplier($supplier_id)
        {
                label_row(_("Supplier's Currency:"), $_POST['curr_code']);
                hidden('curr_code', $_POST['curr_code']);
index a9a6301b8f39ad65f0ca7d6680d69da9483de6ff..bd5b8d34583d578cbd52ef80ba43df2b31ee16c0 100644 (file)
@@ -164,4 +164,10 @@ function get_current_cust_credit($customer_id)
 
 }
 
+function is_new_customer($id)
+{
+       $tables = array('cust_branch', 'debtor_trans', 'recurrent_invoices', 'sales_orders');
+
+       return !key_in_foreign_table($id, $tables, 'debtor_no');
+}
 ?>
\ No newline at end of file
index ee19756583bc2510c0da74ab3b960933c4eb5d52..a20dffb4f5b6b026e6490f74f699b5c75d6db41a 100644 (file)
@@ -205,7 +205,7 @@ function customer_settings($selected_id)
        text_row(_("GSTNo:"), 'tax_id', null, 40, 40);
 
 
-       if (!$selected_id) 
+       if (!$selected_id || is_new_customer($selected_id)
        {
                currencies_list_row(_("Customer's Currency:"), 'curr_code', $_POST['curr_code']);
        }