X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Finquiry%2Fcustomer_branches_list.php;h=e5199def055133fb61804c91c6fdc5c975b3416b;hb=0ce53780d575e7bf4eefaa1b7edc0603131cc2b3;hp=3586628ec4c317079d33b1baacad23430bdb5e83;hpb=1ca0c7081f7a4cb3f68f3ffb6ee05739abb6cebf;p=fa-stable.git diff --git a/sales/inquiry/customer_branches_list.php b/sales/inquiry/customer_branches_list.php index 3586628e..e5199def 100644 --- a/sales/inquiry/customer_branches_list.php +++ b/sales/inquiry/customer_branches_list.php @@ -1,29 +1,33 @@ . +***********************************************************************/ +/********************************************************************** + Page for searching customer branch list and select it to customer + branch selection in pages that have the customer branch dropdown lists. + Author: bogeyman2007 from Discussion Forum. Modified by Joe Hunt ***********************************************************************/ $page_security = "SA_SALESORDER"; $path_to_root = "../.."; include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/includes/ui.inc"); +include_once($path_to_root . "/sales/includes/db/branches_db.inc"); $js = get_js_select_combo_item(); -if (isset($SysPrefs->max_rows_in_search)) - $limit = $SysPrefs->max_rows_in_search; -else - $limit = 10; - page(_($help_context = "Customer Branches"), true, false, "", $js); -// Activate Ajax on form submit if(get_post("search")) { $Ajax->activate("customer_branch_tbl"); } -// BEGIN: Filter form. Use query string so the client_id will not disappear -// after ajax form post. start_form(false, false, $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']); start_table(TABLESTYLE_NOBORDER); @@ -38,41 +42,17 @@ end_row(); end_table(); end_form(); -// END: Filter form -// BEGIN: Link to add new customer branch -// hyperlink_params($path_to_root . "/sales/manage/customer_branches.php", _("Add new"), "debtor_no=" . strip_tags($_GET["SelectedBranch"]) . "&popup=1"); -// END: Link to add new customer branch - -// BEGIN: Customer branches list div_start("customer_branch_tbl"); - start_table(TABLESTYLE); $th = array("", _("Ref"), _("Branch"), _("Contact"), _("Phone")); table_header($th); -// 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 +$k = 0; $name = $_GET["client_id"]; +$result = get_branches_search($_GET["customer_id"], get_post("branch")); while ($myrow = db_fetch_assoc($result)) { alt_table_row_color($k); @@ -88,6 +68,4 @@ while ($myrow = db_fetch_assoc($result)) end_table(1); div_end(); -// END: Customer list - end_page(true);