IDEMPIERE-732 Business Partner info displays partners from all clients.

This commit is contained in:
Heng Sin Low 2013-03-20 22:29:24 +08:00
parent 30af38e5b1
commit e3cf6df872
1 changed files with 29 additions and 9 deletions

View File

@ -342,14 +342,22 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
} }
builder.append(tableInfos[0].getSynonym()).append(".IsActive='Y'"); builder.append(tableInfos[0].getSynonym()).append(".IsActive='Y'");
} }
int count = 0;
for(WEditor editor : editors) { for(WEditor editor : editors) {
if (editor instanceof IWhereClauseEditor) { if (editor instanceof IWhereClauseEditor) {
String whereClause = ((IWhereClauseEditor) editor).getWhereClause(); String whereClause = ((IWhereClauseEditor) editor).getWhereClause();
if (whereClause != null && whereClause.trim().length() > 0) { if (whereClause != null && whereClause.trim().length() > 0) {
if (builder.length() > 0) { count++;
if (count == 1) {
if (builder.length() > 0) {
builder.append(" AND ");
if (!checkAND.isChecked()) builder.append(" ( ");
} else if (p_whereClause != null && p_whereClause.trim().length() > 0) {
builder.append(" AND ");
if (!checkAND.isChecked()) builder.append(" ( ");
}
} else {
builder.append(checkAND.isChecked() ? " AND " : " OR "); builder.append(checkAND.isChecked() ? " AND " : " OR ");
} else if (p_whereClause != null && p_whereClause.trim().length() > 0) {
builder.append(" AND ");
} }
builder.append(whereClause); builder.append(whereClause);
} }
@ -363,11 +371,20 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
if (asIndex > 0) { if (asIndex > 0) {
columnName = columnName.substring(0, asIndex); columnName = columnName.substring(0, asIndex);
} }
if (builder.length() > 0) {
count++;
if (count == 1) {
if (builder.length() > 0) {
builder.append(" AND ");
if (!checkAND.isChecked()) builder.append(" ( ");
} else if (p_whereClause != null && p_whereClause.trim().length() > 0) {
builder.append(" AND ");
if (!checkAND.isChecked()) builder.append(" ( ");
}
} else {
builder.append(checkAND.isChecked() ? " AND " : " OR "); builder.append(checkAND.isChecked() ? " AND " : " OR ");
} else if (p_whereClause != null && p_whereClause.trim().length() > 0) {
builder.append(" AND ");
} }
String columnClause = null; String columnClause = null;
if (mInfoColumn.getQueryFunction() != null && mInfoColumn.getQueryFunction().trim().length() > 0) { if (mInfoColumn.getQueryFunction() != null && mInfoColumn.getQueryFunction().trim().length() > 0) {
String function = mInfoColumn.getQueryFunction(); String function = mInfoColumn.getQueryFunction();
@ -393,6 +410,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
.append(" ?"); .append(" ?");
} }
} }
if (count > 0 && !checkAND.isChecked()) {
builder.append(" ) ");
}
return builder.toString(); return builder.toString();
} }