Fixed issue 18116. Names of common columns will now be generated correctly
authorAntonio Moreno <antonio.moreno@openbravo.com>
Mon, 01 Aug 2011 17:04:08 +0200
changeset 13367 0951c9cfecef
parent 13366 d2e5daf7691b
child 13368 ef6e09f8f68d
Fixed issue 18116. Names of common columns will now be generated correctly
src-db/database/model/functions/AD_TABLE_IMPORT.xml
--- a/src-db/database/model/functions/AD_TABLE_IMPORT.xml	Fri Jul 29 12:26:54 2011 +0200
+++ b/src-db/database/model/functions/AD_TABLE_IMPORT.xml	Mon Aug 01 17:04:08 2011 +0200
@@ -62,6 +62,7 @@
     v_IsUpdateable CHAR(1):='Y';
     v_DefaultValue NVARCHAR2(2000):='';
     v_SeqNo NUMBER(10) ;
+    v_columnNameOrg VARCHAR2(40) ;
     v_columnName VARCHAR2(40) ;
     v_TableName  VARCHAR2(40) ;
     v_LastColumnName VARCHAR2(40) ;
@@ -229,7 +230,29 @@
       IF(v_columnName LIKE '%_Id') THEN
         v_columnName:=SUBSTR(v_columnName, 1, LENGTH(v_columnName) -3) ||'_ID';
       END IF;
-      
+      -- Some columns need to have specific names for DAL to work correctly:
+      v_columnNameOrg:=v_columnName;
+      IF(v_columnName = 'AD_Org_ID') THEN
+        v_columnName:='Organization';
+      END IF;
+      IF(v_columnName = 'AD_Client_ID') THEN
+        v_columnName:='Client';
+      END IF;
+      IF(v_columnName = 'Created') THEN
+        v_columnName:='Creation Date';
+      END IF;
+      IF(v_columnName = 'Createdby') THEN
+        v_columnName:='Created By';
+      END IF;
+      IF(v_columnName = 'Updated') THEN
+        v_columnName:='Updated';
+      END IF;
+      IF(v_columnName = 'Updatedby') THEN
+        v_columnName:='Updated By';
+      END IF;
+      IF(v_columnName = 'Isactive') THEN
+        v_columnName:='Active';
+      END IF;
       IF substr(upper(v_columnName),1,3)='EM_' then
         db_prefix := substr(v_columnName,4,instr(v_columnName,'_',1,2)-4);
         DBMS_OUTPUT.PUT_LINE('Prefix:'||db_prefix);
@@ -284,7 +307,7 @@
           VALUES
           (v_NextNo, '0', '0', 'Y',
           now(), '0', now(), '0',
-          v_columnName, v_columnName, Cur_Column.AD_Table_ID,
+           v_columnName,v_columnNameOrg, Cur_Column.AD_Table_ID,
           v_AD_Reference_ID, v_FieldLength, v_IsKey, v_IsParent,
          (CASE Cur_Column.Nullable WHEN 'Y' THEN 'N' ELSE 'Y' END),
           v_IsIdentifier, v_SeqNo, 'N', 'N', v_IsUpdateable, v_AD_Reference_Value_ID, 
@@ -313,7 +336,7 @@
       FOR Cur_CommonCols IN (select columnname
                               from ad_column c
                              where c.ad_table_id = '100'
-                               and lower(c.columnname) in ('ad_client_id','ad_org_id','isactive','created','updated','createdby','updatedby')
+                               and lower(c.columnname) in ('client','organization','active','creation date','updated','created by','updated by')
                                and not exists (select 1 
                                                  from ad_column c1
                                                 where c1.ad_table_id = v_Record_ID