X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fdb%2Fcustomers_db.inc;h=36db9e1a93b453196facf1964841f61629ce7195;hb=1e4cd218cd0b7e1093b4b63d6636f5360b3c7958;hp=1bbe767728731743f5df846fed2c229557fbd878;hpb=a82e9b552d49b11dad1c726a23bfa958463a5154;p=fa-stable.git diff --git a/sales/includes/db/customers_db.inc b/sales/includes/db/customers_db.inc index 1bbe7677..36db9e1a 100644 --- a/sales/includes/db/customers_db.inc +++ b/sales/includes/db/customers_db.inc @@ -99,7 +99,7 @@ function get_customer_details($customer_id, $to=null, $all=true) AND ".TB_PREF."debtors_master.credit_status = ".TB_PREF."credit_status.id AND ".TB_PREF."debtors_master.debtor_no = ".db_escape($customer_id)." "; if (!$all) - $sql .= "AND ABS(trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount - trans.alloc) > 0.004 "; + $sql .= "AND ABS(trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount - trans.alloc) > ".FLOAT_COMP_DELTA." "; $sql .= "GROUP BY ".TB_PREF."debtors_master.name, ".TB_PREF."payment_terms.terms, @@ -155,8 +155,11 @@ function get_customer_contacts($customer_id, $action=null) $results = array(); $res = get_crm_persons('customer', $action, $customer_id); while($contact = db_fetch($res)) + { + if ($contact['lang'] == 'C') // Fix for improper lang in demo sql files. + $contact['lang'] = ''; $results[] = $contact; - + } return $results; } @@ -174,4 +177,14 @@ function is_new_customer($id) return !key_in_foreign_table($id, $tables, 'debtor_no'); } + +function get_customer_by_ref($reference) +{ + $sql = "SELECT * FROM ".TB_PREF."debtors_master WHERE debtor_ref=".db_escape($reference); + + $result = db_query($sql, "could not get customer"); + + return db_fetch($result); +} + ?> \ No newline at end of file