From 29a830f28694733a997b3095aecc8b192f7b7187 Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 5 May 2014 16:19:26 +0200 Subject: [PATCH] Allow changing urrency on customer/supplier as long as no transactions exist. --- purchasing/manage/suppliers.php | 3 ++- sales/manage/customers.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/purchasing/manage/suppliers.php b/purchasing/manage/suppliers.php index 35ba173d..e5da178a 100644 --- a/purchasing/manage/suppliers.php +++ b/purchasing/manage/suppliers.php @@ -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']); diff --git a/sales/manage/customers.php b/sales/manage/customers.php index 93768344..f76e1cd9 100644 --- a/sales/manage/customers.php +++ b/sales/manage/customers.php @@ -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']); } -- 2.30.2