From 1634583995fa76cb98890304d2d16ca012695706 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Thu, 30 Nov 2006 10:13:37 +0000
Subject: [PATCH] Add a new sql table: alarm. It will be used to store new
 alarm date instead of writing each time into the zodb

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11528 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../result_table_list.xml                     |   1 +
 .../erp5_core/Alarm_zGetAlarmDate.xml         | 175 ++++++++++++++++++
 .../erp5_core/Alarm_zUpdateAlarmDate.xml      | 141 ++++++++++++++
 product/ERP5/bootstrap/erp5_core/bt/revision  |   2 +-
 .../bt/template_catalog_method_id_list        |   3 +
 .../bt/template_catalog_result_table_list     |   1 +
 6 files changed, 322 insertions(+), 1 deletion(-)
 create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Alarm_zGetAlarmDate.xml
 create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Alarm_zUpdateAlarmDate.xml

diff --git a/product/ERP5/bootstrap/erp5_core/CatalogResultTableTemplateItem/result_table_list.xml b/product/ERP5/bootstrap/erp5_core/CatalogResultTableTemplateItem/result_table_list.xml
index 2c9ca2b3b2..ae8f61c0df 100644
--- a/product/ERP5/bootstrap/erp5_core/CatalogResultTableTemplateItem/result_table_list.xml
+++ b/product/ERP5/bootstrap/erp5_core/CatalogResultTableTemplateItem/result_table_list.xml
@@ -1,4 +1,5 @@
 <key_list>
+ <key>alarm</key>
  <key>catalog</key>
  <key>category</key>
  <key>delivery</key>
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Alarm_zGetAlarmDate.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Alarm_zGetAlarmDate.xml
new file mode 100644
index 0000000000..6eb2e777d5
--- /dev/null
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Alarm_zGetAlarmDate.xml
@@ -0,0 +1,175 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.ZSQLMethods.SQL</string>
+          <string>SQL</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_arg</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_data</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>alarm_date</string> </key>
+                                <value>
+                                  <dictionary/>
+                                </value>
+                            </item>
+                            <item>
+                                <key> <string>uid</string> </key>
+                                <value>
+                                  <dictionary/>
+                                </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                    <item>
+                        <key> <string>_keys</string> </key>
+                        <value>
+                          <list>
+<string>uid</string>
+<string>alarm_date</string>
+                          </list>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>allow_simple_one_argument_traversal</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>arguments_src</string> </key>
+            <value> <string>uid\r\n
+alarm_date</string> </value>
+        </item>
+        <item>
+            <key> <string>cache_time_</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>class_file_</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>class_name_</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>connection_hook</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>connection_id</string> </key>
+            <value> <string>erp5_sql_connection</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Alarm_zGetAlarmDate</string> </value>
+        </item>
+        <item>
+            <key> <string>max_cache_</string> </key>
+            <value> <int>100</int> </value>
+        </item>
+        <item>
+            <key> <string>max_rows_</string> </key>
+            <value> <int>1000</int> </value>
+        </item>
+        <item>
+            <key> <string>src</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+SELECT \n
+  alarm_date\n
+FROM\n
+  alarm\n
+WHERE\n
+  uid = <dtml-sqlvar uid type="int">
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>template</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="SQL" module="Shared.DC.ZRDB.DA"/>
+                </klass>
+                <none/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>__name__</string> </key>
+                        <value> <string encoding="cdata"><![CDATA[
+
+<string>
+
+]]></string> </value>
+                    </item>
+                    <item>
+                        <key> <string>_vars</string> </key>
+                        <value>
+                          <dictionary/>
+                        </value>
+                    </item>
+                    <item>
+                        <key> <string>globals</string> </key>
+                        <value>
+                          <dictionary/>
+                        </value>
+                    </item>
+                    <item>
+                        <key> <string>raw</string> </key>
+                        <value> <string encoding="cdata"><![CDATA[
+
+SELECT \n
+  alarm_date\n
+FROM\n
+  alarm\n
+WHERE\n
+  uid = <dtml-sqlvar uid type="int">
+
+]]></string> </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Alarm_zUpdateAlarmDate.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Alarm_zUpdateAlarmDate.xml
new file mode 100644
index 0000000000..d386d27160
--- /dev/null
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Alarm_zUpdateAlarmDate.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.ZSQLMethods.SQL</string>
+          <string>SQL</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_arg</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_data</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>alarm_date</string> </key>
+                                <value>
+                                  <dictionary/>
+                                </value>
+                            </item>
+                            <item>
+                                <key> <string>uid</string> </key>
+                                <value>
+                                  <dictionary/>
+                                </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                    <item>
+                        <key> <string>_keys</string> </key>
+                        <value>
+                          <list>
+<string>uid</string>
+<string>alarm_date</string>
+                          </list>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>arguments_src</string> </key>
+            <value> <string>uid\r\n
+alarm_date</string> </value>
+        </item>
+        <item>
+            <key> <string>connection_id</string> </key>
+            <value> <string>erp5_sql_connection</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Alarm_zUpdateAlarmDate</string> </value>
+        </item>
+        <item>
+            <key> <string>src</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+REPLACE INTO\n
+  alarm (uid, alarm_date)\n
+VALUES\n
+  (<dtml-sqlvar uid type="int">, <dtml-sqlvar alarm_date type="datetime">)
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>template</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="SQL" module="Shared.DC.ZRDB.DA"/>
+                </klass>
+                <none/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>__name__</string> </key>
+                        <value> <string encoding="cdata"><![CDATA[
+
+<string>
+
+]]></string> </value>
+                    </item>
+                    <item>
+                        <key> <string>_vars</string> </key>
+                        <value>
+                          <dictionary/>
+                        </value>
+                    </item>
+                    <item>
+                        <key> <string>globals</string> </key>
+                        <value>
+                          <dictionary/>
+                        </value>
+                    </item>
+                    <item>
+                        <key> <string>raw</string> </key>
+                        <value> <string encoding="cdata"><![CDATA[
+
+REPLACE INTO\n
+  alarm (uid, alarm_date)\n
+VALUES\n
+  (<dtml-sqlvar uid type="int">, <dtml-sqlvar alarm_date type="datetime">)
+
+]]></string> </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index 5e78f1eb7e..e0d1ea1e9a 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-203
\ No newline at end of file
+205
\ No newline at end of file
diff --git a/product/ERP5/bootstrap/erp5_core/bt/template_catalog_method_id_list b/product/ERP5/bootstrap/erp5_core/bt/template_catalog_method_id_list
index 4b79ff736b..0446ff681a 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/template_catalog_method_id_list
+++ b/product/ERP5/bootstrap/erp5_core/bt/template_catalog_method_id_list
@@ -1,3 +1,4 @@
+erp5_mysql/z0_drop_alarm
 erp5_mysql/z0_drop_catalog
 erp5_mysql/z0_drop_category
 erp5_mysql/z0_drop_compatibility
@@ -22,6 +23,7 @@ erp5_mysql/z0_uncatalog_predicate
 erp5_mysql/z0_uncatalog_predicate_category
 erp5_mysql/z0_uncatalog_stock
 erp5_mysql/z0_uncatalog_subject
+erp5_mysql/z_catalog_alarm_list
 erp5_mysql/z_catalog_compatibility_list
 erp5_mysql/z_catalog_delivery_list
 erp5_mysql/z_catalog_fulltext_list
@@ -39,6 +41,7 @@ erp5_mysql/z_catalog_subject_list
 erp5_mysql/z_catalog_translation_list
 erp5_mysql/z_clear_reserved
 erp5_mysql/z_count_results
+erp5_mysql/z_create_alarm
 erp5_mysql/z_create_catalog
 erp5_mysql/z_create_category
 erp5_mysql/z_create_compatibility
diff --git a/product/ERP5/bootstrap/erp5_core/bt/template_catalog_result_table_list b/product/ERP5/bootstrap/erp5_core/bt/template_catalog_result_table_list
index 71c4bc1de0..af47bf5e48 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/template_catalog_result_table_list
+++ b/product/ERP5/bootstrap/erp5_core/bt/template_catalog_result_table_list
@@ -1,5 +1,6 @@
 catalog
 category
+alarm
 delivery
 full_text
 item
-- 
2.30.9