Fixed bug 21602: Static flag in Assets window
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Tue, 11 Sep 2012 18:13:02 +0200
changeset 17926 e75d1f34e9b4
parent 17925 b371ec37d9b4
child 17927 a8f432b843b5
Fixed bug 21602: Static flag in Assets window
A new flag, called Static, is displayed into the Assets window
If set to Yes, it prevents from moving the asset into the tree, which
basically means changing its parent.
src-db/database/model/tables/A_ASSET.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src/org/openbravo/erpCommon/utility/WindowTreeChecks.java
src/org/openbravo/erpCommon/utility/WindowTree_data.xsql
--- a/src-db/database/model/tables/A_ASSET.xml	Tue Sep 11 15:27:40 2012 +0200
+++ b/src-db/database/model/tables/A_ASSET.xml	Tue Sep 11 18:13:02 2012 +0200
@@ -241,6 +241,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="ISSTATIC" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="A_ASSET_GROUP" name="A_ASSET_A_ASSET_GROUP">
         <reference local="A_ASSET_GROUP_ID" foreign="A_ASSET_GROUP_ID"/>
       </foreign-key>
@@ -281,6 +285,7 @@
       <check name="A_ASSET_ISDISPOSED_CHK"><![CDATA[ISDISPOSED IN ('Y', 'N')]]></check>
       <check name="A_ASSET_ISINPOSESSION_CHK"><![CDATA[ISINPOSESSION IN ('Y', 'N')]]></check>
       <check name="A_ASSET_ISOWNED_CHK"><![CDATA[ISOWNED IN ('Y', 'N')]]></check>
