Allow changing urrency on customer/supplier as long as no transactions exist.
authorJoe <unknown>
Mon, 5 May 2014 14:19:26 +0000 (16:19 +0200)
committerJoe <unknown>
Mon, 5 May 2014 14:19:26 +0000 (16:19 +0200)
purchasing/manage/suppliers.php
sales/manage/customers.php

index 35ba173d69aba02efd1b3e04fae0d4c0b7fa6f9d..e5da178a8ac6d52b3c6084650215e96df5f64dc3 100644 (file)
@@ -93,7 +93,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']);
index 93768344ec214fa20eec1d5bf4d0c56c3fe3478c..f76e1cd9ccecc8e24a7056d5b6a6f9aa310c4151 100644 (file)
@@ -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']);
        }