FR [2952085] - Product Info Window - Add filter by Attribute Set

https://sourceforge.net/tracker/index.php?func=detail&aid=2952085&group_id=176962&atid=879332
This commit is contained in:
trifonnt 2010-02-15 14:06:26 +00:00
parent ae98fa29f1
commit e60830d17b
3 changed files with 42 additions and 2 deletions

View File

@ -613,7 +613,7 @@ public class MProduct extends X_M_Product
// AttributeSetInstance reset
if (is_ValueChanged(COLUMNNAME_M_AttributeSet_ID))
{
MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(),getM_AttributeSetInstance_ID(), get_TrxName());
MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(), getM_AttributeSetInstance_ID(), get_TrxName());
setM_AttributeSetInstance_ID(0);
// Delete the old m_attributesetinstance
if (!asi.delete(true, get_TrxName()))

View File

@ -86,7 +86,7 @@ public class InfoPAttribute extends CDialog
/** Resulting Query */
private String m_query = "";
/** Product Attribure Editors */
/** Product Attribute Editors */
private ArrayList<Component> m_productEditors = new ArrayList<Component>();
private ArrayList<Component> m_productEditorsTo = new ArrayList<Component>();
/** Instance Attribute Editors */

View File

@ -154,6 +154,8 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
private CTextField fieldVendor = new CTextField(10);
private CLabel labelProductCategory = new CLabel();
private VComboBox pickProductCategory = new VComboBox();
private CLabel labelAS = new CLabel(); // @Trifon
private VComboBox pickAS = new VComboBox(); // @Trifon
//Begin - fer_luck @ centuryon
private CTextArea fieldDescription = new CTextArea();
@ -214,6 +216,10 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID"));
pickProductCategory.setBackground(AdempierePLAF.getInfoBackground());
// @Trifon
labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID"));
pickAS.setBackground(AdempierePLAF.getInfoBackground());
m_InfoPAttributeButton.setMargin(new Insets(2,2,2,2));
m_InfoPAttributeButton.setToolTipText(Msg.getMsg(Env.getCtx(), "InfoPAttribute"));
m_InfoPAttributeButton.addActionListener(this);
@ -244,6 +250,8 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
parameterPanel.add(pickPriceList, null);
parameterPanel.add(labelProductCategory, null);
parameterPanel.add(pickProductCategory, null);
parameterPanel.add(labelAS, null); // @Trifon
parameterPanel.add(pickAS, null); // @Trifon
// Product Attribute Instance
m_PAttributeButton = ConfirmPanel.createPAttributeButton(true);
@ -500,6 +508,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
pickWarehouse.addActionListener(this);
pickPriceList.addActionListener(this);
pickProductCategory.addActionListener(this);
pickAS.addActionListener(this); // @Trifon
} // initInfo
/**
@ -563,6 +572,15 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
for (KeyNamePair kn : DB.getKeyNamePairs(SQL, true)) {
pickProductCategory.addItem(kn);
}
// Attribute Set - @Trifon
SQL = MRole.getDefault().addAccessSQL (
"SELECT M_AttributeSet_ID, Name FROM M_AttributeSet WHERE IsActive='Y'",
"M_AttributeSet", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO)
+ " ORDER BY Name";
for (KeyNamePair kn : DB.getKeyNamePairs(SQL, true)) {
pickAS.addItem(kn);
}
}
catch (SQLException e)
{
@ -696,6 +714,11 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
where.append(" AND p.M_Product_Category_ID=?");
}
// Optional Attribute Set
if (getM_AttributeSet_ID() > 0) {
where.append(" AND p.M_AttributeSet_ID=?");
}
// Product Attribute Search
if (m_pAttributeWhere != null)
{
@ -773,6 +796,12 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
pstmt.setInt(index++, M_Product_Category_ID);
log.fine("M_Product_Category_ID=" + M_Product_Category_ID);
}
// => Attribute Set - @Trifon
int M_AttributeSet_ID = getM_AttributeSet_ID();
if (M_AttributeSet_ID > 0) {
pstmt.setInt(index++, M_AttributeSet_ID);
log.fine("M_AttributeSet_ID=" + M_AttributeSet_ID);
}
// Rest of Parameter in Query for Attribute Search
if (m_pAttributeWhere != null)
return;
@ -1265,4 +1294,15 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
M_Product_Category_ID = pc.getKey();
return M_Product_Category_ID;
}
/**
* @return selected Attribute Set ID
*/
public int getM_AttributeSet_ID() {
int M_AttributeSet_ID = 0;
KeyNamePair as = (KeyNamePair)pickAS.getSelectedItem();
if (as != null)
M_AttributeSet_ID = as.getKey();
return M_AttributeSet_ID;
}
} // InfoProduct