Allow querying the Business Process for Business Links w/o predecessor or sucessor

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45045 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 491153c0
...@@ -40,6 +40,8 @@ import zope.interface ...@@ -40,6 +40,8 @@ import zope.interface
from zLOG import LOG from zLOG import LOG
_marker = object()
class BusinessProcess(Path, XMLObject): class BusinessProcess(Path, XMLObject):
"""The BusinessProcess class is a container class which is used """The BusinessProcess class is a container class which is used
to describe business processes in the area of trade, payroll to describe business processes in the area of trade, payroll
...@@ -195,7 +197,7 @@ class BusinessProcess(Path, XMLObject): ...@@ -195,7 +197,7 @@ class BusinessProcess(Path, XMLObject):
# IBusinessLinkProcess implementation # IBusinessLinkProcess implementation
security.declareProtected(Permissions.AccessContentsInformation, 'getBusinessLinkValueList') security.declareProtected(Permissions.AccessContentsInformation, 'getBusinessLinkValueList')
def getBusinessLinkValueList(self, trade_phase=None, context=None, def getBusinessLinkValueList(self, trade_phase=None, context=None,
predecessor=None, successor=None, **kw): predecessor=_marker, successor=_marker, **kw):
"""Returns all Business Links of the current BusinessProcess which """Returns all Business Links 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.
...@@ -223,9 +225,11 @@ class BusinessProcess(Path, XMLObject): ...@@ -223,9 +225,11 @@ class BusinessProcess(Path, XMLObject):
# First, collect business links which can be applicable to a given context. # First, collect business links which can be applicable to a given context.
business_link_list = [] business_link_list = []
for business_link in original_business_link_list: for business_link in original_business_link_list:
if predecessor is not None and business_link.getPredecessor() != predecessor: if (predecessor is not _marker and
business_link.getPredecessor() != predecessor):
continue # Filter our business link which predecessor does not match continue # Filter our business link which predecessor does not match
if successor is not None and business_link.getSuccessor() != successor: if (successor is not _marker and
business_link.getSuccessor() != successor):
continue # Filter our business link which successor does not match continue # Filter our business link which successor does not match
if trade_phase is not None and not trade_phase.intersection( if trade_phase is not None and not trade_phase.intersection(
business_link.getTradePhaseList()): business_link.getTradePhaseList()):
......
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