X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fmanage%2Fcustomers.php;h=944d63e0f1b9968f9a7ffa24ce87b3574f419822;hb=13aa48ccc9265df336a1805d2e4709365f19c956;hp=0f86a04d83650282f9bcf349dacfa002309e5d6f;hpb=36dcc6d86df222669cb1d152d53b12635216d5b3;p=fa-stable.git diff --git a/sales/manage/customers.php b/sales/manage/customers.php index 0f86a04d..944d63e0 100644 --- a/sales/manage/customers.php +++ b/sales/manage/customers.php @@ -10,6 +10,10 @@ include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/includes/banking.inc"); include_once($path_to_root . "/includes/ui.inc"); +if (isset($_GET['debtor_no'])) +{ + $_POST['customer_id'] = $_GET['debtor_no']; +} $new_customer = (!isset($_POST['customer_id']) || $_POST['customer_id'] == ""); //-------------------------------------------------------------------------------------------- @@ -18,24 +22,28 @@ function can_process() if (strlen($_POST['CustName']) == 0) { display_error(_("The customer name cannot be empty.")); + set_focus('CustName'); return false; } if (!check_num('credit_limit', 0)) { display_error(_("The credit limit must be numeric and not less than zero.")); + set_focus('credit_limit'); return false; } if (!check_num('pymt_discount', 0, 100)) { display_error(_("The payment discount must be numeric and is expected to be less than 100% and greater than or equal to 0.")); + set_focus('pymt_discount'); return false; } if (!check_num('discount', 0, 100)) { display_error(_("The discount percentage must be numeric and is expected to be less than 100% and greater than or equal to 0.")); + set_focus('discount'); return false; } @@ -97,15 +105,19 @@ function handle_submit() $Ajax->activate('_page_body'); } } - //-------------------------------------------------------------------------------------------- if (isset($_POST['submit'])) { - handle_submit(); } +//-------------------------------------------------------------------------------------------- +if (isset($_POST['select'])) +{ + context_return(array('customer_id' => $_POST['customer_id'], + 'branch_id' => '')); // this fires customer history checks +} //-------------------------------------------------------------------------------------------- if (isset($_POST['delete'])) @@ -161,7 +173,6 @@ if (isset($_POST['delete'])) } //end if Delete Customer } - check_db_has_sales_types(_("There are no sales types defined. Please define at least one sales type before adding a customer.")); start_form(); @@ -175,7 +186,7 @@ if (db_has_customers()) } else { - hidden('customer_id', $_POST['customer_id']); + hidden('customer_id'); } start_table($table_style2, 7, 6); @@ -261,10 +272,12 @@ amount_row(_("Credit Limit:"), 'credit_limit', $_POST['credit_limit']); payment_terms_list_row(_("Payment Terms:"), 'payment_terms', $_POST['payment_terms']); credit_status_list_row(_("Credit Status:"), 'credit_status', $_POST['credit_status']); if (!$new_customer) { -start_row(); - echo ''._('Customer branches').':'; - hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php",''. _("Add or Edit").'', "debtor_no=".$_POST['customer_id']); -end_row(); + start_row(); + echo ''._('Customer branches').':'; + hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php", + ''. (count($_SESSION['Context']) ? _("Select or &Add") : _("&Add or Edit ")).'', + "debtor_no=".$_POST['customer_id']); + end_row(); } end_table(); @@ -278,6 +291,7 @@ else { submit_center_first('submit', _("Update Customer"), _('Update customer data'), true); + submit_return('select', _("Return"), _("Select this customer and return to document entry."), true); submit_center_last('delete', _("Delete Customer"), _('Delete customer data if have been never used'), true); }