IDEMPIERE-1703 improve search panel

This commit is contained in:
hieplq 2018-07-11 19:11:29 +02:00
parent cce8a17248
commit 1ff8e68438
1 changed files with 36 additions and 7 deletions

View File

@ -94,7 +94,6 @@ import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.SecureEngine;
import org.compiere.util.Util;
import org.compiere.util.ValueNamePair;
import org.zkoss.zk.au.out.AuFocus;
@ -351,6 +350,10 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
btnNew.setId("btnNew");
btnNew.addEventListener(Events.ON_CLICK,this);
Button btnClear = ButtonFactory.createNamedButton(ConfirmPanel.A_RESET);
btnClear.setId("btnReset");
btnClear.addEventListener(Events.ON_CLICK,this);
Button btnOk = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
btnOk.setName("btnOkSimple");
btnOk.setId("btnOk");
@ -361,6 +364,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
btnCancel.addEventListener(Events.ON_CLICK,this);
Panel pnlButtonRight = new Panel();
pnlButtonRight.appendChild(btnClear);
pnlButtonRight.appendChild(btnOk);
pnlButtonRight.appendChild(btnCancel);
pnlButtonRight.setStyle("text-align:right");
@ -671,7 +675,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
mField.getVO().FieldLength = 32767; // a conservative max literal string - like oracle extended
mField.getVO().DisplayLength = mField.getVO().FieldLength;
}
if (mField.getVO().displayType == DisplayType.YesNo) {
if (mField.getVO().displayType == DisplayType.YesNo || mField.isEncrypted()) {
// Make Yes-No searchable as list
GridFieldVO vo = mField.getVO();
GridFieldVO ynvo = vo.clone(m_simpleCtx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly);
@ -1136,7 +1140,8 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
editor.addValueChangeListener(this);
Label label = editor.getLabel();
Component fieldEditor = editor.getComponent();
//Fix miss lable of checkbox
label.setValue(mField.getHeader());
//
if (displayLength > 0) // set it back
mField.setDisplayLength(displayLength);
@ -1359,6 +1364,21 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
m_isCancel = false;
dispose();
}
else if ("btnReset".equals(btn.getName())){
for (WEditor clearField : m_sEditors){
clearField.setValue(null);
}
for (WEditor clearField : m_sEditorsTo){
if (clearField != null){
clearField.setValue(null);
clearField.setVisible(false);
ToolBarButton moreButtor = m_sEditorsFlag.get(m_sEditorsTo.indexOf(clearField));
moreButtor.setChecked(false);
}
}
}
}
}
else if (Events.ON_OK.equals(event.getName()))
@ -1789,13 +1809,22 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
// globalqss - Carlos Ruiz - 20060711
// fix a bug with virtualColumn + isSelectionColumn not yielding results
GridField field = getTargetMField(ColumnName);
// add encryption here if the field is encrypted.
if (field.isEncryptedColumn()) {
value = SecureEngine.encrypt(value, Env.getAD_Client_ID(Env.getCtx()));
}
boolean isProductCategoryField = isProductCategoryField(field.getColumnName());
StringBuilder ColumnSQL = new StringBuilder(field.getColumnSQL(false));
// add encryption here if the field is encrypted.
if (field.isEncrypted()) {
String Operator = MQuery.NULL;
if ("Y".equals(value)){
Operator = MQuery.NOT_NULL;
}
m_query.addRestriction(ColumnSQL.toString(), Operator, null,
ColumnName, wed.getDisplay());
appendCode(code, ColumnName, Operator, "", "", "AND", "", "");
continue;
}
//
// Be more permissive for String columns
if (isSearchLike(field))