From 6f2ec9a1a5d4ac3f3e029a2dbd3c11dcbad88e6e Mon Sep 17 00:00:00 2001
From: Mayoro Diagne <mayoro@nexedi.com>
Date: Fri, 25 Jun 2010 18:35:21 +0000
Subject: [PATCH] 2010-06-25 mayoro * modify egov table to be generic for
 erp5_egov bt and catalog methods * remove specific portal_type in filter
 expressions of z_catalog_egov_list

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36614 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../z_catalog_egov_list.catalog_keys.xml      |  7 +--
 .../erp5_mysql_innodb/z_catalog_egov_list.xml | 45 +++++++++++--------
 .../z_create_egov.catalog_keys.xml            |  2 +-
 .../erp5_mysql_innodb/z_create_egov.xml       | 24 ++++------
 .../bt/change_log                             |  4 ++
 .../bt/revision                               |  2 +-
 .../bt/template_local_role_list               |  0
 .../bt/template_portal_type_role_list         |  0
 .../template_registered_skin_selection_list   |  0
 9 files changed, 45 insertions(+), 39 deletions(-)
 create mode 100644 bt5/erp5_egov_mysql_innodb_catalog/bt/template_local_role_list
 create mode 100644 bt5/erp5_egov_mysql_innodb_catalog/bt/template_portal_type_role_list
 create mode 100644 bt5/erp5_egov_mysql_innodb_catalog/bt/template_registered_skin_selection_list

diff --git a/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_egov_list.catalog_keys.xml b/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_egov_list.catalog_keys.xml
index b4ae1c7f88..86cefcf9c2 100644
--- a/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_egov_list.catalog_keys.xml
+++ b/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_egov_list.catalog_keys.xml
@@ -6,8 +6,9 @@
   <value>1</value>
  </item>
  <item key="_filter_expression_archive" type="str">
-  <value>python: here.getPortalType() in ('M0','M0 Bis','M2','M2 Bis','M4','P0','P2','P4','S1','S5','Subscription Form','Declaration TVA','Mandate Form', 'Organisation', 'Assignment')</value>
+  <value>python: context.getPortalType() in ('Organisation', 'Assignment') or (lambda type_info: type_info is not None and type_info.getPortalType() == 'EGov Type')(context.getTypeInfo())</value>
  </item>
- <item key="_filter_type_archive" type="tuple">
+ <item key="_filter_expression_cache_key_archive" type="tuple">
+  <value>portal_type</value>
  </item>
-</catalog_method>
\ No newline at end of file
+</catalog_method>
diff --git a/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_egov_list.xml b/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_egov_list.xml
index c2d0708314..3965e92f8f 100644
--- a/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_egov_list.xml
+++ b/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_egov_list.xml
@@ -9,12 +9,6 @@
     </pickle>
     <pickle>
       <dictionary>
-        <item>
-            <key> <string>__ac_local_roles__</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
         <item>
             <key> <string>_arg</string> </key>
             <value>
@@ -30,13 +24,19 @@
                         <value>
                           <dictionary>
                             <item>
-                                <key> <string>getCorporateRegistrationCode</string> </key>
+                                <key> <string>getPortalType</string> </key>
+                                <value>
+                                  <dictionary/>
+                                </value>
+                            </item>
+                            <item>
+                                <key> <string>getTranslatedValidationStateTitle</string> </key>
                                 <value>
                                   <dictionary/>
                                 </value>
                             </item>
                             <item>
-                                <key> <string>getVatCode</string> </key>
+                                <key> <string>modification_date</string> </key>
                                 <value>
                                   <dictionary/>
                                 </value>
@@ -54,9 +54,10 @@
                         <key> <string>_keys</string> </key>
                         <value>
                           <list>
-<string>uid</string>
-<string>getCorporateRegistrationCode</string>
-<string>getVatCode</string>
+                            <string>uid</string>
+                            <string>getPortalType</string>
+                            <string>getTranslatedValidationStateTitle</string>
+                            <string>modification_date</string>
                           </list>
                         </value>
                     </item>
@@ -65,6 +66,12 @@
               </object>
             </value>
         </item>
+        <item>
+            <key> <string>_col</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
         <item>
             <key> <string>allow_simple_one_argument_traversal</string> </key>
             <value>
@@ -74,9 +81,9 @@
         <item>
             <key> <string>arguments_src</string> </key>
             <value> <string>uid\r\n
-getCorporateRegistrationCode\r\n
-getVatCode\r\n
-</string> </value>
+getPortalType\r\n
+getTranslatedValidationStateTitle\r\n
+modification_date </string> </value>
         </item>
         <item>
             <key> <string>cache_time_</string> </key>
@@ -123,8 +130,9 @@ VALUES\n
   <dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
 ( \n
   <dtml-sqlvar expr="uid[loop_item]" type="int">,\n
-  <dtml-sqlvar expr="getCorporateRegistrationCode[loop_item]" type="string" optional>,\n
-  <dtml-sqlvar expr="getVatCode[loop_item]" type="string" optional>\n
+  <dtml-sqlvar expr="getPortalType[loop_item]" type="string" optional>,\n
+  <dtml-sqlvar expr="getTranslatedValidationStateTitle[loop_item]" type="string" optional>,\n
+  <dtml-sqlvar expr="modification_date[loop_item]" type="datetime" optional>\n
 )\n
 <dtml-if sequence-end><dtml-else>,</dtml-if>\n
   </dtml-in>\n
@@ -176,8 +184,9 @@ VALUES\n
   <dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
 ( \n
   <dtml-sqlvar expr="uid[loop_item]" type="int">,\n
-  <dtml-sqlvar expr="getCorporateRegistrationCode[loop_item]" type="string" optional>,\n
-  <dtml-sqlvar expr="getVatCode[loop_item]" type="string" optional>\n
+  <dtml-sqlvar expr="getPortalType[loop_item]" type="string" optional>,\n
+  <dtml-sqlvar expr="getTranslatedValidationStateTitle[loop_item]" type="string" optional>,\n
+  <dtml-sqlvar expr="modification_date[loop_item]" type="datetime" optional>\n
 )\n
 <dtml-if sequence-end><dtml-else>,</dtml-if>\n
   </dtml-in>\n
diff --git a/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_egov.catalog_keys.xml b/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_egov.catalog_keys.xml
index baf9e92bd9..b0fe64af00 100644
--- a/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_egov.catalog_keys.xml
+++ b/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_egov.catalog_keys.xml
@@ -2,4 +2,4 @@
  <item key="sql_clear_catalog" type="int">
   <value>1</value>
  </item>
-</catalog_method>
\ No newline at end of file
+</catalog_method>
diff --git a/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_egov.xml b/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_egov.xml
index 9909a033e6..e2046d51cf 100644
--- a/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_egov.xml
+++ b/bt5/erp5_egov_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_egov.xml
@@ -9,12 +9,6 @@
     </pickle>
     <pickle>
       <dictionary>
-        <item>
-            <key> <string>__ac_local_roles__</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
         <item>
             <key> <string>_arg</string> </key>
             <value>
@@ -96,11 +90,10 @@
             <key> <string>src</string> </key>
             <value> <string>CREATE TABLE `egov` (\n
   `uid` BIGINT UNSIGNED NOT NULL,\n
-  `corporate_registration_code` VARCHAR(255) DEFAULT \'\',\n
-  `vat_code` VARCHAR(255) DEFAULT \'\',\n
-  PRIMARY KEY (`uid`),\n
-  KEY `rccm` (`corporate_registration_code`),\n
-  KEY `ninea` (`vat_code`)\n
+  `portal_type` VARCHAR(255) DEFAULT \'\',\n
+  `translated_validation_state_title` VARCHAR(255) DEFAULT \'\',\n
+  `modification_date` DATETIME,\n
+  PRIMARY KEY (`uid`)\n
 ) TYPE=InnoDB\n
 </string> </value>
         </item>
@@ -140,11 +133,10 @@
                         <key> <string>raw</string> </key>
                         <value> <string>CREATE TABLE `egov` (\n
   `uid` BIGINT UNSIGNED NOT NULL,\n
-  `corporate_registration_code` VARCHAR(255) DEFAULT \'\',\n
-  `vat_code` VARCHAR(255) DEFAULT \'\',\n
-  PRIMARY KEY (`uid`),\n
-  KEY `rccm` (`corporate_registration_code`),\n
-  KEY `ninea` (`vat_code`)\n
+  `portal_type` VARCHAR(255) DEFAULT \'\',\n
+  `translated_validation_state_title` VARCHAR(255) DEFAULT \'\',\n
+  `modification_date` DATETIME,\n
+  PRIMARY KEY (`uid`)\n
 ) TYPE=InnoDB\n
 </string> </value>
                     </item>
diff --git a/bt5/erp5_egov_mysql_innodb_catalog/bt/change_log b/bt5/erp5_egov_mysql_innodb_catalog/bt/change_log
index 2bbe567204..415f495b12 100644
--- a/bt5/erp5_egov_mysql_innodb_catalog/bt/change_log
+++ b/bt5/erp5_egov_mysql_innodb_catalog/bt/change_log
@@ -1,3 +1,7 @@
+2010-06-25 mayoro
+* modify egov table to be generic for erp5_egov bt and catalog methods
+* remove specific portal_type in filter expressions of z_catalog_egov_list
+
 2008-07-01 fabien
 * add birth_detail table to be able to catalog details relative to birth (place and date)
 
diff --git a/bt5/erp5_egov_mysql_innodb_catalog/bt/revision b/bt5/erp5_egov_mysql_innodb_catalog/bt/revision
index 410b14d2ce..d99e90eb96 100644
--- a/bt5/erp5_egov_mysql_innodb_catalog/bt/revision
+++ b/bt5/erp5_egov_mysql_innodb_catalog/bt/revision
@@ -1 +1 @@
-25
\ No newline at end of file
+29
\ No newline at end of file
diff --git a/bt5/erp5_egov_mysql_innodb_catalog/bt/template_local_role_list b/bt5/erp5_egov_mysql_innodb_catalog/bt/template_local_role_list
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/bt5/erp5_egov_mysql_innodb_catalog/bt/template_portal_type_role_list b/bt5/erp5_egov_mysql_innodb_catalog/bt/template_portal_type_role_list
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/bt5/erp5_egov_mysql_innodb_catalog/bt/template_registered_skin_selection_list b/bt5/erp5_egov_mysql_innodb_catalog/bt/template_registered_skin_selection_list
new file mode 100644
index 0000000000..e69de29bb2
-- 
2.30.9