From 9bc32c1cd46dcb2a0883f43c971b7c6b70d6a54e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 8 Mar 2011 11:45:59 -0500 Subject: [PATCH] Fix several errors with Allocation: - fix a wrong raise of exception when no organization (add throws keyword) - when creating the allocation is taking the organization of log in, and it must take precedence the organization chosen by the user on the allocation window (login org still used in case no org is selected by user) --- .../src/org/compiere/apps/form/VAllocation.java | 4 ++++ .../src/org/adempiere/webui/apps/form/WAllocation.java | 4 ++++ org.adempiere.ui/src/org/compiere/apps/form/Allocation.java | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java index 13d610f1d8..78a758bcfb 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java @@ -424,6 +424,10 @@ public class VAllocation extends Allocation */ public void saveData() { + if (m_AD_Org_ID > 0) + Env.setContext(Env.getCtx(), m_WindowNo, "AD_Org_ID", m_AD_Org_ID); + else + Env.setContext(Env.getCtx(), m_WindowNo, "AD_Org_ID", ""); try { Trx.run(new TrxRunnable() diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java index e4497936bc..bdc5f60f76 100755 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java @@ -486,6 +486,10 @@ public class WAllocation extends Allocation */ public void saveData() { + if (m_AD_Org_ID > 0) + Env.setContext(Env.getCtx(), form.getWindowNo(), "AD_Org_ID", m_AD_Org_ID); + else + Env.setContext(Env.getCtx(), form.getWindowNo(), "AD_Org_ID", ""); Trx trx = Trx.get(Trx.createTrxName("AL"), true); statusBar.setStatusLine(saveData(form.getWindowNo(), dateField.getValue(), paymentTable, invoiceTable, trx.getTrxName())); trx.commit(); diff --git a/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java b/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java index d56842aff9..3cff9c7fe7 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/Allocation.java @@ -604,7 +604,7 @@ public class Allocation if (AD_Org_ID == 0) { //ADialog.error(m_WindowNo, this, "Org0NotAllowed", null); - new AdempiereException("@Org0NotAllowed@"); + throw new AdempiereException("@Org0NotAllowed@"); } // log.config("Client=" + AD_Client_ID + ", Org=" + AD_Org_ID