Commit ad9524cf authored by Kevin Deldycke's avatar Kevin Deldycke

Add functions to access and modify default telephone and fax


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2514 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dcab943f
......@@ -191,6 +191,16 @@ class Entity:
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultTelephoneNumber')
def getDefaultTelephoneNumber(self):
"""
Returns the default telephone number
"""
try:
return self.getDefaultTelephone().getTelephoneNumber()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultFaxText')
def getDefaultFaxText(self):
"""
......@@ -201,6 +211,16 @@ class Entity:
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultFaxNumber')
def getDefaultFaxNumber(self):
"""
Returns the default fax number
"""
try:
return self.getDefaultFax().getTelephoneNumber()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultEmailText')
def getDefaultEmailText(self):
"""
......@@ -323,6 +343,14 @@ class Entity:
self._setDefaultTelephoneText(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultTelephoneNumber')
def setDefaultTelephoneNumber(self, coordinate):
"""
Updates the default telephone number
"""
self._setDefaultTelephoneNumber(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultFaxText')
def setDefaultFaxText(self, coordinate):
"""
......@@ -331,6 +359,14 @@ class Entity:
self._setDefaultFaxText(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultFaxNumber')
def setDefaultFaxNumber(self, coordinate):
"""
Updates the default fax number
"""
self._setDefaultFaxNumber(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultEmailText')
def setDefaultEmailText(self, coordinate):
"""
......@@ -457,6 +493,15 @@ class Entity:
)
self.default_telephone.fromText(coordinate)
security.declarePrivate('_setDefaultTelephoneNumber')
def _setDefaultTelephoneNumber(self, coordinate):
assertAttributePortalType(self, 'default_telephone', 'Telephone')
if not hasattr(self,'default_telephone'):
self.invokeFactory( type_name='Telephone'
, id='default_telephone'
)
self.default_telephone.setTelephoneNumber(coordinate)
security.declarePrivate('_setDefaultFaxText')
def _setDefaultFaxText(self, coordinate):
assertAttributePortalType(self, 'default_fax', 'Fax')
......@@ -466,6 +511,15 @@ class Entity:
)
self.default_fax.fromText(coordinate)
security.declarePrivate('_setDefaultFaxNumber')
def _setDefaultFaxNumber(self, coordinate):
assertAttributePortalType(self, 'default_fax', 'Fax')
if not hasattr(self,'default_fax'):
self.invokeFactory( type_name='Fax'
, id='default_fax'
)
self.default_fax.setTelephoneNumber(coordinate)
security.declarePrivate('_setDefaultEmailText')
def _setDefaultEmailText(self, coordinate):
assertAttributePortalType(self, 'default_email', 'Email')
......
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