Simplify/fix definition of password type fields
authorStefan Hühner <stefan.huehner@openbravo.com>
Wed, 02 Feb 2011 19:03:42 +0100
changeset 10341 77acfabeea30
parent 10340 c314cc7d16b5
child 10342 67d124c3a0d1
Simplify/fix definition of password type fields
Current model contains both an 'isecnrypted' flag in ad_column & ad_field
however the only working combination is the one where both values coincide.
New style definition: use one of the new references:
- Password (decryptable)
- Password (not-decryptable)
No need to set any of the older/special boolean flags
changes:
- Change wad to only use ad_column.isencrypted and ignore ad_field.isencrypted
- Hide ad_field.isencrypted and marks it as deprecated
- Mark old ad_column.{isencrypted,isdesencryptable) as read-only
- set old boolean flags automatically when using the new references
src-db/database/model/triggers/AD_COLUMN_MOD_TRG.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
src-wad/src/org/openbravo/wad/EditionFields_data.xsql
src-wad/src/org/openbravo/wad/Fields_data.xsql
--- a/src-db/database/model/triggers/AD_COLUMN_MOD_TRG.xml	Wed Feb 02 19:02:55 2011 +0100
+++ b/src-db/database/model/triggers/AD_COLUMN_MOD_TRG.xml	Wed Feb 02 19:03:42 2011 +0100
@@ -112,6 +112,19 @@
   IF ((DELETING OR INSERTING) AND devModule='N') THEN
     RAISE_APPLICATION_ERROR(-20533, 'Cannot insert/delete objects in a module not in development.');
   END IF;
+
+  IF (UPDATING OR INSERTING) THEN
+    /* Update old-style password flags: isencrypted & isdesencryptable if used with new reference */
+    IF (:new.ad_reference_id = '16EC6DF4A59747749FDF256B7FBBB058') THEN
+      :new.isencrypted := 'Y';
+      :new.isdesencryptable := 'Y';
+    END IF;
+    IF (:new.ad_reference_id = 'C5C21C28B39E4683A91779F16C112E40') THEN
+      :new.isencrypted := 'Y';
+    :new.isdesencryptable := 'N';
+    END IF;
+  END IF;
+
 END AD_COLUMN_MOD_TRG
 ]]></body>
     </trigger>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Wed Feb 02 19:02:55 2011 +0100
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Wed Feb 02 19:03:42 2011 +0100
@@ -685,7 +685,7 @@
 <!--128-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--128-->  <NAME><![CDATA[Display Encription]]></NAME>
 <!--128-->  <DESCRIPTION><![CDATA[An indication noting if the input box of a field will present full text or just asterisks.]]></DESCRIPTION>
-<!--128-->  <HELP><![CDATA[Display encryption - all characters are displayed as '*'. Data storage encryption (i.e. you will not be able to report the data via report tools) is set in the Column definition.]]></HELP>
+<!--128-->  <HELP><![CDATA[This option is deprecated. One of the new references "Password (decryptable)" or "Password (not-decryptable)" should be used instead.]]></HELP>
 <!--128-->  <COLUMNNAME><![CDATA[IsEncrypted]]></COLUMNNAME>
 <!--128-->  <AD_TABLE_ID><![CDATA[101]]></AD_TABLE_ID>
 <!--128-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
@@ -2048,7 +2048,7 @@
 <!--186-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--186-->  <NAME><![CDATA[Display Encription]]></NAME>
 <!--186-->  <DESCRIPTION><![CDATA[An indication noting if the input box of a field will present full text or just asterisks.]]></DESCRIPTION>
-<!--186-->  <HELP><![CDATA[Display encryption - all characters are displayed as '*'. Data storage encryption (i.e. you will not be able to report the data via report tools) is set in the Column definition.]]></HELP>
+<!--186-->  <HELP><![CDATA[This option is deprecated. One of the new references "Password (decryptable)" or "Password (not-decryptable)" should be used instead.]]></HELP>
 <!--186-->  <COLUMNNAME><![CDATA[IsEncrypted]]></COLUMNNAME>
 <!--186-->  <AD_TABLE_ID><![CDATA[107]]></AD_TABLE_ID>
 <!--186-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
@@ -2065,7 +2065,7 @@
 <!--186-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--186-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--186-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
