Commit b710adcd authored by Jérome Perrin's avatar Jérome Perrin

remove hardcoded state checks, this is not flexible and afterall not really

needed here. (Thanks Romain for pointing this out)



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21054 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fa981ffb
...@@ -37,27 +37,21 @@ class CalendarConstraint: ...@@ -37,27 +37,21 @@ class CalendarConstraint:
'type' : 'ContentExistence', 'type' : 'ContentExistence',
'portal_type' : ('Presence Request Period', ), 'portal_type' : ('Presence Request Period', ),
'description' : 'No Presence Request Period created yet', 'description' : 'No Presence Request Period created yet',
'condition' : 'python: object.getPortalType() == "Presence Request"' 'condition' : 'python: object.getPortalType() == "Presence Request"',
' and object.getSimulationState() not'
' in ("cancelled", "deleted")',
}, },
{ 'id' : 'leave_request_line', { 'id' : 'leave_request_line',
'description' : 'Must contain at least one period', 'description' : 'Must contain at least one period',
'type' : 'ContentExistence', 'type' : 'ContentExistence',
'portal_type' : ('Leave Request Period', ), 'portal_type' : ('Leave Request Period', ),
'description' : 'No Leave Request Period created yet', 'description' : 'No Leave Request Period created yet',
'condition' : 'python: object.getPortalType() == "Leave Request"' 'condition' : 'python: object.getPortalType() == "Leave Request"',
' and object.getSimulationState() not'
' in ("cancelled", "deleted")',
}, },
{ 'id' : 'group_request_line', { 'id' : 'group_request_line',
'description' : 'Must contain at least one period', 'description' : 'Must contain at least one period',
'type' : 'ContentExistence', 'type' : 'ContentExistence',
'portal_type' : ('Group Leave Period', 'Group Presence Period', ), 'portal_type' : ('Group Leave Period', 'Group Presence Period', ),
'description' : 'No Group Presence Period created yet', 'description' : 'No Calendar Line created yet',
'condition' : 'python: object.getPortalType() == "Group Calendar"' 'condition' : 'python: object.getPortalType() == "Group Calendar"',
' and object.getSimulationState() not'
' in ("cancelled", "deleted")',
}, },
) )
...@@ -37,8 +37,6 @@ class CalendarPeriodConstraint: ...@@ -37,8 +37,6 @@ class CalendarPeriodConstraint:
'description': 'Date must be defined', 'description': 'Date must be defined',
'message_property_not_set': 'Start date must be defined', 'message_property_not_set': 'Start date must be defined',
'message_no_such_property': 'Start date must be defined', 'message_no_such_property': 'Start date must be defined',
'condition' : 'python: object.getSimulationState() not'
' in ("cancelled", "deleted")',
'type': 'PropertyExistence', 'type': 'PropertyExistence',
'start_date' : 1, 'start_date' : 1,
}, },
...@@ -47,19 +45,14 @@ class CalendarPeriodConstraint: ...@@ -47,19 +45,14 @@ class CalendarPeriodConstraint:
'description': 'Date must be defined', 'description': 'Date must be defined',
'message_property_not_set': 'Stop date must be defined', 'message_property_not_set': 'Stop date must be defined',
'message_no_such_property': 'Stop date must be defined', 'message_no_such_property': 'Stop date must be defined',
'condition' : 'python: object.getSimulationState() not'
' in ("cancelled", "deleted")',
'type': 'PropertyExistence', 'type': 'PropertyExistence',
'stop_date' : 1, 'stop_date' : 1,
}, },
{ 'id': 'resource_existence', { 'id': 'resource_existence',
'description': 'Type must be defined', 'description': 'Type must be defined',
'message_category_not_set': 'message_category_not_set': 'Type must be defined',
'Type must be defined',
'portal_type': (), 'portal_type': (),
'condition' : 'python: object.getSimulationState() not'
' in ("cancelled", "deleted")',
'type': 'CategoryExistence', 'type': 'CategoryExistence',
'resource' : 1, 'resource' : 1,
}, },
......
...@@ -35,11 +35,8 @@ class IndividualCalendarConstraint: ...@@ -35,11 +35,8 @@ class IndividualCalendarConstraint:
{ 'id': 'destination_existance', { 'id': 'destination_existance',
'description': 'Person must be defined', 'description': 'Person must be defined',
'message_category_not_set': 'message_category_not_set': 'Person must be defined',
'Person must be defined',
'portal_type': ('Person',), 'portal_type': ('Person',),
'condition' : 'python: object.getSimulationState() not'
' in ("cancelled", "deleted")',
'type': 'CategoryExistence', 'type': 'CategoryExistence',
'destination' : 1, 'destination' : 1,
}, },
......
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