From ace56db3f534d8f973877b2d1a438aa96e739543 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Fri, 3 Feb 2006 16:15:37 +0000
Subject: [PATCH] in preinstall for workflow, diff all subobjects to know if
 workflow is modified

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5553 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 34 +++++++++++------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 6a80e94078..c3f0fe2d72 100755
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -956,23 +956,23 @@ class WorkflowTemplateItem(ObjectTemplateItem):
       portal = context.getPortalObject()
       new_keys = self._objects.keys()
       for path in new_keys:
-        if len(path.split('/')) == 2:
-          if installed_bt._objects.has_key(path):          
-            # compare object to see it there is changes
-            new_object = self._objects[path]
-            old_object = installed_bt._objects[path]
-            new_io = StringIO()
-            old_io = StringIO()
-            OFS.XMLExportImport.exportXML(new_object._p_jar, new_object._p_oid, new_io)
-            OFS.XMLExportImport.exportXML(old_object._p_jar, old_object._p_oid, old_io)
-            new_obj_xml = new_io.getvalue()
-            old_obj_xml = old_io.getvalue()
-            new_io.close()
-            old_io.close()
-            if new_obj_xml != old_obj_xml:
-              modified_object_list.update({path : ['Modified', 'Workflow']})
-          else: # new object
-            modified_object_list.update({path : ['New', 'Workflow']})
+        if installed_bt._objects.has_key(path):          
+          # compare object to see it there is changes
+          new_object = self._objects[path]
+          old_object = installed_bt._objects[path]
+          new_io = StringIO()
+          old_io = StringIO()
+          OFS.XMLExportImport.exportXML(new_object._p_jar, new_object._p_oid, new_io)
+          OFS.XMLExportImport.exportXML(old_object._p_jar, old_object._p_oid, old_io)
+          new_obj_xml = new_io.getvalue()
+          old_obj_xml = old_io.getvalue()
+          new_io.close()
+          old_io.close()
+          if new_obj_xml != old_obj_xml:
+            wf_id = path.split('/')[:2]
+            modified_object_list.update({'/'.join(wf_id) : ['Modified', 'Workflow']})
+        else: # new object
+          modified_object_list.update({path : ['New', 'Workflow']})
       # get removed object
       old_keys = installed_bt._objects.keys()
       for path in old_keys:
-- 
2.30.9