FR [ 1661546 ] Mandatory locator fields should use defaults

This commit is contained in:
teo_sarca 2007-02-20 10:54:07 +00:00
parent 8a709d0e69
commit 13f0c92745
1 changed files with 28 additions and 0 deletions

View File

@ -104,6 +104,7 @@ public class VLocator extends JComponent
mRefresh = new CMenuItem(Msg.getMsg(Env.getCtx(), "Refresh"), Env.getImageIcon("Refresh16.gif")); mRefresh = new CMenuItem(Msg.getMsg(Env.getCtx(), "Refresh"), Env.getImageIcon("Refresh16.gif"));
mRefresh.addActionListener(this); mRefresh.addActionListener(this);
popupMenu.add(mRefresh); popupMenu.add(mRefresh);
setDefault_Locator_ID(); // set default locator, teo_sarca [ 1661546 ]
} // VLocator } // VLocator
/** /**
@ -507,6 +508,33 @@ public class VLocator extends JComponent
return only_Product_ID; return only_Product_ID;
} // getOnly_Product_ID } // getOnly_Product_ID
/**
* Set the default locator if this field is mandatory
* and we have a warehouse restriction.
*
* @since 3.1.4
*/
private void setDefault_Locator_ID()
{
// teo_sarca, FR [ 1661546 ] Mandatory locator fields should use defaults
if (!isMandatory() || m_mLocator == null) {
return;
}
int M_Warehouse_ID = getOnly_Warehouse_ID();
if (M_Warehouse_ID <= 0) {
return;
}
MWarehouse wh = MWarehouse.get(Env.getCtx(), M_Warehouse_ID);
if (wh == null || wh.get_ID() <= 0) {
return;
}
MLocator loc = wh.getDefaultLocator();
if (loc == null || loc.get_ID() <= 0) {
return;
}
setValue(Integer.valueOf(loc.get_ID()));
}
} // VLocator } // VLocator
/*****************************************************************************/ /*****************************************************************************/