From a1a3f16d58132d5f38698ddf522bf8d8e56bf680 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Mon, 13 Dec 2004 17:32:23 +0000
Subject: [PATCH] Initial import.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1991 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../sql/common_mysql/z0_drop_record.zsql      |  11 ++
 .../sql/common_mysql/z_create_record.zsql     |  22 ++++
 .../z_delete_recorded_object_list.zsql        |  21 ++++
 .../z_read_recorded_object_list.zsql          |  18 +++
 .../common_mysql/z_record_catalog_object.zsql |  19 +++
 .../z_record_uncatalog_object.zsql            |  19 +++
 .../ERP5Catalog/sql/erp5_mysql/properties.xml | 108 ++++++++++++++++++
 .../sql/erp5_mysql/z0_drop_compatibility.zsql |  11 ++
 .../z0_uncatalog_compatibility.zsql           |  11 ++
 .../erp5_mysql/z_catalog_category_list.zsql   |  78 +++++++++++++
 .../erp5_mysql/z_catalog_compatibility.zsql   |  48 ++++++++
 .../z_catalog_compatibility_list.zsql         |  57 +++++++++
 .../erp5_mysql/z_catalog_movement_list.zsql   |  66 +++++++++++
 .../sql/erp5_mysql/z_catalog_object_list.zsql |  88 ++++++++++++++
 .../z_catalog_roles_and_users_list.zsql       |  29 +++++
 .../sql/erp5_mysql/z_catalog_stock_list.zsql  |  51 +++++++++
 .../erp5_mysql/z_catalog_subject_list.zsql    |  25 ++++
 .../erp5_mysql/z_create_compatibility.zsql    |  37 ++++++
 18 files changed, 719 insertions(+)
 create mode 100755 product/ERP5Catalog/sql/common_mysql/z0_drop_record.zsql
 create mode 100755 product/ERP5Catalog/sql/common_mysql/z_create_record.zsql
 create mode 100755 product/ERP5Catalog/sql/common_mysql/z_delete_recorded_object_list.zsql
 create mode 100755 product/ERP5Catalog/sql/common_mysql/z_read_recorded_object_list.zsql
 create mode 100755 product/ERP5Catalog/sql/common_mysql/z_record_catalog_object.zsql
 create mode 100755 product/ERP5Catalog/sql/common_mysql/z_record_uncatalog_object.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/properties.xml
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z0_drop_compatibility.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z0_uncatalog_compatibility.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_catalog_category_list.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_catalog_compatibility.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_catalog_compatibility_list.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_catalog_movement_list.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_catalog_object_list.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_catalog_roles_and_users_list.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_catalog_stock_list.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_catalog_subject_list.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_create_compatibility.zsql

