Commit 1057211b authored by Đào Nhật Quang's avatar Đào Nhật Quang

quangdn

parent f7f1e07f
......@@ -1126,7 +1126,7 @@ public class CustomerServiceImpl implements CustomerService {
isMainPhoneNull = true;
} else {
if (validateNumberOnly(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim())) {
sb.append(validateExistPhone(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim(), locale));
sb.append(validateExistPhone(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim(), locale, true));
} else {
sb.append(BundleUtils.getLangString("customer.onlyNumber", locale));
}
......@@ -1135,7 +1135,7 @@ public class CustomerServiceImpl implements CustomerService {
isSecondPhoneNull = true;
} else {
if (validateNumberOnly(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString().trim())) {
sb.append(validateLength(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0], rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString(), 50, locale));
sb.append(validateExistPhone(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString(), locale, false));
} else {
sb.append(BundleUtils.getLangString("customer.onlyNumber", locale));
}
......@@ -1380,7 +1380,7 @@ public class CustomerServiceImpl implements CustomerService {
}
//<editor-fold desc="Validate Methods" defaultstate="collapsed">
private String validateExistPhone(String str, Locale locale) {
private String validateExistPhone(String str, Locale locale, boolean isCheckDuplicate) {
String result = "";
String[] arr = str.split(";");
List<CustomerContact> contactList;
......@@ -1397,11 +1397,13 @@ public class CustomerServiceImpl implements CustomerService {
}
}
}
for (int i = 0; i < arr.length; i++) {
contactList = customerContactRepository.findCustomerContactsByContactEquals(arr[i]);
if (contactList.size() != 0) {
result += BundleUtils.getLangString("customer.phoneExists", locale);
break;
if (isCheckDuplicate) {
for (int i = 0; i < arr.length; i++) {
contactList = customerContactRepository.findCustomerContactsByContactEquals(arr[i]);
if (contactList.size() != 0) {
result += BundleUtils.getLangString("customer.phoneExists", locale);
break;
}
}
}
return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment