Commit cf9e5612 authored by Kevin Deldycke's avatar Kevin Deldycke

Move default career accessors from Entity to Person


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2581 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9cbb0e08
...@@ -81,86 +81,6 @@ class Entity: ...@@ -81,86 +81,6 @@ class Entity:
except: except:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultCareerTitle')
def getDefaultCareerTitle(self):
"""
Returns the default address city as a text string
"""
try:
return self.getDefaultCareerValue().getTitle()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultCareerDescription')
def getDefaultCareerDescription(self):
"""
Returns the default address city as a text string
"""
try:
return self.getDefaultCareerValue().getDescription()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultCareerCollectiveAgreementTitle')
def getDefaultCareerCollectiveAgreementTitle(self):
"""
Returns the default address city as a text string
"""
try:
return self.getDefaultCareerValue().getCollectiveAgreementTitle()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultCareerDestinationTitle')
def getDefaultCareerDestinationTitle(self):
"""
Returns the default address city as a text string
"""
try:
return self.getDefaultCareerValue().getDestinationTitle()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultCareerStartDate')
def getDefaultCareerStartDate(self):
"""
Returns the default address city as a text string
"""
try:
return self.getDefaultCareerValue().getStartDate()
except:
return None
security.declareProtected(Permissions.View, 'getDefaultCareerStopDate')
def getDefaultCareerStopDate(self):
"""
Returns the default address city as a text string
"""
try:
return self.getDefaultCareerValue().getStopDate()
except:
return None
security.declareProtected(Permissions.View, 'getDefaultCareerSalaryLevel')
def getDefaultCareerSalaryLevel(self):
"""
Returns the default address city as a text string
"""
try:
return self.getDefaultCareerValue().getSalaryLevel()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultCareerSalaryCoefficient')
def getDefaultCareerSalaryCoefficient(self):
"""
Returns the default address city as a text string
"""
try:
return self.getDefaultCareerValue().getSalaryCoefficient()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultAddressRegion') security.declareProtected(Permissions.View, 'getDefaultAddressRegion')
def getDefaultAddressRegion(self): def getDefaultAddressRegion(self):
""" """
...@@ -199,7 +119,7 @@ class Entity: ...@@ -199,7 +119,7 @@ class Entity:
try: try:
return self.getDefaultTelephone().getTelephoneNumber() return self.getDefaultTelephone().getTelephoneNumber()
except: except:
return '' return ''
security.declareProtected(Permissions.View, 'getDefaultFaxText') security.declareProtected(Permissions.View, 'getDefaultFaxText')
def getDefaultFaxText(self): def getDefaultFaxText(self):
...@@ -239,62 +159,6 @@ class Entity: ...@@ -239,62 +159,6 @@ class Entity:
self._setDefaultAddress(coordinate) self._setDefaultAddress(coordinate)
self.reindexObject() self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerTitle')
def setDefaultCareerTitle(self, coordinate):
"""
Updates the default address from a standard text string
"""
self._setDefaultCareerTitle(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerDescription')
def setDefaultCareerDescription(self, coordinate):
"""
Updates the default address from a standard text string
"""
self._setDefaultCareerDescription(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerCollectiveAgreementTitle')
def setDefaultCareerCollectiveAgreementTitle(self, coordinate):
"""
Updates the default address from a standard text string
"""
self._setDefaultCareerCollectiveAgreementTitle(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerStartDate')
def setDefaultCareerStartDate(self, coordinate):
"""
Updates the default address from a standard text string
"""
self._setDefaultCareerStartDate(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerStopDate')
def setDefaultCareerStopDate(self, coordinate):
"""
Updates the default address from a standard text string
"""
self._setDefaultCareerStopDate(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerSalaryLevel')
def setDefaultCareerSalaryLevel(self, coordinate):
"""
Updates the default address from a standard text string
"""
self._setDefaultCareerSalaryLevel(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerSalaryCoefficient')
def setDefaultCareerSalaryCoefficient(self, coordinate):
"""
Updates the default address from a standard text string
"""
self._setDefaultCareerSalaryCoefficient(coordinate)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultAddressText') security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultAddressText')
def setDefaultAddressText(self, coordinate): def setDefaultAddressText(self, coordinate):
""" """
...@@ -349,7 +213,7 @@ class Entity: ...@@ -349,7 +213,7 @@ class Entity:
Updates the default telephone number Updates the default telephone number
""" """
self._setDefaultTelephoneNumber(coordinate) self._setDefaultTelephoneNumber(coordinate)
self.reindexObject() self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultFaxText') security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultFaxText')
def setDefaultFaxText(self, coordinate): def setDefaultFaxText(self, coordinate):
...@@ -362,11 +226,11 @@ class Entity: ...@@ -362,11 +226,11 @@ class Entity:
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultFaxNumber') security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultFaxNumber')
def setDefaultFaxNumber(self, coordinate): def setDefaultFaxNumber(self, coordinate):
""" """
Updates the default fax number Updates the default fax number
""" """
self._setDefaultFaxNumber(coordinate) self._setDefaultFaxNumber(coordinate)
self.reindexObject() self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultEmailText') security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultEmailText')
def setDefaultEmailText(self, coordinate): def setDefaultEmailText(self, coordinate):
""" """
...@@ -375,7 +239,9 @@ class Entity: ...@@ -375,7 +239,9 @@ class Entity:
self._setDefaultEmailText(coordinate) self._setDefaultEmailText(coordinate)
self.reindexObject() self.reindexObject()
### Private methods - no reindexing ### Private methods - no reindexing
security.declarePrivate('_setDefaultAddress') security.declarePrivate('_setDefaultAddress')
def _setDefaultAddress(self, coordinate): def _setDefaultAddress(self, coordinate):
assertAttributePortalType(self, 'default_address', 'Address') assertAttributePortalType(self, 'default_address', 'Address')
...@@ -430,69 +296,6 @@ class Entity: ...@@ -430,69 +296,6 @@ class Entity:
) )
self.default_address.setRegion(value) self.default_address.setRegion(value)
security.declarePrivate('_setDefaultCareerTitle')
def _setDefaultCareerTitle(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setTitle(coordinate)
security.declarePrivate('_setDefaultCareerDescription')
def _setDefaultCareerDescription(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setDescription(coordinate)
security.declarePrivate('_setDefaultCareerCollectiveAgreementTitle')
def _setDefaultCareerCollectiveAgreementTitle(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setCollectiveAgreementTitle(coordinate)
security.declarePrivate('_setDefaultCareerStartDate')
def _setDefaultCareerStartDate(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setStartDate(coordinate)
security.declarePrivate('_setDefaultCareerStopDate')
def _setDefaultCareerStopDate(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setStopDate(coordinate)
security.declarePrivate('_setDefaultCareerSalaryLevel')
def _setDefaultCareerSalaryLevel(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setSalaryLevel(coordinate)
security.declarePrivate('_setDefaultCareerSalaryCoefficient')
def _setDefaultCareerSalaryCoefficient(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setSalaryCoefficient(coordinate)
security.declarePrivate('_setDefaultTelephoneText') security.declarePrivate('_setDefaultTelephoneText')
def _setDefaultTelephoneText(self, coordinate): def _setDefaultTelephoneText(self, coordinate):
assertAttributePortalType(self, 'default_telephone', 'Telephone') assertAttributePortalType(self, 'default_telephone', 'Telephone')
...@@ -523,12 +326,12 @@ class Entity: ...@@ -523,12 +326,12 @@ class Entity:
security.declarePrivate('_setDefaultFaxNumber') security.declarePrivate('_setDefaultFaxNumber')
def _setDefaultFaxNumber(self, coordinate): def _setDefaultFaxNumber(self, coordinate):
assertAttributePortalType(self, 'default_fax', 'Fax') assertAttributePortalType(self, 'default_fax', 'Fax')
if not hasattr(self,'default_fax'): if not hasattr(self,'default_fax'):
self.invokeFactory( type_name='Fax' self.invokeFactory( type_name='Fax'
, id='default_fax' , id='default_fax'
) )
self.default_fax.setTelephoneNumber(coordinate) self.default_fax.setTelephoneNumber(coordinate)
security.declarePrivate('_setDefaultEmailText') security.declarePrivate('_setDefaultEmailText')
def _setDefaultEmailText(self, coordinate): def _setDefaultEmailText(self, coordinate):
assertAttributePortalType(self, 'default_email', 'Email') assertAttributePortalType(self, 'default_email', 'Email')
...@@ -563,4 +366,4 @@ class Entity: ...@@ -563,4 +366,4 @@ class Entity:
""" """
portal_workflow = getToolByName(self, 'portal_workflow') portal_workflow = getToolByName(self, 'portal_workflow')
wf = portal_workflow.getWorkflowById('validation_workflow') wf = portal_workflow.getWorkflowById('validation_workflow')
return wf._getWorkflowStateOf(self, id_only=id_only ) return wf._getWorkflowStateOf(self, id_only=id_only)
\ No newline at end of file
...@@ -29,12 +29,14 @@ ...@@ -29,12 +29,14 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Utils import assertAttributePortalType
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.Core.Node import Node from Products.ERP5.Core.Node import Node
from Products.ERP5.Document.Entity import Entity from Products.ERP5.Document.Entity import Entity
class Person(Entity, Node, XMLObject): class Person(Entity, Node, XMLObject):
""" """
An Person object holds the information about An Person object holds the information about
...@@ -136,11 +138,11 @@ etc.).""" ...@@ -136,11 +138,11 @@ etc.)."""
""" """
if self.title == '': if self.title == '':
name_list = [] name_list = []
if self.getFirstName() not in (None, ''): if self.getFirstName() not in (None, ''):
name_list.append(self.getFirstName()) name_list.append(self.getFirstName())
if self.getMiddleName() not in (None, ''): if self.getMiddleName() not in (None, ''):
name_list.append(self.getMiddleName()) name_list.append(self.getMiddleName())
if self.getLastName() not in (None, ''): if self.getLastName() not in (None, ''):
name_list.append(self.getLastName()) name_list.append(self.getLastName())
return ' '.join(name_list) return ' '.join(name_list)
else: else:
...@@ -162,7 +164,7 @@ etc.).""" ...@@ -162,7 +164,7 @@ etc.)."""
self.first_name = value self.first_name = value
if self.getFirstName()!=None and self.getLastName()!=None: if self.getFirstName()!=None and self.getLastName()!=None:
self._setTitle(self.getFirstName()+' '+self.getLastName()) self._setTitle(self.getFirstName()+' '+self.getLastName())
security.declareProtected(Permissions.ModifyPortalContent, 'setFirstName') security.declareProtected(Permissions.ModifyPortalContent, 'setFirstName')
def setFirstName(self, value): def setFirstName(self, value):
""" """
...@@ -178,7 +180,7 @@ etc.).""" ...@@ -178,7 +180,7 @@ etc.)."""
self.last_name = value self.last_name = value
if self.getFirstName()!=None and self.getLastName()!=None: if self.getFirstName()!=None and self.getLastName()!=None:
self._setTitle(self.getFirstName()+' '+self.getLastName()) self._setTitle(self.getFirstName()+' '+self.getLastName())
security.declareProtected(Permissions.ModifyPortalContent, 'setLastName') security.declareProtected(Permissions.ModifyPortalContent, 'setLastName')
def setLastName(self, value): def setLastName(self, value):
""" """
...@@ -186,3 +188,205 @@ etc.).""" ...@@ -186,3 +188,205 @@ etc.)."""
""" """
self._setLastName(value) self._setLastName(value)
self.reindexObject() self.reindexObject()
security.declareProtected(Permissions.View, 'getDefaultCareerTitle')
def getDefaultCareerTitle(self):
"""
Returns the default career title
"""
try:
return self.getDefaultCareerValue().getTitle()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultCareerDescription')
def getDefaultCareerDescription(self):
"""
Returns the default career description
"""
try:
return self.getDefaultCareerValue().getDescription()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultCareerCollectiveAgreementTitle')
def getDefaultCareerCollectiveAgreementTitle(self):
"""
Returns the default career collective agreement
"""
try:
return self.getDefaultCareerValue().getCollectiveAgreementTitle()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultCareerDestinationTitle')
def getDefaultCareerDestinationTitle(self):
"""
Returns the default career subordination
"""
try:
return self.getDefaultCareerValue().getDestinationTitle()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultCareerStartDate')
def getDefaultCareerStartDate(self):
"""
Returns the default career start date
"""
try:
return self.getDefaultCareerValue().getStartDate()
except:
return None
security.declareProtected(Permissions.View, 'getDefaultCareerStopDate')
def getDefaultCareerStopDate(self):
"""
Returns the default career stop date
"""
try:
return self.getDefaultCareerValue().getStopDate()
except:
return None
security.declareProtected(Permissions.View, 'getDefaultCareerSalaryLevel')
def getDefaultCareerSalaryLevel(self):
"""
Returns the default career salary level
"""
try:
return self.getDefaultCareerValue().getSalaryLevel()
except:
return ''
security.declareProtected(Permissions.View, 'getDefaultCareerSalaryCoefficient')
def getDefaultCareerSalaryCoefficient(self):
"""
Returns the default career salary coefficient
"""
try:
return self.getDefaultCareerValue().getSalaryCoefficient()
except:
return ''
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerTitle')
def setDefaultCareerTitle(self, value):
"""
Updates the default career title
"""
self._setDefaultCareerTitle(value)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerDescription')
def setDefaultCareerDescription(self, value):
"""
Updates the default career description
"""
self._setDefaultCareerDescription(value)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerCollectiveAgreementTitle')
def setDefaultCareerCollectiveAgreementTitle(self, value):
"""
Updates the default career collective agreement
"""
self._setDefaultCareerCollectiveAgreementTitle(value)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerStartDate')
def setDefaultCareerStartDate(self, value):
"""
Updates the defaul career start date
"""
self._setDefaultCareerStartDate(value)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerStopDate')
def setDefaultCareerStopDate(self, value):
"""
Updates the default career stop date
"""
self._setDefaultCareerStopDate(value)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerSalaryLevel')
def setDefaultCareerSalaryLevel(self, value):
"""
Updates the default career salary level
"""
self._setDefaultCareerSalaryLevel(value)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'setDefaultCareerSalaryCoefficient')
def setDefaultCareerSalaryCoefficient(self, value):
"""
Updates the default career salary coefficient
"""
self._setDefaultCareerSalaryCoefficient(value)
self.reindexObject()
### Private methods - no reindexing
security.declarePrivate('_setDefaultCareerTitle')
def _setDefaultCareerTitle(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setTitle(coordinate)
security.declarePrivate('_setDefaultCareerDescription')
def _setDefaultCareerDescription(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setDescription(coordinate)
security.declarePrivate('_setDefaultCareerCollectiveAgreementTitle')
def _setDefaultCareerCollectiveAgreementTitle(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setCollectiveAgreementTitle(coordinate)
security.declarePrivate('_setDefaultCareerStartDate')
def _setDefaultCareerStartDate(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setStartDate(coordinate)
security.declarePrivate('_setDefaultCareerStopDate')
def _setDefaultCareerStopDate(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setStopDate(coordinate)
security.declarePrivate('_setDefaultCareerSalaryLevel')
def _setDefaultCareerSalaryLevel(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setSalaryLevel(coordinate)
security.declarePrivate('_setDefaultCareerSalaryCoefficient')
def _setDefaultCareerSalaryCoefficient(self, coordinate):
assertAttributePortalType(self, 'default_career', 'Career')
if not hasattr(self,'default_career'):
self.invokeFactory( type_name='Career'
, id='default_career'
)
self.default_career.setSalaryCoefficient(coordinate)
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