* Callback method called by the Form panel when the Form is set to INSERT mode.
* The method can pre-set some v.o. attributes, so that some input controls will have a predefined value associated.
* @param persistentObject new value object
*/
public void createPersistentObject(ValueObject persistentObject) throws Exception {
DetailSaleDocVO vo = (DetailSaleDocVO)persistentObject;
Calendar cal = Calendar.getInstance();
vo.setDocYearDOC01(new BigDecimal(cal.get(cal.YEAR)));
vo.setDocDateDOC01(new java.sql.Date(System.currentTimeMillis()));
vo.setDocTypeDOC01(ApplicationConsts.SALE_ESTIMATE_DOC_TYPE);
vo.setDocStateDOC01(ApplicationConsts.OPENED);
// pre-set warehouse code if previously defined (stored in SYS19 table...)
ClientApplet applet = ( (ApplicationClientFacade) MDIFrame.getInstance().getClientFacade()).getMainClass();
ButtonCompanyAuthorizations bca = applet.getAuthorizations().getCompanyBa();
final ArrayList companiesList = bca.getCompaniesList("DOC01_ESTIMATES");
if (companiesList.size()>0) {
HashMap map = new HashMap();
// retrieve default warehouse...
map.put(ApplicationConsts.COMPANY_CODE_SYS01,companiesList.get(0));
map.put(ApplicationConsts.PARAM_CODE,ApplicationConsts.WAREHOUSE_CODE);
Response res = ClientUtils.getData("loadUserParam",map);
if (!res.isError()) {
String warCode = (String)((VOResponse)res).getVo();
if (warCode!=null) {
vo.setCompanyCodeSys01DOC01(companiesList.get(0).toString());
vo.setWarehouseCodeWar01DOC01(warCode);
}
}
}
}