* See identifiers columns when delete records
Fix problem found with tables without key column Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2877111
This commit is contained in:
parent
6ce3b10eda
commit
c096728030
|
@ -29,8 +29,10 @@ import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.InputEvent;
|
import java.awt.event.InputEvent;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -77,6 +79,7 @@ import org.compiere.model.GridTable;
|
||||||
import org.compiere.model.GridWindow;
|
import org.compiere.model.GridWindow;
|
||||||
import org.compiere.model.GridWindowVO;
|
import org.compiere.model.GridWindowVO;
|
||||||
import org.compiere.model.GridWorkbench;
|
import org.compiere.model.GridWorkbench;
|
||||||
|
import org.compiere.model.Lookup;
|
||||||
import org.compiere.model.MLookupFactory;
|
import org.compiere.model.MLookupFactory;
|
||||||
import org.compiere.model.MProcess;
|
import org.compiere.model.MProcess;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
|
@ -1824,13 +1827,35 @@ public final class APanel extends CPanel
|
||||||
Vector<String> data = new Vector<String>();
|
Vector<String> data = new Vector<String>();
|
||||||
// FR [ 2877111 ]
|
// FR [ 2877111 ]
|
||||||
final String keyColumnName = m_curTab.getKeyColumnName();
|
final String keyColumnName = m_curTab.getKeyColumnName();
|
||||||
final String sql = MLookupFactory.getLookup_TableDirEmbed(Env.getLanguage(m_ctx), keyColumnName, "[?","?]")
|
String sql = null;
|
||||||
|
if (! "".equals(keyColumnName)) {
|
||||||
|
sql = MLookupFactory.getLookup_TableDirEmbed(Env.getLanguage(m_ctx), keyColumnName, "[?","?]")
|
||||||
.replace("[?.?]", "?");
|
.replace("[?.?]", "?");
|
||||||
|
}
|
||||||
int noOfRows = m_curTab.getRowCount();
|
int noOfRows = m_curTab.getRowCount();
|
||||||
for(int i = 0; i < noOfRows; i++)
|
for(int i = 0; i < noOfRows; i++)
|
||||||
{
|
{
|
||||||
final int id = m_curTab.getKeyID(i);
|
|
||||||
StringBuffer displayValue = new StringBuffer();
|
StringBuffer displayValue = new StringBuffer();
|
||||||
|
if ("".equals(keyColumnName))
|
||||||
|
{
|
||||||
|
ArrayList<String> parentColumnNames = m_curTab.getParentColumnNames();
|
||||||
|
for (Iterator<String> iter = parentColumnNames.iterator(); iter.hasNext();)
|
||||||
|
{
|
||||||
|
String columnName = iter.next();
|
||||||
|
GridField field = m_curTab.getField(columnName);
|
||||||
|
if(field.isLookup()){
|
||||||
|
Lookup lookup = field.getLookup();
|
||||||
|
if (lookup != null){
|
||||||
|
displayValue = displayValue.append(lookup.getDisplay(m_curTab.getValue(i,columnName))).append(" | ");
|
||||||
|
} else {
|
||||||
|
displayValue = displayValue.append(m_curTab.getValue(i,columnName)).append(" | ");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
displayValue = displayValue.append(m_curTab.getValue(i,columnName)).append(" | ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final int id = m_curTab.getKeyID(i);
|
||||||
String value = DB.getSQLValueStringEx(null, sql, id);
|
String value = DB.getSQLValueStringEx(null, sql, id);
|
||||||
value = value.replace(" - ", " | ");
|
value = value.replace(" - ", " | ");
|
||||||
displayValue.append(value);
|
displayValue.append(value);
|
||||||
|
@ -1841,6 +1866,7 @@ public final class APanel extends CPanel
|
||||||
displayValue.append(" | ");
|
displayValue.append(" | ");
|
||||||
displayValue.append("<").append(id).append(">");
|
displayValue.append("<").append(id).append(">");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//
|
//
|
||||||
data.add(displayValue.toString());
|
data.add(displayValue.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package org.adempiere.webui.panel;
|
package org.adempiere.webui.panel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -57,6 +58,7 @@ import org.compiere.model.GridTab;
|
||||||
import org.compiere.model.GridTable;
|
import org.compiere.model.GridTable;
|
||||||
import org.compiere.model.GridWindow;
|
import org.compiere.model.GridWindow;
|
||||||
import org.compiere.model.GridWindowVO;
|
import org.compiere.model.GridWindowVO;
|
||||||
|
import org.compiere.model.Lookup;
|
||||||
import org.compiere.model.MLookupFactory;
|
import org.compiere.model.MLookupFactory;
|
||||||
import org.compiere.model.MProcess;
|
import org.compiere.model.MProcess;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
|
@ -1400,13 +1402,35 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
Vector<String> data = new Vector<String>();
|
Vector<String> data = new Vector<String>();
|
||||||
// FR [ 2877111 ]
|
// FR [ 2877111 ]
|
||||||
final String keyColumnName = curTab.getKeyColumnName();
|
final String keyColumnName = curTab.getKeyColumnName();
|
||||||
final String sql = MLookupFactory.getLookup_TableDirEmbed(Env.getLanguage(ctx), keyColumnName, "[?","?]")
|
String sql = null;
|
||||||
|
if (! "".equals(keyColumnName)) {
|
||||||
|
sql = MLookupFactory.getLookup_TableDirEmbed(Env.getLanguage(ctx), keyColumnName, "[?","?]")
|
||||||
.replace("[?.?]", "?");
|
.replace("[?.?]", "?");
|
||||||
|
}
|
||||||
int noOfRows = curTab.getRowCount();
|
int noOfRows = curTab.getRowCount();
|
||||||
for(int i=0; i<noOfRows; i++)
|
for(int i=0; i<noOfRows; i++)
|
||||||
{
|
{
|
||||||
final int id = curTab.getKeyID(i);
|
|
||||||
StringBuffer displayValue = new StringBuffer();
|
StringBuffer displayValue = new StringBuffer();
|
||||||
|
if ("".equals(keyColumnName))
|
||||||
|
{
|
||||||
|
ArrayList<String> parentColumnNames = curTab.getParentColumnNames();
|
||||||
|
for (Iterator<String> iter = parentColumnNames.iterator(); iter.hasNext();)
|
||||||
|
{
|
||||||
|
String columnName = iter.next();
|
||||||
|
GridField field = curTab.getField(columnName);
|
||||||
|
if(field.isLookup()){
|
||||||
|
Lookup lookup = field.getLookup();
|
||||||
|
if (lookup != null){
|
||||||
|
displayValue = displayValue.append(lookup.getDisplay(curTab.getValue(i,columnName))).append(" | ");
|
||||||
|
} else {
|
||||||
|
displayValue = displayValue.append(curTab.getValue(i,columnName)).append(" | ");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
displayValue = displayValue.append(curTab.getValue(i,columnName)).append(" | ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final int id = curTab.getKeyID(i);
|
||||||
String value = DB.getSQLValueStringEx(null, sql, id);
|
String value = DB.getSQLValueStringEx(null, sql, id);
|
||||||
value = value.replace(" - ", " | ");
|
value = value.replace(" - ", " | ");
|
||||||
displayValue.append(value);
|
displayValue.append(value);
|
||||||
|
@ -1417,6 +1441,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
displayValue.append(" | ");
|
displayValue.append(" | ");
|
||||||
displayValue.append("<").append(id).append(">");
|
displayValue.append("<").append(id).append(">");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//
|
//
|
||||||
data.add(displayValue.toString());
|
data.add(displayValue.toString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue