Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5-Boxiang
Commits
77a1b9ce
Commit
77a1b9ce
authored
Mar 07, 2017
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP all: Stop using *_expression catalog arguments.
parent
b1d92322
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
86 additions
and
83 deletions
+86
-83
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_getPersonDetailedContributionList.py
...ins/erp5_base/Person_getPersonDetailedContributionList.py
+2
-4
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_getPersonDetailedReportSectionList.py
...ns/erp5_base/Person_getPersonDetailedReportSectionList.py
+5
-5
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_statPersonDetailedContributionList.py
...ns/erp5_base/Person_statPersonDetailedContributionList.py
+2
-4
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getAdvancedSearchResultList.py
...portal_skins/erp5_dms/Base_getAdvancedSearchResultList.py
+8
-11
bt5/erp5_email_reader/SkinTemplateItem/portal_skins/erp5_email_reader/EmailReader_generateTopicDomain.py
...kins/erp5_email_reader/EmailReader_generateTopicDomain.py
+2
-2
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_generatePersonDomain.py
...tal_skins/erp5_project/TaskModule_generatePersonDomain.py
+1
-1
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_generateProjectDomain.py
...al_skins/erp5_project/TaskModule_generateProjectDomain.py
+2
-2
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReportModule_generatePersonDomain.py
...ins/erp5_project/TaskReportModule_generatePersonDomain.py
+1
-1
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReportModule_generateProjectDomain.py
...ns/erp5_project/TaskReportModule_generateProjectDomain.py
+2
-2
bt5/erp5_registry_ohada/SkinTemplateItem/portal_skins/erp5_registry_ohada/PersonModule_getBestCandidateList.py
.../erp5_registry_ohada/PersonModule_getBestCandidateList.py
+8
-8
bt5/erp5_tiosafe_oscommerce/ExtensionTemplateItem/OscommerceERP5NodeConduit.py
...mmerce/ExtensionTemplateItem/OscommerceERP5NodeConduit.py
+2
-2
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportParameterDict.py
...ins/erp5_trade/OrderModule_getOrderReportParameterDict.py
+2
-5
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewSubjectIndexRenderer.py
...web_widget_library/WebSection_viewSubjectIndexRenderer.py
+1
-1
product/ERP5/Tool/SimulationTool.py
product/ERP5/Tool/SimulationTool.py
+1
-1
product/ERP5/tests/testSupply.py
product/ERP5/tests/testSupply.py
+1
-1
product/ERP5Catalog/CatalogTool.py
product/ERP5Catalog/CatalogTool.py
+2
-2
product/ERP5Form/ListBox.py
product/ERP5Form/ListBox.py
+11
-11
product/ERP5Type/patches/WorkflowTool.py
product/ERP5Type/patches/WorkflowTool.py
+32
-19
product/ERP5eGovSecurity/EGOVUserManager.py
product/ERP5eGovSecurity/EGOVUserManager.py
+1
-1
No files found.
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_getPersonDetailedContributionList.py
View file @
77a1b9ce
...
...
@@ -47,15 +47,13 @@ elif to_date is not None:
'range'
:
'max'
,
'query'
:
to_date
,
}
select_expression
=
{
'date'
:
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,
'portal_type'
:
None
}
group_by
=
[
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,
'portal_type'
]
# count number of object created by the user for each type of document
reference
=
kw
.
get
(
'person_reference_list'
,
context
.
Person_getUserId
())
result_list
=
context
.
portal_catalog
.
countResults
(
select_
expression
=
select_expression
,
result_list
=
context
.
portal_catalog
.
countResults
(
select_
dict
=
{
'date'
:
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,
'portal_type'
:
None
}
,
portal_type
=
portal_type_list
,
limit
=
None
,
owner
=
reference
,
group_by
_expression
=
group_by
,
group_by
=
[
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,
'portal_type'
]
,
**
count_kw
)
# build result dict per portal_type then period
...
...
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_getPersonDetailedReportSectionList.py
View file @
77a1b9ce
...
...
@@ -33,11 +33,11 @@ if context.Person_getUserId() not in (None, ""):
selection_columns
=
[(
'document_type'
,
"Document Type"
)]
if
from_date
is
None
:
# get the minimum creation date in catalog
select_expression
=
"MIN(creation_date)"
group_by
=
"creation_date"
from_date
=
DateTime
(
context
.
portal_catalog
(
select_expression
=
select_expression
,
group_by_expression
=
group_by
,
limit
=
1
)[
0
][
2
])
from_date
=
context
.
portal_catalog
(
select_list
=
[
'creation_date'
],
sort_on
=
[[
'creation_date'
,
'ASC'
]]
,
limit
=
1
,
)[
0
].
creation_date
# get period list between given date
interval_list_dict
=
getIntervalListBetweenDates
(
from_date
=
from_date
,
to_date
=
to_date
,
keys
=
{
'year'
:
aggregation_level
==
"year"
,
...
...
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Person_statPersonDetailedContributionList.py
View file @
77a1b9ce
...
...
@@ -47,14 +47,12 @@ elif to_date is not None:
'range'
:
'ngt'
,
'query'
:
to_date
,
}
select_expression
=
{
'date'
:
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
}
group_by
=
[
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,]
# count number of object created by the user for each type of document
result_list
=
context
.
portal_catalog
.
countResults
(
select_
expression
=
select_expression
,
result_list
=
context
.
portal_catalog
.
countResults
(
select_
dict
=
{
'date'
:
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
}
,
portal_type
=
portal_type_list
,
limit
=
None
,
owner
=
context
.
Person_getUserId
(),
group_by
_expression
=
group_by
,
group_by
=
[
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
]
,
**
count_kw
)
# build result dict per portal_type then period
...
...
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getAdvancedSearchResultList.py
View file @
77a1b9ce
...
...
@@ -9,6 +9,7 @@
- if requested, filters result so that only the user's docs are returned
- if requested, filters result to return only the newest versions
"""
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
portal
=
context
.
getPortalObject
()
query_kw
=
{}
...
...
@@ -49,25 +50,21 @@ for key in ('reference', 'version', 'language',):
if
value
is
not
None
:
query_kw
[
key
]
=
value
where_expression
_list
=
[]
query
_list
=
[]
creation_from
=
parsed_search_string
.
get
(
'creation_from'
,
None
)
creation_to
=
parsed_search_string
.
get
(
'creation_to'
,
None
)
modification_from
=
parsed_search_string
.
get
(
'modification_from'
,
None
)
modification_to
=
parsed_search_string
.
get
(
'modification_to'
,
None
)
if
creation_from
:
where_expression_list
.
append
(
'catalog.creation_date >= "%s"'
\
%
creation_from
.
strftime
(
date_format
))
query_list
.
append
(
SimpleQuery
(
creation_date
=
creation_from
.
strftime
(
'>='
+
date_format
)))
if
creation_to
:
where_expression_list
.
append
(
'catalog.creation_date <= "%s"'
\
%
creation_to
.
strftime
(
date_format
))
query_list
.
append
(
SimpleQuery
(
creation_date
=
creation_to
.
strftime
(
'<='
+
date_format
)))
if
modification_from
:
where_expression_list
.
append
(
'catalog.modification_date >= "%s"'
\
%
modification_from
.
strftime
(
date_format
))
query_list
.
append
(
SimpleQuery
(
modification_date
=
modification_from
.
strftime
(
'>='
+
date_format
)))
if
modification_to
:
where_expression_list
.
append
(
'catalog.modification_date <= "%s"'
\
%
modification_to
.
strftime
(
date_format
))
if
len
(
where_expression_list
):
query_kw
[
'where_expression'
]
=
' AND '
.
join
(
where_expression_list
)
query_list
.
append
(
SimpleQuery
(
modification_date
=
modification_to
.
strftime
(
'<='
+
date_format
)))
if
query_list
:
query_kw
[
'query'
]
=
ComplexQuery
(
query_list
,
logical_operator
=
'and'
)
if
parsed_search_string
.
get
(
'mine'
,
None
)
is
not
None
:
# user wants only his documents
...
...
bt5/erp5_email_reader/SkinTemplateItem/portal_skins/erp5_email_reader/EmailReader_generateTopicDomain.py
View file @
77a1b9ce
...
...
@@ -20,8 +20,8 @@ def getAvailableSubjectList(subject_list=(), container_uid=None):
"""
#log("In getAvailableSubjectList with container: %s subject_list: %s" % (container_uid, subject_list))
kw
=
dict
(
subject
=
"!="
,
select_
expression
=
"subject.subject"
,
group_by
_expression
=
"subject.subject"
,
select_
list
=
[
"subject.subject"
],
group_by
=
[
"subject.subject"
]
,
#src__=1
)
if
container_uid
:
kw
[
'parent_uid'
]
=
container_uid
...
...
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_generatePersonDomain.py
View file @
77a1b9ce
...
...
@@ -4,7 +4,7 @@ if depth == 0:
task_uid_list
=
context
.
portal_selections
.
getSelectionUidList
(
context
=
context
,
selection_name
=
'task_module_selection'
)
person_result
=
context
.
portal_catalog
(
portal_type
=
[
"Person"
,],
source_related_uid
=
task_uid_list
,
select_
expression
=
'relative_url, id, title'
,
select_
list
=
[
'relative_url'
,
'id'
,
'title'
]
,
sort_on
=
((
'title'
,
'ascending'
),))
person_dict
=
{}
...
...
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_generateProjectDomain.py
View file @
77a1b9ce
...
...
@@ -6,11 +6,11 @@ def Task_getRelatedSourceProject(depth, parent_relative_url=None):
task_uid_list
=
context
.
portal_selections
.
getSelectionUidList
(
context
=
context
,
selection_name
=
'task_module_selection'
)
project_result
=
context
.
portal_catalog
(
portal_type
=
[
"Project"
,
"Project Line"
],
source_project_related_uid
=
task_uid_list
,
select_
expression
=
'portal_type, relative_url, id, title'
,
select_
list
=
[
'portal_type'
,
'relative_url'
,
'id'
,
'title'
]
,
sort_on
=
((
'title'
,
'ascending'
),))
else
:
project_result
=
context
.
portal_catalog
(
portal_type
=
[
"Project Line"
,
"Project Milestones"
],
select_
expression
=
'portal_type, relative_url, id, title'
,
select_
list
=
[
'portal_type'
,
'relative_url'
,
'id'
,
'title'
]
,
parent_relative_url
=
parent_relative_url
,
sort_on
=
((
'title'
,
'ascending'
),))
# use a dict to store catalog result
...
...
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReportModule_generatePersonDomain.py
View file @
77a1b9ce
...
...
@@ -4,7 +4,7 @@ if depth == 0:
task_uid_list
=
context
.
portal_selections
.
getSelectionUidList
(
context
=
context
,
selection_name
=
'task_report_module_selection'
)
person_result
=
context
.
portal_catalog
(
portal_type
=
[
"Person"
,],
source_related_uid
=
task_uid_list
,
select_
expression
=
'portal_type, relative_url, id, title'
,
select_
list
=
[
'portal_type'
,
'relative_url'
,
'id'
,
'title'
]
,
sort_on
=
((
'title'
,
'ascending'
),))
person_dict
=
{}
person_list
=
[]
...
...
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReportModule_generateProjectDomain.py
View file @
77a1b9ce
...
...
@@ -6,11 +6,11 @@ def Task_getRelatedSourceProject(depth, parent_relative_url=None):
task_uid_list
=
context
.
portal_selections
.
getSelectionUidList
(
context
=
context
,
selection_name
=
'task_report_module_selection'
)
project_result
=
context
.
portal_catalog
(
portal_type
=
[
"Project"
,
"Project Line"
],
source_project_related_uid
=
task_uid_list
,
select_
expression
=
'portal_type, relative_url, id, title'
,
select_
list
=
[
'portal_type'
,
'relative_url'
,
'id'
,
'title'
]
,
sort_on
=
((
'title'
,
'ascending'
),))
else
:
project_result
=
context
.
portal_catalog
(
portal_type
=
[
"Project Line"
,
"Project Milestones"
],
select_
expression
=
'portal_type, relative_url, id, title'
,
select_
list
=
[
'portal_type'
,
'relative_url'
,
'id'
,
'title'
]
,
parent_relative_url
=
parent_relative_url
,
sort_on
=
((
'title'
,
'ascending'
),))
# use a dict to store catalog result
...
...
bt5/erp5_registry_ohada/SkinTemplateItem/portal_skins/erp5_registry_ohada/PersonModule_getBestCandidateList.py
View file @
77a1b9ce
...
...
@@ -79,18 +79,18 @@ else:
Query
(
birth_date
=
[
DateTime
(
person_start_date
.
year
(),
1
,
1
),
DateTime
(
person_start_date
.
year
(),
12
,
31
),],
range
=
'minmax'
),
operator
=
"AND"
),
operator
=
"OR"
)
select_expression
=
\
"""((title ="%s"))AS result_order
"""
%
(
person_title
)
#select_expression = \
#"""((title ="%s") + (start_date ="%s") + (birthplace_city ="%s"))AS result_order
#""" % (person_title, person_start_date, person_birthplace)
candidate_list
=
context
.
portal_catalog
(
portal_type
=
'Person'
,
query
=
query
,
select_expression
=
select_expression
,
sort_on
=
((
'result_order'
,
'DESC'
,
'int'
),),
select_expression_key
=
'result_order'
)
candidate_list
=
sorted
(
context
.
portal_catalog
(
portal_type
=
'Person'
,
query
=
query
,
select_list
=
[
'title'
],
),
key
=
lambda
x
:
x
.
title
==
person_title
)
for
candidate
in
candidate_list
:
candidate_first_name
=
candidate
.
getFirstName
()
...
...
bt5/erp5_tiosafe_oscommerce/ExtensionTemplateItem/OscommerceERP5NodeConduit.py
View file @
77a1b9ce
...
...
@@ -292,7 +292,7 @@ class OscommerceERP5NodeConduit(TioSafeBaseConduit):
address_list
=
document
.
searchFolder
(
portal_type
=
'Address'
,
sort_on
=
([
'id'
,
'ASC'
],),
where_expression
=
'id != "default_address"
'
,
id
=
'!=default_address
'
,
)
try
:
address
=
address_list
[
address_index
].
getObject
()
...
...
@@ -385,7 +385,7 @@ class OscommerceERP5NodeConduit(TioSafeBaseConduit):
address_list
=
document
.
searchFolder
(
portal_type
=
'Address'
,
sort_on
=
([
'id'
,
'ASC'
],
),
where_expression
=
'id != "default_address"
'
,
id
=
'!=default_address
'
,
)
address_id
=
address_list
[
address_index
].
getId
()
try
:
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportParameterDict.py
View file @
77a1b9ce
...
...
@@ -37,18 +37,15 @@ if from_date is None:
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
NegatedQuery
kw
=
{
"delivery.start_date"
:
None
,
"key"
:
"DefaultKey"
}
q
=
NegatedQuery
(
Query
(
**
kw
))
select_expression
=
"MIN(delivery.start_date)"
group_by
=
"delivery.start_date"
from_date
=
DateTime
()
result_list
=
context
.
portal_catalog
(
select_expression
=
select_expression
,
group_by_expression
=
group_by
,
select_dict
=
{
'start_date'
:
'delivery.start_date'
},
simulation_state
=
simulation_state
,
portal_type
=
doc_portal_type
,
query
=
q
,
limit
=
1
)
if
result_list
:
from_date
=
DateTime
(
result_list
[
0
]
[
2
]
)
from_date
=
DateTime
(
result_list
[
0
]
.
start_date
)
# get period list between given date
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/WebSection_viewSubjectIndexRenderer.py
View file @
77a1b9ce
...
...
@@ -19,7 +19,7 @@ def buildIndex(language=None):
from
Products.ZSQLCatalog.SQLCatalog
import
NegatedQuery
,
Query
# Retrieve the different subjects in the catalog
subject_list
=
context
.
searchResults
(
select_
expression
=
'subject, reference'
,
select_
list
=
[
'subject'
,
'reference'
]
,
query
=
NegatedQuery
(
Query
(
subject
=
None
)),
language
=
language
or
''
,
sort_on
=
((
'subject'
,
'ascending'
),
(
'title'
,
'ascending'
)),
...
...
product/ERP5/Tool/SimulationTool.py
View file @
77a1b9ce
...
...
@@ -808,7 +808,7 @@ class SimulationTool(BaseTool):
if
where_expression
!=
''
:
add_kw
[
'where_expression'
]
=
where_expression
add_kw
[
'predicate_category.uid'
]
=
'!=NULL'
add_kw
[
'group_by
_expression'
]
=
'uid'
add_kw
[
'group_by
'
]
=
[
'uid'
]
add_query
=
self
.
portal_catalog
(
**
add_kw
)
uid_list
=
[]
for
line
in
add_query
:
...
...
product/ERP5/tests/testSupply.py
View file @
77a1b9ce
...
...
@@ -264,7 +264,7 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
kw
=
{}
kw
[
'predicate.uid'
]
=
supply_line
.
getUid
()
kw
[
'select_
expression'
]
=
'predicate.start_date_range_min'
kw
[
'select_
list'
]
=
[
'predicate.start_date_range_min'
]
# check supply line in predicate table
result
=
self
.
catalog_tool
(
**
kw
)
...
...
product/ERP5Catalog/CatalogTool.py
View file @
77a1b9ce
...
...
@@ -576,8 +576,8 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
security_uid_dict
=
{
None
:
[
x
.
security_uid
for
x
in
\
self
.
unrestrictedSearchResults
(
allowedRolesAndUsers
=
allowedRolesAndUsers
,
select_
expression
=
"security_uid"
,
group_by
_expression
=
"security_uid"
)]
}
select_
list
=
[
"security_uid"
]
,
group_by
=
[
"security_uid"
]
)]
}
else
:
# XXX: What with this string transformation ?! Souldn't it be done in
# dtml instead ? ... yes, but how to be bw compatible ?
...
...
product/ERP5Form/ListBox.py
View file @
77a1b9ce
...
...
@@ -1367,11 +1367,11 @@ class ListBoxRenderer:
return
DomainSelection
(
domain_dict
=
root_dict
).
__of__
(
self
.
getContext
())
@
lazyMethod
def
getStatSelect
Expression
(
self
):
"""Return a
string
which expresses the information retrieved by SELECT for
def
getStatSelect
Dict
(
self
):
"""Return a
dict
which expresses the information retrieved by SELECT for
the statistics.
"""
select_
expression_list
=
[]
select_
dict
=
{}
if
self
.
showStat
():
stats
=
self
.
getSelectionTool
().
getSelectionStats
(
self
.
getSelectionName
(),
REQUEST
=
self
.
request
)
stat_column_list
=
self
.
getStatColumnList
()
...
...
@@ -1386,13 +1386,13 @@ class ListBoxRenderer:
if
(
column
is
not
None
)
and
(
column
[
0
]
==
column
[
1
]):
try
:
if
stats
[
index
]
!=
' '
:
select_
expression_list
.
append
(
'%s(%s) AS %s'
%
(
stats
[
index
],
sql
,
alias
)
)
select_
dict
[
alias
]
=
'%s(%s)'
%
(
stats
[
index
],
sql
)
else
:
select_
expression_list
.
append
(
"'' AS %s"
%
alias
)
select_
dict
[
alias
]
=
"''"
except
IndexError
:
select_
expression_list
.
append
(
"'' AS %s"
%
alias
)
select_
dict
[
alias
]
=
"''"
return
', '
.
join
(
select_expression_list
)
return
select_dict
def
makeReportTreeList
(
self
,
root_dict
=
None
,
report_path
=
None
,
base_category
=
None
,
depth
=
0
,
unfolded_list
=
(),
is_report_opened
=
True
,
sort_on
=
((
'id'
,
'ASC'
),),
...
...
@@ -1618,7 +1618,7 @@ class ListBoxRenderer:
# First, get the statitics by the global stat method.
param_dict
=
self
.
getParamDict
()
new_param_dict
=
param_dict
.
copy
()
new_param_dict
[
'select_
expression'
]
=
self
.
getStatSelectExpression
()
new_param_dict
[
'select_
dict'
]
=
self
.
getStatSelectDict
()
selection
=
self
.
getSelection
()
selection
.
edit
(
params
=
new_param_dict
)
...
...
@@ -1702,7 +1702,7 @@ class ListBoxRenderer:
selection
=
self
.
getSelection
()
selection_tool
=
self
.
getSelectionTool
()
report_list
=
selection
.
getReportList
()
stat_select_
expression
=
self
.
getStatSelectExpression
()
stat_select_
dict
=
self
.
getStatSelectDict
()
stat_method
=
self
.
getStatMethod
()
count_method
=
self
.
getCountMethod
()
list_method
=
self
.
getListMethod
()
...
...
@@ -1768,9 +1768,9 @@ class ListBoxRenderer:
stat_method
)
if
report_tree
.
is_pure_summary
and
self
.
showStat
():
# Push a new select_
expression
.
# Push a new select_
dict
.
new_param_dict
=
param_dict
.
copy
()
new_param_dict
[
'select_
expression'
]
=
stat_select_expression
new_param_dict
[
'select_
dict'
]
=
stat_select_dict
selection
.
edit
(
params
=
new_param_dict
)
# Query the stat.
...
...
product/ERP5Type/patches/WorkflowTool.py
View file @
77a1b9ce
...
...
@@ -493,8 +493,8 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
sql_catalog
.
getSQLCatalogSecurityUidGroupsColumnsDict
()
getSecurityUidDictAndRoleColumnDict
=
\
portal_catalog
.
getSecurityUidDictAndRoleColumnDict
search_result
=
getattr
(
self
,
"Base_getCountFromWorklistTable"
,
None
)
use_cache
=
search_result
is
not
None
search_result
_
=
getattr
(
self
,
"Base_getCountFromWorklistTable"
,
None
)
use_cache
=
search_result
_
is
not
None
if
use_cache
:
ignored_security_column_id_set
=
self
.
_getWorklistIgnoredSecurityColumnSet
()
ignored_security_uid_parameter_set
=
{
x
...
...
@@ -512,12 +512,26 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
ignored_security_uid_parameter_set
:
security_uid_dict
.
pop
(
ignored_security_uid_parameter
)
return
security_uid_dict
,
role_column_dict
,
local_role_column_dict
select_expression_prefix
=
'sum(`%s`) as %s'
%
(
COUNT_COLUMN_TITLE
,
COUNT_COLUMN_TITLE
)
count_column_expression
=
'sum(`%s`)'
%
(
COUNT_COLUMN_TITLE
,
)
# Prevent catalog from trying to join
getQuery
=
SimpleQuery
# BBB
def
search_result
(
select_dict
,
group_by
,
query
,
limit
,
src__
):
select_item_list
=
[]
for
alias
,
expression
in
select_dict
.
iteritems
():
if
expression
is
None
:
expression
=
alias
select_item_list
.
append
(
'%s AS %s'
%
(
expression
,
alias
))
return
search_result_
(
select_expression
=
','
.
join
(
select_item_list
),
group_by_expression
=
','
.
join
(
group_by
),
query
=
query
,
limit
=
limit
,
src__
=
src__
,
)
else
:
search_result
=
portal_catalog
.
unrestrictedSearchResults
select_expression_prefix
=
'count(*) as %s'
%
(
COUNT_COLUMN_TITLE
,
)
count_column_expression
=
'count(*)'
# Let catalog join as needed
getQuery
=
lambda
comparison_operator
=
None
,
**
kw
:
AutoQuery
(
operator
=
comparison_operator
,
...
...
@@ -544,18 +558,15 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
getQuery
=
getQuery
,
grouped_worklist_dict
=
grouped_worklist_dict
,
)
group_by
_expression
=
', '
.
join
(
total_criterion_id_list
)
group_by
=
total_criterion_id_list
assert
COUNT_COLUMN_TITLE
not
in
total_criterion_id_list
# If required mapping method is not present on the query, assume it
# handles column mapping properly, and build a bare select
# expression.
select_expression
=
select_expression_prefix
+
', '
\
+
group_by_expression
select_dict
=
dict
.
fromkeys
(
total_criterion_id_list
)
select_dict
[
COUNT_COLUMN_TITLE
]
=
count_column_expression
catalog_brain_result
=
[]
try
:
catalog_brain_result
=
search_result
(
select_
expression
=
select_expression
,
group_by
_expression
=
group_by_expression
,
select_
dict
=
select_dict
,
group_by
=
group_by
,
query
=
query
,
limit
=
None
,
src__
=
src__
)
...
...
@@ -684,14 +695,16 @@ def WorkflowTool_refreshWorklistCache(self):
for
security_column_id
in
security_column_id_set
:
assert
security_column_id
not
in
total_criterion_id_list
total_criterion_id_list
.
append
(
security_column_id
)
group_by
_expression
=
', '
.
join
(
total_criterion_id_list
)
group_by
=
total_criterion_id_list
assert
COUNT_COLUMN_TITLE
not
in
total_criterion_id_list
select_expression
=
'count(*) as %s, %s'
%
(
COUNT_COLUMN_TITLE
,
group_by_expression
)
search_result_kw
=
{
'select_expression'
:
select_expression
,
'group_by_expression'
:
group_by_expression
,
'query'
:
query
,
'limit'
:
None
}
select_dict
=
dict
.
fromkeys
(
total_criterion_id_list
)
select_dict
[
COUNT_COLUMN_TITLE
]
=
'count(*)'
search_result_kw
=
{
'select_dict'
:
select_dict
,
'group_by'
:
group_by
,
'query'
:
query
,
'limit'
:
None
,
}
#LOG('refreshWorklistCache', WARNING, 'Using query: %s' % \
# (search_result(src__=1, **search_result_kw), ))
catalog_brain_result
=
search_result
(
**
search_result_kw
)
...
...
product/ERP5eGovSecurity/EGOVUserManager.py
View file @
77a1b9ce
...
...
@@ -216,7 +216,7 @@ class EGOVUserManager(ERP5UserManager):
newSecurityManager
(
self
,
self
.
getUser
(
SUPER_USER
))
try
:
result
=
portal
.
portal_catalog
.
unrestrictedSearchResults
(
select_
expression
=
'reference'
,
select_
list
=
[
'reference'
]
,
portal_type
=
self
.
portal_type_list
,
reference
=
login
)
if
len
(
result
)
!=
1
:
# we won't proceed with groups
if
len
(
result
)
>
1
:
# configuration is screwed
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment