From 831a7f812d50ce3e6ccccbdefd265888f11240e5 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Thu, 30 Oct 2008 14:32:43 +0000
Subject: [PATCH] Bug Fix for:

"Telephone drops the last piece after -

for example, try to enter +11(0)11-1111-1111 as a telephone number. then it becomes +11(0)11-1111
telephone should not eliminate any part."




git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24426 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Telephone.py | 3 ++-
 product/ERP5/tests/testERP5Base.py | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/Telephone.py b/product/ERP5/Document/Telephone.py
index 596f342ff4..a86b53bde4 100644
--- a/product/ERP5/Document/Telephone.py
+++ b/product/ERP5/Document/Telephone.py
@@ -73,9 +73,10 @@ class Telephone(Coordinate, Base):
   regex_list = [
     # Country, Area, Number, Extension*
     # +11(0)1-11111111/111      or +11(0)1-11111111/      or +11(0)1-11111111
+    # +11(0)1-1111-1111/111      or +11(0)1-1111-1111/      or +11(0)1-1111-1111
     # + 11 (0)1-11 11 01 01/111 or + 11 (0)1-11 11 01 01/ or + 11 (0)1-11 11 01 01
     # +11 (0)11 1011 1100/111   or +11 (0)11 1011 1100/   or +11 (0)11 1011 1100
-    "\+(?P<country>[\d\ ]*)\(0\)(?P<area>\d+)(\-|\ )(?P<number>[\d\ ]*)(?:\/)?(?P<ext>\d+|)",
+    "\+(?P<country>[\d\ ]*)\(0\)(?P<area>\d+)(\-|\ )(?P<number>[\d\ \-]*)(?:\/)?(?P<ext>\d+|)",
 
     # Country, Area, Number, Extension*
     # +11-1-11111111/111 or +11-1-11111111/ or +11-1-11111111
diff --git a/product/ERP5/tests/testERP5Base.py b/product/ERP5/tests/testERP5Base.py
index 49fd83b953..bb802dcc8e 100644
--- a/product/ERP5/tests/testERP5Base.py
+++ b/product/ERP5/tests/testERP5Base.py
@@ -1076,6 +1076,7 @@ class TestERP5Base(ERP5TypeTestCase):
       ['+111/1/1111 1100/111', '+111(0)1-11111100/111'],
       ['+111/1/1111 1100/', '+111(0)1-11111100'],
       ['+111/1/1111 1100', '+111(0)1-11111100'],
+      ['+11(0)11-1111-1111/111', '+11(0)11-11111111/111'],
     ]
 
     for i in input_list:
-- 
2.30.9