-<!--186-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--186-->  <DEVELOPMENTSTATUS><![CDATA[DP]]></DEVELOPMENTSTATUS>
 <!--186-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--186-->  <POSITION><![CDATA[24]]></POSITION>
 <!--186-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
@@ -181186,7 +181186,7 @@
 <!--800832-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--800832-->  <NAME><![CDATA[De-encryptable]]></NAME>
 <!--800832-->  <DESCRIPTION><![CDATA[Is desencryptable]]></DESCRIPTION>
-<!--800832-->  <HELP><![CDATA[When Is Desencryptable field is 'Y' the content of this column will be saved in a desencryptable way.]]></HELP>
+<!--800832-->  <HELP><![CDATA[This option is deprecated. Instead one of the new references "Password (decryptable)" or "Password (not-decryptable)" should be used instead.]]></HELP>
 <!--800832-->  <COLUMNNAME><![CDATA[IsDesencryptable]]></COLUMNNAME>
 <!--800832-->  <AD_TABLE_ID><![CDATA[101]]></AD_TABLE_ID>
 <!--800832-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Feb 02 19:02:55 2011 +0100
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Feb 02 19:03:42 2011 +0100
@@ -2479,7 +2479,7 @@
 <!--374-->  <NAME><![CDATA[Display Encription]]></NAME>
 <!--374-->  <PRINTNAME><![CDATA[Display encrypted]]></PRINTNAME>
 <!--374-->  <DESCRIPTION><![CDATA[An indication noting if the input box of a field will present full text or just asterisks.]]></DESCRIPTION>
-<!--374-->  <HELP><![CDATA[Display encryption - all characters are displayed as '*'. Data storage encryption (i.e. you will not be able to report the data via report tools) is set in the Column definition.]]></HELP>
+<!--374-->  <HELP><![CDATA[Thi options is deprecated. One of the new references "Password (decryptable)" or "Password (not-decryptable)" should be used instead.]]></HELP>
 <!--374-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--374--></AD_ELEMENT>
 
@@ -14812,7 +14812,7 @@
 <!--800185-->  <NAME><![CDATA[De-encryptable]]></NAME>
 <!--800185-->  <PRINTNAME><![CDATA[Is desencryptable]]></PRINTNAME>
 <!--800185-->  <DESCRIPTION><![CDATA[Is desencryptable]]></DESCRIPTION>
-<!--800185-->  <HELP><![CDATA[When Is Desencryptable field is 'Y' the content of this column will be saved in a desencryptable way.]]></HELP>
+<!--800185-->  <HELP><![CDATA[This option is deprecated. Instead one of the new references "Password (decryptable)" or "Password (not-decryptable)" should be used instead.]]></HELP>
 <!--800185-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--800185--></AD_ELEMENT>
 
--- a/src-db/database/sourcedata/AD_FIELD.xml	Wed Feb 02 19:02:55 2011 +0100
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Wed Feb 02 19:03:42 2011 +0100
@@ -833,11 +833,11 @@
 <!--142-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--142-->  <NAME><![CDATA[Display Encription]]></NAME>
 <!--142-->  <DESCRIPTION><![CDATA[An indication noting if the input box of a field will present full text or just asterisks.]]></DESCRIPTION>
-<!--142-->  <HELP><![CDATA[Display encryption - all characters are displayed as '*'. Data storage encryption (i.e. you will not be able to report the data via report tools) is set in the Column definition.]]></HELP>
+<!--142-->  <HELP><![CDATA[This option is deprecated. One of the new references "Password (decryptable)" or "Password (not-decryptable)" should be used instead.]]></HELP>
 <!--142-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--142-->  <AD_TAB_ID><![CDATA[107]]></AD_TAB_ID>
 <!--142-->  <AD_COLUMN_ID><![CDATA[186]]></AD_COLUMN_ID>
-<!--142-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--142-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
 <!--142-->  <DISPLAYLOGIC><![CDATA[@IsDisplayed@='Y']]></DISPLAYLOGIC>
 <!--142-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--142-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
@@ -1337,13 +1337,13 @@
 <!--169-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--169-->  <NAME><![CDATA[Display Encription]]></NAME>
 <!--169-->  <DESCRIPTION><![CDATA[An indication noting if the input box of a field will present full text or just asterisks.]]></DESCRIPTION>
