--- /Users/fm56/Desktop/sin/sin.module 2008-12-07 20:33:28.000000000 -0500
+++ /Volumes/Sagan/Jobs/pitchersMound/mirror/sites/all/modules/sin/sin.module 2009-01-19 22:43:13.000000000 -0500
@@ -148,14 +148,14 @@ function sin_field($op, &$node, $field,
case 'validate': // corresponds to hook phone_widget validate in sin-5.x
foreach ($node_field as $delta => $item) {
if ($item['value'] != '') {
- if ($field['type'] == 'fr_sin' && !valid_fr_sin($item['value'])) {
- form_set_error($field['field_name'],t('"%value" is not a valid French Social Insurance Numbers
Social Insurance Numbers should only contains numbers and be like ...',array('%value' => $item['value'])));
+ if ($field['type'] == 'fr_sin' && !valid_sin_number('fr', $item['value'])) {
+ form_set_error($field['field_name'],t('"%value" is not a valid French Social Insurance numbers.
Social Insurance numbers should only contain numbers and be like ...',array('%value' => $item['value'])));
}
- if ($field['type'] == 'ca_sin' && !valid_ca_sin($item['value'])) {
- form_set_error($field['field_name'],t('"%value" is not a valid Canadian Social Insurance Numbers
Social Insurance Numbers should be like 999999999 ...',array('%value' => $item['value'])));
+ if ($field['type'] == 'ca_sin' && !valid_sin_number('ca', $item['value'])) {
+ form_set_error($field['field_name'],t('"%value" is not a valid Canadian Social Insurance number.
Social Insurance numbers should be like 999999999 ...',array('%value' => $item['value'])));
}
- if ($field['type'] == 'us_sin' && !valid_us_sin($item['value'])) {
- form_set_error($field['field_name'],t('"%value" is not a valid US Social Insurance Numbers
Social Insurance Numbers should be like 999-99-9999 or 999999999 ...',array('%value' => $item['value'])));
+ if ($field['type'] == 'us_sin' && !valid_sin_number('us', $item['value'])) {
+ form_set_error($field['field_name'],t('"%value" is not a valid US Social Security number.
Social Insurance numbers should only contain numbers and be like 999-99-9999 or 999999999 ...',array('%value' => $item['value'])));
}
}
}
@@ -163,7 +163,7 @@ function sin_field($op, &$node, $field,
case 'presave': // corresponds to hook phone_widget 'process form values' in sin-5.x
foreach ($node_field as $delta => $item) {
- //format the phone number
+ //format the number
if ($item['value'] != '') {
if ($field['type'] == 'fr_sin') {
$node_field[$delta]['value'] = format_sin_number('fr', $node_field[$delta]['value'], $field);
@@ -524,9 +524,9 @@ function theme_sin_formatter_default($el
* @param string $sinnumber
* @return boolean Returns boolean FALSE if the SIN number is not valid.
*/
-function valid_sin_number($countrycode, $phonenumber) {
+function valid_sin_number($countrycode, $sinnumber) {
- $countrycode = trim($countrycode);
+ $countrycode = trim($countrycode);
$sinnumber = trim($sinnumber);
if ($countrycode == 'fr'
@@ -540,7 +540,7 @@ function valid_sin_number($countrycode,
module_load_include('inc', 'sin', 'sin.'. $countrycode);
if (function_exists($valid_sin_function)) {
- return $valid_phone_function($sinnumber);
+ return $valid_sin_function($sinnumber);
}
else {
return false;