X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fmanage%2Fcustomers.php;h=511e8feab60b595e64a7034717f28876620b0cd3;hb=8f9265a8c89570c7815998dce800b5145dcf160e;hp=d7422f22034f8cd4f3dd992a805352f191a4246c;hpb=cbcc66d2cc2b92e447cb38cfe5579b8e739933cd;p=fa-stable.git diff --git a/sales/manage/customers.php b/sales/manage/customers.php index d7422f22..511e8fea 100644 --- a/sales/manage/customers.php +++ b/sales/manage/customers.php @@ -117,10 +117,13 @@ 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'], '', ''); - add_crm_contact('cust_branch', 'general', $selected_branch, db_insert_id()); + $pers_id = db_insert_id(); + add_crm_contact('cust_branch', 'general', $selected_branch, $pers_id); + + add_crm_contact('customer', 'general', $selected_id, $pers_id); } commit_transaction(); @@ -233,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']); }