+      <check name="A_ASSET_ISSTATIC_CHK"><![CDATA[ISSTATIC IN ('Y', 'N')]]></check>
       <check name="A_ASSET_ISSUMMARY_CHK"><![CDATA[ISSUMMARY IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Tue Sep 11 15:27:40 2012 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Tue Sep 11 18:13:02 2012 +0200
@@ -284335,6 +284335,42 @@
 <!--B3147C45A604481080501E7C1099A662-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
 <!--B3147C45A604481080501E7C1099A662--></AD_COLUMN>
 
+<!--B35E5E5548A143928E45AAB4057B37F6--><AD_COLUMN>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <AD_COLUMN_ID><![CDATA[B35E5E5548A143928E45AAB4057B37F6]]></AD_COLUMN_ID>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <NAME><![CDATA[Static]]></NAME>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <DESCRIPTION><![CDATA[Prevents from moving the record into the tree]]></DESCRIPTION>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <HELP><![CDATA[Prevents from moving the record into the tree]]></HELP>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <COLUMNNAME><![CDATA[IsStatic]]></COLUMNNAME>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <AD_TABLE_ID><![CDATA[539]]></AD_TABLE_ID>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <SEQNO><![CDATA[380]]></SEQNO>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <AD_ELEMENT_ID><![CDATA[66D79DCEE41D41588FCC2DB58A467EA3]]></AD_ELEMENT_ID>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <POSITION><![CDATA[61]]></POSITION>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--B35E5E5548A143928E45AAB4057B37F6-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--B35E5E5548A143928E45AAB4057B37F6--></AD_COLUMN>
+
 <!--B372776E011046A985A3BB951CEF0A9F--><AD_COLUMN>
 <!--B372776E011046A985A3BB951CEF0A9F-->  <AD_COLUMN_ID><![CDATA[B372776E011046A985A3BB951CEF0A9F]]></AD_COLUMN_ID>
 <!--B372776E011046A985A3BB951CEF0A9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Tue Sep 11 15:27:40 2012 +0200
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Tue Sep 11 18:13:02 2012 +0200
@@ -24311,6 +24311,20 @@
 <!--667AE26F6635E6A7E040007F01015B98-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--667AE26F6635E6A7E040007F01015B98--></AD_ELEMENT>
 
+<!--66D79DCEE41D41588FCC2DB58A467EA3--><AD_ELEMENT>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <AD_ELEMENT_ID><![CDATA[66D79DCEE41D41588FCC2DB58A467EA3]]></AD_ELEMENT_ID>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <COLUMNNAME><![CDATA[IsStatic]]></COLUMNNAME>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <NAME><![CDATA[Static]]></NAME>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <PRINTNAME><![CDATA[Static]]></PRINTNAME>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <DESCRIPTION><![CDATA[Prevents from moving the record into the tree]]></DESCRIPTION>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <HELP><![CDATA[Prevents from moving the record into the tree]]></HELP>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--66D79DCEE41D41588FCC2DB58A467EA3-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--66D79DCEE41D41588FCC2DB58A467EA3--></AD_ELEMENT>
+
 <!--66E1860A46E045D4BD7F018323FA10D4--><AD_ELEMENT>
 <!--66E1860A46E045D4BD7F018323FA10D4-->  <AD_ELEMENT_ID><![CDATA[66E1860A46E045D4BD7F018323FA10D4]]></AD_ELEMENT_ID>
 <!--66E1860A46E045D4BD7F018323FA10D4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Tue Sep 11 15:27:40 2012 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Tue Sep 11 18:13:02 2012 +0200
@@ -178129,6 +178129,34 @@
 <!--1C749E67C7124E3BB1307755C3CF453E-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--1C749E67C7124E3BB1307755C3CF453E--></AD_FIELD>
 
+<!--1C78E6F992F44E50BC5CB9294881C03A--><AD_FIELD>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <AD_FIELD_ID><![CDATA[1C78E6F992F44E50BC5CB9294881C03A]]></AD_FIELD_ID>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <NAME><![CDATA[Static]]></NAME>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <DESCRIPTION><![CDATA[Prevents from moving the record into the tree]]></DESCRIPTION>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <HELP><![CDATA[Prevents from moving the record into the tree]]></HELP>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <AD_TAB_ID><![CDATA[800078]]></AD_TAB_ID>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <AD_COLUMN_ID><![CDATA[B35E5E5548A143928E45AAB4057B37F6]]></AD_COLUMN_ID>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <SEQNO><![CDATA[85]]></SEQNO>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--1C78E6F992F44E50BC5CB9294881C03A-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--1C78E6F992F44E50BC5CB9294881C03A--></AD_FIELD>
+
 <!--1C8A629E52404C48B4CC703DB057E8F3--><AD_FIELD>
 <!--1C8A629E52404C48B4CC703DB057E8F3-->  <AD_FIELD_ID><![CDATA[1C8A629E52404C48B4CC703DB057E8F3]]></AD_FIELD_ID>
 <!--1C8A629E52404C48B4CC703DB057E8F3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Sep 11 15:27:40 2012 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Sep 11 18:13:02 2012 +0200
@@ -16467,6 +16467,17 @@
 <!--491DCBBBBAE544DDABD6F0F1979256B3-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--491DCBBBBAE544DDABD6F0F1979256B3--></AD_MESSAGE>
 
+<!--492C1E7969764AD1BE52DCB41278B5BC--><AD_MESSAGE>
+<!--492C1E7969764AD1BE52DCB41278B5BC-->  <AD_MESSAGE_ID><![CDATA[492C1E7969764AD1BE52DCB41278B5BC]]></AD_MESSAGE_ID>
+<!--492C1E7969764AD1BE52DCB41278B5BC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--492C1E7969764AD1BE52DCB41278B5BC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--492C1E7969764AD1BE52DCB41278B5BC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--492C1E7969764AD1BE52DCB41278B5BC-->  <VALUE><![CDATA[StaticRecord]]></VALUE>
+<!--492C1E7969764AD1BE52DCB41278B5BC-->  <MSGTEXT><![CDATA[You are trying to move a static record into the tree. If you really want to do it, please unset the correspondent Static flag and try it again.]]></MSGTEXT>
+<!--492C1E7969764AD1BE52DCB41278B5BC-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--492C1E7969764AD1BE52DCB41278B5BC-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--492C1E7969764AD1BE52DCB41278B5BC--></AD_MESSAGE>
+
 <!--4A82705B500347DB93524E0EBAFAA4FA--><AD_MESSAGE>
 <!--4A82705B500347DB93524E0EBAFAA4FA-->  <AD_MESSAGE_ID><![CDATA[4A82705B500347DB93524E0EBAFAA4FA]]></AD_MESSAGE_ID>
 <!--4A82705B500347DB93524E0EBAFAA4FA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/utility/WindowTreeChecks.java	Tue Sep 11 15:27:40 2012 +0200
+++ b/src/org/openbravo/erpCommon/utility/WindowTreeChecks.java	Tue Sep 11 18:13:02 2012 +0200
@@ -63,6 +63,10 @@
       String isReady = WindowTreeData.selectIsReady(conn, nodeId);
       if ("Y".equals(isReady))
         return Utility.messageBD(conn, "OrgIsReady", vars.getLanguage());
+      if ("AS".equals(TreeType)
+          && "Y".equals(WindowTreeData.selectIsStatic(conn, "A_ASSET", nodeId))) {
+        return OBMessageUtils.messageBD("StaticRecord");
+      }
       if (isChild && !topNodeId.equals("0")
           && WindowTreeChecksData.selectIsSummary(conn, table, key, topNodeId).equals("N"))
         return Utility.messageBD(conn, "NotIsSummary", vars.getLanguage());
--- a/src/org/openbravo/erpCommon/utility/WindowTree_data.xsql	Tue Sep 11 15:27:40 2012 +0200
+++ b/src/org/openbravo/erpCommon/utility/WindowTree_data.xsql	Tue Sep 11 18:13:02 2012 +0200
@@ -341,6 +341,17 @@
       </Sql>
         <Parameter name="adOrgId"/>
    </SqlMethod>
+   <SqlMethod name="selectIsStatic" type="preparedStatement" return="String" default="N">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql>
+        SELECT A.ISSTATIC
+        FROM A_ASSET A
+        WHERE A.A_ASSET_ID = ?
+      </Sql>
+      <Parameter name="tablename" optional="false" type="replace" after="FROM " text="A_ASSET"/>
+      <Parameter name="tablename" optional="false" type="replace" after="WHERE A." text="A_ASSET"/>
+      <Parameter name="recordId"/>
+   </SqlMethod>
    <SqlMethod name="update" type="preparedStatement" return="rowCount">
       <SqlMethodComment></SqlMethodComment>
       <Sql>