From 66e3e691111d6f34d66715433ee601f68263e57d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 11 Jun 2014 11:51:20 -0500 Subject: [PATCH] IDEMPIERE-1997 Wrong values when selecting a Invoice at Payment Window --- .../adempiere/webui/info/InfoAssetWindow.java | 18 +++++++- .../webui/info/InfoBPartnerWindow.java | 43 ++----------------- .../webui/info/InfoInvoiceWindow.java | 16 ++++++- .../webui/info/InfoProductWindow.java | 8 ++++ 4 files changed, 41 insertions(+), 44 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoAssetWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoAssetWindow.java index e323516b68..5f81b73a1e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoAssetWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoAssetWindow.java @@ -3,16 +3,17 @@ */ package org.adempiere.webui.info; +import org.compiere.util.Env; + /** * @author hengsin * */ public class InfoAssetWindow extends InfoWindow { - /** * */ - private static final long serialVersionUID = 623767863373135404L; + private static final long serialVersionUID = 8671986505516245911L; /** * @param WindowNo @@ -49,4 +50,17 @@ public class InfoAssetWindow extends InfoWindow { // TODO Auto-generated constructor stub } + @Override + protected void saveSelectionDetail() { + int row = contentPanel.getSelectedRow(); + if (row == -1) + return; + + super.saveSelectionDetail(); + + // publish for Callout to read + Integer ID = getSelectedRowKey(); + Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "A_Asset_ID", ID == null ? "0" : ID.toString()); + } + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoBPartnerWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoBPartnerWindow.java index 7a4b15ea14..1d2cce7b24 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoBPartnerWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoBPartnerWindow.java @@ -6,7 +6,6 @@ package org.adempiere.webui.info; import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.panel.InvoiceHistory; import org.compiere.util.Env; -import org.compiere.util.KeyNamePair; import org.compiere.util.Util; /** @@ -17,10 +16,7 @@ public class InfoBPartnerWindow extends InfoWindow { /** * */ - private static final long serialVersionUID = -7970170769665110830L; - - private int m_AD_User_ID_index = -1; - private int m_C_BPartner_Location_ID_index = -1; + private static final long serialVersionUID = 126054851491958589L; /** * @param WindowNo @@ -116,44 +112,11 @@ public class InfoBPartnerWindow extends InfoWindow { if (row == -1) return; - int AD_User_ID = 0; - int C_BPartner_Location_ID = 0; - - if (m_AD_User_ID_index != -1) - { - Object data =contentPanel.getValueAt(row, m_AD_User_ID_index); - if (data instanceof KeyNamePair) - AD_User_ID = ((KeyNamePair)data).getKey(); - } - // - if (m_C_BPartner_Location_ID_index != -1) - { - Object data =contentPanel.getValueAt(row, m_C_BPartner_Location_ID_index); - if (data instanceof KeyNamePair) - C_BPartner_Location_ID = ((KeyNamePair)data).getKey(); - } + super.saveSelectionDetail(); + // publish for Callout to read Integer ID = getSelectedRowKey(); Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_BPartner_ID", ID == null ? "0" : ID.toString()); - Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "AD_User_ID", String.valueOf(AD_User_ID)); - Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_BPartner_Location_ID", String.valueOf(C_BPartner_Location_ID)); - - super.saveSelectionDetail(); } - @Override - protected void prepareTable() { - super.prepareTable(); - - // Get indexes - for (int i = 0; i < p_layout.length; i++) - { - if (p_layout[i].getKeyPairColSQL().indexOf("AD_User_ID") != -1) - m_AD_User_ID_index = i; - // - if (p_layout[i].getKeyPairColSQL().indexOf("C_BPartner_Location_ID") != -1) - m_C_BPartner_Location_ID_index = i; - } - } - } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInvoiceWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInvoiceWindow.java index 705e06dc6d..6a11dd6add 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInvoiceWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoInvoiceWindow.java @@ -12,11 +12,10 @@ import org.compiere.util.Util; * */ public class InfoInvoiceWindow extends InfoWindow { - /** * */ - private static final long serialVersionUID = 3413423439591833575L; + private static final long serialVersionUID = -5614659763247990639L; /** * @param WindowNo @@ -81,4 +80,17 @@ public class InfoInvoiceWindow extends InfoWindow { dynamicDisplay(null); } + @Override + protected void saveSelectionDetail() { + int row = contentPanel.getSelectedRow(); + if (row == -1) + return; + + super.saveSelectionDetail(); + + // publish for Callout to read + Integer ID = getSelectedRowKey(); + Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_Invoice_ID", ID == null ? "0" : ID.toString()); + } + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java index 2566d20faf..4b7ca1fb52 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java @@ -823,7 +823,12 @@ public class InfoProductWindow extends InfoWindow { @Override protected void saveSelectionDetail() { + int row = contentPanel.getSelectedRow(); + if (row == -1) + return; + super.saveSelectionDetail(); + if (m_M_AttributeSetInstance_ID == -1) // not selected { Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID", "0"); @@ -836,6 +841,9 @@ public class InfoProductWindow extends InfoWindow { Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_Locator_ID", String.valueOf(m_M_Locator_ID)); } + // publish for Callout to read + Integer ID = getSelectedRowKey(); + Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_Product_ID", ID == null ? "0" : ID.toString()); } @Override