IDEMPIERE-556 Archive Viewer must not allow search when arriving from button
This commit is contained in:
parent
a36ed8d030
commit
eb26659562
|
@ -158,6 +158,7 @@ public class WArchive implements EventListener<Event>
|
|||
ADForm form = ADForm.openForm(AD_Form_ID);
|
||||
|
||||
WArchiveViewer av = (WArchiveViewer) form.getICustomForm();
|
||||
av.setShowQuery(false);
|
||||
if (e.getTarget() == m_documents)
|
||||
av.query(false, m_AD_Table_ID, m_Record_ID);
|
||||
else if (e.getTarget() == m_reports)
|
||||
|
|
|
@ -59,6 +59,7 @@ import org.compiere.util.Env;
|
|||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.util.media.AMedia;
|
||||
import org.zkoss.zk.ui.Page;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
@ -122,13 +123,20 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
|
|||
|
||||
private Iframe iframe = new Iframe();
|
||||
private Button bRefresh = new Button();
|
||||
private boolean showQuery = true;
|
||||
|
||||
public WArchiveViewer()
|
||||
{
|
||||
log.info("");
|
||||
|
||||
try
|
||||
{
|
||||
form = new CustomForm() {
|
||||
private static final long serialVersionUID = 7226661630651936293L;
|
||||
|
||||
@Override
|
||||
public void onPageAttached(Page newpage, Page oldpage) {
|
||||
super.onPageAttached(newpage, oldpage);
|
||||
if (newpage != null)
|
||||
try {
|
||||
dynInit();
|
||||
jbInit();
|
||||
}
|
||||
|
@ -136,6 +144,10 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
|
|||
{
|
||||
log.log(Level.SEVERE, "init", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -221,23 +233,28 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
|
|||
reportField.setLabel(Msg.translate(Env.getCtx(), "IsReport"));
|
||||
reportField.addEventListener(Events.ON_CHECK, this);
|
||||
|
||||
Rows rows;
|
||||
Row row;
|
||||
Div div;
|
||||
|
||||
if(showQuery){
|
||||
Grid gridQuery = new Grid();
|
||||
gridQuery.setWidth("500px");
|
||||
gridQuery.setStyle("margin:0; padding:0;");
|
||||
gridQuery.makeNoStrip();
|
||||
gridQuery.setOddRowSclass("even");
|
||||
|
||||
Rows rows = new Rows();
|
||||
rows = new Rows();
|
||||
gridQuery.appendChild(rows);
|
||||
|
||||
Row row = new Row();
|
||||
row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.setAlign("right");
|
||||
row.appendCellChild(reportField, 3);
|
||||
|
||||
row = new Row();
|
||||
rows.appendChild(row);
|
||||
Div div = new Div();
|
||||
div = new Div();
|
||||
div.setStyle("text-align: right;");
|
||||
div.appendChild(processLabel);
|
||||
row.appendCellChild(div, 1);
|
||||
|
@ -317,7 +334,7 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
|
|||
|
||||
tabpanels.appendChild(tabQueryPanel);
|
||||
tabs.appendChild(tabQuery);
|
||||
|
||||
}
|
||||
Grid gridView = new Grid();
|
||||
gridView.setStyle("margin:0; padding:0;");
|
||||
gridView.makeNoStrip();
|
||||
|
@ -450,10 +467,10 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
|
|||
SessionManager.getAppDesktop().closeActiveWindow();
|
||||
else if (e.getTarget().getId().equals(ConfirmPanel.A_OK))
|
||||
{
|
||||
if (tabbox.getSelectedIndex() == 1)
|
||||
SessionManager.getAppDesktop().closeActiveWindow();
|
||||
else
|
||||
if (showQuery && tabbox.getSelectedIndex() == 0)
|
||||
cmd_query();
|
||||
else
|
||||
SessionManager.getAppDesktop().closeActiveWindow();
|
||||
}
|
||||
else if (e.getTarget() == reportField)
|
||||
updateQDisplay();
|
||||
|
@ -465,7 +482,7 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
|
|||
iframe.invalidate();
|
||||
else if (e.getTarget() instanceof Tab)
|
||||
{
|
||||
if(tabbox.getSelectedIndex() == 1)
|
||||
if(tabbox.getSelectedIndex() == (showQuery ? 1 : 0))
|
||||
iframe.invalidate();
|
||||
}
|
||||
|
||||
|
@ -504,6 +521,7 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
|
|||
MArchive ar = m_archives[m_index];
|
||||
ar.delete(true);
|
||||
tabbox.setSelectedIndex(0);
|
||||
cmd_query();
|
||||
dynInit();
|
||||
}
|
||||
}
|
||||
|
@ -639,51 +657,68 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
|
|||
{
|
||||
boolean reports = reportField.isChecked();
|
||||
|
||||
ListItem listitem = processField.getSelectedItem();
|
||||
KeyNamePair process = null;
|
||||
Integer C_BPartner_ID = null;
|
||||
String name = null;
|
||||
String description = null;
|
||||
String help = null;
|
||||
KeyNamePair table = null;
|
||||
KeyNamePair createdBy = null;
|
||||
Timestamp createdFrom = null;
|
||||
Timestamp createdTo = null;
|
||||
|
||||
if (showQuery) {
|
||||
ListItem listitem = processField.getSelectedItem();
|
||||
process = null;
|
||||
if (listitem != null)
|
||||
process = (KeyNamePair)listitem.getValue();
|
||||
|
||||
listitem = tableField.getSelectedItem();
|
||||
KeyNamePair table = null;
|
||||
table = null;
|
||||
if (listitem != null)
|
||||
table = (KeyNamePair)listitem.getValue();
|
||||
|
||||
Integer C_BPartner_ID = (Integer)bPartnerField.getValue();
|
||||
String name = nameQField.getText();
|
||||
String description = descriptionQField.getText();
|
||||
String help = helpQField.getText();
|
||||
C_BPartner_ID = (Integer)bPartnerField.getValue();
|
||||
name = nameQField.getText();
|
||||
description = descriptionQField.getText();
|
||||
help = helpQField.getText();
|
||||
|
||||
listitem = createdByQField.getSelectedItem();
|
||||
KeyNamePair createdBy = null;
|
||||
createdBy = null;
|
||||
if (listitem != null)
|
||||
createdBy = (KeyNamePair)listitem.getValue();
|
||||
|
||||
Date date = null;
|
||||
Timestamp createdFrom = null;
|
||||
createdFrom = null;
|
||||
if (createdQFrom.getValue() != null)
|
||||
{
|
||||
date = createdQFrom.getValue();
|
||||
createdFrom = new Timestamp(date.getTime());
|
||||
}
|
||||
|
||||
Timestamp createdTo = null;
|
||||
createdTo = null;
|
||||
if (createdQTo.getValue() != null)
|
||||
{
|
||||
date = createdQTo.getValue();
|
||||
createdTo = new Timestamp(date.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
cmd_query(reports, process, table, C_BPartner_ID, name, description, help,
|
||||
createdBy, createdFrom, createdTo);
|
||||
|
||||
// Display
|
||||
tabbox.setSelectedIndex(1);
|
||||
|
||||
m_index = 1;
|
||||
if (showQuery)
|
||||
tabbox.setSelectedIndex(1);
|
||||
|
||||
updateVDisplay(false);
|
||||
} // cmd_query
|
||||
|
||||
public void setShowQuery(boolean showQuery) {
|
||||
this.showQuery = showQuery;
|
||||
}
|
||||
|
||||
public ADForm getForm() {
|
||||
return form;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue