From f2078a5dccc6771c3f86903aa640e503cdd7424e Mon Sep 17 00:00:00 2001
From: Pierre Buyle <buyle@pheromone.ca>
Date: Tue, 12 Feb 2013 10:20:08 -0500
Subject: [PATCH] Issue #1915188 by mongolito404: "Add the country code if not
 filled by the user" remove country code of US and CA
 numbers when provided.

---
 include/phone.ca.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/phone.ca.inc b/include/phone.ca.inc
index 6fa1432..4b40e83 100644
--- a/include/phone.ca.inc
+++ b/include/phone.ca.inc
@@ -70,7 +70,7 @@ function format_ca_phone_number($phonenumber, $field) {
   $separator = isset($field['ca_phone_separator']) ? $field['ca_phone_separator'] : '-';
 
   // construct ten-digit phone number
-  $phonenumber =
+  $phonenumber = (!empty($matches[1]) ? "$matches[1] " : '') .
     ( $field['ca_phone_parentheses'] ?
       '(' . $matches[2] . ') ' :
       $matches[2] . $separator ) .
-- 
1.7.11.1

