details: https://code.openbravo.com/erp/devel/pi/rev/3e0c1c71113f changeset: 20044:3e0c1c71113f user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed Apr 03 10:05:43 2013 +0200 summary: Related to Issue 22702. Fixes DBConsistency.
details: https://code.openbravo.com/erp/devel/pi/rev/9145aad14222 changeset: 20045:9145aad14222 user: Naiara Martinez <naiara.martinez <at> openbravo.com> date: Mon Mar 18 12:21:57 2013 +0100 summary: fixed bug 23327: Add SetAdminMode(true) in DocInvoice.java to avoid an error diffstat: src-db/database/sourcedata/AD_COLUMN.xml | 2 ++ src-db/database/sourcedata/AD_FIELD.xml | 2 ++ src/org/openbravo/erpCommon/ad_forms/DocInvoice.java | 12 ++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diffs (55 lines): diff -r 4f86e70e5406 -r 9145aad14222 src-db/database/sourcedata/AD_COLUMN.xml --- a/src-db/database/sourcedata/AD_COLUMN.xml Tue Apr 02 19:53:15 2013 +0200 +++ b/src-db/database/sourcedata/AD_COLUMN.xml Mon Mar 18 12:21:57 2013 +0100 @@ -256248,6 +256248,8 @@ <!--6ED02C375E22445E9F2B2FC11FD87510--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> <!--6ED02C375E22445E9F2B2FC11FD87510--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--6ED02C375E22445E9F2B2FC11FD87510--> <NAME><![CDATA[Include in I18N]]></NAME> +<!--6ED02C375E22445E9F2B2FC11FD87510--> <DESCRIPTION><![CDATA[Column to force including Core messages in the OB.I18N object]]></DESCRIPTION> +<!--6ED02C375E22445E9F2B2FC11FD87510--> <HELP><![CDATA[The OB.I18N object allows developers to use labels in the client side. By default only labels that belong to modules other than core are included in this objects. This flag can be used to force including core labels in OB.I18N]]></HELP> <!--6ED02C375E22445E9F2B2FC11FD87510--> <COLUMNNAME><![CDATA[IsIncludeInI18N]]></COLUMNNAME> <!--6ED02C375E22445E9F2B2FC11FD87510--> <AD_TABLE_ID><![CDATA[109]]></AD_TABLE_ID> <!--6ED02C375E22445E9F2B2FC11FD87510--> <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID> diff -r 4f86e70e5406 -r 9145aad14222 src-db/database/sourcedata/AD_FIELD.xml --- a/src-db/database/sourcedata/AD_FIELD.xml Tue Apr 02 19:53:15 2013 +0200 +++ b/src-db/database/sourcedata/AD_FIELD.xml Mon Mar 18 12:21:57 2013 +0100 @@ -275368,6 +275368,8 @@ <!--F585590DD3F74FB4BF56A3FEDEBFD0D3--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> <!--F585590DD3F74FB4BF56A3FEDEBFD0D3--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--F585590DD3F74FB4BF56A3FEDEBFD0D3--> <NAME><![CDATA[Force Availability in Client]]></NAME> +<!--F585590DD3F74FB4BF56A3FEDEBFD0D3--> <DESCRIPTION><![CDATA[Column to force including Core messages in the OB.I18N object]]></DESCRIPTION> +<!--F585590DD3F74FB4BF56A3FEDEBFD0D3--> <HELP><![CDATA[The OB.I18N object allows developers to use labels in the client side. By default only labels that belong to modules other than core are included in this objects. This flag can be used to force including core labels in OB.I18N]]></HELP> <!--F585590DD3F74FB4BF56A3FEDEBFD0D3--> <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED> <!--F585590DD3F74FB4BF56A3FEDEBFD0D3--> <AD_TAB_ID><![CDATA[109]]></AD_TAB_ID> <!--F585590DD3F74FB4BF56A3FEDEBFD0D3--> <AD_COLUMN_ID><![CDATA[6ED02C375E22445E9F2B2FC11FD87510]]></AD_COLUMN_ID> diff -r 4f86e70e5406 -r 9145aad14222 src/org/openbravo/erpCommon/ad_forms/DocInvoice.java --- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java Tue Apr 02 19:53:15 2013 +0200 +++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java Mon Mar 18 12:21:57 2013 +0100 @@ -28,6 +28,7 @@ import org.apache.log4j.Logger; import org.openbravo.base.secureApp.VariablesSecureApp; +import org.openbravo.dal.core.OBContext; import org.openbravo.dal.service.OBDal; import org.openbravo.data.FieldProvider; import org.openbravo.database.ConnectionProvider; @@ -878,10 +879,17 @@ ArrayList<HashMap<String, String>> plan = new ArrayList<HashMap<String, String>>(); int i = 1; BigDecimal total = BigDecimal.ZERO; - int stdPrecision = OBDal.getInstance().get(Currency.class, this.C_Currency_ID) - .getStandardPrecision().intValue(); + int stdPrecision = 0; + OBContext.setAdminMode(true); + try { + stdPrecision = OBDal.getInstance().get(Currency.class, this.C_Currency_ID) + .getStandardPrecision().intValue(); + } finally { + OBContext.restorePreviousMode(); + } BigDecimal periodAmount = amount.divide(new BigDecimal(periodNumber), new MathContext(32, RoundingMode.HALF_UP)).setScale(stdPrecision, BigDecimal.ROUND_HALF_UP); + while (i <= periodNumber) { if (!OBDateUtils.formatDate(date).equals(DateAcct)) { HashMap<String, String> hm = new HashMap<String, String>(); ------------------------------------------------------------------------------ Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits