Merge 3ec3918730fd
This commit is contained in:
commit
1a096ff10a
|
@ -0,0 +1,12 @@
|
||||||
|
-- Dec 27, 2012 6:53:37 PM SGT
|
||||||
|
-- Ticket 1001758: FedEx & UPS
|
||||||
|
UPDATE AD_Process SET Description='Create Package for Shipment',Updated=TO_DATE('2012-12-27 18:53:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=282
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 27, 2012 6:53:37 PM SGT
|
||||||
|
-- Ticket 1001758: FedEx & UPS
|
||||||
|
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=282
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201212271855_TICKET-1001758.sql') FROM dual
|
||||||
|
;
|
|
@ -0,0 +1,12 @@
|
||||||
|
-- Dec 27, 2012 6:53:37 PM SGT
|
||||||
|
-- Ticket 1001758: FedEx & UPS
|
||||||
|
UPDATE AD_Process SET Description='Create Package for Shipment',Updated=TO_TIMESTAMP('2012-12-27 18:53:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=282
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Dec 27, 2012 6:53:37 PM SGT
|
||||||
|
-- Ticket 1001758: FedEx & UPS
|
||||||
|
UPDATE AD_Process_Trl SET IsTranslated='N' WHERE AD_Process_ID=282
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201212271855_TICKET-1001758.sql') FROM dual
|
||||||
|
;
|
|
@ -66,8 +66,6 @@ public class GridFieldVO implements Serializable
|
||||||
return sql.toString();
|
return sql.toString();
|
||||||
} // getSQL
|
} // getSQL
|
||||||
|
|
||||||
public String InfoFactoryClass = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Field Value Object
|
* Create Field Value Object
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
@ -185,9 +183,6 @@ public class GridFieldVO implements Serializable
|
||||||
// Collapse Default State
|
// Collapse Default State
|
||||||
else if (columnName.equalsIgnoreCase("IsCollapsedByDefault"))
|
else if (columnName.equalsIgnoreCase("IsCollapsedByDefault"))
|
||||||
vo.IsCollapsedByDefault = "Y".equals(rs.getString(i));
|
vo.IsCollapsedByDefault = "Y".equals(rs.getString(i));
|
||||||
//Info Factory class
|
|
||||||
else if (columnName.equalsIgnoreCase("InfoFactoryClass"))
|
|
||||||
vo.InfoFactoryClass = rs.getString(i);
|
|
||||||
// Feature Request FR [ 2003044 ]
|
// Feature Request FR [ 2003044 ]
|
||||||
else if (columnName.equalsIgnoreCase("IsAutocomplete"))
|
else if (columnName.equalsIgnoreCase("IsAutocomplete"))
|
||||||
vo.IsAutocomplete = "Y".equals(rs.getString(i));
|
vo.IsAutocomplete = "Y".equals(rs.getString(i));
|
||||||
|
@ -639,8 +634,6 @@ public class GridFieldVO implements Serializable
|
||||||
IsParent, ValidationCode);
|
IsParent, ValidationCode);
|
||||||
if (lookupInfo == null)
|
if (lookupInfo == null)
|
||||||
displayType = DisplayType.ID;
|
displayType = DisplayType.ID;
|
||||||
else
|
|
||||||
lookupInfo.InfoFactoryClass = this.InfoFactoryClass;
|
|
||||||
}
|
}
|
||||||
catch (Exception e) // Cannot create Lookup
|
catch (Exception e) // Cannot create Lookup
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,9 @@ package org.compiere.model;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.compiere.model.AccessSqlParser.TableInfo;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Info Window Column Model
|
* Info Window Column Model
|
||||||
*
|
*
|
||||||
|
@ -53,5 +56,39 @@ public class MInfoColumn extends X_AD_InfoColumn
|
||||||
{
|
{
|
||||||
super (ctx, rs, trxName);
|
super (ctx, rs, trxName);
|
||||||
} // MInfoColumn
|
} // MInfoColumn
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check column read access
|
||||||
|
* @param tableInfos
|
||||||
|
* @return false if current role don't have read access to the column, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean isColumnAccess(TableInfo[] tableInfos)
|
||||||
|
{
|
||||||
|
int index = getSelectClause().indexOf(".");
|
||||||
|
if (index == getSelectClause().lastIndexOf("."))
|
||||||
|
{
|
||||||
|
String synonym = getSelectClause().substring(0, index);
|
||||||
|
String column = getSelectClause().substring(index+1);
|
||||||
|
for(TableInfo tableInfo : tableInfos)
|
||||||
|
{
|
||||||
|
if (tableInfo.getSynonym() != null && tableInfo.getSynonym().equals(synonym))
|
||||||
|
{
|
||||||
|
String tableName = tableInfo.getTableName();
|
||||||
|
MTable mTable = MTable.get(Env.getCtx(), tableName);
|
||||||
|
if (mTable != null)
|
||||||
|
{
|
||||||
|
MColumn mColumn = mTable.getColumn(column);
|
||||||
|
if (mColumn != null)
|
||||||
|
{
|
||||||
|
if (!MRole.getDefault().isColumnAccess(mTable.getAD_Table_ID(), mColumn.getAD_Column_ID(), true))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
} // MInfoColumn
|
} // MInfoColumn
|
||||||
|
|
|
@ -17,8 +17,12 @@
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.compiere.model.AccessSqlParser.TableInfo;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Info Window Model
|
* Info Window Model
|
||||||
*
|
*
|
||||||
|
@ -53,5 +57,49 @@ public class MInfoWindow extends X_AD_InfoWindow
|
||||||
{
|
{
|
||||||
super (ctx, rs, trxName);
|
super (ctx, rs, trxName);
|
||||||
} // MInfoWindow
|
} // MInfoWindow
|
||||||
|
|
||||||
|
public static MInfoWindow get(String tableName, String trxName) {
|
||||||
|
Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), I_AD_InfoWindow.Table_ID), I_AD_InfoWindow.COLUMNNAME_AD_Table_ID+"=?", null);
|
||||||
|
MTable table = MTable.get(Env.getCtx(), tableName);
|
||||||
|
if (table != null) {
|
||||||
|
return query.setParameters(table.getAD_Table_ID())
|
||||||
|
.setOrderBy("AD_Client_ID Desc, AD_Org_ID Desc, AD_InfoWidnow_ID Desc")
|
||||||
|
.setOnlyActiveRecords(true)
|
||||||
|
.setApplyAccessFilter(true)
|
||||||
|
.first();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MInfoColumn[] getInfoColumns(TableInfo[] tableInfos) {
|
||||||
|
Query query = new Query(getCtx(), MTable.get(getCtx(), I_AD_InfoColumn.Table_ID), I_AD_InfoColumn.COLUMNNAME_AD_InfoWindow_ID+"=?", get_TrxName());
|
||||||
|
List<MInfoColumn> list = query.setParameters(getAD_InfoWindow_ID())
|
||||||
|
.setOrderBy(I_AD_InfoColumn.COLUMNNAME_SeqNo)
|
||||||
|
.list();
|
||||||
|
for(int i = list.size() - 1; i >= 0; i--) {
|
||||||
|
MInfoColumn infoColumn = list.get(i);
|
||||||
|
if (!infoColumn.isColumnAccess(tableInfos))
|
||||||
|
list.remove(i);
|
||||||
|
}
|
||||||
|
return list.toArray(new MInfoColumn[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean beforeSave(boolean newRecord) {
|
||||||
|
String tableName = getAD_Table().getTableName();
|
||||||
|
AccessSqlParser parser = new AccessSqlParser("SELECT * FROM " + getFromClause());
|
||||||
|
TableInfo[] tableInfos = parser.getTableInfo(0);
|
||||||
|
if (tableInfos == null || tableInfos.length == 0) {
|
||||||
|
log.saveError("ParseFromClauseError", "Failed to parse from clause");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tableInfos[0].getTableName().equalsIgnoreCase(tableName)) {
|
||||||
|
log.saveError("TableNameDifferent", "Table name is different between from clause and info window definition.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // MInfoWindow
|
} // MInfoWindow
|
||||||
|
|
|
@ -464,6 +464,7 @@ public class MLookupFactory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String lookupDisplayColumn = null;
|
||||||
// Translated
|
// Translated
|
||||||
if (IsTranslated && !Env.isBaseLanguage(language, TableName))
|
if (IsTranslated && !Env.isBaseLanguage(language, TableName))
|
||||||
{
|
{
|
||||||
|
@ -477,8 +478,10 @@ public class MLookupFactory
|
||||||
else {
|
else {
|
||||||
if (showID) {
|
if (showID) {
|
||||||
StringBuilder displayColumn = getDisplayColumn(language, TableName, list);
|
StringBuilder displayColumn = getDisplayColumn(language, TableName, list);
|
||||||
|
lookupDisplayColumn = displayColumn.toString();
|
||||||
realSQL.append(displayColumn);
|
realSQL.append(displayColumn);
|
||||||
} else {
|
} else {
|
||||||
|
lookupDisplayColumn = DisplayColumn;
|
||||||
realSQL.append("NVL(").append(TableName).append("_Trl.").append(DisplayColumn).append(",'-1')");
|
realSQL.append("NVL(").append(TableName).append("_Trl.").append(DisplayColumn).append(",'-1')");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -503,8 +506,10 @@ public class MLookupFactory
|
||||||
else {
|
else {
|
||||||
if (showID) {
|
if (showID) {
|
||||||
StringBuilder displayColumn = getDisplayColumn(language, TableName, list);
|
StringBuilder displayColumn = getDisplayColumn(language, TableName, list);
|
||||||
|
lookupDisplayColumn = displayColumn.toString();
|
||||||
realSQL.append(displayColumn);
|
realSQL.append(displayColumn);
|
||||||
} else {
|
} else {
|
||||||
|
lookupDisplayColumn = DisplayColumn;
|
||||||
realSQL.append("NVL(").append(TableName).append(".").append(DisplayColumn).append(",'-1')");
|
realSQL.append("NVL(").append(TableName).append(".").append(DisplayColumn).append(",'-1')");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,6 +559,7 @@ public class MLookupFactory
|
||||||
StringBuilder msginf = new StringBuilder().append(TableName).append(".").append(KeyColumn);
|
StringBuilder msginf = new StringBuilder().append(TableName).append(".").append(KeyColumn);
|
||||||
retValue = new MLookupInfo (realSQL.toString(), TableName,
|
retValue = new MLookupInfo (realSQL.toString(), TableName,
|
||||||
msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery);
|
msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery);
|
||||||
|
retValue.DisplayColumn = lookupDisplayColumn;
|
||||||
s_cacheRefTable.put(key.toString(), retValue.cloneIt());
|
s_cacheRefTable.put(key.toString(), retValue.cloneIt());
|
||||||
return retValue;
|
return retValue;
|
||||||
} // getLookup_Table
|
} // getLookup_Table
|
||||||
|
@ -750,6 +756,7 @@ public class MLookupFactory
|
||||||
StringBuilder msginf = new StringBuilder().append(TableName).append(".").append(KeyColumn);
|
StringBuilder msginf = new StringBuilder().append(TableName).append(".").append(KeyColumn);
|
||||||
MLookupInfo lInfo = new MLookupInfo(realSQL.toString(), TableName,
|
MLookupInfo lInfo = new MLookupInfo(realSQL.toString(), TableName,
|
||||||
msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery);
|
msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery);
|
||||||
|
lInfo.DisplayColumn = displayColumn.toString();
|
||||||
s_cacheRefTable.put(cacheKey.toString(), lInfo.cloneIt());
|
s_cacheRefTable.put(cacheKey.toString(), lInfo.cloneIt());
|
||||||
return lInfo;
|
return lInfo;
|
||||||
} // getLookup_TableDir
|
} // getLookup_TableDir
|
||||||
|
|
|
@ -192,6 +192,8 @@ public class MLookupInfo implements Serializable, Cloneable
|
||||||
|
|
||||||
public String InfoFactoryClass = null;
|
public String InfoFactoryClass = null;
|
||||||
|
|
||||||
|
public String DisplayColumn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String representation
|
* String representation
|
||||||
* @return info
|
* @return info
|
||||||
|
|
|
@ -482,7 +482,7 @@ public class MPackage extends X_M_Package
|
||||||
st.setAction(action);
|
st.setAction(action);
|
||||||
st.setAD_Client_ID(getAD_Client_ID());
|
st.setAD_Client_ID(getAD_Client_ID());
|
||||||
st.setAD_Org_ID(getAD_Org_ID());
|
st.setAD_Org_ID(getAD_Org_ID());
|
||||||
st.setAD_User_ID(ioOut.getAD_User_ID());
|
st.setAD_User_ID(ioOut.getAD_User_ID() > 0 ? ioOut.getAD_User_ID() : order.getAD_User_ID());
|
||||||
st.setBill_Location_ID(getC_BPartner_Location_ID());
|
st.setBill_Location_ID(getC_BPartner_Location_ID());
|
||||||
st.setBoxCount(getBoxCount());
|
st.setBoxCount(getBoxCount());
|
||||||
st.setC_BP_ShippingAcct_ID(getC_BP_ShippingAcct_ID());
|
st.setC_BP_ShippingAcct_ID(getC_BP_ShippingAcct_ID());
|
||||||
|
|
|
@ -482,7 +482,6 @@ public final class Find extends CDialog
|
||||||
ynvo.lookupInfo = MLookupFactory.getLookupInfo (ynvo.ctx, ynvo.WindowNo, ynvo.AD_Column_ID, ynvo.displayType,
|
ynvo.lookupInfo = MLookupFactory.getLookupInfo (ynvo.ctx, ynvo.WindowNo, ynvo.AD_Column_ID, ynvo.displayType,
|
||||||
Env.getLanguage(ynvo.ctx), ynvo.ColumnName, ynvo.AD_Reference_Value_ID,
|
Env.getLanguage(ynvo.ctx), ynvo.ColumnName, ynvo.AD_Reference_Value_ID,
|
||||||
ynvo.IsParent, ynvo.ValidationCode);
|
ynvo.IsParent, ynvo.ValidationCode);
|
||||||
ynvo.lookupInfo.InfoFactoryClass = ynvo.InfoFactoryClass;
|
|
||||||
|
|
||||||
GridField ynfield = new GridField(ynvo);
|
GridField ynfield = new GridField(ynvo);
|
||||||
|
|
||||||
|
@ -504,7 +503,6 @@ public final class Find extends CDialog
|
||||||
postedvo.lookupInfo = MLookupFactory.getLookupInfo (postedvo.ctx, postedvo.WindowNo, postedvo.AD_Column_ID, postedvo.displayType,
|
postedvo.lookupInfo = MLookupFactory.getLookupInfo (postedvo.ctx, postedvo.WindowNo, postedvo.AD_Column_ID, postedvo.displayType,
|
||||||
Env.getLanguage(postedvo.ctx), postedvo.ColumnName, postedvo.AD_Reference_Value_ID,
|
Env.getLanguage(postedvo.ctx), postedvo.ColumnName, postedvo.AD_Reference_Value_ID,
|
||||||
postedvo.IsParent, postedvo.ValidationCode);
|
postedvo.IsParent, postedvo.ValidationCode);
|
||||||
postedvo.lookupInfo.InfoFactoryClass = postedvo.InfoFactoryClass;
|
|
||||||
|
|
||||||
GridField postedfield = new GridField(postedvo);
|
GridField postedfield = new GridField(postedvo);
|
||||||
|
|
||||||
|
|
|
@ -763,7 +763,33 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
|
||||||
return null;
|
return null;
|
||||||
} // getSelectedRowKey
|
} // getSelectedRowKey
|
||||||
|
|
||||||
|
public Integer getFirstRowKey()
|
||||||
|
{
|
||||||
|
if (m_layout == null)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Layout not defined");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getRowCount() <= 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object data = getModel().getDataAt(0, m_keyColumnIndex);
|
||||||
|
|
||||||
|
if (data instanceof IDColumn)
|
||||||
|
{
|
||||||
|
data = ((IDColumn)data).getRecord_ID();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data instanceof Integer)
|
||||||
|
{
|
||||||
|
return (Integer)data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the index of the first selected row, -1 if no row is selected.
|
* Returns the index of the first selected row, -1 if no row is selected.
|
||||||
*
|
*
|
||||||
|
|
|
@ -47,7 +47,6 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
@ -322,10 +321,11 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
actionButton(text);
|
actionButton(text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
text = text.toUpperCase();
|
// text = text.toUpperCase();
|
||||||
log.config(getColumnName() + " - " + text);
|
log.config(getColumnName() + " - " + text);
|
||||||
|
|
||||||
// Exact first
|
// Exact first
|
||||||
|
/*
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
String finalSQL = Msg.parseTranslation(Env.getCtx(), getDirectAccessSQL(text));
|
String finalSQL = Msg.parseTranslation(Env.getCtx(), getDirectAccessSQL(text));
|
||||||
int id = -3;
|
int id = -3;
|
||||||
|
@ -383,17 +383,31 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
int id = -3;
|
||||||
|
final InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, getComponent().getText(), false, getWhereClause());
|
||||||
|
if (ip != null && ip.loadedOK() && ip.getRowCount() == 1)
|
||||||
|
{
|
||||||
|
Integer key = ip.getFirstRowKey();
|
||||||
|
if (key != null && key.intValue() > 0)
|
||||||
|
{
|
||||||
|
id = key.intValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// No (unique) result
|
// No (unique) result
|
||||||
if (id <= 0)
|
if (id <= 0)
|
||||||
{
|
{
|
||||||
if (id == -3)
|
|
||||||
log.fine(getColumnName() + " - Not Found - " + finalSQL);
|
|
||||||
else
|
|
||||||
log.fine(getColumnName() + " - Not Unique - " + finalSQL);
|
|
||||||
|
|
||||||
//m_value = null; // force re-display
|
//m_value = null; // force re-display
|
||||||
actionButton(getComponent().getText());
|
if (ip != null && ip.loadedOK())
|
||||||
|
{
|
||||||
|
showInfoPanel(ip);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
actionButton(getComponent().getText());
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.fine(getColumnName() + " - Unique ID=" + id);
|
log.fine(getColumnName() + " - Unique ID=" + id);
|
||||||
|
@ -512,6 +526,11 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
getDirectAccessSQL("*");
|
getDirectAccessSQL("*");
|
||||||
|
|
||||||
final InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, queryValue, false, whereClause);
|
final InfoPanel ip = InfoManager.create(lookup, gridField, m_tableName, m_keyColumnName, queryValue, false, whereClause);
|
||||||
|
showInfoPanel(ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void showInfoPanel(final InfoPanel ip) {
|
||||||
ip.setVisible(true);
|
ip.setVisible(true);
|
||||||
ip.setStyle("border: 2px");
|
ip.setStyle("border: 2px");
|
||||||
ip.setClosable(true);
|
ip.setClosable(true);
|
||||||
|
@ -566,6 +585,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
m_tableName = m_columnName.substring(0, m_columnName.length()-3);
|
m_tableName = m_columnName.substring(0, m_columnName.length()-3);
|
||||||
m_keyColumnName = m_columnName;
|
m_keyColumnName = m_columnName;
|
||||||
|
|
||||||
|
//TODO: check info window definition
|
||||||
if (m_columnName.equals("M_Product_ID"))
|
if (m_columnName.equals("M_Product_ID"))
|
||||||
{
|
{
|
||||||
// Reset
|
// Reset
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.webui.factory;
|
package org.adempiere.webui.factory;
|
||||||
|
|
||||||
|
import org.adempiere.webui.info.InfoWindow;
|
||||||
import org.adempiere.webui.panel.InfoAssetPanel;
|
import org.adempiere.webui.panel.InfoAssetPanel;
|
||||||
import org.adempiere.webui.panel.InfoAssignmentPanel;
|
import org.adempiere.webui.panel.InfoAssignmentPanel;
|
||||||
import org.adempiere.webui.panel.InfoBPartnerPanel;
|
import org.adempiere.webui.panel.InfoBPartnerPanel;
|
||||||
|
@ -40,6 +41,7 @@ public class DefaultInfoFactory implements IInfoFactory {
|
||||||
String value, boolean multiSelection, String whereClause, boolean lookup) {
|
String value, boolean multiSelection, String whereClause, boolean lookup) {
|
||||||
InfoPanel info = null;
|
InfoPanel info = null;
|
||||||
|
|
||||||
|
//TODO: info window for c_bpartner, m_product, c_invoice, a_asset, c_order, m_inout, c_payment and resource
|
||||||
if (tableName.equals("C_BPartner"))
|
if (tableName.equals("C_BPartner"))
|
||||||
info = new InfoBPartnerPanel (value,WindowNo, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),
|
info = new InfoBPartnerPanel (value,WindowNo, !Env.getContext(Env.getCtx(),"IsSOTrx").equals("N"),
|
||||||
multiSelection, whereClause, lookup);
|
multiSelection, whereClause, lookup);
|
||||||
|
@ -68,10 +70,14 @@ public class DefaultInfoFactory implements IInfoFactory {
|
||||||
else if (tableName.equals("S_ResourceAssigment"))
|
else if (tableName.equals("S_ResourceAssigment"))
|
||||||
info = new InfoAssignmentPanel (WindowNo, value,
|
info = new InfoAssignmentPanel (WindowNo, value,
|
||||||
multiSelection, whereClause, lookup);
|
multiSelection, whereClause, lookup);
|
||||||
else
|
else {
|
||||||
info = new InfoGeneralPanel (value, WindowNo,
|
// info = new InfoWindow(WindowNo, tableName, keyColumn, value, multiSelection, whereClause, lookup);
|
||||||
tableName, keyColumn,
|
// if (!((InfoWindow)info).loadedOK()) {
|
||||||
multiSelection, whereClause, lookup);
|
info = new InfoGeneralPanel (value, WindowNo,
|
||||||
|
tableName, keyColumn,
|
||||||
|
multiSelection, whereClause, lookup);
|
||||||
|
// }
|
||||||
|
}
|
||||||
//
|
//
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
@ -87,6 +93,12 @@ public class DefaultInfoFactory implements IInfoFactory {
|
||||||
col = col.substring(col.indexOf('.')+1);
|
col = col.substring(col.indexOf('.')+1);
|
||||||
if (col.equals("M_Product_ID"))
|
if (col.equals("M_Product_ID"))
|
||||||
{
|
{
|
||||||
|
//TODO: Product info window
|
||||||
|
/*
|
||||||
|
InfoWindow infoWindow = new InfoWindow(lookup.getWindowNo(), tableName, keyColumn, value, multiSelection, whereClause);
|
||||||
|
if (infoWindow.loadedOk())
|
||||||
|
return infoWindow;
|
||||||
|
*/
|
||||||
// Reset
|
// Reset
|
||||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_Product_ID", "0");
|
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_Product_ID", "0");
|
||||||
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_AttributeSetInstance_ID", "0");
|
Env.setContext(Env.getCtx(), lookup.getWindowNo(), Env.TAB_INFO, "M_AttributeSetInstance_ID", "0");
|
||||||
|
@ -103,6 +115,12 @@ public class DefaultInfoFactory implements IInfoFactory {
|
||||||
}
|
}
|
||||||
else if (col.equals("C_BPartner_ID"))
|
else if (col.equals("C_BPartner_ID"))
|
||||||
{
|
{
|
||||||
|
//TODO: BPartner info window
|
||||||
|
/*
|
||||||
|
InfoWindow infoWindow = new InfoWindow(lookup.getWindowNo(), tableName, keyColumn, multiSelection, whereClause);
|
||||||
|
if (infoWindow.isValid())
|
||||||
|
return infoWindow;
|
||||||
|
*/
|
||||||
boolean isSOTrx = true; // default
|
boolean isSOTrx = true; // default
|
||||||
|
|
||||||
if (Env.getContext(Env.getCtx(), lookup.getWindowNo(), "IsSOTrx").equals("N"))
|
if (Env.getContext(Env.getCtx(), lookup.getWindowNo(), "IsSOTrx").equals("N"))
|
||||||
|
|
|
@ -25,8 +25,10 @@ import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@ -38,6 +40,7 @@ import org.adempiere.webui.component.ListModelTable;
|
||||||
import org.adempiere.webui.component.WListItemRenderer;
|
import org.adempiere.webui.component.WListItemRenderer;
|
||||||
import org.adempiere.webui.component.WListbox;
|
import org.adempiere.webui.component.WListbox;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
|
import org.adempiere.webui.editor.WEditor;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.event.ValueChangeListener;
|
import org.adempiere.webui.event.ValueChangeListener;
|
||||||
import org.adempiere.webui.event.WTableModelEvent;
|
import org.adempiere.webui.event.WTableModelEvent;
|
||||||
|
@ -63,6 +66,7 @@ import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.KeyNamePair;
|
import org.compiere.util.KeyNamePair;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
import org.compiere.util.ValueNamePair;
|
||||||
import org.zkoss.zk.au.out.AuEcho;
|
import org.zkoss.zk.au.out.AuEcho;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
@ -93,7 +97,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 325050327514511004L;
|
private static final long serialVersionUID = 325050327514511004L;
|
||||||
private final static int PAGE_SIZE = 100;
|
private final static int PAGE_SIZE = 100;
|
||||||
|
|
||||||
|
protected Map<String, WEditor> editorMap = new HashMap<String, WEditor>();
|
||||||
|
|
||||||
public static InfoPanel create (int WindowNo,
|
public static InfoPanel create (int WindowNo,
|
||||||
String tableName, String keyColumn, String value,
|
String tableName, String keyColumn, String value,
|
||||||
boolean multiSelection, String whereClause)
|
boolean multiSelection, String whereClause)
|
||||||
|
@ -464,12 +470,42 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
else if (c == Integer.class)
|
else if (c == Integer.class)
|
||||||
value = new Integer(rs.getInt(colIndex));
|
value = new Integer(rs.getInt(colIndex));
|
||||||
else if (c == KeyNamePair.class)
|
else if (c == KeyNamePair.class)
|
||||||
|
{
|
||||||
|
if (p_layout[col].isKeyPairCol())
|
||||||
|
{
|
||||||
|
String display = rs.getString(colIndex);
|
||||||
|
int key = rs.getInt(colIndex+1);
|
||||||
|
value = new KeyNamePair(key, display);
|
||||||
|
|
||||||
|
colOffset++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int key = rs.getInt(colIndex);
|
||||||
|
WEditor editor = editorMap.get(p_layout[col].getColSQL());
|
||||||
|
if (editor != null)
|
||||||
|
{
|
||||||
|
editor.setValue(key);
|
||||||
|
value = new KeyNamePair(key, editor.getDisplayTextForGridView(key));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = new KeyNamePair(key, Integer.toString(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c == ValueNamePair.class)
|
||||||
{
|
{
|
||||||
String display = rs.getString(colIndex);
|
String key = rs.getString(colIndex);
|
||||||
int key = rs.getInt(colIndex+1);
|
WEditor editor = editorMap.get(p_layout[col].getColSQL());
|
||||||
value = new KeyNamePair(key, display);
|
if (editor != null)
|
||||||
|
{
|
||||||
colOffset++;
|
value = new ValueNamePair(key, editor.getDisplayTextForGridView(key));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = new ValueNamePair(key, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1312,4 +1348,12 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
public int getWindowNo() {
|
public int getWindowNo() {
|
||||||
return p_WindowNo;
|
return p_WindowNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getRowCount() {
|
||||||
|
return contentPanel.getRowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getFirstRowKey() {
|
||||||
|
return contentPanel.getFirstRowKey();
|
||||||
|
}
|
||||||
} // Info
|
} // Info
|
||||||
|
|
|
@ -611,7 +611,6 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
ynvo.lookupInfo = MLookupFactory.getLookupInfo (ynvo.ctx, ynvo.WindowNo, ynvo.AD_Column_ID, ynvo.displayType,
|
ynvo.lookupInfo = MLookupFactory.getLookupInfo (ynvo.ctx, ynvo.WindowNo, ynvo.AD_Column_ID, ynvo.displayType,
|
||||||
Env.getLanguage(ynvo.ctx), ynvo.ColumnName, ynvo.AD_Reference_Value_ID,
|
Env.getLanguage(ynvo.ctx), ynvo.ColumnName, ynvo.AD_Reference_Value_ID,
|
||||||
ynvo.IsParent, ynvo.ValidationCode);
|
ynvo.IsParent, ynvo.ValidationCode);
|
||||||
ynvo.lookupInfo.InfoFactoryClass = ynvo.InfoFactoryClass;
|
|
||||||
|
|
||||||
GridField ynfield = new GridField(ynvo);
|
GridField ynfield = new GridField(ynvo);
|
||||||
|
|
||||||
|
@ -633,7 +632,6 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
|
||||||
postedvo.lookupInfo = MLookupFactory.getLookupInfo (postedvo.ctx, postedvo.WindowNo, postedvo.AD_Column_ID, postedvo.displayType,
|
postedvo.lookupInfo = MLookupFactory.getLookupInfo (postedvo.ctx, postedvo.WindowNo, postedvo.AD_Column_ID, postedvo.displayType,
|
||||||
Env.getLanguage(postedvo.ctx), postedvo.ColumnName, postedvo.AD_Reference_Value_ID,
|
Env.getLanguage(postedvo.ctx), postedvo.ColumnName, postedvo.AD_Reference_Value_ID,
|
||||||
postedvo.IsParent, postedvo.ValidationCode);
|
postedvo.IsParent, postedvo.ValidationCode);
|
||||||
postedvo.lookupInfo.InfoFactoryClass = postedvo.InfoFactoryClass;
|
|
||||||
|
|
||||||
GridField postedfield = new GridField(postedvo);
|
GridField postedfield = new GridField(postedvo);
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.minigrid;
|
package org.compiere.minigrid;
|
||||||
|
|
||||||
|
import org.compiere.model.GridField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Info Column Details
|
* Info Column Details
|
||||||
*
|
*
|
||||||
|
@ -77,6 +79,7 @@ public class ColumnInfo
|
||||||
private boolean m_readOnly;
|
private boolean m_readOnly;
|
||||||
private boolean m_colorColumn;
|
private boolean m_colorColumn;
|
||||||
private String m_keyPairColSQL = "";
|
private String m_keyPairColSQL = "";
|
||||||
|
private GridField m_gridField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Col Class
|
* Get Col Class
|
||||||
|
@ -191,4 +194,14 @@ public class ColumnInfo
|
||||||
{
|
{
|
||||||
return m_keyPairColSQL.length() > 0;
|
return m_keyPairColSQL.length() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGridField(GridField gridField)
|
||||||
|
{
|
||||||
|
m_gridField = gridField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GridField getGridField()
|
||||||
|
{
|
||||||
|
return m_gridField;
|
||||||
|
}
|
||||||
} // infoColumn
|
} // infoColumn
|
||||||
|
|
Loading…
Reference in New Issue