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:
Peter Takács 2022-11-28 08:06:29 +01:00 committed by GitHub
parent a217e121fe
commit ea092b56ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 36 deletions

View File

@ -327,19 +327,19 @@ public class WDrillReport extends Window implements EventListener<Event> {
a.appendChild(new Text(".."));
header.appendChild(a);
KeyNamePair[] drillPrintFormats = drillPrintFormatMap != null ? drillPrintFormatMap.get(drillTable.getKey()) : new KeyNamePair[]{findTablePrintFormat(drillTable)};
for (int j = 0; j < drillPrintFormats.length; j++)
KeyNamePair[] drillRules = drillPrintFormatMap != null ? drillPrintFormatMap.get(drillTable.getKey()) : new KeyNamePair[]{findTablePrintFormat(drillTable)};
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
if ((printFormats.length <= 0) && isDrillProcessRule)
{
KeyNamePair[] pfArray = {null};
MPrintFormat pf = null;
MProcessDrillRule dr = MProcessDrillRule.get(Env.getCtx(), drillPrintFormat.getKey());
MProcessDrillRule dr = MProcessDrillRule.get(Env.getCtx(), drillRule.getKey());
if(dr != null) {
int AD_ReportView_ID = dr.getAD_ReportView_ID();
if (AD_ReportView_ID == 0)
@ -360,7 +360,7 @@ public class WDrillReport extends Window implements EventListener<Event> {
printFormats = pfArray;
}
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);
pfArray[0] = new KeyNamePair(pf.getAD_PrintFormat_ID(), pf.getName());
printFormats = pfArray;
@ -370,13 +370,7 @@ public class WDrillReport extends Window implements EventListener<Event> {
String hdr = printFormat.getName();
if (hdr != null && hdr.length() > 0)
{
// field
if ((printFormat.getKey() <= 0) && isDrillProcessRule) {
table.appendChild(getPrintFormatHeader(printFormat, drillPrintFormat));
} else {
table.appendChild(getPrintFormatBox(printFormat, tabIndex, j, tabIndex, null, printFormats.length == 1));
}
table.appendChild(getPrintFormatBox(printFormat, tabIndex, j, tabIndex, isDrillProcessRule ? drillTable : null, drillRule, printFormats.length == 1));
}
}
}
@ -444,22 +438,7 @@ public class WDrillReport extends Window implements EventListener<Event> {
return table;
}
private Tr getPrintFormatHeader(KeyNamePair drillPrintFormat, KeyNamePair drillProcessRule) {
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)
private Tr getPrintFormatBox(KeyNamePair drillPrintFormat, int reportIndex, int formatIndex, int groupIndex, KeyNamePair drillTable, KeyNamePair drillRule, boolean isSinglePrintFormat)
{
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_TABLE_NAME, drillPrintFormat.getName());
if(drillTable != null) {
a.setAttribute(DRILL_PROCESS_RULE_ID_NAME, drillTable.getKey());
a.setAttribute(DRILL_PROCESS_RULE_ID_NAME, drillRule.getKey());
}
td.appendChild(a);
String description = "";
if(drillTable != null && isSinglePrintFormat) {
MProcessDrillRule dr = MProcessDrillRule.get(Env.getCtx(), drillTable.getKey());
MProcessDrillRule dr = MProcessDrillRule.get(Env.getCtx(), drillRule.getKey());
if(dr != null) {
if (!Util.isEmpty(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_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);
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;
pi.setShowHelp(showHelp);
ProcessModalDialog processModalDialog = new ProcessModalDialog(this, windowNo, false, pi);

View File

@ -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
*/
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];
if(processPara. getColumnName().equals(m_ColumnName))
{
iPara.setParameter(DisplayType.isID(sPara.getDisplayType()) ? Integer.valueOf((String) m_Value) : (String) m_Value);
iPara.setInfo(!Util.isEmpty(m_DisplayValue) ? m_DisplayValue : (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.valueOf(m_Value));
isKeyParameterSet = true;
iParams.add(iPara);
continue;