diff --git a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java index 2ee731b625..e88c97403c 100644 --- a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java +++ b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java @@ -138,7 +138,7 @@ public class ProcessInfo implements Serializable private File m_pdf_report = null; /** Record IDs */ - private int[] m_Record_IDs; + private List m_Record_IDs = null; /** Export */ private boolean m_export = false; @@ -833,12 +833,12 @@ public class ProcessInfo implements Serializable m_exportFile = exportFile; } - public int[] getRecord_IDs() + public List getRecord_IDs() { return m_Record_IDs; } - public void setRecord_IDs(int[] Record_IDs) + public void setRecord_IDs(List Record_IDs) { m_Record_IDs = Record_IDs; } diff --git a/org.adempiere.base/src/org/compiere/process/SvrProcess.java b/org.adempiere.base/src/org/compiere/process/SvrProcess.java index af3e6c2bf1..7317530140 100644 --- a/org.adempiere.base/src/org/compiere/process/SvrProcess.java +++ b/org.adempiere.base/src/org/compiere/process/SvrProcess.java @@ -438,6 +438,16 @@ public abstract class SvrProcess implements ProcessCall return m_pi.getRecord_ID(); } // getRecord_ID + /** + * Get Record_IDs + * + * @return Record_IDs + */ + protected List getRecord_IDs() + { + return m_pi.getRecord_IDs(); + } // getRecord_IDs + /** * Get AD_User_ID * @return AD_User_ID of Process owner or -1 if not found diff --git a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java index 3a91485679..cdf47da852 100644 --- a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java +++ b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java @@ -460,7 +460,7 @@ public class ReportStarter implements ProcessCall, ClientProcess params.put("RESOURCE_DIR", resourcePath); } - if (jasperReport != null && pi.getTable_ID() > 0 && Record_ID <= 0 && pi.getRecord_IDs() != null && pi.getRecord_IDs().length > 0) + if (jasperReport != null && pi.getTable_ID() > 0 && Record_ID <= 0 && pi.getRecord_IDs() != null && pi.getRecord_IDs().size() > 0) { try { diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ProcessCtl.java b/org.adempiere.ui.swing/src/org/compiere/apps/ProcessCtl.java index e95b9fc83f..35ead7f7e3 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ProcessCtl.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ProcessCtl.java @@ -26,6 +26,7 @@ import org.adempiere.util.IProcessUI; import org.compiere.model.MPInstance; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; +import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Trx; @@ -184,6 +185,11 @@ public class ProcessCtl extends AbstractProcessCtl } } + if (pi.getRecord_IDs() != null && pi.getRecord_IDs().size() > 0) + { + DB.createT_Selection(pi.getAD_PInstance_ID(), pi.getRecord_IDs(), null); + } + // execute ProcessCtl worker = new ProcessCtl(parent, WindowNo, pi, trx); if (parent != null) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index d174f99bcc..c235d597f8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -3054,7 +3054,28 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements } else { - ProcessModalDialog dialog = new ProcessModalDialog(this, curWindowNo, wButton.getProcess_ID(), table_ID, record_ID, startWOasking); + final IADTabpanel adtabPanel = findADTabpanel(wButton); + + ProcessInfo pi = new ProcessInfo("", wButton.getProcess_ID(), table_ID, record_ID); + if (adtabPanel != null && adtabPanel.isGridView() && adtabPanel.getGridTab() != null) + { + int[] indices = adtabPanel.getGridTab().getSelection(); + if (indices.length > 0) + { + List records = new ArrayList(); + for (int i = 0; i < indices.length; i++) + { + int keyID = adtabPanel.getGridTab().getKeyID(indices[i]); + if (keyID > 0) + records.add(keyID); + } + + // IDEMPIERE-3998 Set multiple selected grid records into process info + pi.setRecord_IDs(records); + } + } + + ProcessModalDialog dialog = new ProcessModalDialog(this, curWindowNo, pi, startWOasking); if (dialog.isValid()) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java index 5d1f88bcdf..ae9bf79adc 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WProcessCtl.java @@ -30,6 +30,7 @@ import org.compiere.apps.IProcessParameter; import org.compiere.model.MPInstance; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; +import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Trx; @@ -192,6 +193,11 @@ public class WProcessCtl extends AbstractProcessCtl { } } + if (pi.getRecord_IDs() != null && pi.getRecord_IDs().size() > 0) + { + DB.createT_Selection(pi.getAD_PInstance_ID(), pi.getRecord_IDs(), null); + } + // execute WProcessCtl worker = new WProcessCtl(aProcessUI, WindowNo, pi, trx); worker.run(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java index c501ff90fa..786b100f59 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java @@ -269,7 +269,7 @@ public class ReportAction implements EventListener // Query boolean currentRowOnly = chkCurrentRowOnly.isChecked(); int Record_ID = 0; - int[] RecordIDs = null; + List RecordIDs = null; MQuery query = new MQuery(gridTab.getTableName()); StringBuilder whereClause = new StringBuilder(""); @@ -284,10 +284,10 @@ public class ReportAction implements EventListener else { whereClause.append(gridTab.getTableModel().getSelectWhereClause()); - RecordIDs = new int[gridTab.getRowCount()]; + RecordIDs = new ArrayList(); for(int i = 0; i < gridTab.getRowCount(); i++) { - RecordIDs[i] = gridTab.getKeyID(i); + RecordIDs.add(gridTab.getKeyID(i)); } }