Fixed bug 21600: Depreciate flag in Asset Group window
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Tue, 11 Sep 2012 15:27:40 +0200
changeset 17925 b371ec37d9b4
parent 17924 61377c542f43
child 17926 e75d1f34e9b4
Fixed bug 21600: Depreciate flag in Asset Group window
Depreciate field is displayed into the Asset Group window (removed
from configScript)
The Depreciate field inside the Assets window inherits from the
selected Asset Category. The SL_Depreciate callout has been developed
for managing this requirement.
modules/org.openbravo.v3/src-db/database/configScript.xml
src-db/database/sourcedata/AD_CALLOUT.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MODEL_OBJECT.xml
src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml
src/org/openbravo/erpCommon/ad_callouts/SL_Depreciate.java
--- a/modules/org.openbravo.v3/src-db/database/configScript.xml	Mon Sep 10 17:29:34 2012 +0200
+++ b/modules/org.openbravo.v3/src-db/database/configScript.xml	Tue Sep 11 15:27:40 2012 +0200
@@ -953,10 +953,6 @@
       <oldValue><![CDATA[Y]]></oldValue>
       <newValue><![CDATA[N]]></newValue>
     </columnDataChange>
-    <columnDataChange tablename="AD_FIELD" columnname="ISDISPLAYED" pkRow="6190">
-      <oldValue><![CDATA[Y]]></oldValue>
-      <newValue><![CDATA[N]]></newValue>
-    </columnDataChange>
     <columnDataChange tablename="AD_FIELD" columnname="ISDISPLAYED" pkRow="6298">
       <oldValue><![CDATA[Y]]></oldValue>
       <newValue><![CDATA[N]]></newValue>
--- a/src-db/database/sourcedata/AD_CALLOUT.xml	Mon Sep 10 17:29:34 2012 +0200
+++ b/src-db/database/sourcedata/AD_CALLOUT.xml	Tue Sep 11 15:27:40 2012 +0200
@@ -817,6 +817,15 @@
 <!--3C9DEC9042534CFA8C74B83D28CA777D-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--3C9DEC9042534CFA8C74B83D28CA777D--></AD_CALLOUT>
 
+<!--3CC0A308B32C4BC6A7E742DDB27F1CFE--><AD_CALLOUT>
+<!--3CC0A308B32C4BC6A7E742DDB27F1CFE-->  <AD_CALLOUT_ID><![CDATA[3CC0A308B32C4BC6A7E742DDB27F1CFE]]></AD_CALLOUT_ID>
+<!--3CC0A308B32C4BC6A7E742DDB27F1CFE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--3CC0A308B32C4BC6A7E742DDB27F1CFE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--3CC0A308B32C4BC6A7E742DDB27F1CFE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--3CC0A308B32C4BC6A7E742DDB27F1CFE-->  <NAME><![CDATA[SL_Depreciate]]></NAME>
+<!--3CC0A308B32C4BC6A7E742DDB27F1CFE-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--3CC0A308B32C4BC6A7E742DDB27F1CFE--></AD_CALLOUT>
+
 <!--3E7999A44EEA40FEBC71EACA93A51198--><AD_CALLOUT>
 <!--3E7999A44EEA40FEBC71EACA93A51198-->  <AD_CALLOUT_ID><![CDATA[3E7999A44EEA40FEBC71EACA93A51198]]></AD_CALLOUT_ID>
 <!--3E7999A44EEA40FEBC71EACA93A51198-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Mon Sep 10 17:29:34 2012 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Tue Sep 11 15:27:40 2012 +0200
@@ -101247,6 +101247,7 @@
 <!--8051-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--8051-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--8051-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--8051-->  <AD_CALLOUT_ID><![CDATA[3CC0A308B32C4BC6A7E742DDB27F1CFE]]></AD_CALLOUT_ID>
 <!--8051-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--8051-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--8051-->  <POSITION><![CDATA[13]]></POSITION>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Mon Sep 10 17:29:34 2012 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Tue Sep 11 15:27:40 2012 +0200
@@ -74521,7 +74521,6 @@
 <!--6190-->  <AD_COLUMN_ID><![CDATA[8115]]></AD_COLUMN_ID>
 <!--6190-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
 <!--6190-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--6190-->  <DISPLAYLOGIC><![CDATA[@IsOwned@='Y']]></DISPLAYLOGIC>
 <!--6190-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--6190-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--6190-->  <SEQNO><![CDATA[60]]></SEQNO>
--- a/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Mon Sep 10 17:29:34 2012 +0200
+++ b/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Tue Sep 11 15:27:40 2012 +0200
@@ -3833,6 +3833,18 @@
 <!--8E86ECAC98194E5985A2E6B5DEC3C870-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
 <!--8E86ECAC98194E5985A2E6B5DEC3C870--></AD_MODEL_OBJECT>
 