-<!--169-->  <HELP><![CDATA[Display encryption - all characters are displayed as '*'. Data storage encryption (i.e. you will not be able to report the data via report tools) is set in the Column definition.]]></HELP>
+<!--169-->  <HELP><![CDATA[This option is deprecated. One of the new references "Password (decryptable)" or "Password (not-decryptable)" should be used instead.]]></HELP>
 <!--169-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--169-->  <AD_TAB_ID><![CDATA[101]]></AD_TAB_ID>
 <!--169-->  <AD_COLUMN_ID><![CDATA[128]]></AD_COLUMN_ID>
 <!--169-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--169-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
-<!--169-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--169-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
 <!--169-->  <SEQNO><![CDATA[360]]></SEQNO>
 <!--169-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
 <!--169-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
@@ -61068,7 +61068,7 @@
 <!--4584-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--4584-->  <NAME><![CDATA[Display Encription]]></NAME>
 <!--4584-->  <DESCRIPTION><![CDATA[An indication noting if the input box of a field will present full text or just asterisks.]]></DESCRIPTION>
-<!--4584-->  <HELP><![CDATA[Display encryption - all characters are displayed as '*'. Data storage encryption (i.e. you will not be able to report the data via report tools) is set in the Column definition.]]></HELP>
+<!--4584-->  <HELP><![CDATA[This option is deprecated. One of the new references "Password (decryptable)" or "Password (not-decryptable)" should be used instead.]]></HELP>
 <!--4584-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--4584-->  <AD_TAB_ID><![CDATA[364]]></AD_TAB_ID>
 <!--4584-->  <AD_COLUMN_ID><![CDATA[128]]></AD_COLUMN_ID>
@@ -138098,14 +138098,14 @@
 <!--801073-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--801073-->  <NAME><![CDATA[De-encryptable]]></NAME>
 <!--801073-->  <DESCRIPTION><![CDATA[Is desencryptable]]></DESCRIPTION>
-<!--801073-->  <HELP><![CDATA[When Is Desencryptable field is 'Y' the content of this column will be saved in a desencryptable way.]]></HELP>
+<!--801073-->  <HELP><![CDATA[This option is deprecated. Instead one of the new references "Password (decryptable)" or "Password (not-decryptable)" should be used instead.]]></HELP>
 <!--801073-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--801073-->  <AD_TAB_ID><![CDATA[101]]></AD_TAB_ID>
 <!--801073-->  <AD_COLUMN_ID><![CDATA[800832]]></AD_COLUMN_ID>
 <!--801073-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--801073-->  <DISPLAYLOGIC><![CDATA[@IsEncrypted@='Y']]></DISPLAYLOGIC>
 <!--801073-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
-<!--801073-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--801073-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
 <!--801073-->  <SEQNO><![CDATA[370]]></SEQNO>
 <!--801073-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--801073-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
--- a/src-wad/src/org/openbravo/wad/EditionFields_data.xsql	Wed Feb 02 19:02:55 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/EditionFields_data.xsql	Wed Feb 02 19:03:42 2011 +0100
@@ -29,7 +29,7 @@
       ad_column.ad_reference_id as reference, displayLength as displaySize, 'x' as htmltext, '' as xmltext, 
       isSameLine as issameline, (CASE ad_field.isActive WHEN 'N' THEN 'N' ELSE isDisplayed END) as isdisplayed, isupdateable as isupdateable, 
       isparent, ad_column.FIELDLENGTH, (CASE WHEN (ad_column.AD_REFERENCE_ID<>'30' OR AD_REFERENCE_VALUE_ID IS NULL) THEN REPLACE(REPLACE(REPLACE(ad_element.name, 'Substitute', 'Product'), 'BOM', ''), 'M_LocatorTo_ID', 'M_Locator_ID') ELSE (SELECT NAME FROM AD_REFERENCE WHERE AD_REFERENCE.AD_REFERENCE_ID=ad_column.AD_REFERENCE_VALUE_ID) END) as searchName, ad_column.ad_callout_id, 
-      ad_column.validateonnew, ad_column.ad_process_id, ad_field.isreadonly, to_char(ad_field.DISPLAYLOGIC) as displaylogic, ad_field.isEncrypted, AD_FIELD.AD_FIELDGROUP_ID AS FieldGroup, ad_field.ad_tab_id as tabid, '' as ad_column_id, ad_column.ad_val_rule_id, '' as displaylength, '' as value, '' as ad_window_id, 
+      ad_column.validateonnew, ad_column.ad_process_id, ad_field.isreadonly, to_char(ad_field.DISPLAYLOGIC) as displaylogic, ad_column.isEncrypted, AD_FIELD.AD_FIELDGROUP_ID AS FieldGroup, ad_field.ad_tab_id as tabid, '' as ad_column_id, ad_column.ad_val_rule_id, '' as displaylength, '' as value, '' as ad_window_id, 
       AD_COLUMN.ValueMin, AD_COLUMN.ValueMax, REPLACE(REPLACE(REPLACE(REPLACE(ad_column.columnname, 'Substitute', 'M_Product'), 'C_Settlement_Cancel_ID', 'C_Settlement_ID'), 'BOM', ''), 'M_LocatorTo_ID', 'M_Locator_ID') as realName, mom.mappingname as java_class_name, '' as realcolumnname, '' as xsqltext, ad_column.isEncrypted AS isColumnEncrypted, ad_column.isDesencryptable, 
       ad_reference.name as reference_name, ad_reference.name as reference_name_trl, '' AS CLASSNAME, '' AS MAPPINGNAME, ad_callout.name as calloutname, 
       moc.classname as classname_callout, momc.mappingname as mappingname_callout, '' AS COLUMNNAME_END, ad_field.isactive, ad_column.readonlylogic, 
--- a/src-wad/src/org/openbravo/wad/Fields_data.xsql	Wed Feb 02 19:02:55 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/Fields_data.xsql	Wed Feb 02 19:03:42 2011 +0100
@@ -33,7 +33,7 @@
         'Medio' as Text_Align, '' AS Xml_Format, 
         ad_field.displaylength, REPLACE(replace(REPLACE(REPLACE(AD_ELEMENT.columnname, 'Substitute_ID', 'M_Product_ID'), 'C_Settlement_Cancel_ID', 'C_Settlement_ID'), 'BOM_ID', '_ID'), 'M_LocatorTo_ID', 'M_Locator_ID') as columnname, 
         '' as WHERECLAUSE, ad_table.tablename, 'StringParameter' as Type, ad_column.ISSESSIONATTR, ad_column.iskey, 
-        isParent, '' as ACCESSLEVEL, ad_field.isreadonly, '' as issecondarykey, ad_field.showInRelation, ad_field.isEncrypted,
+        isParent, '' as ACCESSLEVEL, ad_field.isreadonly, '' as issecondarykey, ad_field.showInRelation, ad_column.isEncrypted,
         ad_field.SORTNO, ad_column.istranslated, '' as id, '' as htmltext, '' as htmltexttrl, '' as xmltexttrl, '' as tablenametrl, 
         0 AS NOWRAP, ad_column.isEncrypted AS isColumnEncrypted, ad_column.isDesencryptable, ad_reference_value_id, ad_column.ad_val_rule_id, '' AS isjasper, ad_field.isactive, '' as AD_Tab_ID, '' as parent_tab_name, '' as orgcode,
         '' as tableModule, '' as columnModule, '' as clientcode, '' as isautosave
@@ -55,19 +55,6 @@
       <SqlMethodComment>Create a registry</SqlMethodComment>
       <Sql></Sql>
   </SqlMethod>
-  <SqlMethod name="selectDescription" type="preparedStatement" return="multiple">
-    <SqlMethodComment>Description of the fields of a tab</SqlMethodComment>
-    <Sql>
-      SELECT f.Name As Name, f.isDisplayed as isdisplayed, f.isEncrypted, c.AD_REFERENCE_ID as reference, 
-      c.FIELDLENGTH, 'Medio' as Text_Align, f.displaylength, c.ColumnName, f.showInRelation 
-      FROM ad_field f, ad_column c 
-      WHERE f.ad_column_id = c.ad_column_id 
-      AND f.showInRelation = 'Y' 
-      AND f.ad_tab_id = ? 
-      ORDER BY f.SEQNO
-    </Sql>
-    <Parameter name="tab"/>
-  </SqlMethod>
   
   <SqlMethod name="selectAuxiliar" type="preparedStatement" return="multiple">
     <SqlMethodComment>Names of the columns and name of the fields of a tab</SqlMethodComment>