If you select spanish format, the module doesn't work because the regexp is wrong. I had change the regexp and now works with +xx xxx xxx xxx format and xxx xxx xxx format.

Attach the patch file.

Comments

StatusFileSize
new2.3 KB

Sorry, the previous patch has a mistake. Attach the correct patch.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status:Closed (fixed)» Needs review

Still this problem isn't solved in dev release.
Confirmed this patch works, but with a minor issue:
When no international code is entered, a space is inserted at the beginning of the phone number.
Ex: " 699 699 699"
I solved it this way:

function format_es_phone_number($phonenumber, $field = FALSE) {
  // define regular expression
  $regex = '/
   \D*                  # optional separator
   (\+[0-9]{2})?        # optional international code
   \D*                  # optional separator
   (\d{3})              # first number group
   \D*                  # optional separator
   (\d{3})              # second number group
   \D*                  # optional separator
   (\d{3})              # third number group
    $/x';
  // get digits of phone number
  preg_match($regex, $phonenumber, $matches);
  // construct ten-digit phone number
  if(strlen($matches[1])>0)
$phonenumber = $matches[1] . ' ' . $matches[2] . ' ' . $matches[3] . ' ' . $matches[4];
  else
$phonenumber = $matches[2] . ' ' . $matches[3] . ' ' . $matches[4];
  return $phonenumber;
}

(Sorry I don't have a development site to create a patch)

After applying this patch is needed this other: #1026708: Spanish phone CCK field removes content

Is this patch going to be committed?

Priority:Normal» Major

Guys why did you release a new version without fixing this?

Priority:Major» Normal

What do you mean? We haven't released a new version.

rfsbsb is the new comaintainer of this module's 1.x branches. He was just given commit access a week or two ago. Please standby.

Few days ago I was prompted to update the module and this fix was not included. That's all I mean.

Assigned:javiferrer» Unassigned
Priority:Normal» Critical

FYI: With 7.x-1.x-dev - 2013-May-25 I get this error:
Notice: Undefined offset: 3 in format_es_phone_number() (line 69 of .../sites/all/modules/phone/include/phone.es.inc).

Didn't tried any patches here.

Priority:Critical» Normal
Issue summary:View changes

Resetting priority. This isn't critical.

# 3 worked for me, and I did not have to apply patch mentioned in #4.

And I would say it is a critical bug. All attemps to save a Spanish phone number throw an error.

For me this meant that I was unable to update any nodes that had a Spanish phone number field, as this field generates an error on save every time.