diff --git a/product/ERP5Catalog/sql/common_mysql/z0_drop_record.zsql b/product/ERP5Catalog/sql/common_mysql/z0_drop_record.zsql
new file mode 100755
index 0000000000..39468abee7
--- /dev/null
+++ b/product/ERP5Catalog/sql/common_mysql/z0_drop_record.zsql
@@ -0,0 +1,11 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params></params>
+DROP TABLE record
\ No newline at end of file
diff --git a/product/ERP5Catalog/sql/common_mysql/z_create_record.zsql b/product/ERP5Catalog/sql/common_mysql/z_create_record.zsql
new file mode 100755
index 0000000000..a77beec75c
--- /dev/null
+++ b/product/ERP5Catalog/sql/common_mysql/z_create_record.zsql
@@ -0,0 +1,22 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params></params>
+# Host:
+# Database: test
+# Table: 'record'
+#
+CREATE TABLE `record` (
+  `path` varchar(255) NOT NULL default '',
+  `catalog` BOOL NOT NULL default 0,
+  `played` BOOL NOT NULL default 0,
+  `date` DATETIME NOT NULL,
+  KEY `path` (`path`),
+  KEY `played` (`played`)
+) TYPE=InnoDB;
\ No newline at end of file
diff --git a/product/ERP5Catalog/sql/common_mysql/z_delete_recorded_object_list.zsql b/product/ERP5Catalog/sql/common_mysql/z_delete_recorded_object_list.zsql
new file mode 100755
index 0000000000..f7e3636210
--- /dev/null
+++ b/product/ERP5Catalog/sql/common_mysql/z_delete_recorded_object_list.zsql
@@ -0,0 +1,21 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>path</params>
+<dtml-comment>Do not delete rows really, but just mark them as "played" to avoid dead locks</dtml-comment>
+<dtml-if path>
+UPDATE
+  record
+SET
+  played = 1
+WHERE
+<dtml-in path>
+  path = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if>
+</dtml-in>
+</dtml-if>
diff --git a/product/ERP5Catalog/sql/common_mysql/z_read_recorded_object_list.zsql b/product/ERP5Catalog/sql/common_mysql/z_read_recorded_object_list.zsql
new file mode 100755
index 0000000000..c9fd3ffea7
--- /dev/null
+++ b/product/ERP5Catalog/sql/common_mysql/z_read_recorded_object_list.zsql
@@ -0,0 +1,18 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params></params>
+SELECT
+  path, catalog
+FROM
+  record
+WHERE
+  played = 0
+ORDER BY
+  path, date DESC
\ No newline at end of file
diff --git a/product/ERP5Catalog/sql/common_mysql/z_record_catalog_object.zsql b/product/ERP5Catalog/sql/common_mysql/z_record_catalog_object.zsql
new file mode 100755
index 0000000000..c442b39081
--- /dev/null
+++ b/product/ERP5Catalog/sql/common_mysql/z_record_catalog_object.zsql
@@ -0,0 +1,19 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>path</params>
+INSERT INTO
+  record
+VALUES
+(
+  <dtml-sqlvar path type="string">,
+  1,
+  0,
+  NOW()
+)
\ No newline at end of file
diff --git a/product/ERP5Catalog/sql/common_mysql/z_record_uncatalog_object.zsql b/product/ERP5Catalog/sql/common_mysql/z_record_uncatalog_object.zsql
new file mode 100755
index 0000000000..a2882d86d3
--- /dev/null
+++ b/product/ERP5Catalog/sql/common_mysql/z_record_uncatalog_object.zsql
@@ -0,0 +1,19 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>path</params>
+INSERT INTO
+  record
+VALUES
+(
+  <dtml-sqlvar path type="string">,
+  0,
+  0,
+  NOW()
+)
\ No newline at end of file
diff --git a/product/ERP5Catalog/sql/erp5_mysql/properties.xml b/product/ERP5Catalog/sql/erp5_mysql/properties.xml
new file mode 100755
index 0000000000..8b0fdd7159
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/properties.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0"?>
+<SQLCatalogData>
+  <property id="title" type="str">ERP5/MySQL</property>
+  <property id="sql_catalog_produce_reserved" type="str">z_produce_reserved_uid_list</property>
+  <property id="sql_catalog_clear_reserved" type="str">z_clear_reserved</property>
+  <property id="sql_catalog_object" type="tuple">
+    <item type="str">z_catalog_category</item>
+    <item type="str">z_catalog_compatibility</item>
+    <item type="str">z_catalog_movement</item>
+    <item type="str">z_catalog_roles_and_users</item>
+    <item type="str">z_catalog_stock</item>
+    <item type="str">z_catalog_subject</item>
+    <item type="str">z_update_object</item>
+  </property>
+  <property id="sql_uncatalog_object" type="tuple">
+    <item type="str">z0_uncatalog_category</item>
+    <item type="str">z0_uncatalog_compatibility</item>
+    <item type="str">z0_uncatalog_movement</item>
+    <item type="str">z0_uncatalog_roles_and_users</item>
+    <item type="str">z0_uncatalog_stock</item>
+    <item type="str">z0_uncatalog_subject</item>
+    <item type="str">z_uncatalog_object</item>
+  </property>
+  <property id="sql_update_object" type="tuple">
+    <item type="str">z0_uncatalog_category</item>
+    <item type="str">z0_uncatalog_compatibility</item>
+    <item type="str">z0_uncatalog_movement</item>
+    <item type="str">z0_uncatalog_roles_and_users</item>
+    <item type="str">z0_uncatalog_stock</item>
+    <item type="str">z0_uncatalog_subject</item>
+    <item type="str">z_catalog_category</item>
+    <item type="str">z_catalog_compatibility</item>
+    <item type="str">z_catalog_movement</item>
+    <item type="str">z_catalog_roles_and_users</item>
+    <item type="str">z_catalog_stock</item>
+    <item type="str">z_catalog_subject</item>
+    <item type="str">z_update_object</item>
+  </property>
+  <property id="sql_clear_catalog" type="tuple">
+    <item type="str">z0_drop_catalog</item>
+    <item type="str">z0_drop_category</item>
+    <item type="str">z0_drop_compatibility</item>
+    <item type="str">z0_drop_movement</item>
+    <item type="str">z0_drop_record</item>
+    <item type="str">z0_drop_roles_and_users</item>
+    <item type="str">z0_drop_stock</item>
+    <item type="str">z0_drop_subject</item>
+    <item type="str">z_create_catalog</item>
+    <item type="str">z_create_category</item>
+    <item type="str">z_create_compatibility</item>
+    <item type="str">z_create_movement</item>
+    <item type="str">z_create_record</item>
+    <item type="str">z_create_roles_and_users</item>
+    <item type="str">z_create_stock</item>
+    <item type="str">z_create_subject</item>
+  </property>
+  <property id="sql_catalog_object_list" type="tuple">
+    <item type="str">z_catalog_category_list</item>
+    <item type="str">z_catalog_compatibility_list</item>
+    <item type="str">z_catalog_movement_list</item>
+    <item type="str">z_catalog_object_list</item>
+    <item type="str">z_catalog_roles_and_users_list</item>
+    <item type="str">z_catalog_stock_list</item>
+    <item type="str">z_catalog_subject_list</item>
+  </property>
+  <property id="sql_record_catalog_object" type="str">z_record_catalog_object</property>
+  <property id="sql_record_uncatalog_object" type="str">z_record_uncatalog_object</property>
+  <property id="sql_read_recorded_object_list" type="str">z_read_recorded_object_list</property>
+  <property id="sql_delete_recorded_object_list" type="str">z_delete_recorded_object_list</property>
+  <property id="sql_search_results" type="str">z_search_results</property>
+  <property id="sql_search_tables" type="tuple">
+    <item type="str">catalog</item>
+    <item type="str">category</item>
+    <item type="str">compatibility</item>
+    <item type="str">movement</item>
+    <item type="str">roles_and_users</item>
+  </property>
+  <property id="sql_search_result_keys" type="tuple">
+    <item type="str">catalog.path</item>
+    <item type="str">catalog.uid</item>
+  </property>
+  <property id="sql_count_results" type="str">z_count_results</property>
+  <property id="sql_getitem_by_path" type="str">z_getitem_by_path</property>
+  <property id="sql_getitem_by_uid" type="str">z_getitem_by_uid</property>
+  <property id="sql_catalog_tables" type="str">z_show_tables</property>
+  <property id="sql_catalog_schema" type="str">z_show_columns</property>
+  <property id="sql_unique_values" type="str">z_unique_values</property>
+  <property id="sql_catalog_paths" type="str">z_catalog_paths</property>
+  <property id="sql_catalog_keyword_search_keys" type="tuple">
+    <item type="str">Description</item>
+    <item type="str">Title</item>
+    <item type="str">catalog.Description</item>
+    <item type="str">catalog.Title</item>
+  </property>
+  <property id="sql_catalog_full_text_search_keys" type="tuple">
+    <item type="str">SearchableText</item>
+    <item type="str">compatibility.SearchableText</item>
+  </property>
+  <property id="sql_catalog_request_keys" type="tuple">
+  </property>
+  <property id="sql_catalog_multivalue_keys" type="tuple">
+  </property>
+  <property id="sql_catalog_topic_search_keys" type="tuple">
+  </property>
+  <property id="sql_catalog_related_keys" type="tuple">
+    <item type="str">allowedRolesAndUsers | roles_and_users/allowedRolesAndUsers/z_related_security</item>
+  </property>
+</SQLCatalogData>
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z0_drop_compatibility.zsql b/product/ERP5Catalog/sql/erp5_mysql/z0_drop_compatibility.zsql
new file mode 100755
index 0000000000..b66546155c
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z0_drop_compatibility.zsql
@@ -0,0 +1,11 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params></params>
+DROP TABLE compatibility
\ No newline at end of file
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z0_uncatalog_compatibility.zsql b/product/ERP5Catalog/sql/erp5_mysql/z0_uncatalog_compatibility.zsql
new file mode 100755
index 0000000000..8fe1296032
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z0_uncatalog_compatibility.zsql
@@ -0,0 +1,11 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>uid</params>
+DELETE FROM compatibility WHERE <dtml-sqltest uid op=eq type=int>
\ No newline at end of file
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_catalog_category_list.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_category_list.zsql
new file mode 100755
index 0000000000..64c4715470
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_category_list.zsql
@@ -0,0 +1,78 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>uid
+isMovement
+getCategoryList
+getAcquiredCategoryList</params>
+INSERT INTO category VALUES
+<dtml-in prefix="loop" expr="_.range(_.len(uid))">
+<dtml-if sequence-start><dtml-else>,</dtml-if>
+  <dtml-if "isMovement[loop_item]">
+    <dtml-if expr="getCategoryList[loop_item]">
+      <dtml-let uid_list="portal_categories.getCategoryParentUidList(getCategoryList[loop_item])">
+        <dtml-if uid_list>
+          <dtml-in prefix="uid" expr="uid_list">
+<dtml-if sequence-start><dtml-else>,</dtml-if>
+(
+  <dtml-sqlvar expr="uid[loop_item]" type="int">,
+  <dtml-sqlvar expr="uid_item[0]" type="int">,
+  <dtml-sqlvar expr="uid_item[1]" type="int">,
+  <dtml-sqlvar expr="uid_item[2]" type="int">
+)
+          </dtml-in> 
+        <dtml-else>
+(
+  <dtml-sqlvar expr="uid[loop_item]" type="int">,
+  NULL,
+  NULL,
+  1
+)
+        </dtml-if>
+      </dtml-let>
+    <dtml-else>
+(
+  <dtml-sqlvar expr="uid[loop_item]" type="int">,
+  NULL,
+  NULL,
+  1
+)
+    </dtml-if>
+  <dtml-else>
+    <dtml-if expr="getAcquiredCategoryList[loop_item]">
+      <dtml-let uid_list="portal_categories.getCategoryParentUidList(getAcquiredCategoryList[loop_item])">
+        <dtml-if uid_list>
+          <dtml-in prefix="uid" expr="uid_list">
+<dtml-if sequence-start><dtml-else>,</dtml-if>
+(
+  <dtml-sqlvar expr="uid[loop_item]" type="int">,
+  <dtml-sqlvar expr="uid_item[0]" type="int">,
+  <dtml-sqlvar expr="uid_item[1]" type="int">,
+  <dtml-sqlvar expr="uid_item[2]" type="int">
+)
+          </dtml-in> 
+        <dtml-else>
+(
+  <dtml-sqlvar expr="uid[loop_item]" type="int">,
+  NULL,
+  NULL,
+  1
+)
+        </dtml-if>
+      </dtml-let>
+    <dtml-else>
+(
+  <dtml-sqlvar expr="uid[loop_item]" type="int">,
+  NULL,
+  NULL,
+  1
+)
+    </dtml-if>
+  </dtml-if>
+</dtml-in>  
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_catalog_compatibility.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_compatibility.zsql
new file mode 100755
index 0000000000..fe62c3dc5d
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_compatibility.zsql
@@ -0,0 +1,48 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>uid
+Creator
+Date
+PrincipiaSearchSource
+SearchableText
+EffectiveDate
+ExpiresDate
+ModificationDate
+Type
+bobobase_modification_time
+created
+effective
+expires
+getIcon
+in_reply_to
+modified
+review_state
+summary
+</params>
+INSERT INTO compatibility VALUES (
+  <dtml-sqlvar uid type="int">,
+  <dtml-sqlvar Creator type="string" optional>,
+  <dtml-sqlvar Date type="string" optional>,
+  <dtml-sqlvar PrincipiaSearchSource type="string" optional>,
+  <dtml-sqlvar SearchableText  type="string" optional>,
+  <dtml-sqlvar EffectiveDate   type="string" optional>,
+  <dtml-sqlvar ExpiresDate    type="string" optional>,
+  <dtml-sqlvar ModificationDate     type="string" optional>,
+  <dtml-sqlvar Type  type="string" optional>,
+  <dtml-sqlvar bobobase_modification_time  type="string" optional>,
+  <dtml-sqlvar created  type="string" optional>,
+  <dtml-sqlvar effective   type="string" optional>,
+  <dtml-sqlvar expires   type="string" optional>,
+  <dtml-sqlvar getIcon  type="string" optional>,
+  <dtml-sqlvar in_reply_to  type="string" optional>,
+  <dtml-sqlvar modified  type="string" optional>,
+  <dtml-sqlvar review_state type="string" optional>,
+  <dtml-sqlvar summary  type="string" optional>
+);
\ No newline at end of file
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_catalog_compatibility_list.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_compatibility_list.zsql
new file mode 100755
index 0000000000..83db1ff9ee
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_compatibility_list.zsql
@@ -0,0 +1,57 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>uid
+Creator
+Date
+PrincipiaSearchSource
+SearchableText
+EffectiveDate
+ExpiresDate
+ModificationDate
+Type
+bobobase_modification_time
+created
+effective
+expires
+getIcon
+in_reply_to
+modified
+review_state
+summary
+</params>
+INSERT INTO
+  compatibility
+VALUES
+<dtml-in prefix="loop" expr="_.range(_.len(uid))">
+(
+  <dtml-sqlvar expr="uid[loop_item]" type="int">,  
+  <dtml-sqlvar expr="Creator[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="Date[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="PrincipiaSearchSource[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="SearchableText[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="EffectiveDate[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="ExpiresDate[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="ModificationDate[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="Type[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="bobobase_modification_time[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="created[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="effective[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="expires[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getIcon[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="in_reply_to[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="modified[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="review_state[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="summary[loop_item]" type="string" optional>
+)
+<dtml-if sequence-end>
+<dtml-else>
+,
+</dtml-if>
+</dtml-in>
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_catalog_movement_list.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_movement_list.zsql
new file mode 100755
index 0000000000..e9eba44803
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_movement_list.zsql
@@ -0,0 +1,66 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>isMovement
+uid
+getExplanationUid
+getSourceUid
+getDestinationUid
+getResourceUid
+getNetConvertedQuantity
+getInventoriatedStartDate
+getInventoriatedStopDate
+getNetConvertedTargetQuantity
+getTargetStartDate
+getTargetStopDate
+getPrice
+getTotalPrice
+getTargetTotalPrice
+hasCellContent
+isAccountable
+isOrderable
+isDeliverable
+getVariationText</params>
+<dtml-let movement_list="[]">
+  <dtml-in prefix="loop" expr="_.range(_.len(uid))">
+    <dtml-if "isMovement[loop_item]">
+      <dtml-call expr="movement_list.append(loop_item)">
+    </dtml-if>
+  </dtml-in>
+  <dtml-if expr="len(movement_list) > 0">
+INSERT INTO
+  movement
+VALUES
+    <dtml-in prefix="loop" expr="movement_list">
+( 
+  <dtml-sqlvar expr="uid[loop_item]" type="int">,
+  <dtml-sqlvar expr="getExplanationUid[loop_item]" type="int" optional>,
+  <dtml-sqlvar expr="getSourceUid[loop_item]" type="int" optional>,
+  <dtml-sqlvar expr="getDestinationUid[loop_item]" type="int" optional>,
+  <dtml-sqlvar expr="getResourceUid[loop_item]" type="int" optional>,
+  <dtml-sqlvar expr="getNetConvertedQuantity[loop_item]" type="float" optional>,
+  NULL,
+  <dtml-sqlvar expr="getInventoriatedStartDate[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getInventoriatedStopDate[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getNetConvertedTargetQuantity[loop_item]" type="float" optional>,
+  <dtml-sqlvar expr="getTargetStartDate[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getTargetStopDate[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getPrice[loop_item]" type="float" optional>,
+  <dtml-sqlvar expr="getTotalPrice[loop_item]" type="float" optional>,
+  <dtml-sqlvar expr="getTargetTotalPrice[loop_item]" type="float" optional>,
+  <dtml-sqlvar expr="hasCellContent[loop_item]" type="int" optional>,
+  <dtml-sqlvar expr="isAccountable[loop_item]" type="int" optional>,
+  <dtml-sqlvar expr="isOrderable[loop_item]" type="int" optional>,
+  <dtml-sqlvar expr="isDeliverable[loop_item]" type="int" optional>,
+  <dtml-sqlvar expr="getVariationText[loop_item]" type="string" optional>
+)
+<dtml-if sequence-end><dtml-else>,</dtml-if>
+    </dtml-in>
+  </dtml-if>
+</dtml-let>
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_catalog_object_list.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_object_list.zsql
new file mode 100755
index 0000000000..07c27caf2e
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_object_list.zsql
@@ -0,0 +1,88 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>uid
+security_uid
+getPath
+getRelativeUrl
+getParentUid
+id
+CreationDate
+getDescription
+getTitle
+meta_type
+getPortalType
+opportunity_state
+getDefaultSourceReference
+getDefaultDestinationReference
+getDefaultSourceTitle
+getDefaultDestinationTitle
+getDefaultSourceSectionTitle
+getDefaultDestinationSectionTitle
+getDefaultCausalityId
+getLocation
+getEan13Code
+simulation_state
+causality_state
+discussion_state
+invoice_state
+getOrderId
+validation_state
+payment_state
+event_state
+getReference
+getSourceReference
+getDestinationReference
+getStringIndex
+getIntIndex
+getFloatIndex</params>
+INSERT INTO
+  catalog
+VALUES
+<dtml-in prefix="loop" expr="_.range(_.len(uid))">
+(
+  <dtml-sqlvar expr="uid[loop_item]" type="int">,  
+  <dtml-sqlvar expr="security_uid[loop_item]" type="int">,
+  <dtml-sqlvar expr="getPath[loop_item]" type="string">,
+  <dtml-sqlvar expr="getRelativeUrl[loop_item]" type="string">,
+  <dtml-sqlvar expr="getParentUid[loop_item]" type="int">,
+  <dtml-sqlvar expr="id[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="CreationDate[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getDescription[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getTitle[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="meta_type[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getPortalType[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="opportunity_state[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getDefaultSourceReference[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getDefaultDestinationReference[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getDefaultSourceTitle[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getDefaultDestinationTitle[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getDefaultSourceSectionTitle[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getDefaultDestinationSectionTitle[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getDefaultCausalityId[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getLocation[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getEan13Code[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="validation_state[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="simulation_state[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="causality_state[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="discussion_state[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="payment_state[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="event_state[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="invoice_state[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getOrderId[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getReference[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getSourceReference[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getDestinationReference[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getStringIndex[loop_item]" type="string" optional>,
+  <dtml-sqlvar expr="getIntIndex[loop_item]" type="int" optional>,
+  <dtml-sqlvar expr="getFloatIndex[loop_item]" type="float" optional>
+
+)
+<dtml-if sequence-end><dtml-else>,</dtml-if>
+</dtml-in>
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_catalog_roles_and_users_list.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_roles_and_users_list.zsql
new file mode 100755
index 0000000000..995c02cc86
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_roles_and_users_list.zsql
@@ -0,0 +1,29 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>security_uid
+optimised_roles_and_users</params>
+<dtml-let row_list="[]">
+  <dtml-in prefix="loop" expr="_.range(_.len(security_uid))">
+    <dtml-if expr="optimised_roles_and_users[loop_item]">
+      <dtml-in prefix="role" expr="optimised_roles_and_users[loop_item]">
+        <dtml-call expr="row_list.append([security_uid[loop_item], role_item])">
+      </dtml-in>
+    </dtml-if>
+  </dtml-in>
+  <dtml-if expr="len(row_list) > 0">
+INSERT INTO
+  roles_and_users
+VALUES
+    <dtml-in prefix="row" expr="row_list">
+(<dtml-sqlvar expr="row_item[0]" type="string">, <dtml-sqlvar expr="row_item[1]" type="string">)
+<dtml-if sequence-end><dtml-else>,</dtml-if>
+    </dtml-in>
+  </dtml-if>
+</dtml-let>
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_catalog_stock_list.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_stock_list.zsql
new file mode 100755
index 0000000000..e9bccc82c7
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_stock_list.zsql
@@ -0,0 +1,51 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>uid
+getResourceUid
+getInventoriatedQuantity
+getSourceUid
+getDestinationUid
+getSourceSectionUid
+getDestinationSectionUid
+isMovement
+getSourceTotalAssetPrice
+getDestinationTotalAssetPrice</params>
+<dtml-let row_list="[]">
+  <dtml-in prefix="loop" expr="_.range(_.len(uid))">
+    <dtml-if "isMovement[loop_item]">
+      <dtml-if "getResourceUid[loop_item]">
+        <dtml-if "getDestinationUid[loop_item]">
+          <dtml-call expr="row_list.append([uid[loop_item], getDestinationUid[loop_item], getDestinationSectionUid[loop_item], getSourceSectionUid[loop_item], getResourceUid[loop_item], -getInventoriatedQuantity[loop_item], getDestinationTotalAssetPrice[loop_item]])">
+        </dtml-if>
+        <dtml-if "getSourceUid[loop_item]">
+          <dtml-call expr="row_list.append([uid[loop_item], getSourceUid[loop_item], getSourceSectionUid[loop_item], getDestinationSectionUid[loop_item], getResourceUid[loop_item], getInventoriatedQuantity[loop_item], getSourceTotalAssetPrice[loop_item]])">
+        </dtml-if>
+      </dtml-if>
+    </dtml-if>
+  </dtml-in>  
+  
+  <dtml-if "len(row_list) > 0">
+INSERT INTO
+  stock
+VALUES
+    <dtml-in prefix="row" expr="row_list">
+(
+  <dtml-sqlvar expr="row_item[0]" type="int">,
+  <dtml-sqlvar expr="row_item[1]" type="int">,  
+  <dtml-sqlvar expr="row_item[2]" type="int" optional>, 
+  <dtml-sqlvar expr="row_item[3]" type="int" optional>,
+  <dtml-sqlvar expr="row_item[4]" type="int">, 
+  <dtml-sqlvar expr="row_item[5]" type="float" optional>,
+  <dtml-sqlvar expr="row_item[6]" type="float" optional>
+)
+<dtml-if sequence-end><dtml-else>,</dtml-if>
+    </dtml-in>
+  </dtml-if>
+</dtml-let>
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_catalog_subject_list.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_subject_list.zsql
new file mode 100755
index 0000000000..7368c78061
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_subject_list.zsql
@@ -0,0 +1,25 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>Subject
+uid</params>
+INSERT INTO subject VALUES 
+<dtml-in prefix="loop" expr="_.range(_.len(uid))">
+  <dtml-if sequence-start><dtml-else>,</dtml-if>
+  <dtml-let subject="Subject[loop_item]">
+    <dtml-if subject>
+      <dtml-in prefix="word" expr="subject.split()">
+<dtml-if sequence-start><dtml-else>,</dtml-if>
+(<dtml-sqlvar "uid[loop_item]" type="int">, <dtml-sqlvar word_item type="string">)
+      </dtml-in>
+    <dtml-else>
+(<dtml-sqlvar "uid[loop_item]" type="int">, NULL)
+    </dtml-if>
+  </dtml-let>
+</dtml-in>
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_create_compatibility.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_create_compatibility.zsql
new file mode 100755
index 0000000000..5645844d44
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_create_compatibility.zsql
@@ -0,0 +1,37 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params></params>
+# Host:
+# Database: test
+# Table: 'compatibility'
+#
+CREATE TABLE `compatibility` (
+  `uid` int(11) NOT NULL,
+  `Creator` varchar(30) default '',
+  `Date` datetime default '0000-00-00 00:00:00',
+  `PrincipiaSearchSource` text,
+  `SearchableText` text,
+  `EffectiveDate` datetime default '0000-00-00 00:00:00',
+  `ExpiresDate` datetime default '0000-00-00 00:00:00',
+  `ModificationDate` datetime default '0000-00-00 00:00:00',
+  `Type` varchar(30) default '',
+  `bobobase_modification_time` datetime default '0000-00-00 00:00:00',
+  `created` datetime default '0000-00-00 00:00:00',
+  `effective` datetime default '0000-00-00 00:00:00',
+  `expires` datetime default '0000-00-00 00:00:00',
+  `getIcon` varchar(30) default '',
+  `in_reply_to` varchar(255) default '',
+  `modified` datetime default '0000-00-00 00:00:00',
+  `review_state` varchar(30) default '',
+  `summary` text,
+  PRIMARY KEY  (`uid`),
+  KEY `Type` (`Type`),
+  KEY `review_state` (`review_state`)
+) TYPE=InnoDB;
\ No newline at end of file
-- 
2.30.9