Commit 023363d9 authored by Jérome Perrin's avatar Jérome Perrin

fix various issues with sorting:

- impossible to search + sort on title or reference
- impossible to sort on specific_reference if no filter by section
- impossible to sort by more than one column

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34620 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1e945de2
......@@ -472,6 +472,7 @@ destination_section_where_expression</string> </value>
</dtml-in>\n
, delivery.start_date as operation_date\n
, \'source\' as section_mark\n
, catalog.reference as specific_reference\n
</dtml-if>\n
</dtml-if>\n
\n
......@@ -675,11 +676,11 @@ destination_section_where_expression</string> </value>
, catalog.*\n
<dtml-if "section_category">, category.uid as category_uid</dtml-if>\n
<dtml-if "not (stat or count) and query[\'order_by_expression\']">\n
<dtml-let order_column="query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-if "not order_column in (\'operation_date\', \'specific_reference\')">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
</dtml-if>\n
</dtml-let>\n
<dtml-in "query[\'order_by_expression\'].split(\', \')">\n
<dtml-unless "\'operation_date\' in _[\'sequence-item\'] or \'specific_reference\' in _[\'sequence-item\'] or \'`catalog`.\' in _[\'sequence-item\']">\n
, <dtml-var expr="_[\'sequence-item\'].split(\' \')[0]">\n
</dtml-unless>\n
</dtml-in>\n
</dtml-if>\n
</dtml-if>\n
\n
......@@ -828,7 +829,7 @@ destination_section_where_expression</string> </value>
\n
<dtml-if "not (count or stat) and query[\'limit_expression\'] and query[\'limit_expression\'].startswith(\'0\')">\n
<dtml-if "query[\'order_by_expression\']">\n
ORDER BY <dtml-var "query[\'order_by_expression\'].split(\'.\')[-1]">\n
ORDER BY <dtml-var "query[\'order_by_expression\']">\n
</dtml-if>\n
LIMIT <dtml-var "query[\'limit_expression\']">\n
</dtml-if>\n
......@@ -863,11 +864,11 @@ UNION\n
, catalog.*\n
<dtml-if "section_category">, category.uid as category_uid</dtml-if>\n
<dtml-if "not (stat or count) and query[\'order_by_expression\']">\n
<dtml-let order_column="query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-if "not order_column in (\'operation_date\', \'specific_reference\')">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
</dtml-if>\n
</dtml-let>\n
<dtml-in "query[\'order_by_expression\'].split(\', \')">\n
<dtml-unless "\'operation_date\' in _[\'sequence-item\'] or \'specific_reference\' in _[\'sequence-item\'] or \'`catalog`.\' in _[\'sequence-item\']">\n
, <dtml-var expr="_[\'sequence-item\'].split(\' \')[0]">\n
</dtml-unless>\n
</dtml-in>\n
</dtml-if>\n
</dtml-if>\n
\n
......@@ -1016,7 +1017,7 @@ UNION\n
\n
<dtml-if "not (count or stat) and query[\'limit_expression\'] and query[\'limit_expression\'].startswith(\'0\')">\n
<dtml-if "query[\'order_by_expression\']">\n
ORDER BY <dtml-var "query[\'order_by_expression\'].split(\'.\')[-1]">\n
ORDER BY <dtml-var "query[\'order_by_expression\']">\n
</dtml-if>\n
LIMIT <dtml-var "query[\'limit_expression\']">\n
</dtml-if>\n
......@@ -1045,7 +1046,14 @@ UNION\n
<dtml-if "not (stat or count)">\n
GROUP BY uid\n
<dtml-if "query[\'order_by_expression\']">\n
ORDER BY <dtml-var "query[\'order_by_expression\'].split(\'.\')[-1]">\n
ORDER BY\n
<dtml-in "query[\'order_by_expression\'].split(\', \')">\n
<dtml-if "\'.\' in _[\'sequence-item\']">\n
<dtml-var expr="_[\'sequence-item\'].split(\'.\')[1]">\n
<dtml-else>\n
<dtml-var sequence-item>\n
</dtml-if><dtml-unless sequence-end>,</dtml-unless>\n
</dtml-in>\n
</dtml-if>\n
<dtml-if "query[\'limit_expression\']">\n
LIMIT <dtml-var "query[\'limit_expression\']">\n
......@@ -1058,9 +1066,6 @@ UNION\n
</dtml-if>\n
\n
</dtml-if>\n
\n
\n
\n
</dtml-let></dtml-let></dtml-let></dtml-let>\n
\n
<dtml-comment> vim: syntax=dtml\n
......@@ -1134,6 +1139,7 @@ UNION\n
</dtml-in>\n
, delivery.start_date as operation_date\n
, \'source\' as section_mark\n
, catalog.reference as specific_reference\n
</dtml-if>\n
</dtml-if>\n
\n
......@@ -1337,11 +1343,11 @@ UNION\n
, catalog.*\n
<dtml-if "section_category">, category.uid as category_uid</dtml-if>\n
<dtml-if "not (stat or count) and query[\'order_by_expression\']">\n
<dtml-let order_column="query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-if "not order_column in (\'operation_date\', \'specific_reference\')">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
</dtml-if>\n
</dtml-let>\n
<dtml-in "query[\'order_by_expression\'].split(\', \')">\n
<dtml-unless "\'operation_date\' in _[\'sequence-item\'] or \'specific_reference\' in _[\'sequence-item\'] or \'`catalog`.\' in _[\'sequence-item\']">\n
, <dtml-var expr="_[\'sequence-item\'].split(\' \')[0]">\n
</dtml-unless>\n
</dtml-in>\n
</dtml-if>\n
</dtml-if>\n
\n
......@@ -1490,7 +1496,7 @@ UNION\n
\n
<dtml-if "not (count or stat) and query[\'limit_expression\'] and query[\'limit_expression\'].startswith(\'0\')">\n
<dtml-if "query[\'order_by_expression\']">\n
ORDER BY <dtml-var "query[\'order_by_expression\'].split(\'.\')[-1]">\n
ORDER BY <dtml-var "query[\'order_by_expression\']">\n
</dtml-if>\n
LIMIT <dtml-var "query[\'limit_expression\']">\n
</dtml-if>\n
......@@ -1525,11 +1531,11 @@ UNION\n
, catalog.*\n
<dtml-if "section_category">, category.uid as category_uid</dtml-if>\n
<dtml-if "not (stat or count) and query[\'order_by_expression\']">\n
<dtml-let order_column="query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-if "not order_column in (\'operation_date\', \'specific_reference\')">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
</dtml-if>\n
</dtml-let>\n
<dtml-in "query[\'order_by_expression\'].split(\', \')">\n
<dtml-unless "\'operation_date\' in _[\'sequence-item\'] or \'specific_reference\' in _[\'sequence-item\'] or \'`catalog`.\' in _[\'sequence-item\']">\n
, <dtml-var expr="_[\'sequence-item\'].split(\' \')[0]">\n
</dtml-unless>\n
</dtml-in>\n
</dtml-if>\n
</dtml-if>\n
\n
......@@ -1678,7 +1684,7 @@ UNION\n
\n
<dtml-if "not (count or stat) and query[\'limit_expression\'] and query[\'limit_expression\'].startswith(\'0\')">\n
<dtml-if "query[\'order_by_expression\']">\n
ORDER BY <dtml-var "query[\'order_by_expression\'].split(\'.\')[-1]">\n
ORDER BY <dtml-var "query[\'order_by_expression\']">\n
</dtml-if>\n
LIMIT <dtml-var "query[\'limit_expression\']">\n
</dtml-if>\n
......@@ -1707,7 +1713,14 @@ UNION\n
<dtml-if "not (stat or count)">\n
GROUP BY uid\n
<dtml-if "query[\'order_by_expression\']">\n
ORDER BY <dtml-var "query[\'order_by_expression\'].split(\'.\')[-1]">\n
ORDER BY\n
<dtml-in "query[\'order_by_expression\'].split(\', \')">\n
<dtml-if "\'.\' in _[\'sequence-item\']">\n
<dtml-var expr="_[\'sequence-item\'].split(\'.\')[1]">\n
<dtml-else>\n
<dtml-var sequence-item>\n
</dtml-if><dtml-unless sequence-end>,</dtml-unless>\n
</dtml-in>\n
</dtml-if>\n
<dtml-if "query[\'limit_expression\']">\n
LIMIT <dtml-var "query[\'limit_expression\']">\n
......@@ -1720,9 +1733,6 @@ UNION\n
</dtml-if>\n
\n
</dtml-if>\n
\n
\n
\n
</dtml-let></dtml-let></dtml-let></dtml-let>\n
\n
<dtml-comment> vim: syntax=dtml\n
......
1188
\ No newline at end of file
1190
\ 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