IDEMPIERE-5302 - Drill Assistant Feature fixes in initialisation logic (#1581)
* IDEMPIERE-5302 - Drill Assistant Feature fixes in initialisation logic * IDEMPIERE-5302 - removing scripts commited by mistake * IDEMPIERE-5302 - pr1581 patch
This commit is contained in:
parent
a217e121fe
commit
ea092b56ff
|
@ -327,19 +327,19 @@ public class WDrillReport extends Window implements EventListener<Event> {
|
||||||
a.appendChild(new Text(".."));
|
a.appendChild(new Text(".."));
|
||||||
header.appendChild(a);
|
header.appendChild(a);
|
||||||
|
|
||||||
KeyNamePair[] drillPrintFormats = drillPrintFormatMap != null ? drillPrintFormatMap.get(drillTable.getKey()) : new KeyNamePair[]{findTablePrintFormat(drillTable)};
|
KeyNamePair[] drillRules = drillPrintFormatMap != null ? drillPrintFormatMap.get(drillTable.getKey()) : new KeyNamePair[]{findTablePrintFormat(drillTable)};
|
||||||
for (int j = 0; j < drillPrintFormats.length; j++)
|
for (int j = 0; j < drillRules.length; j++)
|
||||||
{
|
{
|
||||||
KeyNamePair drillPrintFormat = drillPrintFormats[j];
|
KeyNamePair drillRule = drillRules[j];
|
||||||
|
|
||||||
KeyNamePair[] printFormats = isDrillProcessRule ? drillReportCtl.getDrillProcessRulesPrintFormatMap(drillPrintFormat.getKey()) : new KeyNamePair[] {drillPrintFormat} ;
|
KeyNamePair[] printFormats = isDrillProcessRule ? drillReportCtl.getDrillProcessRulesPrintFormatMap(drillRule.getKey()) : new KeyNamePair[] {drillRule} ;
|
||||||
|
|
||||||
// create new Print Format
|
// create new Print Format
|
||||||
if ((printFormats.length <= 0) && isDrillProcessRule)
|
if ((printFormats.length <= 0) && isDrillProcessRule)
|
||||||
{
|
{
|
||||||
KeyNamePair[] pfArray = {null};
|
KeyNamePair[] pfArray = {null};
|
||||||
MPrintFormat pf = null;
|
MPrintFormat pf = null;
|
||||||
MProcessDrillRule dr = MProcessDrillRule.get(Env.getCtx(), drillPrintFormat.getKey());
|
MProcessDrillRule dr = MProcessDrillRule.get(Env.getCtx(), drillRule.getKey());
|
||||||
if(dr != null) {
|
if(dr != null) {
|
||||||
int AD_ReportView_ID = dr.getAD_ReportView_ID();
|
int AD_ReportView_ID = dr.getAD_ReportView_ID();
|
||||||
if (AD_ReportView_ID == 0)
|
if (AD_ReportView_ID == 0)
|
||||||
|
@ -360,7 +360,7 @@ public class WDrillReport extends Window implements EventListener<Event> {
|
||||||
printFormats = pfArray;
|
printFormats = pfArray;
|
||||||
}
|
}
|
||||||
if (printFormats.length <= 0) {
|
if (printFormats.length <= 0) {
|
||||||
int AD_Table_ID = new Query(Env.getCtx(), MTable.Table_Name, " Name = ? ", null).setParameters(drillPrintFormat.getName()).firstId();
|
int AD_Table_ID = new Query(Env.getCtx(), MTable.Table_Name, " Name = ? ", null).setParameters(drillRule.getName()).firstId();
|
||||||
pf = MPrintFormat.createFromTable(Env.getCtx(), AD_Table_ID);
|
pf = MPrintFormat.createFromTable(Env.getCtx(), AD_Table_ID);
|
||||||
pfArray[0] = new KeyNamePair(pf.getAD_PrintFormat_ID(), pf.getName());
|
pfArray[0] = new KeyNamePair(pf.getAD_PrintFormat_ID(), pf.getName());
|
||||||
printFormats = pfArray;
|
printFormats = pfArray;
|
||||||
|
@ -370,13 +370,7 @@ public class WDrillReport extends Window implements EventListener<Event> {
|
||||||
String hdr = printFormat.getName();
|
String hdr = printFormat.getName();
|
||||||
if (hdr != null && hdr.length() > 0)
|
if (hdr != null && hdr.length() > 0)
|
||||||
{
|
{
|
||||||
// field
|
table.appendChild(getPrintFormatBox(printFormat, tabIndex, j, tabIndex, isDrillProcessRule ? drillTable : null, drillRule, printFormats.length == 1));
|
||||||
if ((printFormat.getKey() <= 0) && isDrillProcessRule) {
|
|
||||||
table.appendChild(getPrintFormatHeader(printFormat, drillPrintFormat));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
table.appendChild(getPrintFormatBox(printFormat, tabIndex, j, tabIndex, null, printFormats.length == 1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,22 +438,7 @@ public class WDrillReport extends Window implements EventListener<Event> {
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tr getPrintFormatHeader(KeyNamePair drillPrintFormat, KeyNamePair drillProcessRule) {
|
private Tr getPrintFormatBox(KeyNamePair drillPrintFormat, int reportIndex, int formatIndex, int groupIndex, KeyNamePair drillTable, KeyNamePair drillRule, boolean isSinglePrintFormat)
|
||||||
Tr tr = new Tr();
|
|
||||||
tr.setWidgetAttribute("class", "drill-window-field-header");
|
|
||||||
|
|
||||||
Td td = new Td();
|
|
||||||
td.setStyle("width: 100%; border-bottom: 1px solid gray;");
|
|
||||||
td.setColspan(3);
|
|
||||||
tr.appendChild(td);
|
|
||||||
H4 h4 = new H4();
|
|
||||||
h4.appendChild(new Text(drillProcessRule != null ? drillProcessRule.getName(): drillPrintFormat.getName()));
|
|
||||||
|
|
||||||
td.appendChild(h4);
|
|
||||||
return tr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Tr getPrintFormatBox(KeyNamePair drillPrintFormat, int reportIndex, int formatIndex, int groupIndex, KeyNamePair drillTable, boolean isSinglePrintFormat)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
Tr tr = new Tr();
|
Tr tr = new Tr();
|
||||||
|
@ -496,14 +475,14 @@ public class WDrillReport extends Window implements EventListener<Event> {
|
||||||
a.setAttribute(DRILL_REPORT_PRINTFORMAT_ID_NAME, drillPrintFormat.getKey());
|
a.setAttribute(DRILL_REPORT_PRINTFORMAT_ID_NAME, drillPrintFormat.getKey());
|
||||||
a.setAttribute(DRILL_REPORT_TABLE_NAME, drillPrintFormat.getName());
|
a.setAttribute(DRILL_REPORT_TABLE_NAME, drillPrintFormat.getName());
|
||||||
if(drillTable != null) {
|
if(drillTable != null) {
|
||||||
a.setAttribute(DRILL_PROCESS_RULE_ID_NAME, drillTable.getKey());
|
a.setAttribute(DRILL_PROCESS_RULE_ID_NAME, drillRule.getKey());
|
||||||
}
|
}
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
|
|
||||||
String description = "";
|
String description = "";
|
||||||
|
|
||||||
if(drillTable != null && isSinglePrintFormat) {
|
if(drillTable != null && isSinglePrintFormat) {
|
||||||
MProcessDrillRule dr = MProcessDrillRule.get(Env.getCtx(), drillTable.getKey());
|
MProcessDrillRule dr = MProcessDrillRule.get(Env.getCtx(), drillRule.getKey());
|
||||||
if(dr != null) {
|
if(dr != null) {
|
||||||
if (!Util.isEmpty(dr.getDescription()))
|
if (!Util.isEmpty(dr.getDescription()))
|
||||||
description = dr.getDescription();
|
description = dr.getDescription();
|
||||||
|
@ -536,9 +515,9 @@ public class WDrillReport extends Window implements EventListener<Event> {
|
||||||
}
|
}
|
||||||
if(event.getTarget().getAttribute(DRILL_REPORT_PRINTFORMAT_ID_NAME) != null) {
|
if(event.getTarget().getAttribute(DRILL_REPORT_PRINTFORMAT_ID_NAME) != null) {
|
||||||
if(event.getTarget().getAttribute(DRILL_PROCESS_RULE_ID_NAME) != null) {
|
if(event.getTarget().getAttribute(DRILL_PROCESS_RULE_ID_NAME) != null) {
|
||||||
ProcessInfo pi = drillReportCtl.getDrillProcessProcessInfo((int) event.getTarget().getAttribute(DRILL_PROCESS_RULE_ID_NAME), (int) event.getTarget().getAttribute(DRILL_REPORT_PRINTFORMAT_ID_NAME));
|
|
||||||
Integer processDrillRuleID = (Integer) event.getTarget().getAttribute(DRILL_PROCESS_RULE_ID_NAME);
|
Integer processDrillRuleID = (Integer) event.getTarget().getAttribute(DRILL_PROCESS_RULE_ID_NAME);
|
||||||
MProcessDrillRule drillRule = new MProcessDrillRule(Env.getCtx(), processDrillRuleID, null);
|
MProcessDrillRule drillRule = new MProcessDrillRule(Env.getCtx(), processDrillRuleID, null);
|
||||||
|
ProcessInfo pi = drillReportCtl.getDrillProcessProcessInfo(processDrillRuleID, (int) event.getTarget().getAttribute(DRILL_REPORT_PRINTFORMAT_ID_NAME));
|
||||||
String showHelp = !Util.isEmpty(showHelp = drillRule.getShowHelp()) ? showHelp : MProcess.SHOWHELP_RunSilently_TakeDefaults;
|
String showHelp = !Util.isEmpty(showHelp = drillRule.getShowHelp()) ? showHelp : MProcess.SHOWHELP_RunSilently_TakeDefaults;
|
||||||
pi.setShowHelp(showHelp);
|
pi.setShowHelp(showHelp);
|
||||||
ProcessModalDialog processModalDialog = new ProcessModalDialog(this, windowNo, false, pi);
|
ProcessModalDialog processModalDialog = new ProcessModalDialog(this, windowNo, false, pi);
|
||||||
|
|
|
@ -393,8 +393,10 @@ public class DrillReportCtl {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch Report Process
|
*
|
||||||
* @param pf print format
|
* @param AD_Process_DrillRule_ID
|
||||||
|
* @param AD_PrintFormat_ID
|
||||||
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public ProcessInfo getDrillProcessProcessInfo (int AD_Process_DrillRule_ID, int AD_PrintFormat_ID) throws Exception
|
public ProcessInfo getDrillProcessProcessInfo (int AD_Process_DrillRule_ID, int AD_PrintFormat_ID) throws Exception
|
||||||
|
@ -479,8 +481,8 @@ public class DrillReportCtl {
|
||||||
MProcessDrillRulePara sPara = sParams[p];
|
MProcessDrillRulePara sPara = sParams[p];
|
||||||
if(processPara. getColumnName().equals(m_ColumnName))
|
if(processPara. getColumnName().equals(m_ColumnName))
|
||||||
{
|
{
|
||||||
iPara.setParameter(DisplayType.isID(sPara.getDisplayType()) ? Integer.valueOf((String) m_Value) : (String) m_Value);
|
iPara.setParameter(DisplayType.isID(sPara.getDisplayType()) ? new BigDecimal(String.valueOf(m_Value)) : String.valueOf(m_Value));
|
||||||
iPara.setInfo(!Util.isEmpty(m_DisplayValue) ? m_DisplayValue : (String) m_Value);
|
iPara.setInfo(!Util.isEmpty(m_DisplayValue) ? m_DisplayValue : String.valueOf(m_Value));
|
||||||
isKeyParameterSet = true;
|
isKeyParameterSet = true;
|
||||||
iParams.add(iPara);
|
iParams.add(iPara);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue