Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: idempiere/idempiere
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7b2c99fa8672
Choose a base ref
...
head repository: idempiere/idempiere
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ef3ed449ca10
Choose a head ref
  • 1 commit
  • 6 files changed
  • 1 contributor

Commits on Dec 23, 2019

  1. Copy the full SHA
    ef3ed44 View commit details
46 changes: 43 additions & 3 deletions org.adempiere.base/src/org/compiere/print/MPrintFormatItem.java
Original file line number Diff line number Diff line change
@@ -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 MPrintFormatItem (Properties ctx, ResultSet rs, String trxName)
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 String getPrintName (Language language)
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 @@ && getPrintName() != null && getPrintName().length() > 0)
+ " 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
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@
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 void init() {
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 void save(){
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 void updatePFI() {
}
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());
}
}

Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@
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 int compare(MPrintFormatItem o1, MPrintFormatItem o2) {
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));
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
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 void refresh() {
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 void refresh() {
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));
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
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 void dynamicInit()
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();
}
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@
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 void dynamicInit(){

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();
}