From 6831af9407431f3bf6cef44110abfb8bfb31e281 Mon Sep 17 00:00:00 2001
From: Thibaut Deheunynck <thibaut@nexedi.com>
Date: Thu, 12 Jun 2008 14:00:06 +0000
Subject: [PATCH] add test to know if we are in erp5_form render or graphic
 render and if the field DateTime can be editable or not

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21540 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Extensions/ERP5Site_createModuleScribus.py        |  2 +-
 .../Extensions/ERP5Site_updateModuleScribus.py        |  2 +-
 product/ERP5Form/ScribusUtils.py                      | 11 +++++++----
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/product/ERP5Form/Extensions/ERP5Site_createModuleScribus.py b/product/ERP5Form/Extensions/ERP5Site_createModuleScribus.py
index af48a2e786..abc98872b2 100644
--- a/product/ERP5Form/Extensions/ERP5Site_createModuleScribus.py
+++ b/product/ERP5Form/Extensions/ERP5Site_createModuleScribus.py
@@ -181,7 +181,7 @@ def ERP5Site_createModuleScribus(self,
     # attributes to get properties values.
     # This represents the main process of the script.
     widget_properties = \
-        ScribusParser.getPropertiesConversionDict(text_field_list)
+        ScribusParser.getPropertiesConversionDict(text_field_list, option_html)
 
     LOG('ERP5Site_createModuleScribus', INFO,
         'createmodule < ScribusParser.getPropertiesConversionDict')
diff --git a/product/ERP5Form/Extensions/ERP5Site_updateModuleScribus.py b/product/ERP5Form/Extensions/ERP5Site_updateModuleScribus.py
index 8fbc98c01c..18e3938834 100644
--- a/product/ERP5Form/Extensions/ERP5Site_updateModuleScribus.py
+++ b/product/ERP5Form/Extensions/ERP5Site_updateModuleScribus.py
@@ -213,7 +213,7 @@ def ERP5Site_updateModuleScribus(self,
     # attributes to get properties values.
     # This represents the main process of the script.
     widget_properties = \
-        ScribusParser.getPropertiesConversionDict(text_field_list)
+        ScribusParser.getPropertiesConversionDict(text_field_list, option_html)
 
     LOG('ERP5Site_updateModuleScribus', INFO, 
         'createmodule < ScribusParser.getPropertiesConversionDict')
diff --git a/product/ERP5Form/ScribusUtils.py b/product/ERP5Form/ScribusUtils.py
index cf95b02de8..4a6abee871 100644
--- a/product/ERP5Form/ScribusUtils.py
+++ b/product/ERP5Form/ScribusUtils.py
@@ -1149,7 +1149,6 @@ class ManageCSS:
 
       field_nb_range = field_nb + 1
       field_range = range(field_nb_range)
-      field_range = field_range
       for iterator in field_range:
         # iterator take the field_id according to the field_nb
         # ie (0..field_nb)
@@ -1499,7 +1498,7 @@ class ScribusParser:
 
 
   security.declarePublic('getPropertiesConversionDict')
-  def getPropertiesConversionDict(self, text_page_dict):
+  def getPropertiesConversionDict(self, text_page_dict, option_html):
     """
     takes a dict generated from 'getXmlObjectsProperties' method
     and returns a dict of PAGE including a list with usefull
@@ -1878,12 +1877,16 @@ class ScribusParser:
           # will automatically insert ' ' between element.
           # > this value is not used in ScribusUtils.py , but in PDFForm.py
           # when creating the fdf file to fill the PDF form.
-          object_properties['date_separator'] = \
+          if option_html == 1 and object_properties['editable'] == 1:
+            object_properties['date_separator'] = ''
+            object_properties['time_separator'] = ''
+          else:
+            object_properties['date_separator'] = \
                 sp.getObjectTooltipProperty('date_separator',
                                             '/',
                                             object_name,
                                             tooltipfield_properties_dict)
-          object_properties['time_separator'] = \
+            object_properties['time_separator'] = \
                 sp.getObjectTooltipProperty('time_separator',
                                             ':',
                                             object_name,
-- 
2.30.9