Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
validate: function (attrs) {
var errors = [];
Validation.checkGroupsNameField(errors, true, attrs.name, 'Subject');
Validation.checkGroupsNameField(errors, true, attrs.source, 'Source');
// Validation.checkGroupsNameField(errors, false, attrs.company.name, 'Company'); // commented in hotFix By Liliya
Validation.checkPhoneField(errors, false, attrs['phones.phone'] || attrs.phones.phone, 'Phone');
Validation.checkPhoneField(errors, false, attrs['phones.mobile'] || attrs.phones.mobile, 'Mobile');
Validation.checkCountryCityStateField(errors, false, attrs['address.country'] || attrs.address.country, 'Country');
Validation.checkCountryCityStateField(errors, false, attrs['address.state'] || attrs.address.state, 'State');
Validation.checkCountryCityStateField(errors, false, attrs['address.city'] || attrs.address.city, 'City');
Validation.checkZipField(errors, false, attrs['address.zip'] || attrs.address.zip, 'Zip');
Validation.checkStreetField(errors, false, attrs['address.street'] || attrs.address.street, 'Street');
Validation.checkEmailField(errors, false, attrs.email, 'Email');
Validation.checkNotesField(errors, false, attrs.internalNotes, 'Notes');
Validation.checkFacebookSocial(errors, false, attrs.social.FB, 'Facebook');
Validation.checkLinkedinSocial(errors, false, attrs.social.LI, 'LinkedIn');
/* if (!attrs.tempCompanyField) {
errors.push('Check company please. ');
}
if (!attrs.customer) {
errors.push('Check person please. ');
}*/
value: getValue('address.region'),
error: validationErrorMessages['address.region'],
},
{
name: 'address.postal_code',
label: 'Postal Code',
type: 'text',
value: getValue('address.postal_code'),
error: validationErrorMessages['address.postal_code'],
},
{
name: 'address.country',
label: 'Country',
type: 'text',
value: getValue('address.country'),
error: validationErrorMessages['address.country'],
},
]
};
},
let orsAddress = addressQueryBuilder(address);
for (let i = 0; i < orsAddress.length; i++) {
ors.push(orsAddress[i]);
}
}
if (ors.length !== 0) {
if (ors.length === 1) {
ors.push(ors[0]);
}
query.$and = ors;
}
if (addressCity) {
query['address.city'] = stringQueryBuilder(addressCity);
}
if (addressCountry) {
query['address.country'] = stringQueryBuilder(addressCountry);
}
if (addressPostalCode) {
query['address.postalCode'] = stringQueryBuilder(addressPostalCode);
}
if (addressState) {
query['address.state'] = stringQueryBuilder(addressState);
}
if (addressUse) {
query['address.use'] = stringQueryBuilder(addressUse);
}
if (communication) {
let queryBuilder = tokenQueryBuilder(communication, 'code', 'communication.coding', '');
for (let i in queryBuilder) {
query[i] = queryBuilder[i];
}
}
ors.push({$or: [{name: stringQueryBuilder(name)}, {alias: stringQueryBuilder(name)}]});
}
if (ors.length !== 0) {
query.$and = ors;
}
if (_id) {
query.id = _id;
}
if (addressCity) {
query['address.city'] = stringQueryBuilder(addressCity);
}
if (addressCountry) {
query['address.country'] = stringQueryBuilder(addressCountry);
}
if (addressPostalCode) {
query['address.postalCode'] = stringQueryBuilder(addressPostalCode);
}
if (addressState) {
query['address.state'] = stringQueryBuilder(addressState);
}
if (addressUse) {
query['address.use'] = addressUse;
}
if (endpoint) {
let queryBuilder = referenceQueryBuilder(endpoint, 'endpoint.reference');
}
if (_id) {
query.id = _id;
}
if (active) {
query.active = (active === 'true');
}
if (address_city) {
query['address.city'] = stringQueryBuilder(address_city);
}
if (address_country) {
query['address.country'] = stringQueryBuilder(address_country);
}
if (address_postalcode) {
query['address.postalCode'] = stringQueryBuilder(address_postalcode);
}
if (address_state) {
query['address.state'] = stringQueryBuilder(address_state);
}
if (address_use) {
query['address.use'] = address_use;
}
if (animal_breed) {
let queryBuilder = tokenQueryBuilder(animal_breed, 'code', 'animal.breed.coding', '');
validate: function (attrs) {
var errors = [];
Validation.checkGroupsNameField(errors, true, attrs['name.first'] || attrs.name.first, 'Company');
Validation.checkPhoneField(errors, false, attrs['phones.phone'] || attrs.phones.phone, 'Phone');
Validation.checkPhoneField(errors, false, attrs['phones.mobile'] || attrs.phones.mobile, 'Mobile');
Validation.checkCountryCityStateField(errors, false, attrs['address.country'] || attrs.address.country, 'Country');
Validation.checkCountryCityStateField(errors, false, attrs['address.state'] || attrs.address.state, 'State');
Validation.checkCountryCityStateField(errors, false, attrs['address.city'] || attrs.address.city, 'City');
Validation.checkZipField(errors, false, attrs['address.zip'] || attrs.address.zip, 'Zip');
Validation.checkEmailField(errors, false, attrs.email, 'Email');
if (errors.length > 0) {
return errors;
}
},
validate: function (attrs) {
var errors = [];
Validation.checkNameField(errors, true, attrs['name.first'] || attrs.name.first, 'First name');
Validation.checkNameField(errors, true, attrs['name.last'] || attrs.name.last, 'Last name');
Validation.checkPhoneField(errors, false, attrs['phones.phone'] || attrs.phones.phone, 'Phone');
Validation.checkPhoneField(errors, false, attrs['phones.mobile'] || attrs.phones.mobile, 'Mobile');
Validation.checkPhoneField(errors, false, attrs['phones.fax'] || attrs.phones.fax, 'Fax');
Validation.checkCountryCityStateField(errors, false, attrs['address.country'] || attrs.address.country, 'Country');
Validation.checkCountryCityStateField(errors, false, attrs['address.state'] || attrs.address.state, 'State');
Validation.checkCountryCityStateField(errors, false, attrs['address.city'] || attrs.address.city, 'City');
Validation.checkZipField(errors, false, attrs['address.zip'] || attrs.address.zip, 'Zip');
Validation.checkStreetField(errors, false, attrs['address.street'] || attrs.address.street, 'Street');
Validation.checkCountryCityStateField(errors, false, attrs['shippingAddress.country'] || attrs.address.country, 'Shipping Country');
Validation.checkCountryCityStateField(errors, false, attrs['shippingAddress.state'] || attrs.address.state, 'Shipping State');
Validation.checkCountryCityStateField(errors, false, attrs['shippingAddress.city'] || attrs.address.city, 'Shipping City');
Validation.checkZipField(errors, false, attrs['shippingAddress.zip'] || attrs.address.zip, 'Shipping Zip');
Validation.checkStreetField(errors, false, attrs['shippingAddress.street'] || attrs.address.street, 'Shipping Street');
Validation.checkNameField(errors, false, attrs.jobPosition, 'Job position');
Validation.checkSkypeField(errors, false, attrs.skype, 'Skype');
Validation.checkEmailField(errors, false, attrs.email, 'Email');
Validation.checkFacebookSocial(errors, false, attrs.social.FB, 'Facebook');
Validation.checkLinkedinSocial(errors, false, attrs.social.LI, 'LinkedIn');
}
if (_id) {
query.id = _id;
}
if (active) {
query.active = (active === 'true');
}
if (address_city) {
query['address.city'] = stringQueryBuilder(address_city);
}
if (address_country) {
query['address.country'] = stringQueryBuilder(address_country);
}
if (address_postalcode) {
query['address.postalCode'] = stringQueryBuilder(address_postalcode);
}
if (address_state) {
query['address.state'] = stringQueryBuilder(address_state);
}
if (address_use) {
query['address.use'] = address_use;
}
if (identifier) {
let queryBuilder = tokenQueryBuilder(identifier, 'value', 'identifier', '');
}
if (_id) {
query.id = _id;
}
if (active) {
query.active = (active === 'true');
}
if (addressCity) {
query['address.city'] = stringQueryBuilder(addressCity);
}
if (addressCountry) {
query['address.country'] = stringQueryBuilder(addressCountry);
}
if (addressPostalCode) {
query['address.postalCode'] = stringQueryBuilder(addressPostalCode);
}
if (addressState) {
query['address.state'] = stringQueryBuilder(addressState);
}
if (addressUse) {
query['address.use'] = addressUse;
}
if (endpoint) {
let queryBuilder = referenceQueryBuilder(endpoint, 'endpoint.reference');