Merge pull request #2315 from internetee/2307-bulk-change-poll-messages

Fixed notifications about automatic contact name update
This commit is contained in:
Timo Võhmar 2022-04-05 18:56:47 +03:00 committed by GitHub
commit 95780ec84a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 329 additions and 221 deletions

View file

@ -30,6 +30,19 @@ class Contact < ApplicationRecord
.where('success = false and verified_at IS NOT NULL')
}
scope :with_different_company_name, (lambda do |company|
where("ident = ? AND ident_country_code = 'EE' AND name != ?",
company.registration_number,
company.company_name)
end)
scope :with_different_registrant_name, (lambda do |user|
where('ident = ? AND ident_country_code = ? AND UPPER(name) != UPPER(?)',
user.ident,
user.country.alpha2,
user.username)
end)
NAME_REGEXP = /([\u00A1-\u00B3\u00B5-\u00BF\u0021-\u0026\u0028-\u002C\u003A-\u0040]|
[\u005B-\u005F\u007B-\u007E\u2040-\u206F\u20A0-\u20BF\u2100-\u218F])/x