Commit de783d41 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Add getSelectionParams for convenience.

If selection columns are none, set them to the parameter columns
before returning.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1202 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cd4f7671
......@@ -145,6 +145,21 @@ class SelectionTool( UniqueObject, SimpleItem ):
#except:
# LOG('WARNING ERP5Form SelectionTool',0,'Could not set Selection')
security.declareProtected(ERP5Permissions.View, 'getSelectionParams')
def getSelectionParams(self, selection_name, params=None, REQUEST=None):
"""
Returns the params in the selection
"""
if params is None: params = []
selection = self.getSelectionFor(selection_name, REQUEST=REQUEST)
if selection is not None:
if len(selection.selection_columns) > 0:
return selection.getSelectionParams()
else:
return params
else:
return params
security.declareProtected(ERP5Permissions.View, 'setSelectionParamsFor')
def setSelectionParamsFor(self, selection_name, params, REQUEST=None):
"""
......@@ -326,12 +341,11 @@ class SelectionTool( UniqueObject, SimpleItem ):
if columns is None: columns = []
selection = self.getSelectionFor(selection_name, REQUEST=REQUEST)
if selection is not None:
if len(selection.selection_columns) > 0:
if len(selection.selection_columns) == 0:
self.setSelectionColumns(selection_name, columns, REQUEST=REQUEST)
return selection.selection_columns
else:
return columns
else:
return columns
security.declareProtected(ERP5Permissions.View, 'setSelectionStats')
......
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