private void processCostDetail(I_M_CostDetail cd) { if (!cd.isProcessed()) { final Properties ctx = InterfaceWrapperHelper.getCtx(cd); final I_C_AcctSchema as = MAcctSchema.get(ctx, cd.getC_AcctSchema_ID()); final I_AD_Client client = MClient.get(ctx, as.getAD_Client_ID()); if (client.isCostImmediate()) { final MCostDetail cdPO = LegacyAdapters.convertToPO(cd); cdPO.process(); } } }
private void setupContext(final boolean initEnvironment) { ctx = Env.getCtx(); trxName = ITrx.TRXNAME_None; // // Setup context: #AD_Client_ID int adClientId = Env.getAD_Client_ID(ctx); if (adClientId <= 0) { adClient = InterfaceWrapperHelper.create(ctx, I_AD_Client.class, ITrx.TRXNAME_None); InterfaceWrapperHelper.save(adClient); adClientId = adClient.getAD_Client_ID(); Env.setContext(ctx, Env.CTXNAME_AD_Client_ID, adClientId); } else { adClient = InterfaceWrapperHelper.create(ctx, adClientId, I_AD_Client.class, ITrx.TRXNAME_None); } int adOrgId = Env.getAD_Org_ID(ctx); if (adOrgId <= 0) { adOrg01 = createOrg("Org01"); adOrgId = adOrg01.getAD_Org_ID(); Env.setContext(ctx, Env.CTXNAME_AD_Org_ID, adOrgId); } else { adOrg01 = InterfaceWrapperHelper.create(ctx, adOrgId, I_AD_Org.class, ITrx.TRXNAME_None); } SystemTime.setTimeSource( new TimeSource() { @Override public long millis() { return _today.getTime(); } }); }
public IMutableMRPContext createMutableMRPContext() { final IMutableMRPContext mrpContext = new MRPContext(); mrpContext.setCtx(ctx); mrpContext.setTrxName(ITrx.TRXNAME_None); mrpContext.setRequireDRP(true); // mrpContext.setPlanner_User_ID(p_Planner_ID); mrpContext.setDate(_today); mrpContext.setAD_Client_ID(adClient.getAD_Client_ID()); return mrpContext; }