Revert "IDEMPIERE-6255:Incorrect column count on datatables (#2483)"

This reverts commit 3512cd00da.
This commit is contained in:
Carlos Ruiz 2024-11-07 17:47:23 +01:00
parent 5ee17ae649
commit 3a810791d0
3 changed files with 20 additions and 50 deletions

View File

@ -24,7 +24,6 @@ import java.util.Properties;
import java.util.logging.Level;
import org.compiere.model.GridField;
import org.compiere.model.I_AD_PrintFormatItem;
import org.compiere.model.MRole;
import org.compiere.model.X_AD_PrintFormatItem;
import org.compiere.util.CCache;
@ -52,18 +51,18 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem implements ImmutableP
*/
private static final long serialVersionUID = 2950704375830865408L;
/**
* UUID based Constructor
* @param ctx Context
* @param AD_PrintFormatItem_UU UUID key
* @param trxName Transaction
*/
public MPrintFormatItem(Properties ctx, String AD_PrintFormatItem_UU, String trxName) {
super(ctx, AD_PrintFormatItem_UU, trxName);
/**
* UUID based Constructor
* @param ctx Context
* @param AD_PrintFormatItem_UU UUID key
* @param trxName Transaction
*/
public MPrintFormatItem(Properties ctx, String AD_PrintFormatItem_UU, String trxName) {
super(ctx, AD_PrintFormatItem_UU, trxName);
if (Util.isEmpty(AD_PrintFormatItem_UU))
setInitialDefaults();
}
}
/**
* Constructor
* @param ctx context
@ -180,51 +179,21 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem implements ImmutableP
private static CLogger s_log = CLogger.getCLogger (MPrintFormatItem.class);
public String getPrintName (boolean useNameWhenEmpty) {
String printName = getPrintName();
if (Util.isEmpty(printName, true) && useNameWhenEmpty) {
return getName();
}
return printName;
}
/**
* Get print name with language<br/>
* Order of alternative values when encountering empty value<br/>
* <ul>
* <li>print name with language</li>
* <li>print name</li>
* <li>name with language</li>
* <li>name</li>
* </ul>
/**************************************************************************
* Get print name with language
* @param language language - ignored if IsMultiLingualDocument not 'Y'
* @return print name
*/
public String getPrintName (Language language)
{
if (language == null || Env.isBaseLanguage(language, "AD_PrintFormatItem"))
return getPrintName(true);
return getPrintName();
loadTranslations();
String retValue = (String)m_translationLabel.get(language.getAD_Language());
String altValue = retValue;
// try print name on base language
if (Util.isEmpty(altValue, true))
altValue = getPrintName();
// try translate of name
if (Util.isEmpty(altValue, true))
altValue = get_Translation(I_AD_PrintFormatItem.COLUMNNAME_Name, language.getAD_Language());
// try name on base language
if (Util.isEmpty(altValue, true))
altValue = getName();
// put value to cache
if (Util.isEmpty(retValue, true) && !Util.isEmpty(altValue, true))
m_translationLabel.put(language.getAD_Language(), altValue);
return altValue;
if (retValue == null || retValue.length() == 0)
return getPrintName();
return retValue;
} // getPrintName
/**************************************************************************

View File

@ -1675,7 +1675,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
}
columnHeader[col] = new ValueNamePair(item.getColumnName(),
item.getPrintName(format.getLanguage()));
colPositions.put(item.getPrintName(true), col);
colPositions.put(item.getPrintName(), col);
columnMaxWidth[col] = item.getMaxWidth();
fixedWidth[col] = (columnMaxWidth[col] != 0 && item.isFixedWidth());
colSuppressRepeats[col] = item.isSuppressRepeats();

View File

@ -25,6 +25,7 @@ import java.io.File;
import java.util.logging.Level;
import org.adempiere.base.Core;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.window.ZkReportViewer;
import org.compiere.print.ReportEngine;
import org.compiere.tools.FileUtil;
@ -90,7 +91,7 @@ public class CSVReportViewerRenderer implements IReportViewerRenderer {
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
CSVReportRendererConfiguration config = new CSVReportRendererConfiguration()
.setLanguage(reportEngine.getPrintFormat().getLanguage())
.setLanguage(AEnv.getLanguage(Env.getCtx()))
.setOutputFile(file);
renderer.renderReport(reportEngine, config);
return new AMedia(file.getName(), getFileExtension(), getContentType(), file, false);