Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/phone/README.txt,v
retrieving revision 1.19
diff -u -p -r1.19 README.txt
--- README.txt 8 Mar 2009 00:04:26 -0000 1.19
+++ README.txt 9 Apr 2009 22:17:11 -0000
@@ -20,6 +20,7 @@ Features:
+ Czech,
+ Hungarian,
+ Costa Rican,
+ + Brazilian,
+ US
and Canadian phone numbers
* Formating of phone numbers
Index: phone.br.inc
===================================================================
RCS file: phone.br.inc
diff -N phone.br.inc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ phone.br.inc 9 Apr 2009 22:17:11 -0000
@@ -0,0 +1,46 @@
+ array('label' => t('Australian Phone Numbers')),
'cs_phone' => array('label' => t('Czech Phone Numbers')),
'hu_phone' => array('label' => t('Hungarian Phone Numbers')),
- 'nl_phone' => array('label' => t('Dutch Phone Numbers'))
+ 'nl_phone' => array('label' => t('Dutch Phone Numbers')),
+ 'br_phone' => array('label' => t('Brazilian Phone Numbers')),
);
}
@@ -134,8 +135,9 @@ function phone_field_settings($op, $fiel
|| $field['type'] == 'es_phone'
|| $field['type'] == 'au_phone'
|| $field['type'] == 'cs_phone'
- || $field['type'] == 'hu_phone'
- || $field['type'] == 'nl_phone'
+ || $field['type'] == 'hu_phone'
+ || $field['type'] == 'nl_phone'
+ || $field['type'] == 'br_phone'
) {
$columns = array(
'value' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
@@ -217,7 +219,10 @@ function phone_field($op, &$node, $field
}
if ($field['type'] == 'nl_phone' && !valid_phone_number('nl', $item['value'])) {
form_set_error($field['field_name'], t('"%value" is not a valid Dutch phone number!
Dutch phone numbers should contain only numbers and spaces and - and be like 099-9999999 with an optional prefix of "+31".', 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'])));
+ }
}
}
break;
@@ -258,7 +263,10 @@ function phone_field($op, &$node, $field
}
if ($field['type'] == 'nl_phone') {
$node_field[$delta]['value'] = format_phone_number('nl', $node_field[$delta]['value'], $field);
- }
+ }
+ if ($field['type'] == 'br_phone') {
+ $node_field[$delta]['value'] = format_phone_number('br', $node_field[$delta]['value'], $field);
+ }
}
}
break;
@@ -359,7 +367,8 @@ function phone_field_formatter_info() {
'au_phone',
'cs_phone',
'hu_phone',
- 'nl_phone'
+ 'nl_phone',
+ 'br_phone'
),
'multiple values' => CONTENT_HANDLE_CORE,
),
@@ -437,7 +446,8 @@ function phone_widget_info() {
'au_phone',
'cs_phone',
'hu_phone',
- 'nl_phone'
+ 'nl_phone',
+ 'br_phone'
),
'multiple values' => CONTENT_HANDLE_CORE,
'callbacks' => array(
@@ -645,7 +655,8 @@ function valid_phone_number($countrycode
|| $countrycode == 'au'
|| $countrycode == 'cs'
|| $countrycode == 'hu'
- || $countrycode == 'nl'
+ || $countrycode == 'nl'
+ || $countrycode == 'br'
) {
//drupal_set_message('langue = ' . $countrycode, 'error');
@@ -688,7 +699,8 @@ function format_phone_number($countrycod
|| $countrycode == 'au'
|| $countrycode == 'cs'
|| $countrycode == 'hu'
- || $countrycode == 'nl'
+ || $countrycode == 'nl'
+ || $countrycode == 'br'
) {
//drupal_set_message('langue = ' . $countrycode, 'error');