0002615: Rerun. voiding an allocated currency invoice doesn't clear FX account
[fa-stable.git] / sales / includes / db / customers_db.inc
index 3a67e4edb895d29189e5307c8e526ff328066ca9..36db9e1a93b453196facf1964841f61629ce7195 100644 (file)
@@ -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