Forwardport changes done on APR during MigrationTool development.
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Wed, 01 Jun 2011 12:28:39 +0200
changeset 12634 eb7f8acad0c8
parent 12633 3aee8491f0e8
child 12635 4e6226f6d3b5
Forwardport changes done on APR during MigrationTool development.
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Wed Jun 01 12:02:01 2011 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Wed Jun 01 12:28:39 2011 +0200
@@ -72,12 +72,14 @@
       OBDal.getInstance().flush();
       if (strAction.equals("P") || strAction.equals("D")) {
         // Set APRM_Ready preference
-        if (!dao.existsAPRMReadyPreference()) {
+        if (!dao.existsAPRMReadyPreference()
+            && vars.getSessionValue("APRMT_MigrationToolRunning", "N").equals("Y")) {
           dao.createAPRMReadyPreference();
         }
 
         Set<String> documentOrganizations = OBContext.getOBContext()
-            .getOrganizationStructureProvider().getNaturalTree(payment.getOrganization().getId());
+            .getOrganizationStructureProvider(payment.getClient().getId()).getNaturalTree(
+                payment.getOrganization().getId());
         if (!documentOrganizations.contains(payment.getAccount().getOrganization().getId())) {
           msg.setType("Error");
           msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Wed Jun 01 12:02:01 2011 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Wed Jun 01 12:28:39 2011 +0200
@@ -294,9 +294,12 @@
   public static DocumentType getDocumentType(Organization org, String docCategory) {
     DocumentType outDocType = null;
     OBCriteria<DocumentType> obcDoc = OBDal.getInstance().createCriteria(DocumentType.class);
+    obcDoc.setFilterOnReadableClients(false);
+    obcDoc.setFilterOnReadableOrganization(false);
 
-    obcDoc.add(Restrictions.in("organization.id", OBContext.getOBContext()
-        .getOrganizationStructureProvider().getParentTree(org.getId(), true)));
+    obcDoc.add(Restrictions
+        .in("organization.id", OBContext.getOBContext().getOrganizationStructureProvider(
+            org.getClient().getId()).getParentTree(org.getId(), true)));
     obcDoc.add(Restrictions.eq(DocumentType.PROPERTY_DOCUMENTCATEGORY, docCategory));
     obcDoc.addOrderBy(DocumentType.PROPERTY_DEFAULT, false);
     obcDoc.addOrderBy(DocumentType.PROPERTY_ID, false);