Merge with a38faf9fb423b6a26fd5085f0b8b45a4f339311e
This commit is contained in:
commit
41c9005d81
|
@ -0,0 +1,8 @@
|
|||
-- Nov 16, 2012 8:41:14 PM COT
|
||||
-- IDEMPIERE-387 Enable mixed payments on POS Sales Order
|
||||
UPDATE AD_Column SET AD_Val_Rule_ID=NULL,Updated=TO_DATE('2012-11-16 20:41:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4020
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201211162041_IDEMPIERE-387.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
-- Nov 16, 2012 8:41:14 PM COT
|
||||
-- IDEMPIERE-387 Enable mixed payments on POS Sales Order
|
||||
UPDATE AD_Column SET AD_Val_Rule_ID=NULL,Updated=TO_TIMESTAMP('2012-11-16 20:41:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4020
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201211162041_IDEMPIERE-387.sql') FROM dual
|
||||
;
|
||||
|
|
@ -108,12 +108,10 @@ import org.compiere.util.ValueNamePair;
|
|||
*/
|
||||
public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6259178346327832664L;
|
||||
private static final long serialVersionUID = 336562925897569888L;
|
||||
|
||||
public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate";
|
||||
|
||||
|
@ -3239,15 +3237,23 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
return m_window.getTab(parentTabNo);
|
||||
}
|
||||
|
||||
public int getColumns(){
|
||||
int col=0;
|
||||
|
||||
String sql="SELECT MAX(f.XPosition+f.ColumnSpan-case when f.isfieldonly='Y' OR c.ad_reference_id in (20/*yesno*/,28/*button*/) then 1 else 0 end)"
|
||||
+" FROM AD_Field f JOIN AD_Column c ON (f.AD_Column_ID=c.AD_Column_ID)"
|
||||
+" WHERE f.isdisplayed='Y' AND f.isactive='Y' AND c.isactive='Y' AND f.AD_Tab_ID=?";
|
||||
col=DB.getSQLValue(null, sql, getAD_Tab_ID());
|
||||
|
||||
return col;
|
||||
public int getNumColumns() {
|
||||
int maxcol=0;
|
||||
for (GridField gridField : getFields())
|
||||
{
|
||||
if (!gridField.isDisplayed() || gridField.isToolbarButton())
|
||||
continue;
|
||||
int col = gridField.getXPosition() + gridField.getColumnSpan();
|
||||
if (gridField.isFieldOnly()
|
||||
|| gridField.getDisplayType() == DisplayType.Button
|
||||
|| gridField.getDisplayType() == DisplayType.YesNo) {
|
||||
col--;
|
||||
}
|
||||
if (col > maxcol) {
|
||||
maxcol = col;
|
||||
}
|
||||
}
|
||||
return maxcol;
|
||||
}
|
||||
|
||||
public boolean isNew() {
|
||||
|
|
|
@ -438,6 +438,30 @@ public class MLookupFactory
|
|||
if (!KeyColumn.endsWith("_ID"))
|
||||
realSQL.append("NULL,");
|
||||
|
||||
boolean showID = DisplayColumn.equals(TableName+"_ID");
|
||||
|
||||
ArrayList<LookupDisplayColumn> list = null;
|
||||
if (showID) {
|
||||
list = getListIdentifiers(TableName);
|
||||
// Do we have columns ?
|
||||
if (list == null || list.size() == 0)
|
||||
{
|
||||
if (s_log.isLoggable(Level.INFO))
|
||||
{
|
||||
s_log.log(Level.INFO, "No Identifier records found: " + KeyColumn);
|
||||
}
|
||||
list.add(new LookupDisplayColumn(KeyColumn, null, false, DisplayType.ID, 0));
|
||||
}
|
||||
// set isTranslated
|
||||
IsTranslated = false;
|
||||
for (LookupDisplayColumn ldc : list) {
|
||||
if (!IsTranslated && ldc.IsTranslated) {
|
||||
IsTranslated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Translated
|
||||
if (IsTranslated && !Env.isBaseLanguage(language, TableName))
|
||||
{
|
||||
|
@ -448,8 +472,14 @@ public class MLookupFactory
|
|||
realSQL.append("NVL(").append(TableName).append(".Value,'-1') || '-' || ");
|
||||
if (displayColumnSQL != null && displayColumnSQL.trim().length() > 0)
|
||||
realSQL.append("NVL(").append(displayColumnSQL).append(",'-1')");
|
||||
else
|
||||
else {
|
||||
if (showID) {
|
||||
StringBuilder displayColumn = getDisplayColumn(language, TableName, list);
|
||||
realSQL.append(displayColumn);
|
||||
} else {
|
||||
realSQL.append("NVL(").append(TableName).append("_Trl.").append(DisplayColumn).append(",'-1')");
|
||||
}
|
||||
}
|
||||
realSQL.append(",").append(TableName).append(".IsActive");
|
||||
realSQL.append(" FROM ").append(TableName)
|
||||
.append(" INNER JOIN ").append(TableName).append("_TRL ON (")
|
||||
|
@ -468,8 +498,14 @@ public class MLookupFactory
|
|||
realSQL.append("NVL(").append(TableName).append(".Value,'-1') || '-' || ");
|
||||
if (displayColumnSQL != null && displayColumnSQL.trim().length() > 0)
|
||||
realSQL.append("NVL(").append(displayColumnSQL).append(",'-1')");
|
||||
else
|
||||
else {
|
||||
if (showID) {
|
||||
StringBuilder displayColumn = getDisplayColumn(language, TableName, list);
|
||||
realSQL.append(displayColumn);
|
||||
} else {
|
||||
realSQL.append("NVL(").append(TableName).append(".").append(DisplayColumn).append(",'-1')");
|
||||
}
|
||||
}
|
||||
realSQL.append(",").append(TableName).append(".IsActive");
|
||||
realSQL.append(" FROM ").append(TableName);
|
||||
}
|
||||
|
@ -654,54 +690,10 @@ public class MLookupFactory
|
|||
if (s_cacheRefTable.containsKey(cacheKey))
|
||||
return s_cacheRefTable.get(cacheKey).cloneIt();
|
||||
|
||||
// get display column names
|
||||
String sql0 = "SELECT c.ColumnName,c.IsTranslated,c.AD_Reference_ID,"
|
||||
+ "c.AD_Reference_Value_ID,t.AD_Window_ID,t.PO_Window_ID "
|
||||
+ ", c.ColumnSQL " // 7
|
||||
+ "FROM AD_Table t"
|
||||
+ " INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) "
|
||||
+ "WHERE TableName=?"
|
||||
+ " AND c.IsIdentifier='Y' "
|
||||
+ "ORDER BY c.SeqNo";
|
||||
//
|
||||
ArrayList<LookupDisplayColumn> list = new ArrayList<LookupDisplayColumn>();
|
||||
boolean isTranslated = false;
|
||||
//
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql0, null);
|
||||
pstmt.setString(1, TableName);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
LookupDisplayColumn ldc = new LookupDisplayColumn (rs.getString(1),
|
||||
rs.getString(7), // ColumnSQL
|
||||
"Y".equals(rs.getString(2)), rs.getInt(3), rs.getInt(4));
|
||||
list.add (ldc);
|
||||
// s_log.fine("getLookup_TableDir: " + ColumnName + " - " + ldc);
|
||||
//
|
||||
if (!isTranslated && ldc.IsTranslated)
|
||||
isTranslated = true;
|
||||
ZoomWindow = rs.getInt(5);
|
||||
ZoomWindowPO = rs.getInt(6);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql0, e);
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
ArrayList<LookupDisplayColumn> list = getListIdentifiers(TableName);
|
||||
|
||||
// Do we have columns ?
|
||||
if (list.size() == 0)
|
||||
if (list == null || list.size() == 0)
|
||||
{
|
||||
if (s_log.isLoggable(Level.INFO))
|
||||
{
|
||||
|
@ -710,69 +702,23 @@ public class MLookupFactory
|
|||
list.add(new LookupDisplayColumn(KeyColumn, null, false, DisplayType.ID, 0));
|
||||
}
|
||||
|
||||
// set isTranslated
|
||||
boolean isTranslated = false;
|
||||
for (LookupDisplayColumn ldc : list) {
|
||||
if (!isTranslated && ldc.IsTranslated) {
|
||||
isTranslated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MTable table = MTable.get(ctx, TableName);
|
||||
ZoomWindow = table.getAD_Window_ID();
|
||||
ZoomWindowPO = table.getPO_Window_ID();
|
||||
|
||||
StringBuilder realSQL = new StringBuilder("SELECT ");
|
||||
realSQL.append(TableName).append(".").append(KeyColumn).append(",NULL,");
|
||||
|
||||
StringBuilder displayColumn = new StringBuilder();
|
||||
int size = list.size();
|
||||
// Get Display Column
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
displayColumn.append(" ||'_'|| " );
|
||||
LookupDisplayColumn ldc = (LookupDisplayColumn)list.get(i);
|
||||
StringBuilder msg = new StringBuilder().append(TableName).append(".").append(ldc.ColumnName);
|
||||
String columnSQL = ldc.IsVirtual ? ldc.ColumnSQL : msg.toString();
|
||||
|
||||
displayColumn.append("NVL(");
|
||||
|
||||
// translated
|
||||
if (ldc.IsTranslated && !Env.isBaseLanguage(language, TableName) && !ldc.IsVirtual)
|
||||
{
|
||||
displayColumn.append(TableName).append("_Trl.").append(ldc.ColumnName);
|
||||
}
|
||||
// date
|
||||
else if (DisplayType.isDate(ldc.DisplayType))
|
||||
{
|
||||
displayColumn.append(DB.TO_CHAR(columnSQL, ldc.DisplayType, language.getAD_Language()));
|
||||
}
|
||||
// Table
|
||||
else if ((ldc.DisplayType == DisplayType.Table || ldc.DisplayType == DisplayType.Search) && ldc.AD_Reference_ID != 0)
|
||||
{
|
||||
String embeddedSQL;
|
||||
if (ldc.IsVirtual)
|
||||
embeddedSQL = getLookup_TableEmbed (language, ldc.ColumnSQL, TableName, ldc.AD_Reference_ID);
|
||||
else
|
||||
embeddedSQL = getLookup_TableEmbed (language, ldc.ColumnName, TableName, ldc.AD_Reference_ID);
|
||||
if (embeddedSQL != null)
|
||||
displayColumn.append("(").append(embeddedSQL).append(")");
|
||||
}
|
||||
// TableDir
|
||||
else if ((ldc.DisplayType == DisplayType.TableDir || ldc.DisplayType == DisplayType.Search)
|
||||
&& ldc.ColumnName.endsWith("_ID"))
|
||||
{
|
||||
String embeddedSQL;
|
||||
if (ldc.IsVirtual)
|
||||
embeddedSQL = getLookup_TableDirEmbed(language, ldc.ColumnName, TableName, ldc.ColumnSQL);
|
||||
else
|
||||
embeddedSQL = getLookup_TableDirEmbed(language, ldc.ColumnName, TableName);
|
||||
if (embeddedSQL != null)
|
||||
displayColumn.append("(").append(embeddedSQL).append(")");
|
||||
}
|
||||
// number
|
||||
else if (DisplayType.isNumeric(ldc.DisplayType))
|
||||
{
|
||||
displayColumn.append(DB.TO_CHAR(columnSQL, ldc.DisplayType, language.getAD_Language()));
|
||||
}
|
||||
// String
|
||||
else
|
||||
{
|
||||
displayColumn.append(columnSQL);
|
||||
}
|
||||
|
||||
displayColumn.append(",'-1')");
|
||||
|
||||
}
|
||||
StringBuilder displayColumn = getDisplayColumn(language, TableName, list);
|
||||
realSQL.append(displayColumn.toString());
|
||||
realSQL.append(",").append(TableName).append(".IsActive");
|
||||
|
||||
|
@ -804,6 +750,69 @@ public class MLookupFactory
|
|||
return lInfo;
|
||||
} // getLookup_TableDir
|
||||
|
||||
private static StringBuilder getDisplayColumn(Language language, String TableName, ArrayList<LookupDisplayColumn> list) {
|
||||
StringBuilder displayColumn = new StringBuilder();
|
||||
int size = list.size();
|
||||
// Get Display Column
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
displayColumn.append(" ||'_'|| " );
|
||||
LookupDisplayColumn ldc = (LookupDisplayColumn)list.get(i);
|
||||
StringBuilder msg = new StringBuilder().append(TableName).append(".").append(ldc.ColumnName);
|
||||
String columnSQL = ldc.IsVirtual ? ldc.ColumnSQL : msg.toString();
|
||||
|
||||
displayColumn.append("NVL(");
|
||||
|
||||
// translated
|
||||
if (ldc.IsTranslated && !Env.isBaseLanguage(language, TableName) && !ldc.IsVirtual)
|
||||
{
|
||||
displayColumn.append(TableName).append("_Trl.").append(ldc.ColumnName);
|
||||
}
|
||||
// date, number
|
||||
else if (DisplayType.isDate(ldc.DisplayType) || DisplayType.isNumeric(ldc.DisplayType))
|
||||
{
|
||||
displayColumn.append(DB.TO_CHAR(columnSQL, ldc.DisplayType, language.getAD_Language()));
|
||||
}
|
||||
// Table
|
||||
else if ((ldc.DisplayType == DisplayType.Table || ldc.DisplayType == DisplayType.Search) && ldc.AD_Reference_ID != 0)
|
||||
{
|
||||
String embeddedSQL;
|
||||
if (ldc.IsVirtual)
|
||||
embeddedSQL = getLookup_TableEmbed (language, ldc.ColumnSQL, TableName, ldc.AD_Reference_ID);
|
||||
else
|
||||
embeddedSQL = getLookup_TableEmbed (language, ldc.ColumnName, TableName, ldc.AD_Reference_ID);
|
||||
if (embeddedSQL != null)
|
||||
displayColumn.append("(").append(embeddedSQL).append(")");
|
||||
}
|
||||
// TableDir
|
||||
else if ((ldc.DisplayType == DisplayType.TableDir || ldc.DisplayType == DisplayType.Search)
|
||||
&& ldc.ColumnName.endsWith("_ID"))
|
||||
{
|
||||
String embeddedSQL;
|
||||
if (ldc.IsVirtual)
|
||||
embeddedSQL = getLookup_TableDirEmbed(language, ldc.ColumnName, TableName, ldc.ColumnSQL);
|
||||
else
|
||||
embeddedSQL = getLookup_TableDirEmbed(language, ldc.ColumnName, TableName);
|
||||
if (embeddedSQL != null)
|
||||
displayColumn.append("(").append(embeddedSQL).append(")");
|
||||
}
|
||||
// ID
|
||||
else if (DisplayType.isID(ldc.DisplayType))
|
||||
{
|
||||
displayColumn.append(DB.TO_CHAR(columnSQL, ldc.DisplayType, language.getAD_Language()));
|
||||
}
|
||||
// String
|
||||
else
|
||||
{
|
||||
displayColumn.append(columnSQL);
|
||||
}
|
||||
|
||||
displayColumn.append(",'-1')");
|
||||
|
||||
}
|
||||
return displayColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get embedded SQL for TableDir Lookup
|
||||
|
@ -834,106 +843,29 @@ public class MLookupFactory
|
|||
String KeyColumn = MQuery.getZoomColumnName(ColumnName);
|
||||
String TableName = MQuery.getZoomTableName(ColumnName);
|
||||
|
||||
// get display column name (first identifier column)
|
||||
String sql = "SELECT c.ColumnName,c.IsTranslated,c.AD_Reference_ID,c.AD_Reference_Value_ID "
|
||||
+ ", c.ColumnSQL " // 5
|
||||
+ "FROM AD_Table t INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) "
|
||||
+ "WHERE TableName=?"
|
||||
+ " AND c.IsIdentifier='Y' "
|
||||
+ "ORDER BY c.SeqNo";
|
||||
//
|
||||
ArrayList<LookupDisplayColumn> list = new ArrayList<LookupDisplayColumn>();
|
||||
boolean isTranslated = false;
|
||||
//
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setString(1, TableName);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
LookupDisplayColumn ldc = new LookupDisplayColumn (rs.getString(1),
|
||||
rs.getString(5),
|
||||
"Y".equals(rs.getString(2)), rs.getInt(3), rs.getInt(4));
|
||||
list.add (ldc);
|
||||
// s_log.fine("getLookup_TableDirEmbed: " + ColumnName + " - " + ldc);
|
||||
//
|
||||
if (!isTranslated && ldc.IsTranslated)
|
||||
isTranslated = true;
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
return "";
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
ArrayList<LookupDisplayColumn> list = getListIdentifiers(TableName);
|
||||
|
||||
// Do we have columns ?
|
||||
if (list.size() == 0)
|
||||
if (list == null || list.size() == 0)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "No Identifier records found: " + ColumnName);
|
||||
return "";
|
||||
}
|
||||
|
||||
// set isTranslated
|
||||
boolean isTranslated = false;
|
||||
for (LookupDisplayColumn ldc : list) {
|
||||
if (!isTranslated && ldc.IsTranslated) {
|
||||
isTranslated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
StringBuilder embedSQL = new StringBuilder("SELECT ");
|
||||
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
embedSQL.append("||' - '||" );
|
||||
LookupDisplayColumn ldc = (LookupDisplayColumn)list.get(i);
|
||||
StringBuilder msg = new StringBuilder().append(TableName).append(".").append(ldc.ColumnName);
|
||||
String columnSQL = ldc.IsVirtual ? ldc.ColumnSQL : msg.toString();
|
||||
|
||||
// translated
|
||||
if (ldc.IsTranslated && !Env.isBaseLanguage(language, TableName) && !ldc.IsVirtual)
|
||||
{
|
||||
embedSQL.append(TableName).append("_Trl.").append(ldc.ColumnName);
|
||||
}
|
||||
// date, number
|
||||
else if (DisplayType.isDate(ldc.DisplayType) || DisplayType.isNumeric(ldc.DisplayType))
|
||||
{
|
||||
embedSQL.append("NVL(" + DB.TO_CHAR(columnSQL, ldc.DisplayType, language.getAD_Language()) + ",'')");
|
||||
}
|
||||
// TableDir
|
||||
else if ((ldc.DisplayType == DisplayType.TableDir || ldc.DisplayType == DisplayType.Search)
|
||||
&& ldc.ColumnName.endsWith("_ID"))
|
||||
{
|
||||
String embeddedSQL;
|
||||
if (ldc.IsVirtual)
|
||||
embeddedSQL = getLookup_TableDirEmbed(language, ldc.ColumnName, TableName, ldc.ColumnSQL);
|
||||
else
|
||||
embeddedSQL = getLookup_TableDirEmbed(language, ldc.ColumnName, TableName);
|
||||
embedSQL.append("NVL((").append(embeddedSQL).append("),'')");
|
||||
}
|
||||
// Table - teo_sarca [ 1714261 ]
|
||||
else if (ldc.DisplayType == DisplayType.Table && ldc.AD_Reference_ID != 0)
|
||||
{
|
||||
String embeddedSQL = getLookup_TableEmbed (language, ldc.ColumnName, TableName, ldc.AD_Reference_ID);
|
||||
embedSQL.append("NVL((").append(embeddedSQL).append("),'')");
|
||||
}
|
||||
// ID
|
||||
else if (DisplayType.isID(ldc.DisplayType))
|
||||
{
|
||||
embedSQL.append("NVL(" + DB.TO_CHAR(columnSQL, ldc.DisplayType, language.getAD_Language()) + ",'')");
|
||||
}
|
||||
// String
|
||||
else
|
||||
{
|
||||
embedSQL.append("NVL(").append(columnSQL).append(",'')");
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder displayColumn = getDisplayColumn(language, TableName, list);
|
||||
embedSQL.append(displayColumn.toString());
|
||||
embedSQL.append(" FROM ").append(TableName);
|
||||
// Translation
|
||||
if (isTranslated && !Env.isBaseLanguage(language, TableName))
|
||||
|
@ -957,5 +889,45 @@ public class MLookupFactory
|
|||
return embedSQL.toString();
|
||||
} // getLookup_TableDirEmbed
|
||||
|
||||
private static ArrayList<LookupDisplayColumn> getListIdentifiers(String TableName) {
|
||||
// get display column name (first identifier column)
|
||||
String sql = "SELECT c.ColumnName,c.IsTranslated,c.AD_Reference_ID,c.AD_Reference_Value_ID "
|
||||
+ ", c.ColumnSQL " // 5
|
||||
+ "FROM AD_Table t INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) "
|
||||
+ "WHERE TableName=?"
|
||||
+ " AND c.IsIdentifier='Y' "
|
||||
+ "ORDER BY c.SeqNo";
|
||||
//
|
||||
ArrayList<LookupDisplayColumn> list = new ArrayList<LookupDisplayColumn>();
|
||||
//
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setString(1, TableName);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
LookupDisplayColumn ldc = new LookupDisplayColumn (rs.getString(1),
|
||||
rs.getString(5),
|
||||
"Y".equals(rs.getString(2)), rs.getInt(3), rs.getInt(4));
|
||||
list.add (ldc);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
} // MLookupFactory
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ DataStatusListener, IADTabpanel
|
|||
|
||||
uiCreated = true;
|
||||
|
||||
int numCols=gridTab.getColumns();
|
||||
int numCols=gridTab.getNumColumns();
|
||||
if (numCols <= 0) {
|
||||
numCols=4;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ import org.compiere.model.MField;
|
|||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.X_AD_FieldGroup;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
@ -181,7 +180,7 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
|||
form.setHeight(null);
|
||||
form.setVflex(false);
|
||||
|
||||
int numCols = getMaxColumns(getMTab().getAD_Tab_ID());
|
||||
int numCols = getNumColumns();
|
||||
if (numCols <= 0) {
|
||||
numCols=4;
|
||||
}
|
||||
|
@ -201,19 +200,15 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
|||
Rows rows = form.newRows();
|
||||
Row row = new Row();
|
||||
int actualxpos = 0;
|
||||
|
||||
int lastseq = 0;
|
||||
String currentFieldGroup = null;
|
||||
for (GridField gridField : getGridFields())
|
||||
{
|
||||
MField field = getMField(gridField.getAD_Field_ID());
|
||||
|
||||
if (!gridField.isDisplayed())
|
||||
if (!gridField.isDisplayed() || gridField.isToolbarButton())
|
||||
continue;
|
||||
|
||||
if (gridField.isToolbarButton()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// field group
|
||||
String fieldGroup = gridField.getFieldGroup();
|
||||
if (!Util.isEmpty(fieldGroup) && !fieldGroup.equals(currentFieldGroup)) // group changed
|
||||
|
@ -331,10 +326,14 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
|||
row.appendCellChild(div);
|
||||
setLastCellProps(row.getLastCell(), gridField);
|
||||
}
|
||||
lastseq = field.getSeqNo();
|
||||
}
|
||||
|
||||
if (numCols - actualxpos + 1 > 0)
|
||||
if (numCols - actualxpos + 1 > 0){
|
||||
row.appendCellChild(createSpacer(), numCols - actualxpos + 1);
|
||||
// make last empty space droppable
|
||||
setLastCellProps(row.getLastCell(), actualxpos, lastseq + 10);
|
||||
}
|
||||
row.setGroup(currentGroup);
|
||||
rows.appendChild(row);
|
||||
if (rowList != null)
|
||||
|
@ -361,15 +360,23 @@ public class WTabEditor extends TabEditor implements IFormController, EventListe
|
|||
return new Space();
|
||||
}
|
||||
|
||||
private int getMaxColumns(int ad_Tab_ID) {
|
||||
int col=0;
|
||||
|
||||
String sql="SELECT MAX(f.XPosition+f.ColumnSpan-case when f.isfieldonly='Y' OR c.ad_reference_id in (20/*yesno*/,28/*button*/) then 1 else 0 end)"
|
||||
+" FROM AD_Field f JOIN AD_Column c ON (f.AD_Column_ID=c.AD_Column_ID)"
|
||||
+" WHERE f.isdisplayed='Y' AND f.isactive='Y' AND c.isactive='Y' AND f.AD_Tab_ID=?";
|
||||
col = DB.getSQLValue(null, sql, ad_Tab_ID);
|
||||
|
||||
return col;
|
||||
private int getNumColumns() {
|
||||
int maxcol=0;
|
||||
for (GridField gridField : getGridFields())
|
||||
{
|
||||
if (!gridField.isDisplayed() || gridField.isToolbarButton())
|
||||
continue;
|
||||
int col = gridField.getXPosition() + gridField.getColumnSpan();
|
||||
if (gridField.isFieldOnly()
|
||||
|| (gridField.getDisplayType() == DisplayType.Button && !gridField.isToolbarButton())
|
||||
|| gridField.getDisplayType() == DisplayType.YesNo) {
|
||||
col--;
|
||||
}
|
||||
if (col > maxcol) {
|
||||
maxcol = col;
|
||||
}
|
||||
}
|
||||
return maxcol;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -563,7 +563,7 @@ public class CustomizeGridViewPanel extends Panel
|
|||
//
|
||||
if(ok) {
|
||||
m_saved = true;
|
||||
FDialog.info(m_WindowNo, null, "Saved");
|
||||
// FDialog.info(m_WindowNo, null, "Saved");
|
||||
getParent().detach();
|
||||
if(gridPanel!=null){
|
||||
gridPanel.reInit();
|
||||
|
|
Loading…
Reference in New Issue