Infos:
- Used Zammad version: 5.2.x
- Used Zammad installation type: package
- Operating system: Debian 10
- Browser + version: Chrome 10x
Expected behavior:
- Our voicemail system creates tickets with the voicemail text and the attached audio. To do this, it looks up for existing users by phone number, if the user don’t exist, it will create a new user with the following data:
{"phone": "phone number","roles":["Customer"]}'
To have a outbound sms notification channel to the user, i check if the number is a mobile phone number. If so, then i want to create a new user with
{"mobile": "phone number","roles":["Customer"]}'
This is needed, because the sms notification only works, if the mobile field is filled with a phone number.
Actual behavior:
- The backend throws an error, because only firstname, lastname, phone or email are accepted for creating new users:
{
"error": "At least one identifier (firstname, lastname, phone or email) for user is required.",
"error_human": "At least one identifier (firstname, lastname, phone or email) for user is required."
}
In /app/models/user.rb the function “ensure_identifier” checks for one of these types.
def ensure_identifier
return if login.present? && !login.start_with?('auto-')
return if [email, firstname, lastname, phone].any?(&:present?)
errors.add :base, __('At least one identifier (firstname, lastname, phone or email) for user is required.')
end
Is it possible, to expand the function to check for mobile also?
Like this:
return if [email, firstname, lastname, phone, mobile].any?(&:present?)