Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-11292

Format and validate phone numbers

    Details

    • Type: New Feature
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.0
    • Fix Version/s: Unscheduled
    • Component/s: Core CiviCRM, NYSS
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Core Team Contract

      Description

      Initial research and spec:

      Requirements:
      1) Ability to search on phone numbers
      2) Standardize formatting of phone numbers in the database (which may allow the above search to be better optimized)

      Schema Changes:
      1) Add `phone_numeric` column to the `civicrm_phone` table (see phase 1 notes)
      2) Add `country` column to `civicrm_phone` table - FK to `civicrm_country`

      UI Changes:
      1) Country would be a selectable option for all phone numbers (core forms and profiles)
      2) Phone numbers would be auto-formatted as the user types based on given country
      3) Phone numbers would be validated by input forms

      Resources:
      1) http://code.google.com/p/libphonenumber/ appears to meet all the above requirements. It has a js library for client-side autoformat and validation, and a php library for server-side validation and batch updating.

      Project Phases:
      1) Add phone field to advanced search. The lack of standard formatting in the db could be gotten around by the addition of a `phone_numeric` column to the `civicrm_phone` table, a calculated field kind of like `sort_name` which holds the number stripped of all punctuation for search purposes. This phase is being tracked at http://dev.nysenate.gov/issues/5804
      (est 10 hrs)

      2) Add the `country` column to `civicrm_phone` table. Add client-side autoformatting and validation to core forms. The country field would be non-required, and the autoformat and validate would only be active if country is specified (so phone fields could continue to work as they do now if country is left blank).
      (est 10 hrs)

      3) Add country field and client-side format/validate to profiles and webforms
      (est 10 hrs).

      4) Add server-side validation and come up with a stricter policy for keeping all phone numbers consistent. Add a batch-format script to clean up existing phone numbers. Consider making the `country` field required (possibly give site admins that choice).
      (est 10-20 hrs)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                colemanw Coleman Watts
                Reporter:
                colemanw Coleman Watts
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: