From 8739cb7282259edab92af636348dee7d84da2d7a Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Mon, 9 Apr 2007 08:12:20 +0000
Subject: [PATCH] Revert the previous commit and fixed the problem found on
 dates. The at_date parameter must be in both the where expression and in
 pamaters given to the zsql methods.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14027 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/SimulationTool.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py
index 7fde18b150..6ddcb6e715 100644
--- a/product/ERP5/Tool/SimulationTool.py
+++ b/product/ERP5/Tool/SimulationTool.py
@@ -1059,6 +1059,14 @@ class SimulationTool(BaseTool):
 
       """
       new_kw = self._generateSQLKeywordDict(table='item',strict_simulation_state=strict_simulation_state,**kw)
+      at_date = kw.get('at_date',None)
+      if at_date is not None:
+        from Products.ZSQLCatalog.SQLCatalog import QueryMixin
+        query_mixin = QueryMixin()
+        at_date = query_mixin._quoteSQLString(at_date)
+      # Do not remove at_date in new_kw, it is required in 
+      # order to do a "select item left join item on date"
+      new_kw['at_date'] = at_date
 
       # Extra parameters for the SQL Method
       new_kw['join_on_item'] = new_kw.get('at_date') or \
-- 
2.30.9