IDEMPIERE-3998: Execute Toolbar Process, get list of multiple row selected from the Grid view.
This commit is contained in:
parent
64ab5ccf0a
commit
31c236e419
|
@ -138,7 +138,7 @@ public class ProcessInfo implements Serializable
|
|||
private File m_pdf_report = null;
|
||||
|
||||
/** Record IDs */
|
||||
private int[] m_Record_IDs;
|
||||
private List <Integer> 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<Integer> getRecord_IDs()
|
||||
{
|
||||
return m_Record_IDs;
|
||||
}
|
||||
|
||||
public void setRecord_IDs(int[] Record_IDs)
|
||||
public void setRecord_IDs(List<Integer> Record_IDs)
|
||||
{
|
||||
m_Record_IDs = Record_IDs;
|
||||
}
|
||||
|
|
|
@ -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<Integer> 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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<Integer> records = new ArrayList<Integer>();
|
||||
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())
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -269,7 +269,7 @@ public class ReportAction implements EventListener<Event>
|
|||
// Query
|
||||
boolean currentRowOnly = chkCurrentRowOnly.isChecked();
|
||||
int Record_ID = 0;
|
||||
int[] RecordIDs = null;
|
||||
List <Integer> RecordIDs = null;
|
||||
MQuery query = new MQuery(gridTab.getTableName());
|
||||
StringBuilder whereClause = new StringBuilder("");
|
||||
|
||||
|
@ -284,10 +284,10 @@ public class ReportAction implements EventListener<Event>
|
|||
else
|
||||
{
|
||||
whereClause.append(gridTab.getTableModel().getSelectWhereClause());
|
||||
RecordIDs = new int[gridTab.getRowCount()];
|
||||
RecordIDs = new ArrayList<Integer>();
|
||||
for(int i = 0; i < gridTab.getRowCount(); i++)
|
||||
{
|
||||
RecordIDs[i] = gridTab.getKeyID(i);
|
||||
RecordIDs.add(gridTab.getKeyID(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue