details: /erp/devel/pi/rev/66ab23222ea0
changeset: 6696:66ab23222ea0
user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date: Fri Mar 12 11:26:58 2010 +0100
summary: Fixes bug 0012663: Proper management of DAL security
details: /erp/devel/pi/rev/46483cbd31d9
changeset: 6697:46483cbd31d9
user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date: Fri Mar 12 13:55:38 2010 +0100
summary: Fixes bug 0012668: Proper management of DAL security
details: /erp/devel/pi/rev/0d511b2d743e
changeset: 6698:0d511b2d743e
user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date: Fri Mar 12 17:22:00 2010 +0100
summary: Fixes bug 0012668: Proper management of DAL security
diffstat:
src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product.java | 18 +-
src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java | 34 +++-
src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java | 65
+++++----
3 files changed, 70 insertions(+), 47 deletions(-)
diffs (170 lines):
diff -r 29688f05f60a -r 0d511b2d743e
src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product.java
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product.java Fri Mar
12 17:19:38 2010 +0100
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product.java Fri Mar
12 17:22:00 2010 +0100
@@ -28,6 +28,7 @@
import org.openbravo.base.secureApp.HttpSecureAppServlet;
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.erpCommon.utility.ComboTableData;
@@ -111,12 +112,17 @@
+ "\"),\n");
String strAttrSet, strAttrSetValueType;
strAttrSet = strAttrSetValueType = "";
- final Product product = OBDal.getInstance().get(Product.class,
strMProductID);
- if (product != null) {
- AttributeSet attributeset = product.getAttributeSet();
- if (attributeset != null)
- strAttrSet = product.getAttributeSet().toString();
- strAttrSetValueType = product.getUseAttributeSetValueAs();
+ final boolean prevMode =
OBContext.getOBContext().setInAdministratorMode(true);
+ try {
+ final Product product = OBDal.getInstance().get(Product.class,
strMProductID);
+ if (product != null) {
+ AttributeSet attributeset = product.getAttributeSet();
+ if (attributeset != null)
+ strAttrSet = product.getAttributeSet().toString();
+ strAttrSetValueType = product.getUseAttributeSetValueAs();
+ }
+ } finally {
+ OBContext.getOBContext().setInAdministratorMode(prevMode);
}
resultado.append("new Array(\"inpattributeset\", \"" +
FormatUtilities.replaceJS(strAttrSet)
+ "\"),\n");
diff -r 29688f05f60a -r 0d511b2d743e
src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java
--- a/src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java Fri Mar 12
17:19:38 2010 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java Fri Mar 12
17:22:00 2010 +0100
@@ -279,15 +279,20 @@
.append(SALTO_LINEA);
m_info.append(SALTO_LINEA).append(Utility.messageBD(this, "StartingOrg",
vars.getLanguage()))
.append(SALTO_LINEA);
- if (!createOrg(request, vars, strOrganization, strOrgType, strParentOrg,
strOrgUser,
- strcLocationId)) {
- releaseRollbackConnection(conn);
- m_info.append(SALTO_LINEA).append(
- Utility.messageBD(this, "createOrgFailed",
vars.getLanguage())).append(SALTO_LINEA);
- strSummary.append(SALTO_LINEA).append(
- Utility.messageBD(this, "createOrgFailed",
vars.getLanguage())).append(SALTO_LINEA);
- isOK = false;
- return m_info.toString();
+ final boolean prevMode =
OBContext.getOBContext().setInAdministratorMode(true);
+ try {
+ if (!createOrg(request, vars, strOrganization, strOrgType,
strParentOrg, strOrgUser,
+ strcLocationId)) {
+ releaseRollbackConnection(conn);
+ m_info.append(SALTO_LINEA).append(
+ Utility.messageBD(this, "createOrgFailed",
vars.getLanguage())).append(SALTO_LINEA);
+ strSummary.append(SALTO_LINEA).append(
+ Utility.messageBD(this, "createOrgFailed",
vars.getLanguage())).append(SALTO_LINEA);
+ isOK = false;
+ return m_info.toString();
+ }
+ } finally {
+ OBContext.getOBContext().setInAdministratorMode(prevMode);
}
} catch (final Exception err) {
m_info.append(SALTO_LINEA).append(
@@ -362,8 +367,14 @@
m_info.append(SALTO_LINEA).append(
Utility.messageBD(this, "StartingReferenceData",
vars.getLanguage())).append(
SALTO_LINEA);
- final String strReferenceData = createReferenceData(vars,
strOrganization, AD_Client_ID,
- strModules, bProduct, bBPartner, bProject, bCampaign,
bSalesRegion, strCreateAccounting);
+ final boolean prevMode =
OBContext.getOBContext().setInAdministratorMode(true);
+ String strReferenceData = "";
+ try {
+ strReferenceData = createReferenceData(vars, strOrganization,
AD_Client_ID, strModules,
+ bProduct, bBPartner, bProject, bCampaign, bSalesRegion,
strCreateAccounting);
+ } finally {
+ OBContext.getOBContext().setInAdministratorMode(prevMode);
+ }
if (!strReferenceData.equals("")) {
releaseRollbackConnection(conn);
strError = Utility.messageBD(this, "CreateReferenceDataFailed",
vars.getLanguage());
@@ -374,6 +385,7 @@
Utility.messageBD(this, "CreateReferenceDataFailed",
vars.getLanguage())).append(
SALTO_LINEA);
isOK = false;
+ strReferenceData = "";
return m_info.toString();
}
} catch (final Exception err) {
diff -r 29688f05f60a -r 0d511b2d743e
src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java
--- a/src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java Fri Mar
12 17:19:38 2010 +0100
+++ b/src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java Fri Mar
12 17:22:00 2010 +0100
@@ -28,38 +28,43 @@
* Updates payment monitor information
*/
public static void updateInvoice(Invoice invoice) {
- List<DebtPayment> payments = invoice.getFinancialMgmtDebtPaymentList();
- BigDecimal paidAmount = BigDecimal.ZERO;
- BigDecimal overDueAmount = BigDecimal.ZERO;
- for (DebtPayment payment : payments) {
- if (payment.isPaymentComplete())
- paidAmount = paidAmount.add(getConvertedAmt(payment.getAmount(),
payment.getCurrency()
- .getId(), invoice.getCurrency().getId(),
invoice.getAccountingDate(), invoice
- .getClient().getId(), invoice.getOrganization().getId()));
- else {
- paidAmount = paidAmount.add(calculatePaidAmount(payment,
invoice.getCurrency().getId(),
- invoice.getAccountingDate(), BigDecimal.ONE));
- overDueAmount = overDueAmount.add(calculateOverdueAmount(payment,
invoice.getCurrency()
- .getId(), invoice.getAccountingDate(), BigDecimal.ONE));
+ final boolean prevMode =
OBContext.getOBContext().setInAdministratorMode(true);
+ try {
+ List<DebtPayment> payments = invoice.getFinancialMgmtDebtPaymentList();
+ BigDecimal paidAmount = BigDecimal.ZERO;
+ BigDecimal overDueAmount = BigDecimal.ZERO;
+ for (DebtPayment payment : payments) {
+ if (payment.isPaymentComplete())
+ paidAmount = paidAmount.add(getConvertedAmt(payment.getAmount(),
payment.getCurrency()
+ .getId(), invoice.getCurrency().getId(),
invoice.getAccountingDate(), invoice
+ .getClient().getId(), invoice.getOrganization().getId()));
+ else {
+ paidAmount = paidAmount.add(calculatePaidAmount(payment,
invoice.getCurrency().getId(),
+ invoice.getAccountingDate(), BigDecimal.ONE));
+ overDueAmount = overDueAmount.add(calculateOverdueAmount(payment,
invoice.getCurrency()
+ .getId(), invoice.getAccountingDate(), BigDecimal.ONE));
+ }
}
+ if
(paidAmount.setScale(invoice.getCurrency().getStandardPrecision().intValue(),
+ BigDecimal.ROUND_HALF_UP).compareTo(invoice.getGrandTotalAmount())
== 0) {
+ invoice.setDaysTillDue(0L);
+ invoice.setDueAmount(BigDecimal.ZERO);
+ invoice.setPaymentComplete(true);
+ } else {
+ invoice.setDaysTillDue(getDaysTillDue(invoice));
+ invoice.setPaymentComplete(false);
+ }
+
invoice.setTotalPaid(paidAmount.setScale(invoice.getCurrency().getStandardPrecision()
+ .intValue(), BigDecimal.ROUND_HALF_UP));
+
invoice.setDueAmount(overDueAmount.setScale(invoice.getCurrency().getStandardPrecision()
+ .intValue(), BigDecimal.ROUND_HALF_UP));
+
invoice.setOutstandingAmount(invoice.getGrandTotalAmount().subtract(invoice.getTotalPaid()));
+ invoice.setLastCalculatedOnDate(new Date());
+ OBDal.getInstance().save(invoice);
+ OBDal.getInstance().flush();
+ } finally {
+ OBContext.getOBContext().setInAdministratorMode(prevMode);
}
- if
(paidAmount.setScale(invoice.getCurrency().getStandardPrecision().intValue(),
- BigDecimal.ROUND_HALF_UP).compareTo(invoice.getGrandTotalAmount()) ==
0) {
- invoice.setDaysTillDue(0L);
- invoice.setDueAmount(BigDecimal.ZERO);
- invoice.setPaymentComplete(true);
- } else {
- invoice.setDaysTillDue(getDaysTillDue(invoice));
- invoice.setPaymentComplete(false);
- }
-
invoice.setTotalPaid(paidAmount.setScale(invoice.getCurrency().getStandardPrecision()
- .intValue(), BigDecimal.ROUND_HALF_UP));
-
invoice.setDueAmount(overDueAmount.setScale(invoice.getCurrency().getStandardPrecision()
- .intValue(), BigDecimal.ROUND_HALF_UP));
-
invoice.setOutstandingAmount(invoice.getGrandTotalAmount().subtract(invoice.getTotalPaid()));
- invoice.setLastCalculatedOnDate(new Date());
- OBDal.getInstance().save(invoice);
- OBDal.getInstance().flush();
return;
}
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits