Beispiel #1
0
 protected void assignToCustomer(LegalEntity legalEntity) {
   TradeManagerRemote tm = TradePlugin.getDefault().getTradeManager();
   AnchorID customerID = (AnchorID) JDOHelper.getObjectId(legalEntity);
   OrderID orderID = (OrderID) getArticleContainerEdit().getArticleContainerID();
   try {
     tm.assignCustomer(orderID, customerID, true, null, 1);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
Beispiel #2
0
  public static ArticleContainerEditorInput createEditorInput() {
    TradeManagerRemote tm;
    try {
      try {
        Login.getLogin();

        TradeConfigModule tradeConfigModule =
            ConfigUtil.getUserCfMod(
                TradeConfigModule.class,
                new String[] {
                  FetchPlan.DEFAULT, TradeConfigModule.FETCH_GROUP_CURRENCY,
                },
                NLJDOHelper.MAX_FETCH_DEPTH_NO_LIMIT,
                new NullProgressMonitor()); // TODO async!

        tm =
            JFireEjb3Factory.getRemoteBean(
                TradeManagerRemote.class, Login.getLogin().getInitialContextProperties());
        // by default get the customerID of the anonymous customer
        AnchorID customerID =
            (AnchorID)
                JDOHelper.getObjectId(
                    LegalEntityDAO.sharedInstance()
                        .getAnonymousLegalEntity(new NullProgressMonitor()));
        //			 FIXME IDPREFIX (next line) should be asked from user if necessary!
        OrderID orderID =
            tm.createQuickSaleWorkOrder(
                customerID,
                null,
                tradeConfigModule.getCurrencyID(),
                new SegmentTypeID[] {null}); // null here is a shortcut for default segment type
        return new ArticleContainerEditorInput(orderID);
      } catch (LoginException le) {
        return null;
      }
    } catch (Throwable t) {
      throw new RuntimeException(t);
    }
  }