From fd70983c8cec13624533c71a8b2056b537bcdf61 Mon Sep 17 00:00:00 2001 From: trifonnt Date: Sun, 23 Nov 2008 15:47:01 +0000 Subject: [PATCH] Set Proper Shipment Type: MM Shipment Indirect --- .../posterita/businesslogic/MenuManager.java | 8 +++++++- .../posterita/businesslogic/MinOutManager.java | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/MenuManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/MenuManager.java index 83a93edb62..a00e8141e4 100644 --- a/posterita/posterita/src/main/org/posterita/businesslogic/MenuManager.java +++ b/posterita/posterita/src/main/org/posterita/businesslogic/MenuManager.java @@ -218,7 +218,13 @@ public class MenuManager public static MWebMenu createSubMenu(Properties ctx,String menuName, String menuLink, String moduleName, int parentId, int sequence, String category) throws OperationException { - MWebMenu menu = new MWebMenu(ctx, 0, null); + MWebMenu menu; + try { + menu = new MWebMenu(ctx, getMenuId(ctx, menuName), null); + } catch (SystemException e) + { + menu = new MWebMenu(ctx, 0, null); + } menu.setParentMenu_ID(parentId); if(!menuLink.contains("javascript")) diff --git a/posterita/posterita/src/main/org/posterita/businesslogic/MinOutManager.java b/posterita/posterita/src/main/org/posterita/businesslogic/MinOutManager.java index 3a251369e4..5eb78ee46c 100644 --- a/posterita/posterita/src/main/org/posterita/businesslogic/MinOutManager.java +++ b/posterita/posterita/src/main/org/posterita/businesslogic/MinOutManager.java @@ -242,7 +242,7 @@ public class MinOutManager extends AbstractDocumentManager MOrder salesOrder = new MOrder(ctx,salesOrderId,trxName); - MInOut inOut = new MInOut(salesOrder,MDocType.C_DOCTYPESHIPMENT_ID_AD_Reference_ID,stamp); + MInOut inOut = new MInOut(salesOrder, MDocType.C_DOCTYPESHIPMENT_ID_AD_Reference_ID, stamp); try { int [] invoiceIds = MInvoice.getAllIDs(MInvoice.Table_Name,"AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+" and c_order_id="+salesOrderId,trxName); @@ -260,9 +260,20 @@ public class MinOutManager extends AbstractDocumentManager inOut.setIsSOTrx(true); inOut.setDescription("Shipment"); - inOut.setC_DocType_ID(MDocType.DOCBASETYPE_MaterialDelivery); + //inOut.setC_DocType_ID(MDocType.DOCBASETYPE_MaterialDelivery); // @Trifon + int [] docTypeShipmentIndirectId = MInvoice.getAllIDs(MDocType.Table_Name, + "AD_CLIENT_ID="+Env.getAD_Client_ID(ctx) + + " AND DocBaseType='"+MDocType.DOCBASETYPE_MaterialDelivery+"' " + + " AND IsActive='Y' " + + " AND IsSOTrx='Y' " + + " AND Name = 'MM Shipment Indirect'", trxName); + if (docTypeShipmentIndirectId.length > 0) + { + inOut.setC_DocType_ID( docTypeShipmentIndirectId[0] ); + } else { + inOut.setC_DocType_ID(MDocType.DOCBASETYPE_MaterialDelivery); // @Trifon; old behavior + } - PoManager.save(inOut); MInOutLine [] line=new MInOutLine[salesOrderLineid.length];