details: /erp/devel/pi/rev/7c8a23c0be24
changeset: 10266:7c8a23c0be24
user: Mikel Irurita <mikel.irurita <at> openbravo.com>
date: Mon Jan 31 18:22:33 2011 +0100
summary: Do not use APRM API from a core callout
details: /erp/devel/pi/rev/ebf89ddfb647
changeset: 10267:ebf89ddfb647
user: Mikel Irurita <mikel.irurita <at> openbravo.com>
date: Mon Jan 31 18:25:06 2011 +0100
summary: [APRM] Possibility to include client/org filters in obcriteria
generic method
diffstat:
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
| 27 ++++++++-
src/org/openbravo/erpCommon/ad_callouts/SE_FinancialAccount_BSAccounts.java
| 11 ++-
2 files changed, 30 insertions(+), 8 deletions(-)
diffs (79 lines):
diff -r cde1d8da7761 -r ebf89ddfb647
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
---
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
Mon Jan 31 16:51:06 2011 +0100
+++
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
Mon Jan 31 18:25:06 2011 +0100
@@ -500,15 +500,21 @@
*
* @param clazz
* Class (entity).
+ * @param setFilterClient
+ * If true then only objects from readable clients are returned, if
false then objects
+ * from all clients are returned
+ * @param setFilterOrg
+ * If true then when querying (for example call list()) a filter on
readable
+ * organizations is added to the query, if false then this is not
done
* @param values
* Value. Property, value and operator.
* @return All the records that satisfy the conditions.
*/
- public static <T extends BaseOBObject> List<T> getAllInstances(Class<T>
clazz, Value... values) {
+ public static <T extends BaseOBObject> List<T> getAllInstances(Class<T>
clazz,
+ boolean setFilterClient, boolean setFilterOrg, Value... values) {
OBCriteria<T> obc = OBDal.getInstance().createCriteria(clazz);
- obc.setFilterOnReadableClients(false);
- obc.setFilterOnReadableOrganization(false);
- obc.add(Expression.ne(Client.PROPERTY_ID, "0"));
+ obc.setFilterOnReadableClients(setFilterClient);
+ obc.setFilterOnReadableOrganization(setFilterOrg);
for (Value value : values) {
if (value.getValue() == null && "==".equals(value.getOperator())) {
obc.add(Expression.isNull(value.getField()));
@@ -534,6 +540,19 @@
}
/**
+ * Generic OBCriteria with filter on readable clients and organizations
active.
+ *
+ * @param clazz
+ * Class (entity).
+ * @param values
+ * Value. Property, value and operator.
+ * @return All the records that satisfy the conditions.
+ */
+ public static <T extends BaseOBObject> List<T> getAllInstances(Class<T>
clazz, Value... values) {
+ return getAllInstances(clazz, true, true, values);
+ }
+
+ /**
* Generic OBCriteria.
*
* @param clazz
diff -r cde1d8da7761 -r ebf89ddfb647
src/org/openbravo/erpCommon/ad_callouts/SE_FinancialAccount_BSAccounts.java
---
a/src/org/openbravo/erpCommon/ad_callouts/SE_FinancialAccount_BSAccounts.java
Mon Jan 31 16:51:06 2011 +0100
+++
b/src/org/openbravo/erpCommon/ad_callouts/SE_FinancialAccount_BSAccounts.java
Mon Jan 31 18:25:06 2011 +0100
@@ -27,10 +27,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.openbravo.advpaymentmngt.utility.FIN_Utility;
-import org.openbravo.advpaymentmngt.utility.Value;
+import org.hibernate.criterion.Expression;
import org.openbravo.base.secureApp.HttpSecureAppServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.service.OBCriteria;
import org.openbravo.dal.service.OBDal;
import org.openbravo.erpCommon.utility.Utility;
import org.openbravo.model.financialmgmt.accounting.coa.AccountingCombination;
@@ -139,8 +139,11 @@
String strAccountingSchemaId) {
FIN_FinancialAccount account =
OBDal.getInstance().get(FIN_FinancialAccount.class,
strfinFinancialAccountId);
- List<FinAccPaymentMethod> accountPaymentMethods =
FIN_Utility.getAllInstances(
- FinAccPaymentMethod.class, new
Value(FinAccPaymentMethod.PROPERTY_ACCOUNT, account));
+ OBCriteria<FinAccPaymentMethod> obc = OBDal.getInstance().createCriteria(
+ FinAccPaymentMethod.class);
+ obc.add(Expression.eq(FinAccPaymentMethod.PROPERTY_ACCOUNT, account));
+ List<FinAccPaymentMethod> accountPaymentMethods = obc.list();
+
// Configure clearing account for all payment methods upon clearing event
for (FinAccPaymentMethod paymentMethod : accountPaymentMethods) {
paymentMethod.setOUTUponClearingUse("CLE");
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits