Skip to content

EspoCRM – Open Source CRM Application

phone foreign disable numeric search

Yuri Kuznetsov1ba4937f328f
diff --git a/client/src/views/fields/foreign-phone.js b/client/src/views/fields/foreign-phone.js
index 4cfb10fbd1..4e7e4d0718 100644
--- a/client/src/views/fields/foreign-phone.js
+++ b/client/src/views/fields/foreign-phone.js
@@ -32,6 +32,12 @@ class ForeignPhoneFieldView extends PhoneFieldView {
type = 'foreign'
readOnly = true
+
+ setup() {
+ super.setup();
+
+ this.isNumeric = false;
+ }
}
export default ForeignPhoneFieldView;
diff --git a/client/src/views/fields/phone.js b/client/src/views/fields/phone.js
index 75dc6f5b42..867e51cd7f 100644
--- a/client/src/views/fields/phone.js
+++ b/client/src/views/fields/phone.js
@@ -86,6 +86,12 @@ class PhoneFieldView extends VarcharFieldView {
*/
validationRegExp
+ /**
+ * @protected
+ * @type {boolean}
+ */
+ isNumeric
+
events = {
/** @this PhoneFieldView */
'click [data-action="switchPhoneProperty"]': function (e) {
@@ -696,6 +702,8 @@ class PhoneFieldView extends VarcharFieldView {
});
this.validations.push(() => this.validateMaxCount());
+
+ this.isNumeric = this.getConfig().get('phoneNumberNumericSearch');
}
/**
@@ -819,9 +827,7 @@ class PhoneFieldView extends VarcharFieldView {
fetchSearch() {
const type = this.fetchSearchType() || 'startsWith';
- const isNumeric = this.getConfig().get('phoneNumberNumericSearch');
-
- const name = isNumeric ?
+ const name = this.isNumeric ?
this.name + 'Numeric' :
this.name;
@@ -852,7 +858,7 @@ class PhoneFieldView extends VarcharFieldView {
const originalValue = value;
- if (isNumeric && value) {
+ if (this.isNumeric && value) {
value = value.replace(/[^0-9]/g, '');
}