IDEMPIERE-2389:Print format and Report type selection on process dialog
add language combobox
This commit is contained in:
parent
57c729ea5b
commit
a8f5e0745b
|
@ -0,0 +1,20 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
|
||||
-- Mar 13, 2015 3:58:49 AM ICT
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (211868,0,'Language ID',282,'AD_Language_ID','@SQL=SELECT NVL(MAX(AD_Language_ID),0)+1 AS DefaultValue FROM AD_Language',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2015-03-13 03:58:48','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-03-13 03:58:48','YYYY-MM-DD HH24:MI:SS'),100,2159,'N','N','D','N','N','N','Y','f813543d-ec4b-4673-8bb2-8a7099f9fbb0','N',0,'N','N')
|
||||
;
|
||||
|
||||
-- Mar 13, 2015 3:59:05 AM ICT
|
||||
ALTER TABLE AD_PInstance ADD AD_Language_ID NUMBER(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
|
||||
-- Mar 13, 2015 4:59:52 AM ICT
|
||||
UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_DATE('2015-03-13 04:59:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211868
|
||||
;
|
||||
|
||||
|
||||
SELECT register_migration_script('201503131604-IDEMPIERE-2389.sql') FROM dual
|
||||
;
|
|
@ -0,0 +1,15 @@
|
|||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
|
||||
-- Mar 13, 2015 3:58:49 AM ICT
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (211868,0,'Language ID',282,'AD_Language_ID','@SQL=SELECT NVL(MAX(AD_Language_ID),0)+1 AS DefaultValue FROM AD_Language',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2015-03-13 03:58:48','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-03-13 03:58:48','YYYY-MM-DD HH24:MI:SS'),100,2159,'N','N','D','N','N','N','Y','f813543d-ec4b-4673-8bb2-8a7099f9fbb0','N',0,'N','N')
|
||||
;
|
||||
|
||||
-- Mar 13, 2015 3:59:05 AM ICT
|
||||
ALTER TABLE AD_PInstance ADD COLUMN AD_Language_ID NUMERIC(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_TIMESTAMP('2015-03-13 04:59:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211868
|
||||
;
|
||||
|
||||
|
||||
SELECT register_migration_script('201503131604-IDEMPIERE-2389.sql') FROM dual
|
||||
;
|
|
@ -86,7 +86,9 @@ public interface I_AD_PInstance
|
|||
|
||||
/** Column name AD_PrintFormat_ID */
|
||||
public static final String COLUMNNAME_AD_PrintFormat_ID = "AD_PrintFormat_ID";
|
||||
|
||||
|
||||
public static final String COLUMNNAME_AD_Language_ID = "AD_Language_ID";
|
||||
|
||||
/** Set Print Format.
|
||||
* Data Print Format
|
||||
*/
|
||||
|
|
|
@ -449,6 +449,13 @@ public class MPInstance extends X_AD_PInstance
|
|||
.append(ip.getInfo_To()).append("|")
|
||||
.append(")");
|
||||
}
|
||||
if (getAD_Process().isReport()){
|
||||
cksum.append(this.getAD_Language_ID()).append("|")
|
||||
.append(this.getAD_PrintFormat_ID())
|
||||
.append(this.getAD_Language_ID())
|
||||
.append(this.getReportType())
|
||||
.append(this.getIsSummary());
|
||||
}
|
||||
return cksum.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,34 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent
|
|||
return ii.intValue();
|
||||
}
|
||||
|
||||
public org.compiere.model.I_AD_Language getAD_Language() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_AD_Language)MTable.get(getCtx(), org.compiere.model.I_AD_Language.Table_Name)
|
||||
.getPO(getAD_PrintFormat_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Print Format.
|
||||
@param AD_PrintFormat_ID
|
||||
Data Print Format
|
||||
*/
|
||||
public void setAD_Language_ID (int AD_Language_ID)
|
||||
{
|
||||
if (AD_Language_ID < 1)
|
||||
set_Value (COLUMNNAME_AD_Language_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_AD_Language_ID, Integer.valueOf(AD_Language_ID));
|
||||
}
|
||||
|
||||
/** Get Print Format.
|
||||
@return Data Print Format
|
||||
*/
|
||||
public int getAD_Language_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Language_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set IsSummary.
|
||||
@param IsSummary
|
||||
Data IsSummary
|
||||
|
|
|
@ -205,6 +205,8 @@ public class ReportEngine implements PrintServiceAttributeListener
|
|||
/** Window */
|
||||
private int m_windowNo = 0;
|
||||
|
||||
private int m_language_id = 0;
|
||||
|
||||
private boolean m_summary = false;
|
||||
|
||||
private List<IReportEngineEventListener> eventListeners = new ArrayList<IReportEngineEventListener>();
|
||||
|
@ -1796,6 +1798,16 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
return m_summary;
|
||||
}
|
||||
|
||||
public void setLanguageID(int languageID)
|
||||
{
|
||||
m_language_id = languageID;
|
||||
}
|
||||
|
||||
public int getLanguageID()
|
||||
{
|
||||
return m_language_id;
|
||||
}
|
||||
|
||||
private String reportType;
|
||||
|
||||
public void setReportType(String type)
|
||||
|
|
|
@ -148,6 +148,16 @@ public class ProcessInfo implements Serializable
|
|||
|
||||
private boolean isSummary = false;
|
||||
|
||||
private int languageID = 0;
|
||||
|
||||
public int getLanguageID() {
|
||||
return languageID;
|
||||
}
|
||||
|
||||
public void setLanguageID(int languageID) {
|
||||
this.languageID = languageID;
|
||||
}
|
||||
|
||||
public String getReportType() {
|
||||
return reportType;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import javax.servlet.ServletRequest;
|
|||
import org.adempiere.webui.adwindow.ADWindow;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.desktop.IDesktop;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.info.InfoWindow;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.theme.ThemeManager;
|
||||
|
@ -47,7 +48,10 @@ import org.compiere.model.GridWindowVO;
|
|||
import org.compiere.model.I_AD_Window;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MLanguage;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MSession;
|
||||
import org.compiere.model.MTable;
|
||||
|
@ -787,4 +791,15 @@ public final class AEnv
|
|||
|
||||
return adWindowID;
|
||||
}
|
||||
|
||||
public static WTableDirEditor getListDocumentLanguage (MClient client) throws Exception {
|
||||
WTableDirEditor fLanguageType = null;
|
||||
if (client.isMultiLingualDocument()){
|
||||
Lookup lookupLanguage = MLookupFactory.get (Env.getCtx(), 0, 0, DisplayType.TableDir,
|
||||
Env.getLanguage(Env.getCtx()), MLanguage.COLUMNNAME_AD_Language_ID, 0, false,
|
||||
" IsActive='Y' AND IsLoginLocale = 'Y' ");
|
||||
fLanguageType = new WTableDirEditor(MLanguage.COLUMNNAME_AD_Language_ID, false, false, true, lookupLanguage);
|
||||
}
|
||||
return fLanguageType;
|
||||
}
|
||||
} // AEnv
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.adempiere.webui.component.Listbox;
|
|||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.event.DialogEvents;
|
||||
import org.adempiere.webui.factory.ButtonFactory;
|
||||
|
@ -53,6 +54,7 @@ import org.compiere.Adempiere;
|
|||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MAttachment;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MLanguage;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MLookupInfo;
|
||||
|
@ -112,8 +114,6 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
private ProcessInfo m_pi = null;
|
||||
private boolean m_disposeOnComplete;
|
||||
|
||||
private Html message = null;
|
||||
|
||||
private ProcessParameterPanel parameterPanel = null;
|
||||
private Checkbox runAsJobField = null;
|
||||
private WTableDirEditor notificationTypeField = null;
|
||||
|
@ -135,7 +135,6 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
protected AbstractProcessDialog()
|
||||
{
|
||||
super();
|
||||
message = new Html();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,7 +211,6 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
//
|
||||
this.setTitle(m_Name);
|
||||
initialMessage = m_messageText.toString();
|
||||
message.setContent(initialMessage);
|
||||
|
||||
// Move from APanel.actionButton
|
||||
if (m_pi == null)
|
||||
|
@ -249,6 +247,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
protected HtmlBasedComponent bottomParameterLayout;
|
||||
protected HtmlBasedComponent mainParameterLayout;
|
||||
private WTableDirEditor fPrintFormat;
|
||||
private WEditor fLanguageType;
|
||||
private Listbox freportType;
|
||||
private Checkbox chbIsSummary;
|
||||
protected Button bOK;
|
||||
|
@ -384,9 +383,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
}
|
||||
|
||||
protected void reportOptionLayout(HtmlBasedComponent bottomParameterLayout) {
|
||||
MProcess pr = new MProcess(m_ctx, m_AD_Process_ID, null);
|
||||
boolean isReport = pr.isReport() && pr.getJasperReport() == null;
|
||||
if (!isReport)
|
||||
if (!isReport())
|
||||
return;//if not a report not need show this pannel
|
||||
|
||||
// option control
|
||||
|
@ -405,10 +402,17 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
Label lIsSummary = new Label(Msg.translate(Env.getCtx(), "Summary"));
|
||||
lIsSummary.setSclass("option-input-parameter");
|
||||
|
||||
listPrintFormat();
|
||||
MClient client = MClient.get(m_ctx);
|
||||
listPrintFormat(client);
|
||||
|
||||
reportOptionLayout.appendChild(lPrintFormat);
|
||||
reportOptionLayout.appendChild(fPrintFormat.getComponent());
|
||||
if (client.isMultiLingualDocument()){
|
||||
Label lLanguageType = new Label(Msg.translate(Env.getCtx(), MLanguage.COLUMNNAME_AD_Language_ID));
|
||||
reportOptionLayout.appendChild(lLanguageType);
|
||||
reportOptionLayout.appendChild(fLanguageType.getComponent());
|
||||
((Combobox)fLanguageType.getComponent()).setSclass("option-input-parameter");
|
||||
}
|
||||
fPrintFormat.getComponent().setSclass("option-input-parameter");
|
||||
reportOptionLayout.appendChild(lreportType);
|
||||
reportOptionLayout.appendChild(freportType);
|
||||
|
@ -416,6 +420,12 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
reportOptionLayout.appendChild(chbIsSummary);
|
||||
}
|
||||
|
||||
protected boolean isReport () {
|
||||
MProcess pr = new MProcess(m_ctx, m_AD_Process_ID, null);
|
||||
return pr.isReport() && pr.getJasperReport() == null;
|
||||
|
||||
}
|
||||
|
||||
protected void savePrameterLayout(HtmlBasedComponent bottomParameterLayout) {
|
||||
HtmlBasedComponent savePrameterLayout = new Div();
|
||||
savePrameterLayout.setSclass("save-parameter-container");
|
||||
|
@ -470,7 +480,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
|
||||
}
|
||||
|
||||
private void listPrintFormat()
|
||||
private void listPrintFormat(MClient client)
|
||||
{
|
||||
int AD_Column_ID = 0;
|
||||
boolean m_isCanExport = false;
|
||||
|
@ -501,6 +511,11 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
valCode);
|
||||
|
||||
fPrintFormat = new WTableDirEditor("AD_PrintFormat_ID", false, false, true, lookup);
|
||||
|
||||
if (client.isMultiLingualDocument()){
|
||||
fLanguageType = AEnv.getListDocumentLanguage(client);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -532,6 +547,10 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
fPrintFormat.setValue((Integer) instance.getAD_PrintFormat_ID());
|
||||
}
|
||||
|
||||
if (fLanguageType != null && instance != null) {
|
||||
fLanguageType.setValue((Integer) instance.getAD_Language_ID());
|
||||
}
|
||||
|
||||
if (freportType != null && instance != null) {
|
||||
if (instance.getReportType() == null)
|
||||
freportType.setValue("HTML");
|
||||
|
@ -544,6 +563,9 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
}
|
||||
|
||||
protected void saveReportOption (){
|
||||
if (!isReport()){
|
||||
return;
|
||||
}
|
||||
if(freportType.getSelectedItem() != null) {
|
||||
getProcessInfo().setReportType(freportType.getSelectedItem().getValue().toString());
|
||||
}
|
||||
|
@ -555,6 +577,8 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
}
|
||||
|
||||
getProcessInfo().setIsSummary(chbIsSummary.isChecked());
|
||||
if (fLanguageType != null)
|
||||
getProcessInfo().setLanguageID(fLanguageType.getValue() == null?0:(int)fLanguageType.getValue());
|
||||
}
|
||||
|
||||
protected void autoStart()
|
||||
|
@ -605,7 +629,21 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
para.deleteEx(true);
|
||||
}
|
||||
getParameterPanel().saveParameters();
|
||||
savedParams.get(i).setAD_PrintFormat_ID((Integer)fPrintFormat.getValue());
|
||||
|
||||
Object value = fPrintFormat.getValue();
|
||||
if (value == null){
|
||||
savedParams.get(i).setAD_PrintFormat_ID(0);
|
||||
}else{
|
||||
savedParams.get(i).setAD_PrintFormat_ID((Integer)value);
|
||||
}
|
||||
|
||||
value = fLanguageType.getValue();
|
||||
if (value == null){
|
||||
savedParams.get(i).setAD_Language_ID(0);
|
||||
}else{
|
||||
savedParams.get(i).setAD_Language_ID((Integer)value);
|
||||
}
|
||||
|
||||
savedParams.get(i).setReportType(freportType.getSelectedItem().getValue().toString());
|
||||
savedParams.get(i).setIsSummary(chbIsSummary.isSelected());
|
||||
savedParams.get(i).saveEx();
|
||||
|
@ -946,12 +984,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
{
|
||||
return m_AD_Process_ID;
|
||||
}
|
||||
|
||||
public Html getMessage()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
public ProcessParameterPanel getParameterPanel()
|
||||
{
|
||||
return parameterPanel;
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.logging.Level;
|
|||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.DocumentLink;
|
||||
import org.adempiere.webui.component.Mask;
|
||||
import org.adempiere.webui.component.Window;
|
||||
|
@ -47,6 +48,7 @@ import org.compiere.util.CLogger;
|
|||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zhtml.Table;
|
||||
import org.zkoss.zhtml.Td;
|
||||
import org.zkoss.zhtml.Text;
|
||||
|
@ -54,13 +56,16 @@ import org.zkoss.zhtml.Tr;
|
|||
import org.zkoss.zk.au.out.AuEcho;
|
||||
import org.zkoss.zk.au.out.AuScript;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.HtmlBasedComponent;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.A;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Html;
|
||||
import org.zkoss.zul.Label;
|
||||
import org.zkoss.zul.Vlayout;
|
||||
|
||||
import com.lowagie.text.Document;
|
||||
import com.lowagie.text.pdf.PdfContentByte;
|
||||
|
@ -96,6 +101,9 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
|
||||
private boolean isParameterPage = true;
|
||||
private Mask mask;
|
||||
private HtmlBasedComponent resultPanelLayout;
|
||||
private HtmlBasedComponent messageResultContent;
|
||||
private HtmlBasedComponent infoResultContent;
|
||||
|
||||
/**
|
||||
* Dialog to start a process/report
|
||||
|
@ -161,6 +169,7 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
else
|
||||
restart();
|
||||
}else if (bCancel.equals(component)){
|
||||
super.onEvent(event);
|
||||
cancelProcess();
|
||||
} else if (event.getName().equals(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT)) {
|
||||
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Process, getAD_Process_ID());
|
||||
|
@ -240,33 +249,56 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
swithToFinishScreen();
|
||||
}
|
||||
|
||||
protected void swithToFinishScreen() {
|
||||
ProcessInfo pi = getProcessInfo();
|
||||
ProcessInfoUtil.setLogFromDB(pi);
|
||||
getMessageText().append("<p><font color=\"").append(pi.isError() ? "#FF0000" : "#0000FF").append("\">** ")
|
||||
.append(pi.getSummary())
|
||||
.append("</font></p>");
|
||||
getMessage().setContent(getMessageText().toString());
|
||||
|
||||
layoutResultPanel (topParameterLayout);
|
||||
|
||||
// Add Log info with zoom on record id
|
||||
appendRecordLogInfo(pi.getLogs());
|
||||
appendRecordLogInfo(pi.getLogs(), infoResultContent);
|
||||
|
||||
bOK.setLabel(Msg.getMsg(Env.getCtx(), "Parameter"));
|
||||
bOK.setImage(ThemeManager.getThemeResource("images/Reset16.png"));
|
||||
|
||||
bCancel.setLabel(Msg.getMsg(Env.getCtx(), "Close"));
|
||||
bCancel.setImage(ThemeManager.getThemeResource("images/Cancel16.png"));
|
||||
|
||||
isParameterPage = false;
|
||||
|
||||
m_ids = pi.getIDs();
|
||||
|
||||
//move message div to center to give more space to display potentially very long log info
|
||||
topParameterLayout.detach();
|
||||
//TODO:hieplq show result
|
||||
replaceComponent (resultPanelLayout, topParameterLayout);
|
||||
invalidate();
|
||||
|
||||
Clients.response(new AuEcho(this, "onAfterProcess", null));
|
||||
}
|
||||
|
||||
private void appendRecordLogInfo(ProcessInfoLog[] m_logs) {
|
||||
private void layoutResultPanel (HtmlBasedComponent topParameterLayout){
|
||||
if (resultPanelLayout == null){
|
||||
resultPanelLayout = new Vlayout();
|
||||
resultPanelLayout.setSclass("result-parameter-layout");
|
||||
resultPanelLayout.setVflex("true");
|
||||
// reference for update late
|
||||
messageResultContent = setHeadMessage(resultPanelLayout, getMessageText().toString());
|
||||
|
||||
infoResultContent = new Div();
|
||||
resultPanelLayout.appendChild(infoResultContent);
|
||||
}
|
||||
}
|
||||
|
||||
protected void replaceComponent(HtmlBasedComponent newComponent, HtmlBasedComponent oldComponent) {
|
||||
oldComponent.getParent().insertBefore(newComponent, oldComponent);
|
||||
oldComponent.detach();
|
||||
}
|
||||
|
||||
private void appendRecordLogInfo(ProcessInfoLog[] m_logs, HtmlBasedComponent infoResultContent) {
|
||||
if (m_logs == null)
|
||||
return;
|
||||
|
||||
|
@ -280,7 +312,7 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
logMessageTable.setDynamicProperty("cellspacing", "0");
|
||||
logMessageTable.setDynamicProperty("width", "100%");
|
||||
|
||||
this.appendChild(logMessageTable);
|
||||
infoResultContent.appendChild(logMessageTable);
|
||||
|
||||
boolean datePresents = false;
|
||||
boolean numberPresents = false;
|
||||
|
@ -343,18 +375,15 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
}
|
||||
|
||||
private void restart() {
|
||||
setMessageText(new StringBuffer(getInitialMessage()));
|
||||
getMessage().setContent(getInitialMessage());
|
||||
|
||||
if(logMessageTable!=null){
|
||||
//messageDiv.removeChild(logMessageTable);
|
||||
}
|
||||
//messageDiv.setStyle(MESSAGE_DIV_STYLE);
|
||||
|
||||
replaceComponent (topParameterLayout, resultPanelLayout);
|
||||
|
||||
isParameterPage = true;
|
||||
|
||||
bOK.setLabel(Msg.getMsg(Env.getCtx(), "Start"));
|
||||
bOK.setImage(ThemeManager.getThemeResource("images/Ok16.png"));
|
||||
|
||||
bCancel.setLabel(Util.cleanAmp(Msg.translate(Env.getCtx(), ConfirmPanel.A_CANCEL)));
|
||||
bCancel.setImage(ThemeManager.getThemeResource("images/Cancel16.png"));
|
||||
|
||||
//recreate process info
|
||||
ProcessInfo m_pi = new WProcessInfo(getName(), getAD_Process_ID());
|
||||
|
@ -364,7 +393,8 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
getParameterPanel().setProcessInfo(m_pi);
|
||||
|
||||
m_ids = null;
|
||||
|
||||
if (fSavedName != null)
|
||||
querySaved();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
@ -418,7 +448,7 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
public void onCallback(Boolean result) {
|
||||
if (result) {
|
||||
getMessageText().append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("</p>");
|
||||
getMessage().setContent(getMessageText().toString());
|
||||
((Html)messageResultContent).setContent(getMessageText().toString());
|
||||
showBusyDialog();
|
||||
Clients.response(new AuEcho(ProcessDialog.this, "onPrintShipments", null));
|
||||
}
|
||||
|
@ -502,7 +532,7 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
if (result)
|
||||
{
|
||||
getMessageText().append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("</p>");
|
||||
getMessage().setContent(getMessageText().toString());
|
||||
((Html)messageResultContent).setContent(getMessageText().toString());
|
||||
showBusyDialog();
|
||||
Clients.response(new AuEcho(ProcessDialog.this, "onPrintInvoices", null));
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.adempiere.webui.apps;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.event.DialogEvents;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
|
@ -182,13 +181,13 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
|
|||
*/
|
||||
public void onEvent(Event event) {
|
||||
Component component = event.getTarget();
|
||||
if (component instanceof Button) {
|
||||
Button element = (Button)component;
|
||||
if ("Ok".equalsIgnoreCase(element.getId()))
|
||||
startProcess();
|
||||
else if ("Cancel".equalsIgnoreCase(element.getId()))
|
||||
cancelProcess();
|
||||
} else {
|
||||
if (component.equals(bOK)) {
|
||||
super.onEvent(event);
|
||||
startProcess();
|
||||
} else if (component.equals(bCancel)) {
|
||||
super.onEvent(event);
|
||||
cancelProcess();
|
||||
}else {
|
||||
super.onEvent(event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.adempiere.webui.component.Mask;
|
|||
import org.adempiere.webui.component.Tabpanel;
|
||||
import org.adempiere.webui.component.ToolBarButton;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.event.DialogEvents;
|
||||
import org.adempiere.webui.event.DrillEvent;
|
||||
import org.adempiere.webui.event.ZoomEvent;
|
||||
|
@ -63,6 +64,7 @@ import org.compiere.Adempiere;
|
|||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.MArchive;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MLanguage;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MSysConfig;
|
||||
|
@ -79,6 +81,7 @@ import org.compiere.util.CLogger;
|
|||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.util.media.AMedia;
|
||||
|
@ -166,6 +169,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
|||
private ToolBarButton bExport = new ToolBarButton();
|
||||
private ToolBarButton bWizard = new ToolBarButton();
|
||||
private Listbox comboReport = new Listbox();
|
||||
private WTableDirEditor wLanguage;
|
||||
private Label labelDrill = new Label();
|
||||
private Listbox comboDrill = new Listbox();
|
||||
private Listbox previewType = new Listbox();
|
||||
|
@ -304,6 +308,21 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
|||
|
||||
toolBar.appendChild(new Separator("vertical"));
|
||||
|
||||
MClient client = MClient.get(m_ctx);
|
||||
if (client.isMultiLingualDocument()){
|
||||
try {
|
||||
wLanguage = AEnv.getListDocumentLanguage(client);
|
||||
wLanguage.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "AD_PrintFormat_ID"));
|
||||
toolBar.appendChild(wLanguage.getComponent());
|
||||
wLanguage.setValue(m_reportEngine.getLanguageID());
|
||||
wLanguage.getComponent().addEventListener(Events.ON_SELECT, this);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
toolBar.appendChild(new Separator("vertical"));
|
||||
|
||||
summary.setText(Msg.getMsg(Env.getCtx(), "Summary"));
|
||||
toolBar.appendChild(summary);
|
||||
summary.setChecked(m_reportEngine.isSummary());
|
||||
|
@ -764,7 +783,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
|||
return;
|
||||
if (e.getTarget() == comboReport)
|
||||
cmd_report();
|
||||
else if (e.getTarget() == bFind)
|
||||
else if (MClient.get(m_ctx).isMultiLingualDocument() && e.getTarget() == wLanguage.getComponent()){
|
||||
cmd_report();
|
||||
}else if (e.getTarget() == bFind)
|
||||
cmd_find();
|
||||
else if (e.getTarget() == bExport)
|
||||
cmd_export();
|
||||
|
@ -1058,8 +1079,19 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
|||
postRenderReportEvent();
|
||||
} // cmd_report
|
||||
|
||||
protected void setLanguage (){
|
||||
if (MClient.get(m_ctx).isMultiLingualDocument() && wLanguage.getValue() != null){
|
||||
MLanguage language = new MLanguage (m_ctx, (int)wLanguage.getValue(), null);
|
||||
Language lang = new Language(language.getName(), language.getAD_Language(), language.getLocale());
|
||||
m_reportEngine.setLanguageID(language.getAD_Language_ID());
|
||||
m_reportEngine.getPrintFormat().setLanguage(lang);
|
||||
m_reportEngine.getPrintFormat().setTranslationLanguage(lang);
|
||||
}
|
||||
}
|
||||
|
||||
private void postRenderReportEvent() {
|
||||
showBusyDialog();
|
||||
setLanguage();
|
||||
Events.echoEvent(ON_RENDER_REPORT_EVENT, this, null);
|
||||
}
|
||||
|
||||
|
@ -1372,7 +1404,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
|||
log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
||||
}
|
||||
File file = File.createTempFile(prefix, ".html", new File(path));
|
||||
viewer.m_reportEngine.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(contextPath, "rp", viewer.getUuid()));
|
||||
viewer.m_reportEngine.createHTML(file, false, viewer.m_reportEngine.getPrintFormat().getLanguage(), new HTMLExtension(contextPath, "rp", viewer.getUuid()));
|
||||
viewer.media = new AMedia(file.getName(), "html", "text/html", file, false);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof RuntimeException)
|
||||
|
@ -1418,7 +1450,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
|||
log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
||||
}
|
||||
File file = File.createTempFile(prefix, ".xls", new File(path));
|
||||
viewer.m_reportEngine.createXLS(file, AEnv.getLanguage(Env.getCtx()));
|
||||
viewer.m_reportEngine.createXLS(file, viewer.m_reportEngine.getPrintFormat().getLanguage());
|
||||
viewer.media = new AMedia(file.getName(), "xls", "application/vnd.ms-excel", file, true);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof RuntimeException)
|
||||
|
|
|
@ -133,6 +133,7 @@ public class ReportCtl
|
|||
if (pi.getSerializableObject() != null)
|
||||
instance.setAD_PrintFormat_ID(((MPrintFormat)pi.getSerializableObject()).getAD_PrintFormat_ID());
|
||||
instance.setIsSummary(pi.isSummary());
|
||||
instance.setAD_Language_ID(pi.getLanguageID());
|
||||
instance.saveEx();
|
||||
|
||||
/**
|
||||
|
@ -259,7 +260,7 @@ public class ReportCtl
|
|||
if (pi.getReportType() != null) {
|
||||
re.setReportType(pi.getReportType());
|
||||
}
|
||||
|
||||
re.setLanguageID(pi.getLanguageID());
|
||||
re.setWindowNo(WindowNo);
|
||||
createOutput(re, pi.isPrintPreview(), null);
|
||||
return true;
|
||||
|
@ -301,8 +302,14 @@ public class ReportCtl
|
|||
}
|
||||
PrintInfo info = new PrintInfo(pi);
|
||||
|
||||
ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info);
|
||||
ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info, pi.isSummary());
|
||||
re.setWindowNo(WindowNo);
|
||||
if (pi.getReportType() != null) {
|
||||
re.setReportType(pi.getReportType());
|
||||
}
|
||||
|
||||
re.setLanguageID(pi.getLanguageID());
|
||||
|
||||
createOutput(re, pi.isPrintPreview(), null);
|
||||
return true;
|
||||
} // startFinReport
|
||||
|
|
Loading…
Reference in New Issue