[Erp5-report] r11006 - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTemplateItem/p...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Oct 30 15:53:22 CET 2006


Author: kevin
Date: Mon Oct 30 15:53:21 2006
New Revision: 11006

URL: http://svn.erp5.org?rev=11006&view=rev
Log:
Fix ID handling in category importing tool. Now the 4 category tree representation (described in the openoffice example file) can be imported.

Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFileForm/category_import_tips.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/change_log
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.xml?rev=11006&r1=11005&r2=11006&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.xml Mon Oct 30 15:53:21 2006
@@ -127,7 +127,7 @@
 \n
   # Get the header of the table\n
   columns_header = spreadsheets[table_name][0]\n
-  # Get the mapping to help us to know the property according a cell index\n
+  # Get the mapping to help us know the property according a cell index\n
   property_map = {}\n
   column_index = 0\n
   path_index = 0\n
@@ -192,13 +192,15 @@
       # Returned cell_id can be None or \'\' (empty string). Both have different meaning:\n
       #   None : no data was inputed by the user.\n
       #   \'\'   : data entered by the user, but no good transformation of the string to a safe ID.\n
-      # In case of an empty string, we should use the title as path id if present.\n
-\n
-      # If the cell_id tranformation return anything, and if the cell is a path item,\n
-      # we should try to use the line title (if exist) as basic info to get the safe id.\n
+\n
+      # If the cell_id tranformation return an empty string, and if the cell is a path item,\n
+      # we should try to use other line data to get a safe id.\n
       if cell_id == \'\' and property_id.startswith(\'path_\'):\n
-        if line_data.has_key(\'title\'):\n
-          cell_id = getIDFromString(line_data[\'title\'])\n
+        for alt_id_source in [\'id\', \'title\']:\n
+          if line_data.has_key(alt_id_source):\n
+            cell_id = getIDFromString(line_data[alt_id_source])\n
+            if cell_id not in (\'\', None):\n
+              break\n
 \n
       # Ignore empty cells\n
       if cell_id not in (\'\', None):\n
@@ -223,9 +225,11 @@
                 break\n
           category_properties[\'path\'] = \'/\'.join([base_category_id,] + absolut_path_element_list[::-1])\n
 \n
-          # If no title, get it from raw cell value\n
+          # Save the current raw path item value as title if no title column defined\n
           if \'title\' not in category_properties.keys():\n
             clean_title = cell_data.strip()\n
+            # Only set title if it look like a title\n
+            # (i.e. its tranformation to ID is not the same as the original value)\n
             if clean_title != cell_id:\n
               category_properties[\'title\'] = clean_title\n
 \n
@@ -269,7 +273,7 @@
 \n
       # Set the category properties\n
       for key in keys:\n
-        if key != \'path\':\n
+        if key not in [\'path\', \'id\']:\n
           setter_method_id = "set" + convertToUpperCase(key)\n
           getter_method_id = "get" + convertToUpperCase(key)\n
           value = category[key]\n
@@ -384,6 +388,7 @@
                             <string>category_properties</string>
                             <string>cell_data</string>
                             <string>cell_id</string>
+                            <string>alt_id_source</string>
                             <string>path_element_id</string>
                             <string>absolut_path_element_list</string>
                             <string>int</string>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFileForm/category_import_tips.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFileForm/category_import_tips.xml?rev=11006&r1=11005&r2=11006&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFileForm/category_import_tips.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFileForm/category_import_tips.xml Mon Oct 30 15:53:21 2006
@@ -201,7 +201,7 @@
                     <key> <string>default</string> </key>
                     <value> <string encoding="cdata"><![CDATA[
 
-<ul><li>An OpenOffice file is available at <a href="portal_skins/erp5_core/erp5_import_category_tree_examples.sxc">/portal_skins/erp5_core/erp5_import_category_tree_examples.sxc</a> . It contain different examples of how to input a tree of categories.</li><li>Do not merge cells in the uploaded spreadsheet: this will confuse the parser and produce unpredictible results.</li><li>Do not use category IDs which are defined in Property Sheets as property. ERP5 is currently not able to make the difference between a subobject ID and a property ID. This bug must be fixed.</li><li>Even if this tool was designed to import OpenOffice v1.x documents, OASIS OpenDocument files seems to work as well.</li></ul>
+<ul><li>An OpenOffice file is available at <a href="portal_skins/erp5_core/erp5_import_category_tree_examples.sxc">/portal_skins/erp5_core/erp5_import_category_tree_examples.sxc</a> . It contain different examples of how to input a tree of categories. Each sheet title will be used as Base Category.</li><li>Do not merge cells in the uploaded spreadsheet: this will confuse the parser and produce unpredictible results.</li><li>Do not use category IDs which are defined in Property Sheets as property. ERP5 is currently not able to make the difference between a subobject ID and a property ID. This bug must be fixed.</li><li>Even if this tool was designed to import OpenOffice v1.x documents, OASIS OpenDocument files seems to work as well.</li><li>This tool is not intrusive: if an existing category tree is found, it will update each category but will not try to remove any one.</li></ul>
 
 ]]></string> </value>
                 </item>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/change_log?rev=11006&r1=11005&r2=11006&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/change_log (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/change_log Mon Oct 30 15:53:21 2006
@@ -1,3 +1,6 @@
+2006-10-30 Kevin
+* Fix ID handling in category importing tool. Now the 4 category tree representation (described in the openoffice example file) can be imported.
+
 2006-10-04 Kevin
 * Add Tips on category import fast input screen to help user.
 

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=11006&r1=11005&r2=11006&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Mon Oct 30 15:53:21 2006
@@ -1,1 +1,1 @@
-126
+128




More information about the Erp5-report mailing list