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. ');
}*/
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 (errors.length > 0) {
return errors;