Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
francois
erp5
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
Show 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:
...
@@ -47,15 +47,13 @@ elif to_date is not None:
'range'
:
'max'
,
'range'
:
'max'
,
'query'
:
to_date
,
'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
# count number of object created by the user for each type of document
reference
=
kw
.
get
(
'person_reference_list'
,
context
.
Person_getUserId
())
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
,
portal_type
=
portal_type_list
,
limit
=
None
,
owner
=
reference
,
owner
=
reference
,
group_by
_expression
=
group_by
,
group_by
=
[
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
,
'portal_type'
]
,
**
count_kw
)
**
count_kw
)
# build result dict per portal_type then period
# 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, ""):
...
@@ -33,11 +33,11 @@ if context.Person_getUserId() not in (None, ""):
selection_columns
=
[(
'document_type'
,
"Document Type"
)]
selection_columns
=
[(
'document_type'
,
"Document Type"
)]
if
from_date
is
None
:
if
from_date
is
None
:
# get the minimum creation date in catalog
# get the minimum creation date in catalog
select_expression
=
"MIN(creation_date)"
from_date
=
context
.
portal_catalog
(
group_by
=
"creation_date"
select_list
=
[
'creation_date'
],
from_date
=
DateTime
(
context
.
portal_catalog
(
select_expression
=
select_expression
,
sort_on
=
[[
'creation_date'
,
'ASC'
]]
,
group_by_expression
=
group_by
,
limit
=
1
,
limit
=
1
)[
0
][
2
])
)[
0
].
creation_date
# get period list between given date
# get period list between given date
interval_list_dict
=
getIntervalListBetweenDates
(
from_date
=
from_date
,
to_date
=
to_date
,
interval_list_dict
=
getIntervalListBetweenDates
(
from_date
=
from_date
,
to_date
=
to_date
,
keys
=
{
'year'
:
aggregation_level
==
"year"
,
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:
...
@@ -47,14 +47,12 @@ elif to_date is not None:
'range'
:
'ngt'
,
'range'
:
'ngt'
,
'query'
:
to_date
,
'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
# 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
,
portal_type
=
portal_type_list
,
limit
=
None
,
owner
=
context
.
Person_getUserId
(),
owner
=
context
.
Person_getUserId
(),
group_by
_expression
=
group_by
,
group_by
=
[
'DATE_FORMAT(creation_date, "%s")'
%
sql_format
]
,
**
count_kw
)
**
count_kw
)
# build result dict per portal_type then period
# 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 @@
...
@@ -9,6 +9,7 @@
- if requested, filters result so that only the user's docs are returned
- if requested, filters result so that only the user's docs are returned
- if requested, filters result to return only the newest versions
- if requested, filters result to return only the newest versions
"""
"""
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
query_kw
=
{}
query_kw
=
{}
...
@@ -49,25 +50,21 @@ for key in ('reference', 'version', 'language',):
...
@@ -49,25 +50,21 @@ for key in ('reference', 'version', 'language',):
if
value
is
not
None
:
if
value
is
not
None
:
query_kw
[
key
]
=
value
query_kw
[
key
]
=
value
where_expression
_list
=
[]
query
_list
=
[]
creation_from
=
parsed_search_string
.
get
(
'creation_from'
,
None
)
creation_from
=
parsed_search_string
.
get
(
'creation_from'
,
None
)
creation_to
=
parsed_search_string
.
get
(
'creation_to'
,
None
)
creation_to
=
parsed_search_string
.
get
(
'creation_to'
,
None
)
modification_from
=
parsed_search_string
.
get
(
'modification_from'
,
None
)
modification_from
=
parsed_search_string
.
get
(
'modification_from'
,
None
)
modification_to
=
parsed_search_string
.
get
(
'modification_to'
,
None
)
modification_to
=
parsed_search_string
.
get
(
'modification_to'
,
None
)
if
creation_from
:
if
creation_from
:
where_expression_list
.
append
(
'catalog.creation_date >= "%s"'
\
query_list
.
append
(
SimpleQuery
(
creation_date
=
creation_from
.
strftime
(
'>='
+
date_format
)))
%
creation_from
.
strftime
(
date_format
))
if
creation_to
:
if
creation_to
:
where_expression_list
.
append
(
'catalog.creation_date <= "%s"'
\
query_list
.
append
(
SimpleQuery
(
creation_date
=
creation_to
.
strftime
(
'<='
+
date_format
)))
%
creation_to
.
strftime
(
date_format
))
if
modification_from
:
if
modification_from
:
where_expression_list
.
append
(
'catalog.modification_date >= "%s"'
\
query_list
.
append
(
SimpleQuery
(
modification_date
=
modification_from
.
strftime
(
'>='
+
date_format
)))
%
modification_from
.
strftime
(
date_format
))
if
modification_to
:
if
modification_to
:
where_expression_list
.
append
(
'catalog.modification_date <= "%s"'
\
query_list
.
append
(
SimpleQuery
(
modification_date
=
modification_to
.
strftime
(
'<='
+
date_format
)))
%
modification_to
.
strftime
(
date_format
))
if
query_list
:
if
len
(
where_expression_list
):
query_kw
[
'query'
]
=
ComplexQuery
(
query_list
,
logical_operator
=
'and'
)
query_kw
[
'where_expression'
]
=
' AND '
.
join
(
where_expression_list
)
if
parsed_search_string
.
get
(
'mine'
,
None
)
is
not
None
:
if
parsed_search_string
.
get
(
'mine'
,
None
)
is
not
None
:
# user wants only his documents
# 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):
...
@@ -20,8 +20,8 @@ def getAvailableSubjectList(subject_list=(), container_uid=None):
"""
"""
#log("In getAvailableSubjectList with container: %s subject_list: %s" % (container_uid, subject_list))
#log("In getAvailableSubjectList with container: %s subject_list: %s" % (container_uid, subject_list))
kw
=
dict
(
subject
=
"!="
,
kw
=
dict
(
subject
=
"!="
,
select_
expression
=
"subject.subject"
,
select_
list
=
[
"subject.subject"
],
group_by
_expression
=
"subject.subject"
,
group_by
=
[
"subject.subject"
]
,
#src__=1
#src__=1
)
)
if
container_uid
:
kw
[
'parent_uid'
]
=
container_uid
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:
...
@@ -4,7 +4,7 @@ if depth == 0:
task_uid_list
=
context
.
portal_selections
.
getSelectionUidList
(
context
=
context
,
selection_name
=
'task_module_selection'
)
task_uid_list
=
context
.
portal_selections
.
getSelectionUidList
(
context
=
context
,
selection_name
=
'task_module_selection'
)
person_result
=
context
.
portal_catalog
(
portal_type
=
[
"Person"
,],
person_result
=
context
.
portal_catalog
(
portal_type
=
[
"Person"
,],
source_related_uid
=
task_uid_list
,
source_related_uid
=
task_uid_list
,
select_
expression
=
'relative_url, id, title'
,
select_
list
=
[
'relative_url'
,
'id'
,
'title'
]
,
sort_on
=
((
'title'
,
'ascending'
),))
sort_on
=
((
'title'
,
'ascending'
),))
person_dict
=
{}
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):
...
@@ -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'
)
task_uid_list
=
context
.
portal_selections
.
getSelectionUidList
(
context
=
context
,
selection_name
=
'task_module_selection'
)
project_result
=
context
.
portal_catalog
(
portal_type
=
[
"Project"
,
"Project Line"
],
project_result
=
context
.
portal_catalog
(
portal_type
=
[
"Project"
,
"Project Line"
],
source_project_related_uid
=
task_uid_list
,
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'
),))
sort_on
=
((
'title'
,
'ascending'
),))
else
:
else
:
project_result
=
context
.
portal_catalog
(
portal_type
=
[
"Project Line"
,
"Project Milestones"
],
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
,
parent_relative_url
=
parent_relative_url
,
sort_on
=
((
'title'
,
'ascending'
),))
sort_on
=
((
'title'
,
'ascending'
),))
# use a dict to store catalog result
# 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:
...
@@ -4,7 +4,7 @@ if depth == 0:
task_uid_list
=
context
.
portal_selections
.
getSelectionUidList
(
context
=
context
,
selection_name
=
'task_report_module_selection'
)
task_uid_list
=
context
.
portal_selections
.
getSelectionUidList
(
context
=
context
,
selection_name
=
'task_report_module_selection'
)
person_result
=
context
.
portal_catalog
(
portal_type
=
[
"Person"
,],
person_result
=
context
.
portal_catalog
(
portal_type
=
[
"Person"
,],
source_related_uid
=
task_uid_list
,
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'
),))
sort_on
=
((
'title'
,
'ascending'
),))
person_dict
=
{}
person_dict
=
{}
person_list
=
[]
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):
...
@@ -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'
)
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"
],
project_result
=
context
.
portal_catalog
(
portal_type
=
[
"Project"
,
"Project Line"
],
source_project_related_uid
=
task_uid_list
,
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'
),))
sort_on
=
((
'title'
,
'ascending'
),))
else
:
else
:
project_result
=
context
.
portal_catalog
(
portal_type
=
[
"Project Line"
,
"Project Milestones"
],
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
,
parent_relative_url
=
parent_relative_url
,
sort_on
=
((
'title'
,
'ascending'
),))
sort_on
=
((
'title'
,
'ascending'
),))
# use a dict to store catalog result
# 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:
...
@@ -79,18 +79,18 @@ else:
Query
(
birth_date
=
[
DateTime
(
person_start_date
.
year
(),
1
,
1
),
DateTime
(
person_start_date
.
year
(),
12
,
31
),],
range
=
'minmax'
),
Query
(
birth_date
=
[
DateTime
(
person_start_date
.
year
(),
1
,
1
),
DateTime
(
person_start_date
.
year
(),
12
,
31
),],
range
=
'minmax'
),
operator
=
"AND"
),
operator
=
"AND"
),
operator
=
"OR"
)
operator
=
"OR"
)
select_expression
=
\
"""((title ="%s"))AS result_order
"""
%
(
person_title
)
#select_expression = \
#select_expression = \
#"""((title ="%s") + (start_date ="%s") + (birthplace_city ="%s"))AS result_order
#"""((title ="%s") + (start_date ="%s") + (birthplace_city ="%s"))AS result_order
#""" % (person_title, person_start_date, person_birthplace)
#""" % (person_title, person_start_date, person_birthplace)
candidate_list
=
context
.
portal_catalog
(
portal_type
=
'Person'
,
candidate_list
=
sorted
(
query
=
query
,
context
.
portal_catalog
(
select_expression
=
select_expression
,
portal_type
=
'Person'
,
sort_on
=
((
'result_order'
,
'DESC'
,
'int'
),),
query
=
query
,
select_expression_key
=
'result_order'
)
select_list
=
[
'title'
],
),
key
=
lambda
x
:
x
.
title
==
person_title
)
for
candidate
in
candidate_list
:
for
candidate
in
candidate_list
:
candidate_first_name
=
candidate
.
getFirstName
()
candidate_first_name
=
candidate
.
getFirstName
()
...
...
bt5/erp5_tiosafe_oscommerce/ExtensionTemplateItem/OscommerceERP5NodeConduit.py
View file @
77a1b9ce
...
@@ -292,7 +292,7 @@ class OscommerceERP5NodeConduit(TioSafeBaseConduit):
...
@@ -292,7 +292,7 @@ class OscommerceERP5NodeConduit(TioSafeBaseConduit):
address_list
=
document
.
searchFolder
(
address_list
=
document
.
searchFolder
(
portal_type
=
'Address'
,
portal_type
=
'Address'
,
sort_on
=
([
'id'
,
'ASC'
],),
sort_on
=
([
'id'
,
'ASC'
],),
where_expression
=
'id != "default_address"
'
,
id
=
'!=default_address
'
,
)
)
try
:
try
:
address
=
address_list
[
address_index
].
getObject
()
address
=
address_list
[
address_index
].
getObject
()
...
@@ -385,7 +385,7 @@ class OscommerceERP5NodeConduit(TioSafeBaseConduit):
...
@@ -385,7 +385,7 @@ class OscommerceERP5NodeConduit(TioSafeBaseConduit):
address_list
=
document
.
searchFolder
(
address_list
=
document
.
searchFolder
(
portal_type
=
'Address'
,
portal_type
=
'Address'
,
sort_on
=
([
'id'
,
'ASC'
],
),
sort_on
=
([
'id'
,
'ASC'
],
),
where_expression
=
'id != "default_address"
'
,
id
=
'!=default_address
'
,
)
)
address_id
=
address_list
[
address_index
].
getId
()
address_id
=
address_list
[
address_index
].
getId
()
try
:
try
:
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportParameterDict.py
View file @
77a1b9ce
...
@@ -37,18 +37,15 @@ if from_date is None:
...
@@ -37,18 +37,15 @@ if from_date is None:
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
NegatedQuery
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
NegatedQuery
kw
=
{
"delivery.start_date"
:
None
,
"key"
:
"DefaultKey"
}
kw
=
{
"delivery.start_date"
:
None
,
"key"
:
"DefaultKey"
}
q
=
NegatedQuery
(
Query
(
**
kw
))
q
=
NegatedQuery
(
Query
(
**
kw
))
select_expression
=
"MIN(delivery.start_date)"
group_by
=
"delivery.start_date"
from_date
=
DateTime
()
from_date
=
DateTime
()
result_list
=
context
.
portal_catalog
(
result_list
=
context
.
portal_catalog
(
select_expression
=
select_expression
,
select_dict
=
{
'start_date'
:
'delivery.start_date'
},
group_by_expression
=
group_by
,
simulation_state
=
simulation_state
,
simulation_state
=
simulation_state
,
portal_type
=
doc_portal_type
,
portal_type
=
doc_portal_type
,
query
=
q
,
query
=
q
,
limit
=
1
)
limit
=
1
)
if
result_list
:
if
result_list
:
from_date
=
DateTime
(
result_list
[
0
]
[
2
]
)
from_date
=
DateTime
(
result_list
[
0
]
.
start_date
)
# get period list between given 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):
...
@@ -19,7 +19,7 @@ def buildIndex(language=None):
from
Products.ZSQLCatalog.SQLCatalog
import
NegatedQuery
,
Query
from
Products.ZSQLCatalog.SQLCatalog
import
NegatedQuery
,
Query
# Retrieve the different subjects in the catalog
# Retrieve the different subjects in the catalog
subject_list
=
context
.
searchResults
(
subject_list
=
context
.
searchResults
(
select_
expression
=
'subject, reference'
,
select_
list
=
[
'subject'
,
'reference'
]
,
query
=
NegatedQuery
(
Query
(
subject
=
None
)),
query
=
NegatedQuery
(
Query
(
subject
=
None
)),
language
=
language
or
''
,
language
=
language
or
''
,
sort_on
=
((
'subject'
,
'ascending'
),
(
'title'
,
'ascending'
)),
sort_on
=
((
'subject'
,
'ascending'
),
(
'title'
,
'ascending'
)),
...
...
product/ERP5/Tool/SimulationTool.py
View file @
77a1b9ce
...
@@ -808,7 +808,7 @@ class SimulationTool(BaseTool):
...
@@ -808,7 +808,7 @@ class SimulationTool(BaseTool):
if
where_expression
!=
''
:
if
where_expression
!=
''
:
add_kw
[
'where_expression'
]
=
where_expression
add_kw
[
'where_expression'
]
=
where_expression
add_kw
[
'predicate_category.uid'
]
=
'!=NULL'
add_kw
[
'predicate_category.uid'
]
=
'!=NULL'
add_kw
[
'group_by
_expression'
]
=
'uid'
add_kw
[
'group_by
'
]
=
[
'uid'
]
add_query
=
self
.
portal_catalog
(
**
add_kw
)
add_query
=
self
.
portal_catalog
(
**
add_kw
)
uid_list
=
[]
uid_list
=
[]
for
line
in
add_query
:
for
line
in
add_query
:
...
...
product/ERP5/tests/testSupply.py
View file @
77a1b9ce
...
@@ -264,7 +264,7 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
...
@@ -264,7 +264,7 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
kw
=
{}
kw
=
{}
kw
[
'predicate.uid'
]
=
supply_line
.
getUid
()
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
# check supply line in predicate table
result
=
self
.
catalog_tool
(
**
kw
)
result
=
self
.
catalog_tool
(
**
kw
)
...
...
product/ERP5Catalog/CatalogTool.py
View file @
77a1b9ce
...
@@ -576,8 +576,8 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
...
@@ -576,8 +576,8 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
security_uid_dict
=
{
None
:
[
x
.
security_uid
for
x
in
\
security_uid_dict
=
{
None
:
[
x
.
security_uid
for
x
in
\
self
.
unrestrictedSearchResults
(
self
.
unrestrictedSearchResults
(
allowedRolesAndUsers
=
allowedRolesAndUsers
,
allowedRolesAndUsers
=
allowedRolesAndUsers
,
select_
expression
=
"security_uid"
,
select_
list
=
[
"security_uid"
]
,
group_by
_expression
=
"security_uid"
)]
}
group_by
=
[
"security_uid"
]
)]
}
else
:
else
:
# XXX: What with this string transformation ?! Souldn't it be done in
# XXX: What with this string transformation ?! Souldn't it be done in
# dtml instead ? ... yes, but how to be bw compatible ?
# dtml instead ? ... yes, but how to be bw compatible ?
...
...
product/ERP5Form/ListBox.py
View file @
77a1b9ce
...
@@ -1367,11 +1367,11 @@ class ListBoxRenderer:
...
@@ -1367,11 +1367,11 @@ class ListBoxRenderer:
return
DomainSelection
(
domain_dict
=
root_dict
).
__of__
(
self
.
getContext
())
return
DomainSelection
(
domain_dict
=
root_dict
).
__of__
(
self
.
getContext
())
@
lazyMethod
@
lazyMethod
def
getStatSelect
Expression
(
self
):
def
getStatSelect
Dict
(
self
):
"""Return a
string
which expresses the information retrieved by SELECT for
"""Return a
dict
which expresses the information retrieved by SELECT for
the statistics.
the statistics.
"""
"""
select_
expression_list
=
[]
select_
dict
=
{}
if
self
.
showStat
():
if
self
.
showStat
():
stats
=
self
.
getSelectionTool
().
getSelectionStats
(
self
.
getSelectionName
(),
REQUEST
=
self
.
request
)
stats
=
self
.
getSelectionTool
().
getSelectionStats
(
self
.
getSelectionName
(),
REQUEST
=
self
.
request
)
stat_column_list
=
self
.
getStatColumnList
()
stat_column_list
=
self
.
getStatColumnList
()
...
@@ -1386,13 +1386,13 @@ class ListBoxRenderer:
...
@@ -1386,13 +1386,13 @@ class ListBoxRenderer:
if
(
column
is
not
None
)
and
(
column
[
0
]
==
column
[
1
]):
if
(
column
is
not
None
)
and
(
column
[
0
]
==
column
[
1
]):
try
:
try
:
if
stats
[
index
]
!=
' '
:
if
stats
[
index
]
!=
' '
:
select_
expression_list
.
append
(
'%s(%s) AS %s'
%
(
stats
[
index
],
sql
,
alias
)
)
select_
dict
[
alias
]
=
'%s(%s)'
%
(
stats
[
index
],
sql
)
else
:
else
:
select_
expression_list
.
append
(
"'' AS %s"
%
alias
)
select_
dict
[
alias
]
=
"''"
except
IndexError
:
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
,
def
makeReportTreeList
(
self
,
root_dict
=
None
,
report_path
=
None
,
base_category
=
None
,
depth
=
0
,
unfolded_list
=
(),
is_report_opened
=
True
,
sort_on
=
((
'id'
,
'ASC'
),),
unfolded_list
=
(),
is_report_opened
=
True
,
sort_on
=
((
'id'
,
'ASC'
),),
...
@@ -1618,7 +1618,7 @@ class ListBoxRenderer:
...
@@ -1618,7 +1618,7 @@ class ListBoxRenderer:
# First, get the statitics by the global stat method.
# First, get the statitics by the global stat method.
param_dict
=
self
.
getParamDict
()
param_dict
=
self
.
getParamDict
()
new_param_dict
=
param_dict
.
copy
()
new_param_dict
=
param_dict
.
copy
()
new_param_dict
[
'select_
expression'
]
=
self
.
getStatSelectExpression
()
new_param_dict
[
'select_
dict'
]
=
self
.
getStatSelectDict
()
selection
=
self
.
getSelection
()
selection
=
self
.
getSelection
()
selection
.
edit
(
params
=
new_param_dict
)
selection
.
edit
(
params
=
new_param_dict
)
...
@@ -1702,7 +1702,7 @@ class ListBoxRenderer:
...
@@ -1702,7 +1702,7 @@ class ListBoxRenderer:
selection
=
self
.
getSelection
()
selection
=
self
.
getSelection
()
selection_tool
=
self
.
getSelectionTool
()
selection_tool
=
self
.
getSelectionTool
()
report_list
=
selection
.
getReportList
()
report_list
=
selection
.
getReportList
()
stat_select_
expression
=
self
.
getStatSelectExpression
()
stat_select_
dict
=
self
.
getStatSelectDict
()
stat_method
=
self
.
getStatMethod
()
stat_method
=
self
.
getStatMethod
()
count_method
=
self
.
getCountMethod
()
count_method
=
self
.
getCountMethod
()
list_method
=
self
.
getListMethod
()
list_method
=
self
.
getListMethod
()
...
@@ -1768,9 +1768,9 @@ class ListBoxRenderer:
...
@@ -1768,9 +1768,9 @@ class ListBoxRenderer:
stat_method
)
stat_method
)
if
report_tree
.
is_pure_summary
and
self
.
showStat
():
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
=
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
)
selection
.
edit
(
params
=
new_param_dict
)
# Query the stat.
# 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):
...
@@ -493,8 +493,8 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
sql_catalog
.
getSQLCatalogSecurityUidGroupsColumnsDict
()
sql_catalog
.
getSQLCatalogSecurityUidGroupsColumnsDict
()
getSecurityUidDictAndRoleColumnDict
=
\
getSecurityUidDictAndRoleColumnDict
=
\
portal_catalog
.
getSecurityUidDictAndRoleColumnDict
portal_catalog
.
getSecurityUidDictAndRoleColumnDict
search_result
=
getattr
(
self
,
"Base_getCountFromWorklistTable"
,
None
)
search_result
_
=
getattr
(
self
,
"Base_getCountFromWorklistTable"
,
None
)
use_cache
=
search_result
is
not
None
use_cache
=
search_result
_
is
not
None
if
use_cache
:
if
use_cache
:
ignored_security_column_id_set
=
self
.
_getWorklistIgnoredSecurityColumnSet
()
ignored_security_column_id_set
=
self
.
_getWorklistIgnoredSecurityColumnSet
()
ignored_security_uid_parameter_set
=
{
x
ignored_security_uid_parameter_set
=
{
x
...
@@ -512,12 +512,26 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
...
@@ -512,12 +512,26 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
ignored_security_uid_parameter_set
:
ignored_security_uid_parameter_set
:
security_uid_dict
.
pop
(
ignored_security_uid_parameter
)
security_uid_dict
.
pop
(
ignored_security_uid_parameter
)
return
security_uid_dict
,
role_column_dict
,
local_role_column_dict
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
# Prevent catalog from trying to join
getQuery
=
SimpleQuery
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
:
else
:
search_result
=
portal_catalog
.
unrestrictedSearchResults
search_result
=
portal_catalog
.
unrestrictedSearchResults
select_expression_prefix
=
'count(*) as %s'
%
(
COUNT_COLUMN_TITLE
,
)
count_column_expression
=
'count(*)'
# Let catalog join as needed
# Let catalog join as needed
getQuery
=
lambda
comparison_operator
=
None
,
**
kw
:
AutoQuery
(
getQuery
=
lambda
comparison_operator
=
None
,
**
kw
:
AutoQuery
(
operator
=
comparison_operator
,
operator
=
comparison_operator
,
...
@@ -544,18 +558,15 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
...
@@ -544,18 +558,15 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
getQuery
=
getQuery
,
getQuery
=
getQuery
,
grouped_worklist_dict
=
grouped_worklist_dict
,
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
assert
COUNT_COLUMN_TITLE
not
in
total_criterion_id_list
# If required mapping method is not present on the query, assume it
select_dict
=
dict
.
fromkeys
(
total_criterion_id_list
)
# handles column mapping properly, and build a bare select
select_dict
[
COUNT_COLUMN_TITLE
]
=
count_column_expression
# expression.
select_expression
=
select_expression_prefix
+
', '
\
+
group_by_expression
catalog_brain_result
=
[]
catalog_brain_result
=
[]
try
:
try
:
catalog_brain_result
=
search_result
(
catalog_brain_result
=
search_result
(
select_
expression
=
select_expression
,
select_
dict
=
select_dict
,
group_by
_expression
=
group_by_expression
,
group_by
=
group_by
,
query
=
query
,
query
=
query
,
limit
=
None
,
limit
=
None
,
src__
=
src__
)
src__
=
src__
)
...
@@ -684,14 +695,16 @@ def WorkflowTool_refreshWorklistCache(self):
...
@@ -684,14 +695,16 @@ def WorkflowTool_refreshWorklistCache(self):
for
security_column_id
in
security_column_id_set
:
for
security_column_id
in
security_column_id_set
:
assert
security_column_id
not
in
total_criterion_id_list
assert
security_column_id
not
in
total_criterion_id_list
total_criterion_id_list
.
append
(
security_column_id
)
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
assert
COUNT_COLUMN_TITLE
not
in
total_criterion_id_list
select_expression
=
'count(*) as %s, %s'
%
(
COUNT_COLUMN_TITLE
,
select_dict
=
dict
.
fromkeys
(
total_criterion_id_list
)
group_by_expression
)
select_dict
[
COUNT_COLUMN_TITLE
]
=
'count(*)'
search_result_kw
=
{
'select_expression'
:
select_expression
,
search_result_kw
=
{
'group_by_expression'
:
group_by_expression
,
'select_dict'
:
select_dict
,
'group_by'
:
group_by
,
'query'
:
query
,
'query'
:
query
,
'limit'
:
None
}
'limit'
:
None
,
}
#LOG('refreshWorklistCache', WARNING, 'Using query: %s' % \
#LOG('refreshWorklistCache', WARNING, 'Using query: %s' % \
# (search_result(src__=1, **search_result_kw), ))
# (search_result(src__=1, **search_result_kw), ))
catalog_brain_result
=
search_result
(
**
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):
...
@@ -216,7 +216,7 @@ class EGOVUserManager(ERP5UserManager):
newSecurityManager
(
self
,
self
.
getUser
(
SUPER_USER
))
newSecurityManager
(
self
,
self
.
getUser
(
SUPER_USER
))
try
:
try
:
result
=
portal
.
portal_catalog
.
unrestrictedSearchResults
(
result
=
portal
.
portal_catalog
.
unrestrictedSearchResults
(
select_
expression
=
'reference'
,
select_
list
=
[
'reference'
]
,
portal_type
=
self
.
portal_type_list
,
reference
=
login
)
portal_type
=
self
.
portal_type_list
,
reference
=
login
)
if
len
(
result
)
!=
1
:
# we won't proceed with groups
if
len
(
result
)
!=
1
:
# we won't proceed with groups
if
len
(
result
)
>
1
:
# configuration is screwed
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