Commit aaf58f81 authored by Łukasz Nowak's avatar Łukasz Nowak

- pass relative url to build method to be able to use it in activities

 - if no trade_phase is passed for getPathValueList return all paths
 - fix typo


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28194 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e2455221
...@@ -71,7 +71,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -71,7 +71,7 @@ class BusinessProcess(Path, XMLObject):
# Access to path and states of the business process # Access to path and states of the business process
security.declareProtected(Permissions.AccessContentsInformation, 'getPathValueList') security.declareProtected(Permissions.AccessContentsInformation, 'getPathValueList')
def getPathValueList(self, trade_phase, context=None, **kw): def getPathValueList(self, trade_phase=None, context=None, **kw):
""" """
Returns all Path of the current BusinessProcess which Returns all Path of the current BusinessProcess which
are matching the given trade_phase and the optional context. are matching the given trade_phase and the optional context.
...@@ -89,6 +89,8 @@ class BusinessProcess(Path, XMLObject): ...@@ -89,6 +89,8 @@ class BusinessProcess(Path, XMLObject):
if not isinstance(trade_phase, (list, tuple)): if not isinstance(trade_phase, (list, tuple)):
trade_phase = (trade_phase,) trade_phase = (trade_phase,)
result = [] result = []
if len(trade_phase) == 0:
return self.contentValues(portal_type="Business Path")
for document in self.contentValues(portal_type="Business Path"): for document in self.contentValues(portal_type="Business Path"):
for phase in trade_phase: for phase in trade_phase:
if document.isMemberOf('trade_phase/' + phase): # XXX - not so good, use filter if possible if document.isMemberOf('trade_phase/' + phase): # XXX - not so good, use filter if possible
...@@ -183,10 +185,11 @@ class BusinessProcess(Path, XMLObject): ...@@ -183,10 +185,11 @@ class BusinessProcess(Path, XMLObject):
result.append(state) result.append(state)
return result return result
def build(self, explanation): def build(self, explanation_relative_url):
""" """
Build whatever is buildable Build whatever is buildable
""" """
explanation = self.restrictedTraverse(explanation_relative_url)
for path in self.getBuildablePathValueList(explanation): for path in self.getBuildablePathValueList(explanation):
path.build(explanation) path.build(explanation)
...@@ -221,7 +224,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -221,7 +224,7 @@ class BusinessProcess(Path, XMLObject):
""" """
Returns a list of head path(s) of this business process Returns a list of head path(s) of this business process
trade_phase_list -- used to filterring, means that discovering trade_phase_list -- used to filtering, means that discovering
a list of head path with the trade_phase_list a list of head path with the trade_phase_list
""" """
head_path_list = list() head_path_list = list()
......
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