Commit b00e2f79 authored by Aurel's avatar Aurel

fix sql expression used in report (see bugs #1820 and #1824)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36203 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5be2911b
...@@ -97,8 +97,8 @@ elif from_date is not None:\n ...@@ -97,8 +97,8 @@ elif from_date is not None:\n
elif to_date is not None:\n elif to_date is not None:\n
params = {"creation_date":to_date}\n params = {"creation_date":to_date}\n
query = Query(range="max", **params)\n query = Query(range="max", **params)\n
select_expression = \'DATE_FORMAT(creation_date, "%s") as date, portal_type\' %sql_format\n select_expression = {\'date\' : \'DATE_FORMAT(creation_date, "%s")\'%sql_format, \'portal_type\' : None}\n
group_by = \'DATE_FORMAT(creation_date, "%s"), portal_type\' %sql_format\n group_by = [\'DATE_FORMAT(creation_date, "%s")\' % sql_format, \'portal_type\']\n
\n \n
# count number of object created by the user for each type of document\n # count number of object created by the user for each type of document\n
reference = kw.get(\'person_reference_list\', context.getReference())\n reference = kw.get(\'person_reference_list\', context.getReference())\n
......
...@@ -61,7 +61,6 @@ stat_line = request.get(\'stat_line\', None)\n ...@@ -61,7 +61,6 @@ stat_line = request.get(\'stat_line\', None)\n
return stat_line\n return stat_line\n
\n \n
\n \n
\n
# XXX example of another way to get the stat line but this is slower\n # XXX example of another way to get the stat line but this is slower\n
from Products.ERP5Type.Log import log\n from Products.ERP5Type.Log import log\n
from Products.PythonScripts.standard import Object\n from Products.PythonScripts.standard import Object\n
...@@ -98,8 +97,9 @@ elif from_date is not None:\n ...@@ -98,8 +97,9 @@ elif from_date is not None:\n
elif to_date is not None:\n elif to_date is not None:\n
params = {"creation_date":to_date}\n params = {"creation_date":to_date}\n
query = Query(range="ngt", **params)\n query = Query(range="ngt", **params)\n
select_expression_list = \'DATE_FORMAT(creation_date, "%s") as date\' %sql_format\n select_expression = {\'date\' : \'DATE_FORMAT(creation_date, "%s")\'%sql_format}\n
group_by_list = \'DATE_FORMAT(creation_date, "%s")\' %sql_format\n group_by = [\'DATE_FORMAT(creation_date, "%s")\' % sql_format,]\n
\n
# count number of object created by the user for each type of document\n # count number of object created by the user for each type of document\n
result_list = context.portal_catalog.countResults(select_expression=select_expression_list,\n result_list = context.portal_catalog.countResults(select_expression=select_expression_list,\n
portal_type=portal_type_list,limit=None,\n portal_type=portal_type_list,limit=None,\n
...@@ -191,6 +191,8 @@ return [obj,]\n ...@@ -191,6 +191,8 @@ return [obj,]\n
<string>params</string> <string>params</string>
<string>query</string> <string>query</string>
<string>_apply_</string> <string>_apply_</string>
<string>select_expression</string>
<string>group_by</string>
<string>select_expression_list</string> <string>select_expression_list</string>
<string>group_by_list</string> <string>group_by_list</string>
<string>result_list</string> <string>result_list</string>
......
772 773
\ No newline at end of file \ No newline at end of file
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