CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Community Sponsored Improvements (Moderator: Donald Lobo) »
  • Validation for phone numbers
Pages: [1]

Author Topic: Validation for phone numbers  (Read 3379 times)

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Validation for phone numbers
December 13, 2010, 10:47:49 am
This has come up before but never went anywhere. There is a sponsor willing to contribute some of the money for this e.g. via make-it-happen if anyone else is interested and can chip in.

Here is the proposal:

Add a new option value "Phone format". Prepopulate the default install with some common formats for various locales and allow an admin to add/edit/delete. The "value" field would be a regular expression specifying the allowed format(s). I know some people don't like regexes but in this case these are all just variations of "\d" and it avoids having to create a new language and automatically supports multiple formats at once.

In the administration section, maybe under localization or preferences, there would be a field to select the phone format you want from the list of option values. The default is no validation.

On save, the system checks that setting and presents an error message if it doesn't validate.

Similarly for import, the system would check against the config and generate an error entry as it does for other errors during import.

Possible add-on if funds permit:
Custom search to use the config setting to locate existing contacts with invalid phones, which would then automatically support a batch-update via profile action.

Out of scope:
Custom fields of type "phone". However, it makes sense to expose the validation functions in a way that doesn't prevent re-using them later for this.
« Last Edit: December 13, 2010, 12:00:19 pm by demeritcowboy »

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Validation for phone numbers
December 17, 2010, 11:08:09 am

I think to add this for the main edit / profile  screens, import and an admin screen with a few pre-built regex's would be approx 20 hours

The custom search and batch update would be another 10 hours

Do you think your client can sponsor a fair chunk of this? if so, lets chat and get an MIH going

lobo

A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

alanms

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 5
Re: Validation for phone numbers
December 20, 2010, 07:44:34 am
If this happens and does get into core, please please please retain an option for no validation. There will always be surprising phone number requirements or idiosyncratic set ups where nothing works better than slipping a little cheeky snippet of text into a phone number field: for example, for differentiating a European Minister's Brussels number from their Strasbourg number from their constituency number from their office number from some other 5 'work' desk numbers they have of different types that are unique to their committees and position, or for storing the codes to save time navigating a torturous automated phone system, or for unusual desk extension number systems, or a quick note if a number is that of an unusual type of representative - for example, if a friendly celebrity is contacted via the desk of an artists' manager rather than an assistant or agency. That's a few off the top of my head - there's plenty more rare one-off cases like these that for some organisations wouldn't make sense to configure for.

Other CRM system have harsh validation forcing these tiny snippets of phone-number related info into separate notes that often aren't seen when they're needed - certainly for us, Civi's flexibility here was a major plus point.

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Validation for phone numbers
December 20, 2010, 11:43:07 am
Yes the default is no validation.
I suppose an enhancement to the (maybe out-of-scope) custom search would be to be able the pick the formula to validate against on the search options page, so that you could still have no real-time validation but be able to run an on-demand search.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Community Sponsored Improvements (Moderator: Donald Lobo) »
  • Validation for phone numbers

This forum was archived on 2017-11-26.