IDEMPIERE-1424 Report Wizard is not using translated columns
This commit is contained in:
parent
7b2c99fa86
commit
ef3ed449ca
|
@ -45,8 +45,7 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -679302944951915141L;
|
||||
|
||||
private static final long serialVersionUID = 7145503984951798641L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -116,6 +115,8 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
|
|||
private String m_columnName = null;
|
||||
/** Locally cached label translations */
|
||||
private HashMap<String,String> m_translationLabel;
|
||||
String m_newTranslationLabel = null;
|
||||
boolean m_translationLabelChanged = false;
|
||||
/** Locally cached suffix translations */
|
||||
private HashMap<String,String> m_translationSuffix;
|
||||
|
||||
|
@ -138,6 +139,26 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
|
|||
return retValue;
|
||||
} // getPrintName
|
||||
|
||||
/**************************************************************************
|
||||
* Set print name on language
|
||||
* @param language language - ignored if IsMultiLingualDocument not 'Y'
|
||||
*/
|
||||
public void setPrintName (Language language, String printName)
|
||||
{
|
||||
if (language == null || Env.isBaseLanguage(language, "AD_PrintFormatItem")) {
|
||||
setPrintName(printName);
|
||||
return;
|
||||
}
|
||||
loadTranslations();
|
||||
String retValue = (String)m_translationLabel.get(language.getAD_Language());
|
||||
if ((retValue != null && ! retValue.equals(printName))
|
||||
|| (retValue == null && printName != null)) {
|
||||
m_newTranslationLabel = printName;
|
||||
m_translationLabelChanged = true;
|
||||
m_translationLabel.put(language.getAD_Language(), printName);
|
||||
}
|
||||
} // getPrintName
|
||||
|
||||
/**
|
||||
* Get print name suffix with language
|
||||
* @param language language - ignored if IsMultiLingualDocument not 'Y'
|
||||
|
@ -683,11 +704,30 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
|
|||
+ " AND AD_PrintFormatItem_Trl.AD_PrintFormatItem_ID = " + get_ID() + ")"
|
||||
+ " AND EXISTS (SELECT * FROM AD_Client "
|
||||
+ "WHERE AD_Client_ID=AD_PrintFormatItem_Trl.AD_Client_ID AND IsMultiLingualDocument='Y')";
|
||||
int no = DB.executeUpdate(sql, get_TrxName());
|
||||
int no = DB.executeUpdateEx(sql, get_TrxName());
|
||||
if (log.isLoggable(Level.FINE)) log.fine("translations updated #" + no);
|
||||
}
|
||||
|
||||
if (m_translationLabelChanged) {
|
||||
String sql = "UPDATE AD_PrintFormatItem_Trl "
|
||||
+ "SET PrintName = ? "
|
||||
+ "WHERE AD_PrintFormatItem_ID = ?"
|
||||
+ " AND AD_Language=?";
|
||||
int no = DB.executeUpdateEx(sql, new Object[] {m_newTranslationLabel, get_ID(), Language.getLoginLanguage().getAD_Language()}, get_TrxName());
|
||||
if (log.isLoggable(Level.FINE)) log.fine("translations updated #" + no);
|
||||
|
||||
m_newTranslationLabel = null;
|
||||
m_translationLabelChanged = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
} // afterSave
|
||||
|
||||
@Override
|
||||
public boolean is_Changed() {
|
||||
if (m_translationLabelChanged)
|
||||
return true;
|
||||
return super.is_Changed();
|
||||
}
|
||||
|
||||
} // MPrintFormatItem
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.adempiere.webui.util.ZKUpdateUtil;
|
|||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.MPrintFormatItem;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
@ -122,7 +123,7 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
row.appendChild(m_chkboxes[i]);
|
||||
|
||||
m_textBoxes[i] = new Textbox();
|
||||
String strValue = printItem.getPrintName();
|
||||
String strValue = printItem.getPrintName(Language.getLoginLanguage());
|
||||
if(strValue ==null || strValue.length()==0){
|
||||
strValue = printItem.getName();
|
||||
}
|
||||
|
@ -141,7 +142,7 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
int i=0;
|
||||
for (MPrintFormatItem item : m_pfi){
|
||||
item.setIsActive(m_chkboxes[i].isChecked());
|
||||
item.setPrintName(m_textBoxes[i].getText());
|
||||
item.setPrintName(Language.getLoginLanguage(), m_textBoxes[i].getText());
|
||||
item.saveEx();
|
||||
i++;
|
||||
}
|
||||
|
@ -176,8 +177,8 @@ public class WRC1DisplayFieldsPanel extends WRCTabPanel implements EventListener
|
|||
}
|
||||
String printname = m_textBoxes[i].getValue();
|
||||
if (!Util.isEmpty(printname))
|
||||
if (! printname.equals(m_pfi.get(i).getPrintName()))
|
||||
m_pfi.get(i).setPrintName(m_textBoxes[i].getValue());
|
||||
if (! printname.equals(m_pfi.get(i).getPrintName(Language.getLoginLanguage())))
|
||||
m_pfi.get(i).setPrintName(Language.getLoginLanguage(), m_textBoxes[i].getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.adempiere.webui.theme.ThemeManager;
|
|||
import org.adempiere.webui.util.ZKUpdateUtil;
|
||||
import org.compiere.print.MPrintFormatItem;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.NamePair;
|
||||
import org.zkoss.zk.au.out.AuFocus;
|
||||
import org.zkoss.zk.ui.event.DropEvent;
|
||||
|
@ -207,7 +208,7 @@ public class WRC2FieldOrderPanel extends WRCTabPanel implements EventListener<Ev
|
|||
for (MPrintFormatItem pfi : listColumns){
|
||||
pfi.setSeqNo(seq);
|
||||
m_pfi.get(m_pfi.indexOf(pfi)).setSeqNo(seq);
|
||||
String name= pfi.getPrintName()== null ? pfi.getName(): pfi.getPrintName() ;
|
||||
String name= pfi.getPrintName(Language.getLoginLanguage())== null ? pfi.getName(): pfi.getPrintName(Language.getLoginLanguage()) ;
|
||||
ListElement element =new ListElement(pfi.get_ID(), name, pfi.getSeqNo(), pfi.getAD_Client_ID(), pfi.getAD_Org_ID());
|
||||
sortModel.addElement(element);
|
||||
sortList.addItem(new KeyNamePair(m_pfi.get(m_pfi.indexOf(pfi)).get_ID(), name));
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.compiere.model.MRefList;
|
|||
import org.compiere.print.MPrintFormatItem;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.NamePair;
|
||||
import org.compiere.util.Util;
|
||||
|
@ -233,7 +234,7 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
yesModel.removeAllElements();
|
||||
for (int i=0 ; i < yesItems.size() ; i++) {
|
||||
int ID= yesItems.get(i).get_ID();
|
||||
String name = getName(yesItems.get(i));
|
||||
String name = yesItems.get(i).getPrintName(Language.getLoginLanguage())==null? yesItems.get(i).getName():yesItems.get(i).getPrintName(Language.getLoginLanguage());
|
||||
yesList.addItem(new KeyNamePair(ID, name));
|
||||
yesModel.addElement(new ListElement(ID, name, yesItems.get(i).getSortNo(), true, yesItems.get(i).getAD_Client_ID(), yesItems.get(i).getAD_Org_ID()));
|
||||
}
|
||||
|
@ -243,7 +244,7 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
|
|||
noModel.removeAllElements();
|
||||
for (int i=0 ; i < noItems.size() ; i++) {
|
||||
int ID= noItems.get(i).get_ID();
|
||||
String name = noItems.get(i).getPrintName()== null ? noItems.get(i).getName() : noItems.get(i).getPrintName();
|
||||
String name = noItems.get(i).getPrintName(Language.getLoginLanguage())== null ? noItems.get(i).getName() : noItems.get(i).getPrintName(Language.getLoginLanguage());
|
||||
noItems.get(i).setSortNo(0);
|
||||
noItems.get(i).setIsOrderBy(false);
|
||||
noList.addItem(new KeyNamePair(ID, name));
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.adempiere.webui.component.Rows;
|
|||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.util.ZKUpdateUtil;
|
||||
import org.compiere.print.MPrintFormatItem;
|
||||
import org.compiere.util.Language;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
@ -124,7 +125,7 @@ public class WRC4GroupingCriteriaPanel extends WRCTabPanel implements EventListe
|
|||
m_chkboxes[i].setChecked(orderfield.get(i).isGroupBy());
|
||||
m_chkboxes[i].addEventListener(Events.ON_CHECK, this);
|
||||
|
||||
String strValue = orderfield.get(i).getPrintName();
|
||||
String strValue = orderfield.get(i).getPrintName(Language.getLoginLanguage());
|
||||
if(strValue ==null || strValue.length()==0){
|
||||
strValue = orderfield.get(i).getName();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.adempiere.webui.component.Window;
|
|||
import org.adempiere.webui.util.ZKUpdateUtil;
|
||||
import org.compiere.print.MPrintFormatItem;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
@ -159,7 +160,7 @@ public class WRC5SummaryFieldsPanel extends WRCTabPanel implements EventListener
|
|||
|
||||
for(int i=0 ;i<DisplayItems.size(); i++){
|
||||
row=new Row();
|
||||
String strValue = DisplayItems.get(i).getPrintName();
|
||||
String strValue = DisplayItems.get(i).getPrintName(Language.getLoginLanguage());
|
||||
if(strValue ==null || strValue.length()==0){
|
||||
strValue = DisplayItems.get(i).getName();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue