-// Query based on function get_sql_for_customer_branches in includes/db/branches_db.inc.
-$sql = "SELECT
- b.branch_code,
- b.branch_ref,
- b.br_name,
- p.name as contact_name,
- p.phone
- FROM ".TB_PREF."cust_branch b
- LEFT JOIN ".TB_PREF."crm_contacts c
- ON c.entity_id=b.branch_code AND c.type='cust_branch' AND c.action='general'
- LEFT JOIN ".TB_PREF."crm_persons p
- on c.person_id=p.id
- WHERE b.debtor_no = ".db_escape($_GET["customer_id"])."
- AND b.br_name LIKE " . db_escape("%" . get_post("branch"). "%") . "
- ORDER BY b.br_name LIMIT 0, $limit"; // We only display 10 items.
-
-$result = db_query($sql, "Failed in retreiving branches list.");
-
-$k = 0; //row colour counter