X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fmanage%2Fcustomer_branches.php;h=ee33fa860c684fc53eb38949425aa2c64da658b3;hb=bbb034b7e0ab111ce200d81ab5a9b56ad9ad880c;hp=7cd65cb3795b92eb9497506a40e5c1a463b574b1;hpb=8ffddf50ffbe93672c769e2cf0501d0f9125e2a0;p=fa-stable.git diff --git a/sales/manage/customer_branches.php b/sales/manage/customer_branches.php index 7cd65cb3..ee33fa86 100644 --- a/sales/manage/customer_branches.php +++ b/sales/manage/customer_branches.php @@ -15,7 +15,11 @@ $path_to_root="../.."; include($path_to_root . "/includes/db_pager.inc"); include($path_to_root . "/includes/session.inc"); -page(_($help_context = "Customer Branches"), @$_REQUEST['popup']); +$js = ""; +if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search) + $js .= get_js_open_window(900, 500); + +page(_($help_context = "Customer Branches"), @$_REQUEST['popup'], false, "", $js); include($path_to_root . "/includes/ui.inc"); include($path_to_root . "/includes/ui/contacts_view.inc"); @@ -74,36 +78,18 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') if ($input_error != 1) { - begin_transaction(); - if ($selected_id != -1) - { - update_branch($_POST['customer_id'], $_POST['branch_code'], $_POST['br_name'], $_POST['br_ref'], + $id = $_POST['branch_code'] == -1 ? 0 : $_POST['branch_code']; + write_cust_branch($id, $_POST['customer_id'], $_POST['br_name'], $_POST['br_ref'], $_POST['br_address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], $_POST['sales_account'], $_POST['sales_discount_account'], $_POST['receivables_account'], $_POST['payment_discount_account'], $_POST['default_location'], $_POST['br_post_address'], $_POST['group_no'], - $_POST['default_ship_via'], $_POST['notes'], $_POST['bank_account']); + $_POST['default_ship_via'], $_POST['notes'], $_POST['bank_account'], + get_post('contact_name'), get_post('phone'), get_post('phone2'), get_post('fax'), get_post('email'), get_post('rep_lang')); + if ($selected_id != -1) $note =_('Selected customer branch has been updated'); - } else - { - add_branch($_POST['customer_id'], $_POST['br_name'], $_POST['br_ref'], - $_POST['br_address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], $_POST['sales_account'], - $_POST['sales_discount_account'], $_POST['receivables_account'], $_POST['payment_discount_account'], - $_POST['default_location'], $_POST['br_post_address'], $_POST['group_no'], - $_POST['default_ship_via'], $_POST['notes'], $_POST['bank_account']); - $selected_id = db_insert_id(); - - add_crm_person($_POST['contact_name'], $_POST['contact_name'], '', $_POST['br_post_address'], - $_POST['phone'], $_POST['phone2'], $_POST['fax'], $_POST['email'], - $_POST['rep_lang'], ''); - - add_crm_contact('cust_branch', 'general', $selected_id, db_insert_id()); - - $note = _('New customer branch has been added'); - } - commit_transaction(); display_notification($note); if (@$_REQUEST['popup']) { @@ -230,7 +216,7 @@ function branch_settings($selected_id, $num_branches) { sales_areas_list_row( _("Sales Area:"), 'area', null); sales_groups_list_row(_("Sales Group:"), 'group_no', null, true); locations_list_row(_("Default Inventory Location:"), 'default_location', null); - shippers_list_row(_("Default Shipping Company:"), 'default_ship_via', null); + shipping_methods_list_row(_("Default Shipping:"), 'default_ship_via', null); tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null); table_section_title(_("GL Accounts"));