+<!--91ED626A1F6445459119962799D17FA9--><AD_MODEL_OBJECT>
+<!--91ED626A1F6445459119962799D17FA9-->  <AD_MODEL_OBJECT_ID><![CDATA[91ED626A1F6445459119962799D17FA9]]></AD_MODEL_OBJECT_ID>
+<!--91ED626A1F6445459119962799D17FA9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--91ED626A1F6445459119962799D17FA9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--91ED626A1F6445459119962799D17FA9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--91ED626A1F6445459119962799D17FA9-->  <ACTION><![CDATA[C]]></ACTION>
+<!--91ED626A1F6445459119962799D17FA9-->  <CLASSNAME><![CDATA[org.openbravo.erpCommon.ad_callouts.SL_Depreciate]]></CLASSNAME>
+<!--91ED626A1F6445459119962799D17FA9-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--91ED626A1F6445459119962799D17FA9-->  <AD_CALLOUT_ID><![CDATA[3CC0A308B32C4BC6A7E742DDB27F1CFE]]></AD_CALLOUT_ID>
+<!--91ED626A1F6445459119962799D17FA9-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
+<!--91ED626A1F6445459119962799D17FA9--></AD_MODEL_OBJECT>
+
 <!--9282C90A36A848ADBA7ACED8CDF02304--><AD_MODEL_OBJECT>
 <!--9282C90A36A848ADBA7ACED8CDF02304-->  <AD_MODEL_OBJECT_ID><![CDATA[9282C90A36A848ADBA7ACED8CDF02304]]></AD_MODEL_OBJECT_ID>
 <!--9282C90A36A848ADBA7ACED8CDF02304-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml	Mon Sep 10 17:29:34 2012 +0200
+++ b/src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml	Tue Sep 11 15:27:40 2012 +0200
@@ -3790,6 +3790,16 @@
 <!--4574500DD2314CE28AB179852DFD091C-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
 <!--4574500DD2314CE28AB179852DFD091C--></AD_MODEL_OBJECT_MAPPING>
 
+<!--4A9AF7FBED4D4FE891EF7E2AAA389FBA--><AD_MODEL_OBJECT_MAPPING>
+<!--4A9AF7FBED4D4FE891EF7E2AAA389FBA-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[4A9AF7FBED4D4FE891EF7E2AAA389FBA]]></AD_MODEL_OBJECT_MAPPING_ID>
+<!--4A9AF7FBED4D4FE891EF7E2AAA389FBA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--4A9AF7FBED4D4FE891EF7E2AAA389FBA-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--4A9AF7FBED4D4FE891EF7E2AAA389FBA-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--4A9AF7FBED4D4FE891EF7E2AAA389FBA-->  <AD_MODEL_OBJECT_ID><![CDATA[91ED626A1F6445459119962799D17FA9]]></AD_MODEL_OBJECT_ID>
+<!--4A9AF7FBED4D4FE891EF7E2AAA389FBA-->  <MAPPINGNAME><![CDATA[/ad_callouts/SL_Depreciate.html]]></MAPPINGNAME>
+<!--4A9AF7FBED4D4FE891EF7E2AAA389FBA-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--4A9AF7FBED4D4FE891EF7E2AAA389FBA--></AD_MODEL_OBJECT_MAPPING>
+
 <!--527057E70F3145A78A293DC1B0AD5E53--><AD_MODEL_OBJECT_MAPPING>
 <!--527057E70F3145A78A293DC1B0AD5E53-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[527057E70F3145A78A293DC1B0AD5E53]]></AD_MODEL_OBJECT_MAPPING_ID>
 <!--527057E70F3145A78A293DC1B0AD5E53-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Depreciate.java	Tue Sep 11 15:27:40 2012 +0200
@@ -0,0 +1,50 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SLU 
+ * All portions are Copyright (C) 2012 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.erpCommon.ad_callouts;
+
+import javax.servlet.ServletException;
+
+import org.apache.commons.lang.StringUtils;
+import org.openbravo.base.filter.IsIDFilter;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.financialmgmt.assetmgmt.AssetGroup;
+
+public class SL_Depreciate extends SimpleCallout {
+  private static final long serialVersionUID = 1L;
+
+  @Override
+  protected void execute(CalloutInfo info) throws ServletException {
+    final String assetCategoryID = info.getStringParameter("inpaAssetGroupId", IsIDFilter.instance);
+    if (!StringUtils.isBlank(assetCategoryID)) {
+      info.addResult("inpisdepreciated", getDepreciatedFlag(assetCategoryID));
+    }
+  }
+
+  protected Boolean getDepreciatedFlag(final String assetCategoryID) {
+    OBContext.setAdminMode();
+    try {
+      final AssetGroup assetCategory = OBDal.getInstance().get(AssetGroup.class, assetCategoryID);
+      return (assetCategory == null ? Boolean.FALSE : assetCategory.isDepreciate());
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+  }
+}