Commit 977ada81 authored by Rafael Monnerat's avatar Rafael Monnerat

Removed "/" if extension does not exist



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21300 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9ec41b61
......@@ -401,6 +401,9 @@ class Telephone(Coordinate, Base):
notation=notation.replace('<number>',telephone_number)
notation=notation.replace('<ext>',telephone_extension)
if telephone_extension == '':
notation=notation.replace('/','')
return notation
security.declareProtected(Permissions.AccessContentsInformation,
......
......@@ -882,71 +882,71 @@ class TestERP5Base(ERP5TypeTestCase):
pref.enable()
input_list = [
["+33(0)2-27224896/999","+33(0)2-27224896/999"],
["+33(0)2-27224896/","+33(0)2-27224896/"],
["+33(0)2-27224896","+33(0)2-27224896/"],
["+33(0)2-27224896/","+33(0)2-27224896"],
["+33(0)2-27224896","+33(0)2-27224896"],
["+33(0)-5744896/999","+33(0)2-5744896/999"],
["+33(0)-5744896/","+33(0)2-5744896/"],
["+33(0)-5744896","+33(0)2-5744896/"],
["+33(0)-5744896/","+33(0)2-5744896"],
["+33(0)-5744896","+33(0)2-5744896"],
["+(0)2-27224896/999","+33(0)2-27224896/999"],
["+(0)2-27224896/","+33(0)2-27224896/"],
["+(0)2-27224896","+33(0)2-27224896/"],
["+(0)2-27224896/","+33(0)2-27224896"],
["+(0)2-27224896","+33(0)2-27224896"],
["+(0)-27224896/999","+33(0)2-27224896/999"],
["+(0)-27224896/","+33(0)2-27224896/"],
["+(0)-27224896","+33(0)2-27224896/"],
["+(0)-27224896/","+33(0)2-27224896"],
["+(0)-27224896","+33(0)2-27224896"],
["+33(629)024425/222","+33(0)629-024425/222"],
["+33(629)024425/","+33(0)629-024425/"],
["+33(629)024425","+33(0)629-024425/"],
["+33(629)024425/","+33(0)629-024425"],
["+33(629)024425","+33(0)629-024425"],
["(22)27224897/333","+33(0)22-27224897/333"],
["(22)27224897/","+33(0)22-27224897/"],
["(22)27224897","+33(0)22-27224897/"],
["(22)27224897/","+33(0)22-27224897"],
["(22)27224897","+33(0)22-27224897"],
["(22)-12345678/222","+33(0)22-12345678/222"],
["(22)-12345678/","+33(0)22-12345678/"],
["(22)-12345678","+33(0)22-12345678/"],
["(22)-12345678/","+33(0)22-12345678"],
["(22)-12345678","+33(0)22-12345678"],
["+33 2 098765432/1","+33(0)2-098765432/1"],
["+33 2 098765432/","+33(0)2-098765432/"],
["+33 2 098765432","+33(0)2-098765432/"],
["+33 2 098765432/","+33(0)2-098765432"],
["+33 2 098765432","+33(0)2-098765432"],
["+33 662 1241 1233/999","+33(0)662-12411233/999"],
["+33 662 1241 1233/","+33(0)662-12411233/"],
["+33 662 1241 1233","+33(0)662-12411233/"],
["+33 662 1241 1233/","+33(0)662-12411233"],
["+33 662 1241 1233","+33(0)662-12411233"],
["6-62 05 76 14/999","+33(0)6-62057614/999"],
["6-62 05 76 14/","+33(0)6-62057614/"],
["6-62 05 76 14","+33(0)6-62057614/"],
["6-62 05 76 14/","+33(0)6-62057614"],
["6-62 05 76 14","+33(0)6-62057614"],
["62 05 76 14/999","+33(0)2-62057614/999"],
["62 05 76 14/","+33(0)2-62057614/"],
["62 05 76 14","+33(0)2-62057614/"],
["62 05 76 14/","+33(0)2-62057614"],
["62 05 76 14","+33(0)2-62057614"],
["631 22 43/999","+33(0)2-6312243/999"],
["631 22 43/","+33(0)2-6312243/"],
["631 22 43","+33(0)2-6312243/"],
["631 22 43/","+33(0)2-6312243"],
["631 22 43","+33(0)2-6312243"],
["631-22 43/999","+33(0)631-2243/999"],
["631-22 43/","+33(0)631-2243/"],
["631-22 43","+33(0)631-2243/"],
["631-22 43/","+33(0)631-2243"],
["631-22 43","+33(0)631-2243"],
["8291212/33","+33(0)2-8291212/33"],
["047-336-5411/999","+33(0)47-3365411/999"],
["047-336-5411/","+33(0)47-3365411/"],
["047-336-5411","+33(0)47-3365411/"],
["047-336-5411/","+33(0)47-3365411"],
["047-336-5411","+33(0)47-3365411"],
["047(336)5411/999","+33(0)47-3365411/999"],
["047(336)5411/","+33(0)47-3365411/"],
["047(336)5411","+33(0)47-3365411/"],
["047(336)5411/","+33(0)47-3365411"],
["047(336)5411","+33(0)47-3365411"],
["+33 662 1244 4112/999","+33(0)662-12444112/999"],
["+33 662 1244 4112/","+33(0)662-12444112/"],
["+33 662 1244 4112","+33(0)662-12444112/"],
["+33 662 1244 4112/","+33(0)662-12444112"],
["+33 662 1244 4112","+33(0)662-12444112"],
]
for i in input_list:
......@@ -962,79 +962,79 @@ class TestERP5Base(ERP5TypeTestCase):
pref.enable()
input_list = [
["+221(2)27224896/999","+221(2)27224896/999"],
["+221(2)27224896/","+221(2)27224896/"],
["+221(2)27224896","+221(2)27224896/"],
["+221(2)27224896/","+221(2)27224896"],
["+221(2)27224896","+221(2)27224896"],
["+221()27224896/999","+221()27224896/999"],
["+221()27224896/","+221()27224896/"],
["+221()27224896","+221()27224896/"],
["+221()27224896/","+221()27224896"],
["+221()27224896","+221()27224896"],
["+221()-27224896/999","+221()27224896/999"],
["+221()-27224896/","+221()27224896/"],
["+221()-27224896","+221()27224896/"],
["+221()-27224896/","+221()27224896"],
["+221()-27224896","+221()27224896"],
["+(2)27224896/999","+221(2)27224896/999"],
["+(2)27224896/","+221(2)27224896/"],
["+(2)27224896","+221(2)27224896/"],
["+(2)27224896/","+221(2)27224896"],
["+(2)27224896","+221(2)27224896"],
["+()27224896/999","+221()27224896/999"],
["+()27224896/","+221()27224896/"],
["+()27224896","+221()27224896/"],
["+()27224896/","+221()27224896"],
["+()27224896","+221()27224896"],
["+221(629)024425/222","+221(629)024425/222"],
["+221(629)024425/","+221(629)024425/"],
["+221(629)024425","+221(629)024425/"],
["+221(629)024425/","+221(629)024425"],
["+221(629)024425","+221(629)024425"],
["(22)27224897/333","+221(22)27224897/333"],
["(22)27224897/","+221(22)27224897/"],
["(22)27224897","+221(22)27224897/"],
["(22)27224897/","+221(22)27224897"],
["(22)27224897","+221(22)27224897"],
["(22)-12345678/222","+221(22)12345678/222"],
["(22)-12345678/","+221(22)12345678/"],
["(22)-12345678","+221(22)12345678/"],
["(22)-12345678/","+221(22)12345678"],
["(22)-12345678","+221(22)12345678"],
["+221 2 098765432/1","+221(2)098765432/1"],
["+221 2 098765432/","+221(2)098765432/"],
["+221 2 098765432","+221(2)098765432/"],
["+221 2 098765432/","+221(2)098765432"],
["+221 2 098765432","+221(2)098765432"],
["+221 662 1241 1233/999","+221(662)12411233/999"],
["+221 662 1241 1233/","+221(662)12411233/"],
["+221 662 1241 1233","+221(662)12411233/"],
["+221 662 1241 1233/","+221(662)12411233"],
["+221 662 1241 1233","+221(662)12411233"],
["6-62 05 76 14/999","+221(6)62057614/999"],
["6-62 05 76 14/","+221(6)62057614/"],
["6-62 05 76 14","+221(6)62057614/"],
["6-62 05 76 14/","+221(6)62057614"],
["6-62 05 76 14","+221(6)62057614"],
["62 05 76 14/999","+221()62057614/999"],
["62 05 76 14/","+221()62057614/"],
["62 05 76 14","+221()62057614/"],
["62 05 76 14/","+221()62057614"],
["62 05 76 14","+221()62057614"],
["631 22 43/999","+221()6312243/999"],
["631 22 43/","+221()6312243/"],
["631 22 43","+221()6312243/"],
["631 22 43/","+221()6312243"],
["631 22 43","+221()6312243"],
["631-22 43/999","+221(631)2243/999"],
["631-22 43/","+221(631)2243/"],
["631-22 43","+221(631)2243/"],
["631-22 43/","+221(631)2243"],
["631-22 43","+221(631)2243"],
["8291212/33","+221()8291212/33"],
["047-336-5411/999","+221(047)3365411/999"],
["047-336-5411/","+221(047)3365411/"],
["047-336-5411","+221(047)3365411/"],
["047-336-5411/","+221(047)3365411"],
["047-336-5411","+221(047)3365411"],
["047(336)5411/999","+221(047)3365411/999"],
["047(336)5411/","+221(047)3365411/"],
["047(336)5411","+221(047)3365411/"],
["047(336)5411/","+221(047)3365411"],
["047(336)5411","+221(047)3365411"],
["+221 662 1244 4112/999","+221(662)12444112/999"],
["+221 662 1244 4112/","+221(662)12444112/"],
["+221 662 1244 4112","+221(662)12444112/"],
["+221 662 1244 4112/","+221(662)12444112"],
["+221 662 1244 4112","+221(662)12444112"],
["+221-047-12345678/990","+221(047)12345678/990"],
["+221-047-12345678/","+221(047)12345678/"],
["+221-047-12345678","+221(047)12345678/"]
["+221-047-12345678/","+221(047)12345678"],
["+221-047-12345678","+221(047)12345678"]
]
for i in input_list:
......@@ -1051,82 +1051,81 @@ class TestERP5Base(ERP5TypeTestCase):
pref.enable()
input_list = [
["+55(2)27224896/999","+55(2)27224896/999"],
["+55(2)27224896/","+55(2)27224896/"],
["+55(2)27224896","+55(2)27224896/"],
["+55(2)27224896/","+55(2)27224896"],
["+55(2)27224896","+55(2)27224896"],
["+55()27224896/999","+55(2)27224896/999"],
["+55()27224896/","+55(2)27224896/"],
["+55()27224896","+55(2)27224896/"],
["+55()27224896/","+55(2)27224896"],
["+55()27224896","+55(2)27224896"],
["+55()-27224896/999","+55(2)27224896/999"],
["+55()-27224896/","+55(2)27224896/"],
["+55()-27224896","+55(2)27224896/"],
["+55()-27224896/","+55(2)27224896"],
["+55()-27224896","+55(2)27224896"],
["+(2)27224896/999","+55(2)27224896/999"],
["+(2)27224896/","+55(2)27224896/"],
["+(2)27224896","+55(2)27224896/"],
["+(2)27224896/","+55(2)27224896"],
["+(2)27224896","+55(2)27224896"],
["+()27224896/999","+55(2)27224896/999"],
["+()27224896/","+55(2)27224896/"],
["+()27224896","+55(2)27224896/"],
["+()27224896/","+55(2)27224896"],
["+()27224896","+55(2)27224896"],
["+55(629)024425/222","+55(629)024425/222"],
["+55(629)024425/","+55(629)024425/"],
["+55(629)024425","+55(629)024425/"],
["+55(629)024425/","+55(629)024425"],
["+55(629)024425","+55(629)024425"],
["(22)27224897/333","+55(22)27224897/333"],
["(22)27224897/","+55(22)27224897/"],
["(22)27224897","+55(22)27224897/"],
["(22)27224897/","+55(22)27224897"],
["(22)27224897","+55(22)27224897"],
["(22)-12345678/222","+55(22)12345678/222"],
["(22)-12345678/","+55(22)12345678/"],
["(22)-12345678","+55(22)12345678/"],
["(22)-12345678/","+55(22)12345678"],
["(22)-12345678","+55(22)12345678"],
["+55 2 098765432/1","+55(2)098765432/1"],
["+55 2 098765432/","+55(2)098765432/"],
["+55 2 098765432","+55(2)098765432/"],
["+55 2 098765432/","+55(2)098765432"],
["+55 2 098765432","+55(2)098765432"],
["+55 662 1241 1233/999","+55(662)12411233/999"],
["+55 662 1241 1233/","+55(662)12411233/"],
["+55 662 1241 1233","+55(662)12411233/"],
["+55 662 1241 1233/","+55(662)12411233"],
["+55 662 1241 1233","+55(662)12411233"],
["6-62 05 76 14/999","+55(6)62057614/999"],
["6-62 05 76 14/","+55(6)62057614/"],
["6-62 05 76 14","+55(6)62057614/"],
["6-62 05 76 14/","+55(6)62057614"],
["6-62 05 76 14","+55(6)62057614"],
["62 05 76 14/999","+55(2)62057614/999"],
["62 05 76 14/","+55(2)62057614/"],
["62 05 76 14","+55(2)62057614/"],
["62 05 76 14/","+55(2)62057614"],
["62 05 76 14","+55(2)62057614"],
["631 22 43/999","+55(2)6312243/999"],
["631 22 43/","+55(2)6312243/"],
["631 22 43","+55(2)6312243/"],
["631 22 43/","+55(2)6312243"],
["631 22 43","+55(2)6312243"],
["631-22 43/999","+55(631)2243/999"],
["631-22 43/","+55(631)2243/"],
["631-22 43","+55(631)2243/"],
["631-22 43/","+55(631)2243"],
["631-22 43","+55(631)2243"],
["8291212/33","+55(2)8291212/33"],
["047-336-5411/999","+55(047)3365411/999"],
["047-336-5411/","+55(047)3365411/"],
["047-336-5411","+55(047)3365411/"],
["047-336-5411/","+55(047)3365411"],
["047-336-5411","+55(047)3365411"],
["047(336)5411/999","+55(047)3365411/999"],
["047(336)5411/","+55(047)3365411/"],
["047(336)5411","+55(047)3365411/"],
["047(336)5411/","+55(047)3365411"],
["047(336)5411","+55(047)3365411"],
["+55 662 1244 4112/999","+55(662)12444112/999"],
["+55 662 1244 4112/","+55(662)12444112/"],
["+55 662 1244 4112","+55(662)12444112/"],
["+55 662 1244 4112/","+55(662)12444112"],
["+55 662 1244 4112","+55(662)12444112"],
["+55-047-12345678/990","+55(047)12345678/990"],
["+55-047-12345678/","+55(047)12345678/"],
["+55-047-12345678","+55(047)12345678/"]
["+55-047-12345678/","+55(047)12345678"],
["+55-047-12345678","+55(047)12345678"]
]
# To help with debug,
for i in input_list:
tel.fromText(coordinate_text=i[0])
self.assertEquals(i[1],tel.asText())
......@@ -1140,71 +1139,71 @@ class TestERP5Base(ERP5TypeTestCase):
pref.enable()
input_list = [
["+81(2)27224896/999","+81(2)27224896/999"],
["+81(2)27224896/","+81(2)27224896/"],
["+81(2)27224896","+81(2)27224896/"],
["+81(2)27224896/","+81(2)27224896"],
["+81(2)27224896","+81(2)27224896"],
["+(2)27224896/999","+81(2)27224896/999"],
["+(2)27224896/","+81(2)27224896/"],
["+(2)27224896","+81(2)27224896/"],
["+(2)27224896/","+81(2)27224896"],
["+(2)27224896","+81(2)27224896"],
["+()27224896/999","+81(2)27224896/999"],
["+()27224896/","+81(2)27224896/"],
["+()27224896","+81(2)27224896/"],
["+()27224896/","+81(2)27224896"],
["+()27224896","+81(2)27224896"],
["+81(629)024425/222","+81(629)024425/222"],
["+81(629)024425/","+81(629)024425/"],
["+81(629)024425","+81(629)024425/"],
["+81(629)024425/","+81(629)024425"],
["+81(629)024425","+81(629)024425"],
["(22)27224897/333","+81(22)27224897/333"],
["(22)27224897/","+81(22)27224897/"],
["(22)27224897","+81(22)27224897/"],
["(22)27224897/","+81(22)27224897"],
["(22)27224897","+81(22)27224897"],
["(22)-12345678/222","+81(22)12345678/222"],
["(22)-12345678/","+81(22)12345678/"],
["(22)-12345678","+81(22)12345678/"],
["(22)-12345678/","+81(22)12345678"],
["(22)-12345678","+81(22)12345678"],
["+81 2 098765432/1","+81(2)098765432/1"],
["+81 2 098765432/","+81(2)098765432/"],
["+81 2 098765432","+81(2)098765432/"],
["+81 2 098765432/","+81(2)098765432"],
["+81 2 098765432","+81(2)098765432"],
["+81 662 1241 1233/999","+81(662)12411233/999"],
["+81 662 1241 1233/","+81(662)12411233/"],
["+81 662 1241 1233","+81(662)12411233/"],
["+81 662 1241 1233/","+81(662)12411233"],
["+81 662 1241 1233","+81(662)12411233"],
["6-62 05 76 14/999","+81(6)62057614/999"],
["6-62 05 76 14/","+81(6)62057614/"],
["6-62 05 76 14","+81(6)62057614/"],
["6-62 05 76 14/","+81(6)62057614"],
["6-62 05 76 14","+81(6)62057614"],
["62 05 76 14/999","+81(2)62057614/999"],
["62 05 76 14/","+81(2)62057614/"],
["62 05 76 14","+81(2)62057614/"],
["62 05 76 14/","+81(2)62057614"],
["62 05 76 14","+81(2)62057614"],
["631 22 43/999","+81(2)6312243/999"],
["631 22 43/","+81(2)6312243/"],
["631 22 43","+81(2)6312243/"],
["631 22 43/","+81(2)6312243"],
["631 22 43","+81(2)6312243"],
["631-22 43/999","+81(631)2243/999"],
["631-22 43/","+81(631)2243/"],
["631-22 43","+81(631)2243/"],
["631-22 43/","+81(631)2243"],
["631-22 43","+81(631)2243"],
["8291212/33","+81(2)8291212/33"],
["047-336-5411/999","+81(047)3365411/999"],
["047-336-5411/","+81(047)3365411/"],
["047-336-5411","+81(047)3365411/"],
["047-336-5411/","+81(047)3365411"],
["047-336-5411","+81(047)3365411"],
["047(336)5411/999","+81(047)3365411/999"],
["047(336)5411/","+81(047)3365411/"],
["047(336)5411","+81(047)3365411/"],
["047(336)5411/","+81(047)3365411"],
["047(336)5411","+81(047)3365411"],
["+81 662 1244 4112/999","+81(662)12444112/999"],
["+81 662 1244 4112/","+81(662)12444112/"],
["+81 662 1244 4112","+81(662)12444112/"],
["+81 662 1244 4112/","+81(662)12444112"],
["+81 662 1244 4112","+81(662)12444112"],
["+81-047-12345678/990","+81(047)12345678/990"],
["+81-047-12345678/","+81(047)12345678/"],
["+81-047-12345678","+81(047)12345678/"]
["+81-047-12345678/","+81(047)12345678"],
["+81-047-12345678","+81(047)12345678"]
]
for i in input_list:
......@@ -1215,7 +1214,7 @@ class TestERP5Base(ERP5TypeTestCase):
pers = self.getPersonModule().newContent(portal_type='Person')
tel = pers.newContent(portal_type='Telephone')
tel.fromText(coordinate_text='12345678')
self.assertEquals('+(0)-12345678/',tel.asText())
self.assertEquals('+(0)-12345678',tel.asText())
def test_TelephoneAsTextBlankNumber(self):
# Test asText method with blank number
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment