diff --git a/phone.br.inc b/phone.br.inc index 88184d6..b59d13c 100644 --- a/phone.br.inc +++ b/phone.br.inc @@ -5,12 +5,12 @@ * CCK Field for Brazilian phone numbers. * (based on CCK Field for French phone numbers.) */ -define('PHONE_BR_REGEX', "/^(\+|0{2}|)?(55|0|)[ -.]?((\(0?[1-9][0-9]\))|(0?[1-9][0-9]))[ -.]?([1-9][0-9]{2,3})[ -.]?([0-9]{4})$/"); +define('PHONE_BR_REGEX', "/^(\+|0{2}|)?(55|0|)[\s-.]?((\(0?[1-9][0-9]\))|(0?[1-9][0-9]))[\s-.]?([1-9][0-9]{2,4})[\s-.]?([0-9]{4})$/"); function phone_br_metadata() { return array( 'label' => ' Phone Numbers - Brazil', - 'error' => '"%value" is not a valid Brazilian phone number
Brazilian phone numbers should contain only numbers and spaces and - and be like 099 9999-9999 or 99 9999-9999 with an optional prefix of "+55".', + 'error' => '"%value" is not a valid Brazilian phone number
Brazilian phone numbers should contain only numbers and spaces and - and be like 099 9999-9999, 99 9999-9999 or 99 99999-9999 with an optional prefix of "+55".', ); } diff --git a/phone.module b/phone.module index 76e9f3f..d7b9e48 100644 --- a/phone.module +++ b/phone.module @@ -310,7 +310,7 @@ function phone_field($op, &$node, $field, &$node_field, $teaser, $page) { form_set_error($field['field_name'], t('"%value" is not a valid New Zealand phone number!
New Zealand phone numbers should contain only numbers, spaces, brackets and "-". They should look like 04 123 4567 or can optionally omit the leading 0 and have a prefix of "+64".', array('%value' => $item['value']))); } if ($field['type'] == 'br_phone' && !valid_phone_number('br', $item['value'])) { - form_set_error($field['field_name'], t('"%value" is not a valid Brazilian phone number!
Brazilian phone numbers should contain only numbers and spaces and - and be like 099 9999-9999 or 99 9999-9999 with an optional prefix of "+55".', array('%value' => $item['value']))); + form_set_error($field['field_name'], t('"%value" is not a valid Brazilian phone number!
Brazilian phone numbers should contain only numbers and spaces and - and be like 099 9999-9999, 99 9999-9999 or 99 99999-9999 with an optional prefix of "+55".', array('%value' => $item['value']))); } if ($field['type'] == 'cl_phone' && !valid_phone_number('cl', $item['value'])) { form_set_error($field['field_name'], t('"%value" is not a valid Chilian phone number!
Chilean phone numbers should ...', array('%value' => $item['value'])));