You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2009/04/22 12:44:15 UTC

Re: svn commit: r767394 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/invoice/ order/config/ product/config/ product/servicedef/ product/src/org/ofbiz/shipment/packing/ product/src/org/ofbiz/s

Is this really a bug fix ? On the other hand we could have a short period while such changes could be accepted...

Jacques


From: <mo...@apache.org>
> Author: mor
> Date: Wed Apr 22 06:50:16 2009
> New Revision: 767394
>
> URL: http://svn.apache.org/viewvc?rev=767394&view=rev
> Log:
> Facilitate packing screen to use verified orders from Verify Pick screen by using existing shipment and invoice.
> Patch from Akash Jain (reviewed and tested by Pranay Pandey), Part of OFBIZ-2329 
> (https://issues.apache.org/jira/browse/OFBIZ-2329).
>
> Note: I have done little modifications to the new labels part of this patch.
>
> This issue completes the functionality of the Verify Pick feature added recently. I would like to port these changes to 
> release09.04 later today
> if I do not see any objections.
>
>
>
> Modified:
>    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
>    ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
>    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
>    ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml
>    ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
>    ofbiz/trunk/applications/product/servicedef/services_shipment.xml
>    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
>    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
>    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
>    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java
>    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
>    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy
>    ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl
>
> Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
> +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Wed Apr 22 06:50:16 2009
> @@ -6390,6 +6390,9 @@
>         <value 
> xml:lang="th">ปัญหามีผลต่อโปรแกรมประยุกต์ใช้การชำระเงินสำหรับรหัสการชำระเงิน 
> [${invoiceId}]</value>
>         <value xml:lang="zh">为发票编号[${invoiceId}]获得支付应用时出错</value>
>     </property>
> +    <property key="AccountingProblemGettingShipmentItemBilling">
> +        <value xml:lang="en">Problem getting ShipmentItemBilling records</value>
> +    </property>
>     <property key="AccountingProblemLookingUpOrderItemBilling">
>         <value xml:lang="en">Problem looking up OrderItemBilling records for ${billFields}</value>
>         <value xml:lang="es">Problema buscando Elemento de orden de facturación para ${billFields}</value>
>
> Modified: ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml (original)
> +++ ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml Wed Apr 22 06:50:16 2009
> @@ -152,7 +152,7 @@
>         </description>
>         <attribute name="orderId" type="String" mode="IN" optional="false"/>
>         <attribute name="billItems" type="List" mode="IN" optional="false"/>
> -        <attribute name="invoiceId" type="String" mode="OUT" optional="true"/>
> +        <attribute name="invoiceId" type="String" mode="INOUT" optional="true"/>
>         <attribute name="invoiceTypeId" type="String" mode="OUT" optional="true"/>
>     </service>
>     <service name="createInvoiceFromReturn" engine="java"
>
> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original)
> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Wed Apr 22 06:50:16 2009
> @@ -151,6 +151,7 @@
>
>         String orderId = (String) context.get("orderId");
>         List billItems = (List) context.get("billItems");
> +        String invoiceId = (String) context.get("invoiceId");
>         boolean previousInvoiceFound = false;
>
>         if (billItems == null || billItems.size() == 0) {
> @@ -241,6 +242,7 @@
>             }
>
>             // create the invoice record
> +            if (UtilValidate.isEmpty(invoiceId)) {
>             Map createInvoiceContext = FastMap.newInstance();
>             createInvoiceContext.put("partyId", billToCustomerPartyId);
>             createInvoiceContext.put("partyIdFrom", billFromVendorPartyId);
> @@ -260,7 +262,8 @@
>             }
>
>             // call service, not direct entity op: delegator.create(invoice);
> -            String invoiceId = (String) createInvoiceResult.get("invoiceId");
> +            invoiceId = (String) createInvoiceResult.get("invoiceId");
> +            }
>
>             // order roles to invoice roles
>             List orderRoles = orderHeader.getRelated("OrderRole");
> @@ -491,6 +494,8 @@
>                     }
>
>                     if ("ItemIssuance".equals(currentValue.getEntityName())) {
> +                    List<GenericValue> shipmentItemBillings = delegator.findByAnd("ShipmentItemBilling", 
> UtilMisc.toMap("shipmentId", currentValue.get("shipmentId")));
> +                    if (UtilValidate.isEmpty(shipmentItemBillings)) {
>
>                         // create the ShipmentItemBilling record
>                         GenericValue shipmentItemBilling = delegator.makeValue("ShipmentItemBilling", UtilMisc.toMap("invoiceId", 
> invoiceId, "invoiceItemSeqId", invoiceItemSeqId));
> @@ -498,6 +503,7 @@
>                         shipmentItemBilling.put("shipmentItemSeqId", currentValue.get("shipmentItemSeqId"));
>                         shipmentItemBilling.create();
>                     }
> +                    }
>
>                     String parentInvoiceItemSeqId = invoiceItemSeqId;
>                     // increment the counter
> @@ -1538,8 +1544,22 @@
>                 Debug.logInfo(UtilProperties.getMessage(resource, "AccountingIgnoringAdditionalShipCharges", 
> productStore.getAllFields(), locale), module);
>             }
>
> +            String invoiceId = null;
> +            List<GenericValue> shipmentItemBillings = null;
> +            String shipmentId = (String) shipmentIds.get(0);
> +            try {
> +                shipmentItemBillings = delegator.findByAnd("ShipmentItemBilling", UtilMisc.toMap("shipmentId", shipmentId));
> +            } catch ( GenericEntityException e ) {
> +                String errMsg = UtilProperties.getMessage(resource, "AccountingProblemGettingShipmentItemBilling", locale);
> +                return ServiceUtil.returnError(errMsg);
> +            }
> +            if (UtilValidate.isNotEmpty(shipmentItemBillings)) {
> +                GenericValue shipmentItemBilling = EntityUtil.getFirst(shipmentItemBillings);
> +                invoiceId = shipmentItemBilling.getString("invoiceId");
> +            }
> +
>             // call the createInvoiceForOrder service for each order
> -            Map serviceContext = UtilMisc.toMap("orderId", orderId, "billItems", toBillItems, "userLogin", 
> context.get("userLogin"));
> +            Map serviceContext = UtilMisc.toMap("orderId", orderId, "billItems", toBillItems, "invoiceId", invoiceId, 
> "userLogin", context.get("userLogin"));
>             try {
>                 Map result = dispatcher.runSync("createInvoiceForOrder", serviceContext);
>                 invoicesCreated.add(result.get("invoiceId"));
>
> Modified: ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml (original)
> +++ ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml Wed Apr 22 06:50:16 2009
> @@ -334,6 +334,9 @@
>         <value xml:lang="th">ERROR : ข้อผิดพลาด !</value>
>         <value xml:lang="zh">错误:</value>
>     </property>
> +    <property key="OrderErrorAllItemsOfOrderAreAlreadyVerified">
> +        <value xml:lang="en">ERROR: All items of order #${orderId} are already verified</value>
> +    </property>
>     <property key="OrderErrorCallingCountProductQuantityOrderedService">
>         <value xml:lang="en">Error calling countProductQuantityOrdered service : </value>
>         <value xml:lang="es">Error al llamar al servicio countProductQuantityOrdered:</value>
> @@ -685,6 +688,12 @@
>         <value xml:lang="ru">ОШИБКА: Позиция заказа с кодом [${orderId}] и orderItemSeqId 
> [${orderItemSeqId}] не найдены</value>
>         <value xml:lang="th">ERROR : ข้อผิดพลาด ! 
> รายการสั่งซื้อด้วยรหัส [${orderId}] 
> และรหัสรายการสั่งซื้อ[${orderItemSeqId}] ไม่พบ</value>
>     </property>
> +    <property key="OrderErrorOrderNotApprovedForPacking">
> +        <value xml:lang="en">ERROR: Order #${orderId} is not approved for packing</value>
> +    </property>
> +    <property key="OrderErrorOrderNotApprovedForPicking">
> +        <value xml:lang="en">ERROR: Order #${orderId} is not approved for picking</value>
> +    </property>
>     <property key="OrderErrorOrderNotPurchaseOrder">
>         <value xml:lang="en">Order ${orderId} is not a Purchase Order</value>
>         <value xml:lang="es">El pedido ${orderId} no es un pedido de compra</value>
> @@ -693,6 +702,9 @@
>         <value xml:lang="ru">Заказ ${orderId} не является закупочным заказом</value>
>         <value xml:lang="th">ใบสั่งซื้อสินค้า ${orderId} 
> ไม่เป็นรายการสั่งซื้อ</value>
>     </property>
> +    <property key="OrderErrorOrderNotVerifiedForPacking">
> +        <value xml:lang="en">ERROR: Order #${orderId} is not verified for packing</value>
> +    </property>
>     <property key="OrderErrorOrderTypeLookupFailed">
>         <value xml:lang="en">ERROR : OrderType lookup failed : </value>
>         <value xml:lang="es">ERROR: La búsqueda ha fallado :</value>
>
> Modified: ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml (original)
> +++ ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml Wed Apr 22 06:50:16 2009
> @@ -55,6 +55,9 @@
>         <value xml:lang="en">Error Inventory Item Label Id Not Found</value>
>         <value xml:lang="it">Errore riga etichetta inventario non trovata</value>
>     </property>
> +    <property key="ProductErrorNoShipGroupSequenceIdFoundCannotProcess">
> +        <value xml:lang="en">ERROR: No ship group sequence Id found cannot process</value>
> +    </property>
>     <property key="ProductFeatureTypeIdMustContainsLettersAndDigits">
>         <value xml:lang="de">Die Produktmerkmal Typ ID darf nur Buchstaben, Zahlen und _ enthalten. Bitte erneut eingeben.</value>
>         <value xml:lang="en">The Product Feature TypeId must contains only letters, underscore and digits. Please re-enter</value>
>
> Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
> +++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Wed Apr 22 06:50:16 2009
> @@ -562,6 +562,9 @@
>             location="org.ofbiz.shipment.packing.PackingServices" invoke="completePack" auth="true">
>         <description>Complete the packging set the shipment to PACKED</description>
>         <attribute name="packingSession" type="org.ofbiz.shipment.packing.PackingSession" mode="IN" optional="false"/>
> +        <attribute name="orderId" type="String" mode="IN" optional="true"/>
> +        <attribute name="invoiceId" type="String" mode="IN" optional="true"/>
> +        <attribute name="shipmentId" type="String" mode="IN" optional="true"/>
>         <attribute name="handlingInstructions" type="String" mode="IN" optional="true"/>
>         <attribute name="pickerPartyId" type="String" mode="IN" optional="true"/>
>         <attribute name="additionalShippingCharge" type="BigDecimal" mode="IN" optional="true"/>
>
> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java (original)
> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java Wed Apr 22 06:50:16 2009
> @@ -271,11 +271,16 @@
>         PackingSession session = (PackingSession) context.get("packingSession");
>
>         // set the instructions -- will clear out previous if now null
> +        String orderId = (String) context.get("orderId");
> +        String shipmentId = (String) context.get("shipmentId");
> +        String invoiceId = (String) context.get("invoiceId");
>         String instructions = (String) context.get("handlingInstructions");
>         String pickerPartyId = (String) context.get("pickerPartyId");
>         BigDecimal additionalShippingCharge = (BigDecimal) context.get("additionalShippingCharge");
>         Map<String, String> packageWeights = UtilGenerics.checkMap(context.get("packageWeights"));
>         String weightUomId = (String) context.get("weightUomId");
> +        session.setShipmentId(shipmentId);
> +        session.setInvoiceId(invoiceId);
>         session.setHandlingInstructions(instructions);
>         session.setPickerPartyId(pickerPartyId);
>         session.setAdditionalShippingCharge(additionalShippingCharge);
> @@ -287,9 +292,8 @@
>             force = Boolean.FALSE;
>         }
>
> -        String shipmentId = null;
>         try {
> -            shipmentId = session.complete(force);
> +            shipmentId = session.complete(force, orderId);
>         } catch (GeneralException e) {
>             Debug.logError(e, module);
>             return ServiceUtil.returnError(e.getMessage(), e.getMessageList());
>
> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java (original)
> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java Wed Apr 22 06:50:16 2009
> @@ -60,6 +60,7 @@
>     protected String shipmentId = null;
>     protected String instructions = null;
>     protected String weightUomId = null;
> +    protected String invoiceId = null;
>     protected BigDecimal additionalShippingCharge = null;
>     protected Map<Integer, BigDecimal> packageWeights = null;
>     protected List<PackingEvent> packEvents = null;
> @@ -367,6 +368,18 @@
>         return this.shipmentId;
>     }
>
> +    public void setShipmentId(String shipmentId) {
> +        this.shipmentId = shipmentId;
> +    }
> +
> +    public String getInvoiceId() {
> +        return this.invoiceId;
> +    }
> +
> +    public void setInvoiceId(String invoiceId) {
> +        this.invoiceId = invoiceId;
> +    }
> +
>     public List<PackingSessionLine> getLines() {
>         return this.packLines;
>     }
> @@ -613,7 +626,7 @@
>         this.runEvents(PackingEvent.EVENT_CODE_CLEAR);
>     }
>
> -    public String complete(boolean force) throws GeneralException {
> +    public String complete(boolean force, String orderId) throws GeneralException {
>         // clear out empty lines
>         // this.checkEmptyLines(); // removing, this seems to be causeing issues -  mja
>
> @@ -622,12 +635,16 @@
>             return "EMPTY";
>         }
>
> +        this.checkPackedQty(orderId);
>         // check for errors
>         this.checkReservations(force);
>         // set the status to 0
>         this.status = 0;
>         // create the shipment
> -        this.createShipment();
> +        String shipmentId = this.getShipmentId();
> +        if (UtilValidate.isEmpty(shipmentId)) {
> +            this.createShipment();
> +        }
>         // create the packages
>         this.createPackages();
>         // issue the items
> @@ -646,6 +663,27 @@
>         return this.shipmentId;
>     }
>
> +    protected void checkPackedQty(String orderId) throws GeneralException {
> +        int counter = 0;
> +        List<GenericValue> orderItems = null;
> +        for (PackingSessionLine line : this.getLines()) {
> +            orderItems = this.getDelegator().findByAnd("OrderItem", UtilMisc.toMap("orderId", orderId));
> +            for (GenericValue orderItem : orderItems) {
> +                if (orderId.equals(line.getOrderId())) {
> +                    if ((orderItem.get("orderItemSeqId")).equals(line.getOrderItemSeqId())) {
> +                        BigDecimal packedQty = this.getPackedQuantity(line.getOrderId(), line.getOrderItemSeqId(), 
> line.getShipGroupSeqId(), line.getProductId());
> +                        if ((packedQty.compareTo(orderItem.getBigDecimal("quantity"))) == 0 ) {
> +                            counter++;
> +                        }
> +                    }
> +                }
> +            }
> +        }
> +        if (((this.getLines().size()) != (orderItems.size())) || (counter != (orderItems.size()))) {
> +            throw new GeneralException("All order items are not packed");
> +        }
> +    }
> +
>     protected void checkReservations(boolean ignore) throws GeneralException {
>         List<String> errors = FastList.newInstance();
>         for (PackingSessionLine line: this.getLines()) {
>
> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java (original)
> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java Wed Apr 22 06:50:16 2009
> @@ -140,14 +140,11 @@
>     }
>
>     public String complete(String orderId) throws GeneralException {
> -        String shipmentId = null;
>         String shipmentItemSeqId = null;
>         String invoiceId = null;
>         String invoiceItemSeqId = null;
> -        for (VerifyPickSessionRow line: this.getPickRows(orderId)) {
> -            shipmentId = this.createShipment(line);
> -            break;
> -        }
> +        this.checkVerifiedQty(orderId);
> +        String shipmentId = this.createShipment((this.getPickRows(orderId)).get(0));
>         for (VerifyPickSessionRow line: this.getPickRows(orderId)) {
>             shipmentItemSeqId = this.createShipmentItem(line,shipmentId);
>             line.setShipmentItemSeqId(shipmentItemSeqId);
> @@ -160,6 +157,24 @@
>         return shipmentId;
>     }
>
> +    protected void checkVerifiedQty(String orderId) throws GeneralException {
> +        int counter = 0;
> +        List<GenericValue> orderItems = null;
> +        for (VerifyPickSessionRow line : this.getPickRows(orderId)) {
> +            orderItems = this.getDelegator().findByAnd("OrderItem", UtilMisc.toMap("orderId", orderId));
> +            for (GenericValue orderItem : orderItems) {
> +                if ((orderItem.get("orderItemSeqId")).equals(line.getOrderSeqId())) {
> +                    if (((line.getReadyToVerifyQty()).compareTo(orderItem.getBigDecimal("quantity"))) == 0 ) {
> +                        counter++;
> +                    }
> +                }
> +            }
> +        }
> +        if (counter != (orderItems.size())) {
> +            throw new GeneralException("All order items are not verified");
> +        }
> +    }
> +
>     protected String createShipment(VerifyPickSessionRow line) throws GeneralException {
>         Map<String, Object> newShipment = FastMap.newInstance();
>         newShipment.put("originFacilityId", line.getFacilityId());
> @@ -202,11 +217,17 @@
>     }
>
>     protected String createInvoice(String orderId) throws GeneralException {
> +        GenericDelegator delegator = this.getDelegator();
>         Map createInvoiceContext = FastMap.newInstance();
> -        createInvoiceContext.put("partyId", (EntityUtil.getFirst(this.getDelegator().findByAnd("OrderRole", 
> UtilMisc.toMap("orderId", orderId, "roleTypeId", "BILL_TO_CUSTOMER")))).getString("partyId"));
> -        createInvoiceContext.put("partyIdFrom", (EntityUtil.getFirst(this.getDelegator().findByAnd("OrderRole", 
> UtilMisc.toMap("orderId", orderId, "roleTypeId", "BILL_FROM_VENDOR")))).getString("partyId"));
> +        GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false);
> +        GenericValue billingAccount = orderHeader.getRelatedOne("BillingAccount");
> +        String billingAccountId = billingAccount != null ? billingAccount.getString("billingAccountId") : null;
> +        createInvoiceContext.put("partyId", (EntityUtil.getFirst(delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", 
> orderId, "roleTypeId", "BILL_TO_CUSTOMER")))).getString("partyId"));
> +        createInvoiceContext.put("partyIdFrom", (EntityUtil.getFirst(delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", 
> orderId, "roleTypeId", "BILL_FROM_VENDOR")))).getString("partyId"));
> +        createInvoiceContext.put("billingAccountId", billingAccountId);
>         createInvoiceContext.put("invoiceTypeId", "SALES_INVOICE");
>         createInvoiceContext.put("statusId", "INVOICE_IN_PROCESS");
> +        createInvoiceContext.put("currencyUomId", orderHeader.getString("currencyUom"));
>         createInvoiceContext.put("userLogin", this.getUserLogin());
>         Map createInvoiceResult = this.getDispatcher().runSync("createInvoice", createInvoiceContext);
>         if (ServiceUtil.isError(createInvoiceResult)) {
>
> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java (original)
> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java Wed Apr 22 06:50:16 2009
> @@ -50,6 +50,7 @@
>         this.orderItem = orderItem;
>         this.rowItem = rowItem;
>         this.shipmentItemSeqId = null;
> +        this.invoiceItemSeqId = null;
>     }
>
>     public String getOrderId() {
>
> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy (original)
> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy Wed Apr 22 06:50:16 2009
> @@ -115,6 +115,16 @@
> context.shipGroupSeqId = shipGroupSeqId;
> context.picklistBinId = picklistBinId;
>
> +shipment = EntityUtil.getFirst(delegator.findByAnd("Shipment", [primaryOrderId : orderId, statusId : "SHIPMENT_PICKED"]));
> +context.shipment = shipment;
> +
> +if (shipment) {
> +    invoice = EntityUtil.getFirst(delegator.findByAnd("ShipmentItemBilling", [shipmentId : shipment.shipmentId]));
> +    context.invoice = invoice;
> +} else {
> +    context.invoice = null;
> +}
> +
> // grab the order information
> if (orderId) {
>     orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
> @@ -128,6 +138,7 @@
>
>         if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
>             if (shipGroupSeqId) {
> +            if (shipment) {
>
>                 // Generate the shipment cost estimate for the ship group
>                 productStoreId = orh.getProductStoreId();
> @@ -145,13 +156,16 @@
>                     //context.put("itemInfos", shippableItemInfo);
>                 }
>             } else {
> -                request.setAttribute("errorMessageList", ['No ship group sequence ID. Cannot process.']);
> +                request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", 
> "OrderErrorOrderNotVerifiedForPacking", [orderId : orderId], locale));
> +            }
> +            } else {
> +                request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", 
> "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>             }
>         } else {
> -            request.setAttribute("errorMessageList", ["Order #" + orderId + " is not approved for packing."]);
> +            request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", 
> "OrderErrorOrderNotApprovedForPacking", [orderId : orderId], locale));
>         }
>     } else {
> -        request.setAttribute("errorMessageList", ["Order #" + orderId + " cannot be found."]);
> +        request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", 
> [orderId : orderId], locale));
>     }
> }
>
>
> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy (original)
> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy Wed Apr 22 06:50:16 2009
> @@ -17,9 +17,10 @@
>  * under the License.
>  */
>
> -import org.ofbiz.order.order.OrderReadHelper;
> +import org.ofbiz.base.util.UtilProperties;
> import org.ofbiz.entity.util.EntityUtil;
> import org.ofbiz.entity.condition.EntityCondition;
> +import org.ofbiz.order.order.OrderReadHelper;
> import org.ofbiz.shipment.verify.VerifyPickSession;
>
> verifyPickSession = session.getAttribute("verifyPickSession");
> @@ -42,6 +43,7 @@
>         invoiceIds = EntityUtil.getFieldListFromEntityList(shipmentItemBillingList, "invoiceId", true);
>         if (invoiceIds) {
>             context.invoiceIds = invoiceIds;
> +            parameters.orderId = null;
>         }
>     }
> }
> @@ -90,14 +92,18 @@
>             if (shipGroupSeqId) {
>                 productStoreId = orh.getProductStoreId();
>                 context.productStoreId = productStoreId;
> +                shipments = delegator.findByAnd("Shipment", [primaryOrderId : orderId, statusId : "SHIPMENT_PICKED"]);
> +                if (shipments) {
> +                    request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", 
> "OrderErrorAllItemsOfOrderAreAlreadyVerified", [orderId : orderId], locale));
> +                }
>             } else {
> -                request.setAttribute("errorMessageList", ['No ship group sequence ID. Cannot process.']);
> +                request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", 
> "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>             }
>         } else {
> -            request.setAttribute("errorMessageList", ["Order #" + orderId + " is not approved for picking."]);
> +            request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", 
> "OrderErrorOrderNotApprovedForPicking", [orderId : orderId], locale));
>         }
>     } else {
> -        request.setAttribute("errorMessageList", ["Order #" + orderId + " cannot be found."]);
> +        request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", 
> [orderId : orderId], locale));
>     }
> }
> context.verifyPickSession = verifyPickSession;
> \ No newline at end of file
>
> Modified: ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl?rev=767394&r1=767393&r2=767394&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl (original)
> +++ ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl Wed Apr 22 06:50:16 2009
> @@ -21,7 +21,7 @@
>     <#assign showInput = requestParameters.showInput?default("Y")>
>     <#assign hideGrid = requestParameters.hideGrid?default("N")>
>
> -    <#if (requestParameters.forceComplete?has_content && !shipmentId?has_content)>
> +    <#if (requestParameters.forceComplete?has_content && !invoiceIds?has_content)>
>         <#assign forceComplete = "true">
>         <#assign showInput = "Y">
>     </#if>
> @@ -33,12 +33,11 @@
>             <br class="clear"/>
>         </div>
>         <div class="screenlet-body">
> -            <#if shipmentId?has_content>
> +            <#if shipmentId?has_content && invoiceIds?exists && invoiceIds?has_content>
>                 <div>
>                 ${uiLabelMap.CommonView} <a href="<@o...@ofbizUrl>" 
> target="_blank" class="buttontext">${uiLabelMap.ProductPackingSlip}</a> ${uiLabelMap.CommonOr}
>                 ${uiLabelMap.CommonView} <a href="<@o...@ofbizUrl>" 
> target="_blank" class="buttontext">${uiLabelMap.ProductBarcode}</a> ${uiLabelMap.CommonFor} ${uiLabelMap.ProductShipmentId} <a 
> href="<@o...@ofbizUrl>" class="buttontext">${shipmentId}</a>
>                 </div>
> -                <#if invoiceIds?exists && invoiceIds?has_content>
>                 <div>
>                     <p>${uiLabelMap.AccountingInvoices}:</p>
>                     <ul>
> @@ -50,7 +49,6 @@
>                     </#list>
>                     </ul>
>                 </div>
> -                </#if>
>             </#if>
>             <br/>
>
> @@ -115,6 +113,7 @@
>         </div>
>     </div>
>
> +    <#if ((shipment?has_content) && (shipment.shipmentId)?exists)>
>     <#if showInput != "N" && ((orderHeader?exists && orderHeader?has_content))>
>     <div class="screenlet">
>         <div class="screenlet-title-bar">
> @@ -329,6 +328,8 @@
>                   <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
>                   <input type="hidden" name="forceComplete" value="${forceComplete?default('false')}"/>
>                   <input type="hidden" name="weightUomId" value="${defaultWeightUomId}"/>
> +                  <input type="hidden" name="shipmentId" value="${(shipment.shipmentId)?default("")}"/>
> +                  <input type="hidden" name="invoiceId" value="${(invoice.invoiceId)?default("")}"/>
>                   <input type="hidden" name="showInput" value="N"/>
>                   <hr>
>                   <table class="basic-table" cellpadding="2" cellspacing='0'>
> @@ -490,6 +491,7 @@
>   </#if>
>   </div>
>   </div>
> +  </#if>
> <#else>
>   <h3>${uiLabelMap.ProductFacilityViewPermissionError}</h3>
> </#if>
> \ No newline at end of file
>
> 



Re: svn commit: r767394 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/invoice/ order/config/ product/config/ product/servicedef/ product/src/org/ofbiz/shipment/packing/ product/src/org/ofbiz/s

Posted by Vikas Mayur <vi...@hotwaxmedia.com>.
I did back port these change to release09.04 in r767544 and r 767449,  
since I did not see any objections and hopefully will not :)

Vikas

On Apr 22, 2009, at 6:00 PM, Vikas Mayur wrote:

> Hi Jacques, Does that mean you agree with doing a back port for this  
> commit to release09.04 branch? IMO, this can be part of release  
> branch as described.
>
> Vikas
>
> On Apr 22, 2009, at 5:28 PM, Jacques Le Roux wrote:
>
>> From: "Vikas Mayur" <vi...@hotwaxmedia.com>
>> Hi Jacques,
>> This is part of Verify Pick feature added recently in trunk. This
>> commit is integral part of this feature and make this new feature
>> complete.
>> Now about the problem description:
>> With this commit, now it becomes necessary to do a Verify Pick before
>> Packing. Being said that, user will also not be able to create a
>> shipment until all the items of an order are verified.
>>
>> Thanks for clarification Vikas
>>
>> Btw, I did not understand your last sentence {quote} On the other  
>> hand
>> we could have a short period while such changes could be accepted...
>> {quote}. Does it mean that new features can also be ported back to  
>> the
>> release branch for few more days (like for example the https://issues.apache.org/jira/browse/OFBIZ-2225)?
>>
>> Not I don"t think so. It was a proposition related to this commit.  
>> Because I was not completly aware of the feature, but I felt that  
>> you were asking for something needed.
>>
>> Jacques
>>
>> Vikas
>>
>> On Apr 22, 2009, at 4:14 PM, Jacques Le Roux wrote:
>>
>>> Is this really a bug fix ? On the other hand we could have a  
>>> short  period while such changes could be accepted...
>>>
>>> Jacques
>>>
>>>
>>> From: <mo...@apache.org>
>>>> Author: mor
>>>> Date: Wed Apr 22 06:50:16 2009
>>>> New Revision: 767394
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=767394&view=rev
>>>> Log:
>>>> Facilitate packing screen to use verified orders from Verify  
>>>> Pick  screen by using existing shipment and invoice.
>>>> Patch from Akash Jain (reviewed and tested by Pranay Pandey),  
>>>> Part  of OFBIZ-2329 (https://issues.apache.org/jira/browse/OFBIZ-2329 
>>>> ).
>>>>
>>>> Note: I have done little modifications to the new labels part of   
>>>> this patch.
>>>>
>>>> This issue completes the functionality of the Verify Pick  
>>>> feature  added recently. I would like to port these changes to  
>>>> release09.04  later today
>>>> if I do not see any objections.
>>>>
>>>>
>>>>
>>>> Modified:
>>>> ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
>>>> ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
>>>> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/  
>>>> invoice/InvoiceServices.java
>>>> ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml
>>>> ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
>>>> ofbiz/trunk/applications/product/servicedef/services_shipment.xml
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/  
>>>> PackingServices.java
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/  
>>>> PackingSession.java
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/  
>>>> VerifyPickSession.java
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/  
>>>> VerifyPickSessionRow.java
>>>> ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/  
>>>> shipment/PackOrder.groovy
>>>> ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/  
>>>> shipment/VerifyPick.groovy
>>>> ofbiz/trunk/applications/product/webapp/facility/shipment/  
>>>> PackOrder.ftl
>>>>
>>>> Modified: ofbiz/trunk/applications/accounting/config/  
>>>> AccountingUiLabels.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/accounting/config/  
>>>> AccountingUiLabels.xml (original)
>>>> +++ ofbiz/trunk/applications/accounting/config/  
>>>> AccountingUiLabels.xml Wed Apr 22 06:50:16 2009
>>>> @@ -6390,6 +6390,9 @@
>>>>      <value xml:lang="th">à¸>ภ
>>>> ±à¸Ÿà¸«à¸”มีà¸oลà¸.à’^ภ  
>>>> à’,à¸>à¸£à’™à¸™à¸£à¸¡à¸>ระภ
>>>> ¢à¸¸à¸™à¸.à’Oà’fà¸Sà’?นดภ 
>>>> £à¸Sณระà’?à¸?ภ
>>>> ´à¸Tสณหรัà¸sรหภ
>>>> ±à¸ªà¸™à¸”ภ£à¸Sณระà’?à¸? 
>>>> ิà¸T [${invoiceId}]</value>
>>>>      <value xml:lang="zh">为å∂'票çπ-å∂·[$  
>>>> {invoiceId}]èZ·å≤-æ"¯ä»~åº"ç"¨æ-¶å?ºé"T</value>
>>>>  </property>
>>>> +    <property key="AccountingProblemGettingShipmentItemBilling">
>>>> +        <value xml:lang="en">Problem getting  
>>>> ShipmentItemBilling  records</value>
>>>> +    </property>
>>>>  <property key="AccountingProblemLookingUpOrderItemBilling">
>>>>      <value xml:lang="en">Problem looking up OrderItemBilling   
>>>> records for ${billFields}</value>
>>>>      <value xml:lang="es">Problema buscando Elemento de orden de   
>>>> facturaciÓn para ${billFields}</value>
>>>>
>>>> Modified: ofbiz/trunk/applications/accounting/servicedef/  
>>>> services_invoice.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/accounting/servicedef/  
>>>> services_invoice.xml (original)
>>>> +++ ofbiz/trunk/applications/accounting/servicedef/  
>>>> services_invoice.xml Wed Apr 22 06:50:16 2009
>>>> @@ -152,7 +152,7 @@
>>>>      </description>
>>>>      <attribute name="orderId" type="String" mode="IN"   
>>>> optional="false"/>
>>>>      <attribute name="billItems" type="List" mode="IN"   
>>>> optional="false"/>
>>>> -        <attribute name="invoiceId" type="String" mode="OUT"   
>>>> optional="true"/>
>>>> +        <attribute name="invoiceId" type="String" mode="INOUT"   
>>>> optional="true"/>
>>>>      <attribute name="invoiceTypeId" type="String" mode="OUT"   
>>>> optional="true"/>
>>>>  </service>
>>>>  <service name="createInvoiceFromReturn" engine="java"
>>>>
>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/  
>>>> accounting/invoice/InvoiceServices.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/  
>>>> invoice/InvoiceServices.java (original)
>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/  
>>>> invoice/InvoiceServices.java Wed Apr 22 06:50:16 2009
>>>> @@ -151,6 +151,7 @@
>>>>
>>>>      String orderId = (String) context.get("orderId");
>>>>      List billItems = (List) context.get("billItems");
>>>> +        String invoiceId = (String) context.get("invoiceId");
>>>>      boolean previousInvoiceFound = false;
>>>>
>>>>      if (billItems == null || billItems.size() == 0) {
>>>> @@ -241,6 +242,7 @@
>>>>          }
>>>>
>>>>          // create the invoice record
>>>> +            if (UtilValidate.isEmpty(invoiceId)) {
>>>>          Map createInvoiceContext = FastMap.newInstance();
>>>>          createInvoiceContext.put("partyId",   
>>>> billToCustomerPartyId);
>>>>          createInvoiceContext.put("partyIdFrom",   
>>>> billFromVendorPartyId);
>>>> @@ -260,7 +262,8 @@
>>>>          }
>>>>
>>>>          // call service, not direct entity op:   
>>>> delegator.create(invoice);
>>>> -            String invoiceId = (String)   
>>>> createInvoiceResult.get("invoiceId");
>>>> +            invoiceId = (String)   
>>>> createInvoiceResult.get("invoiceId");
>>>> +            }
>>>>
>>>>          // order roles to invoice roles
>>>>          List orderRoles = orderHeader.getRelated("OrderRole");
>>>> @@ -491,6 +494,8 @@
>>>>                  }
>>>>
>>>>                  if   
>>>> ("ItemIssuance".equals(currentValue.getEntityName())) {
>>>> +                    List<GenericValue> shipmentItemBillings =   
>>>> delegator.findByAnd("ShipmentItemBilling",  
>>>> UtilMisc.toMap("shipmentId", currentValue.get("shipmentId")));
>>>> +                    if   
>>>> (UtilValidate.isEmpty(shipmentItemBillings)) {
>>>>
>>>>                      // create the ShipmentItemBilling record
>>>>                      GenericValue shipmentItemBilling =   
>>>> delegator.makeValue("ShipmentItemBilling",  
>>>> UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId",   
>>>> invoiceItemSeqId));
>>>> @@ -498,6 +503,7 @@
>>>>                       
>>>> shipmentItemBilling.put("shipmentItemSeqId",   
>>>> currentValue.get("shipmentItemSeqId"));
>>>>                      shipmentItemBilling.create();
>>>>                  }
>>>> +                    }
>>>>
>>>>                  String parentInvoiceItemSeqId = invoiceItemSeqId;
>>>>                  // increment the counter
>>>> @@ -1538,8 +1544,22 @@
>>>>              Debug.logInfo(UtilProperties.getMessage(resource,   
>>>> "AccountingIgnoringAdditionalShipCharges",  
>>>> productStore.getAllFields(), locale), module);
>>>>          }
>>>>
>>>> +            String invoiceId = null;
>>>> +            List<GenericValue> shipmentItemBillings = null;
>>>> +            String shipmentId = (String) shipmentIds.get(0);
>>>> +            try {
>>>> +                shipmentItemBillings =   
>>>> delegator.findByAnd("ShipmentItemBilling",   
>>>> UtilMisc.toMap("shipmentId", shipmentId));
>>>> +            } catch ( GenericEntityException e ) {
>>>> +                String errMsg =   
>>>> UtilProperties.getMessage(resource,   
>>>> "AccountingProblemGettingShipmentItemBilling", locale);
>>>> +                return ServiceUtil.returnError(errMsg);
>>>> +            }
>>>> +            if (UtilValidate.isNotEmpty(shipmentItemBillings)) {
>>>> +                GenericValue shipmentItemBilling =   
>>>> EntityUtil.getFirst(shipmentItemBillings);
>>>> +                invoiceId =   
>>>> shipmentItemBilling.getString("invoiceId");
>>>> +            }
>>>> +
>>>>          // call the createInvoiceForOrder service for each order
>>>> -            Map serviceContext = UtilMisc.toMap("orderId",   
>>>> orderId, "billItems", toBillItems, "userLogin",  
>>>> context.get("userLogin"));
>>>> +            Map serviceContext = UtilMisc.toMap("orderId",   
>>>> orderId, "billItems", toBillItems, "invoiceId", invoiceId,  
>>>> "userLogin", context.get("userLogin"));
>>>>          try {
>>>>              Map result =   
>>>> dispatcher.runSync("createInvoiceForOrder", serviceContext);
>>>>              invoicesCreated.add(result.get("invoiceId"));
>>>>
>>>> Modified: ofbiz/trunk/applications/order/config/  
>>>> OrderErrorUiLabels.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml   
>>>> (original)
>>>> +++ ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml   
>>>> Wed Apr 22 06:50:16 2009
>>>> @@ -334,6 +334,9 @@
>>>>      <value xml:lang="th">ERROR : à¸,à’?ภà¸oภ
>>>> ´à¸"à¸zลดà¸" ! </value>
>>>>      <value xml:lang="zh">é"T误ïπs</value>
>>>>  </property>
>>>> +    <property key="OrderErrorAllItemsOfOrderAreAlreadyVerified">
>>>> +        <value xml:lang="en">ERROR: All items of order #$ 
>>>> {orderId}  are already verified</value>
>>>> +    </property>
>>>>  <property   
>>>> key="OrderErrorCallingCountProductQuantityOrderedService">
>>>>      <value xml:lang="en">Error calling   
>>>> countProductQuantityOrdered service : </value>
>>>>      <value xml:lang="es">Error al llamar al servicio   
>>>> countProductQuantityOrdered:</value>
>>>> @@ -685,6 +688,12 @@
>>>>      <value xml:lang="ru">‹z‹¨‹~‹'‹s‹∆:  
>>>> ‹Y‹≤‹·‹¸Ñ?‹¸Ñ∂ ‹·‹°‹º‹°‹·‹ °  
>>>> Ñ™ ‹º‹≤‹´‹≤‹π [${orderId}] ‹¸  
>>>> orderItemSeqId [${orderItemSeqId}]  ܸܵ  
>>>> ‹∏‹°‹’‹´‹µ‹∏Ñ<</value>
>>>>      <value xml:lang="th">ERROR : à¸,à’?ภà¸oภ
>>>> ´à¸"à¸zภ¥à¸”à¸" ! รดภ
>>>> ¢à¸™à¸”รสัà’^à¸?à¸<ืà’?ภ 
>>>> à¸"à’?วยภ£à¸«à¸±à¸ª [${orderId}]  
>>>> à’™à¸¥à¸°à¸£à¸«à¸±à¸ªà¸£à¸”à¸ 
>>>> ¢à¸™à¸”รสภ±à’^à¸?à¸<ืà’? 
>>>> ภ[${orderItemSeqId}] à’"มà’^à¸zà¸s</value>
>>>>  </property>
>>>> +    <property key="OrderErrorOrderNotApprovedForPacking">
>>>> +        <value xml:lang="en">ERROR: Order #${orderId} is not   
>>>> approved for packing</value>
>>>> +    </property>
>>>> +    <property key="OrderErrorOrderNotApprovedForPicking">
>>>> +        <value xml:lang="en">ERROR: Order #${orderId} is not   
>>>> approved for picking</value>
>>>> +    </property>
>>>>  <property key="OrderErrorOrderNotPurchaseOrder">
>>>>      <value xml:lang="en">Order ${orderId} is not a Purchase   
>>>> Order</value>
>>>>      <value xml:lang="es">El pedido ${orderId} no es un pedido  
>>>> de  compra</value>
>>>> @@ -693,6 +702,9 @@
>>>>      <value xml:lang="ru">‹-‹°‹º‹°‹· ${orderId}  
>>>> ‹∏‹µ  Ñ∂‹”‹»Ñ∂‹µÑ,Ñ™Ñ∂  
>>>> ‹·‹°‹ºÑf‹¿‹≤Ñ?‹∏Ñ<‹π  
>>>> ‹·‹°‹º‹°‹·‹≤‹π</value>
>>>>      <value xml:lang="th">à’fà¸sสัà’^à¸? 
>>>> à¸<ืà’?ภสภ´à¸Tà¸"à’?ด $ 
>>>> {orderId} à’"มà’^à’?à¸>à’?à¸Tรดภ
>>>> ¢à¸™à¸”ภ£à¸ªà¸±à’^à¸?à¸<ืà’? 
>>>> ภ</value>
>>>>  </property>
>>>> +    <property key="OrderErrorOrderNotVerifiedForPacking">
>>>> +        <value xml:lang="en">ERROR: Order #${orderId} is not   
>>>> verified for packing</value>
>>>> +    </property>
>>>>  <property key="OrderErrorOrderTypeLookupFailed">
>>>>      <value xml:lang="en">ERROR : OrderType lookup failed : </  
>>>> value>
>>>>      <value xml:lang="es">ERROR: La búsqueda ha fallado :</ 
>>>> value>
>>>>
>>>> Modified: ofbiz/trunk/applications/product/config/  
>>>> ProductErrorUiLabels.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/product/config/  
>>>> ProductErrorUiLabels.xml (original)
>>>> +++ ofbiz/trunk/applications/product/config/  
>>>> ProductErrorUiLabels.xml Wed Apr 22 06:50:16 2009
>>>> @@ -55,6 +55,9 @@
>>>>      <value xml:lang="en">Error Inventory Item Label Id Not   
>>>> Found</value>
>>>>      <value xml:lang="it">Errore riga etichetta inventario non   
>>>> trovata</value>
>>>>  </property>
>>>> +    <property   
>>>> key="ProductErrorNoShipGroupSequenceIdFoundCannotProcess">
>>>> +        <value xml:lang="en">ERROR: No ship group sequence Id   
>>>> found cannot process</value>
>>>> +    </property>
>>>>  <property key="ProductFeatureTypeIdMustContainsLettersAndDigits">
>>>>      <value xml:lang="de">Die Produktmerkmal Typ ID darf nur   
>>>> Buchstaben, Zahlen und _ enthalten. Bitte erneut eingeben.</value>
>>>>      <value xml:lang="en">The Product Feature TypeId must   
>>>> contains only letters, underscore and digits. Please re-enter</ 
>>>> value>
>>>>
>>>> Modified: ofbiz/trunk/applications/product/servicedef/  
>>>> services_shipment.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/product/servicedef/  
>>>> services_shipment.xml (original)
>>>> +++ ofbiz/trunk/applications/product/servicedef/  
>>>> services_shipment.xml Wed Apr 22 06:50:16 2009
>>>> @@ -562,6 +562,9 @@
>>>>          location="org.ofbiz.shipment.packing.PackingServices"   
>>>> invoke="completePack" auth="true">
>>>>      <description>Complete the packging set the shipment to   
>>>> PACKED</description>
>>>>      <attribute name="packingSession"   
>>>> type="org.ofbiz.shipment.packing.PackingSession" mode="IN"   
>>>> optional="false"/>
>>>> +        <attribute name="orderId" type="String" mode="IN"   
>>>> optional="true"/>
>>>> +        <attribute name="invoiceId" type="String" mode="IN"   
>>>> optional="true"/>
>>>> +        <attribute name="shipmentId" type="String" mode="IN"   
>>>> optional="true"/>
>>>>      <attribute name="handlingInstructions" type="String"   
>>>> mode="IN" optional="true"/>
>>>>      <attribute name="pickerPartyId" type="String" mode="IN"   
>>>> optional="true"/>
>>>>      <attribute name="additionalShippingCharge"  
>>>> type="BigDecimal"  mode="IN" optional="true"/>
>>>>
>>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/ 
>>>> shipment/ packing/PackingServices.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>> packing/ PackingServices.java (original)
>>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>> packing/ PackingServices.java Wed Apr 22 06:50:16 2009
>>>> @@ -271,11 +271,16 @@
>>>>      PackingSession session = (PackingSession)   
>>>> context.get("packingSession");
>>>>
>>>>      // set the instructions -- will clear out previous if now null
>>>> +        String orderId = (String) context.get("orderId");
>>>> +        String shipmentId = (String) context.get("shipmentId");
>>>> +        String invoiceId = (String) context.get("invoiceId");
>>>>      String instructions = (String)   
>>>> context.get("handlingInstructions");
>>>>      String pickerPartyId = (String) context.get("pickerPartyId");
>>>>      BigDecimal additionalShippingCharge = (BigDecimal)   
>>>> context.get("additionalShippingCharge");
>>>>      Map<String, String> packageWeights =   
>>>> UtilGenerics.checkMap(context.get("packageWeights"));
>>>>      String weightUomId = (String) context.get("weightUomId");
>>>> +        session.setShipmentId(shipmentId);
>>>> +        session.setInvoiceId(invoiceId);
>>>>      session.setHandlingInstructions(instructions);
>>>>      session.setPickerPartyId(pickerPartyId);
>>>>      session.setAdditionalShippingCharge(additionalShippingCharge);
>>>> @@ -287,9 +292,8 @@
>>>>          force = Boolean.FALSE;
>>>>      }
>>>>
>>>> -        String shipmentId = null;
>>>>      try {
>>>> -            shipmentId = session.complete(force);
>>>> +            shipmentId = session.complete(force, orderId);
>>>>      } catch (GeneralException e) {
>>>>          Debug.logError(e, module);
>>>>          return ServiceUtil.returnError(e.getMessage(),   
>>>> e.getMessageList());
>>>>
>>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/ 
>>>> shipment/ packing/PackingSession.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>> packing/ PackingSession.java (original)
>>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>> packing/ PackingSession.java Wed Apr 22 06:50:16 2009
>>>> @@ -60,6 +60,7 @@
>>>>  protected String shipmentId = null;
>>>>  protected String instructions = null;
>>>>  protected String weightUomId = null;
>>>> +    protected String invoiceId = null;
>>>>  protected BigDecimal additionalShippingCharge = null;
>>>>  protected Map<Integer, BigDecimal> packageWeights = null;
>>>>  protected List<PackingEvent> packEvents = null;
>>>> @@ -367,6 +368,18 @@
>>>>      return this.shipmentId;
>>>>  }
>>>>
>>>> +    public void setShipmentId(String shipmentId) {
>>>> +        this.shipmentId = shipmentId;
>>>> +    }
>>>> +
>>>> +    public String getInvoiceId() {
>>>> +        return this.invoiceId;
>>>> +    }
>>>> +
>>>> +    public void setInvoiceId(String invoiceId) {
>>>> +        this.invoiceId = invoiceId;
>>>> +    }
>>>> +
>>>>  public List<PackingSessionLine> getLines() {
>>>>      return this.packLines;
>>>>  }
>>>> @@ -613,7 +626,7 @@
>>>>      this.runEvents(PackingEvent.EVENT_CODE_CLEAR);
>>>>  }
>>>>
>>>> -    public String complete(boolean force) throws  
>>>> GeneralException {
>>>> +    public String complete(boolean force, String orderId)  
>>>> throws  GeneralException {
>>>>      // clear out empty lines
>>>>      // this.checkEmptyLines(); // removing, this seems to be   
>>>> causeing issues -  mja
>>>>
>>>> @@ -622,12 +635,16 @@
>>>>          return "EMPTY";
>>>>      }
>>>>
>>>> +        this.checkPackedQty(orderId);
>>>>      // check for errors
>>>>      this.checkReservations(force);
>>>>      // set the status to 0
>>>>      this.status = 0;
>>>>      // create the shipment
>>>> -        this.createShipment();
>>>> +        String shipmentId = this.getShipmentId();
>>>> +        if (UtilValidate.isEmpty(shipmentId)) {
>>>> +            this.createShipment();
>>>> +        }
>>>>      // create the packages
>>>>      this.createPackages();
>>>>      // issue the items
>>>> @@ -646,6 +663,27 @@
>>>>      return this.shipmentId;
>>>>  }
>>>>
>>>> +    protected void checkPackedQty(String orderId) throws   
>>>> GeneralException {
>>>> +        int counter = 0;
>>>> +        List<GenericValue> orderItems = null;
>>>> +        for (PackingSessionLine line : this.getLines()) {
>>>> +            orderItems =   
>>>> this.getDelegator().findByAnd("OrderItem",   
>>>> UtilMisc.toMap("orderId", orderId));
>>>> +            for (GenericValue orderItem : orderItems) {
>>>> +                if (orderId.equals(line.getOrderId())) {
>>>> +                    if   
>>>> ((orderItem 
>>>>  .get("orderItemSeqId")).equals(line.getOrderItemSeqId())) {
>>>> +                        BigDecimal packedQty =   
>>>> this.getPackedQuantity(line.getOrderId(),  
>>>> line.getOrderItemSeqId(), line.getShipGroupSeqId(),  
>>>> line.getProductId());
>>>> +                        if   
>>>> ((packedQty.compareTo(orderItem.getBigDecimal("quantity"))) ==  
>>>> 0 ) {
>>>> +                            counter++;
>>>> +                        }
>>>> +                    }
>>>> +                }
>>>> +            }
>>>> +        }
>>>> +        if (((this.getLines().size()) != (orderItems.size()))  
>>>> ||  (counter != (orderItems.size()))) {
>>>> +            throw new GeneralException("All order items are not   
>>>> packed");
>>>> +        }
>>>> +    }
>>>> +
>>>>  protected void checkReservations(boolean ignore) throws   
>>>> GeneralException {
>>>>      List<String> errors = FastList.newInstance();
>>>>      for (PackingSessionLine line: this.getLines()) {
>>>>
>>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/ 
>>>> shipment/ verify/VerifyPickSession.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>> verify/ VerifyPickSession.java (original)
>>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>> verify/ VerifyPickSession.java Wed Apr 22 06:50:16 2009
>>>> @@ -140,14 +140,11 @@
>>>>  }
>>>>
>>>>  public String complete(String orderId) throws GeneralException {
>>>> -        String shipmentId = null;
>>>>      String shipmentItemSeqId = null;
>>>>      String invoiceId = null;
>>>>      String invoiceItemSeqId = null;
>>>> -        for (VerifyPickSessionRow line:  
>>>> this.getPickRows(orderId)) {
>>>> -            shipmentId = this.createShipment(line);
>>>> -            break;
>>>> -        }
>>>> +        this.checkVerifiedQty(orderId);
>>>> +        String shipmentId =   
>>>> this.createShipment((this.getPickRows(orderId)).get(0));
>>>>      for (VerifyPickSessionRow line: this.getPickRows(orderId)) {
>>>>          shipmentItemSeqId =   
>>>> this.createShipmentItem(line,shipmentId);
>>>>          line.setShipmentItemSeqId(shipmentItemSeqId);
>>>> @@ -160,6 +157,24 @@
>>>>      return shipmentId;
>>>>  }
>>>>
>>>> +    protected void checkVerifiedQty(String orderId) throws   
>>>> GeneralException {
>>>> +        int counter = 0;
>>>> +        List<GenericValue> orderItems = null;
>>>> +        for (VerifyPickSessionRow line :   
>>>> this.getPickRows(orderId)) {
>>>> +            orderItems =   
>>>> this.getDelegator().findByAnd("OrderItem",   
>>>> UtilMisc.toMap("orderId", orderId));
>>>> +            for (GenericValue orderItem : orderItems) {
>>>> +                if   
>>>> ((orderItem.get("orderItemSeqId")).equals(line.getOrderSeqId())) {
>>>> +                    if  (((line .getReadyToVerifyQty  
>>>> ()).compareTo(orderItem.getBigDecimal("quantity"))) == 0 ) {
>>>> +                        counter++;
>>>> +                    }
>>>> +                }
>>>> +            }
>>>> +        }
>>>> +        if (counter != (orderItems.size())) {
>>>> +            throw new GeneralException("All order items are not   
>>>> verified");
>>>> +        }
>>>> +    }
>>>> +
>>>>  protected String createShipment(VerifyPickSessionRow line)   
>>>> throws GeneralException {
>>>>      Map<String, Object> newShipment = FastMap.newInstance();
>>>>      newShipment.put("originFacilityId", line.getFacilityId());
>>>> @@ -202,11 +217,17 @@
>>>>  }
>>>>
>>>>  protected String createInvoice(String orderId) throws   
>>>> GeneralException {
>>>> +        GenericDelegator delegator = this.getDelegator();
>>>>      Map createInvoiceContext = FastMap.newInstance();
>>>> -        createInvoiceContext.put("partyId",   
>>>> (EntityUtil.getFirst(this.getDelegator().findByAnd("OrderRole",  
>>>> UtilMisc.toMap("orderId", orderId, "roleTypeId",   
>>>> "BILL_TO_CUSTOMER")))).getString("partyId"));
>>>> -        createInvoiceContext.put("partyIdFrom",   
>>>> (EntityUtil.getFirst(this.getDelegator().findByAnd("OrderRole",  
>>>> UtilMisc.toMap("orderId", orderId, "roleTypeId",   
>>>> "BILL_FROM_VENDOR")))).getString("partyId"));
>>>> +        GenericValue orderHeader =   
>>>> delegator.findOne("OrderHeader", UtilMisc.toMap("orderId",   
>>>> orderId), false);
>>>> +        GenericValue billingAccount =   
>>>> orderHeader.getRelatedOne("BillingAccount");
>>>> +        String billingAccountId = billingAccount != null ?   
>>>> billingAccount.getString("billingAccountId") : null;
>>>> +        createInvoiceContext.put("partyId",   
>>>> (EntityUtil.getFirst(delegator.findByAnd("OrderRole",   
>>>> UtilMisc.toMap("orderId", orderId, "roleTypeId",   
>>>> "BILL_TO_CUSTOMER")))).getString("partyId"));
>>>> +        createInvoiceContext.put("partyIdFrom",   
>>>> (EntityUtil.getFirst(delegator.findByAnd("OrderRole",  
>>>> UtilMisc.toMap("orderId", orderId, "roleTypeId",   
>>>> "BILL_FROM_VENDOR")))).getString("partyId"));
>>>> +        createInvoiceContext.put("billingAccountId",   
>>>> billingAccountId);
>>>>      createInvoiceContext.put("invoiceTypeId", "SALES_INVOICE");
>>>>      createInvoiceContext.put("statusId", "INVOICE_IN_PROCESS");
>>>> +        createInvoiceContext.put("currencyUomId",   
>>>> orderHeader.getString("currencyUom"));
>>>>      createInvoiceContext.put("userLogin", this.getUserLogin());
>>>>      Map createInvoiceResult =   
>>>> this.getDispatcher().runSync("createInvoice",  
>>>> createInvoiceContext);
>>>>      if (ServiceUtil.isError(createInvoiceResult)) {
>>>>
>>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/ 
>>>> shipment/ verify/VerifyPickSessionRow.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>> verify/ VerifyPickSessionRow.java (original)
>>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>> verify/ VerifyPickSessionRow.java Wed Apr 22 06:50:16 2009
>>>> @@ -50,6 +50,7 @@
>>>>      this.orderItem = orderItem;
>>>>      this.rowItem = rowItem;
>>>>      this.shipmentItemSeqId = null;
>>>> +        this.invoiceItemSeqId = null;
>>>>  }
>>>>
>>>>  public String getOrderId() {
>>>>
>>>> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB- 
>>>> INF/ actions/shipment/PackOrder.groovy
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/  
>>>> actions/shipment/PackOrder.groovy (original)
>>>> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/  
>>>> actions/shipment/PackOrder.groovy Wed Apr 22 06:50:16 2009
>>>> @@ -115,6 +115,16 @@
>>>> context.shipGroupSeqId = shipGroupSeqId;
>>>> context.picklistBinId = picklistBinId;
>>>>
>>>> +shipment = EntityUtil.getFirst(delegator.findByAnd("Shipment",   
>>>> [primaryOrderId : orderId, statusId : "SHIPMENT_PICKED"]));
>>>> +context.shipment = shipment;
>>>> +
>>>> +if (shipment) {
>>>> +    invoice =   
>>>> EntityUtil.getFirst(delegator.findByAnd("ShipmentItemBilling",   
>>>> [shipmentId : shipment.shipmentId]));
>>>> +    context.invoice = invoice;
>>>> +} else {
>>>> +    context.invoice = null;
>>>> +}
>>>> +
>>>> // grab the order information
>>>> if (orderId) {
>>>>  orderHeader = delegator.findOne("OrderHeader", [orderId :   
>>>> orderId], false);
>>>> @@ -128,6 +138,7 @@
>>>>
>>>>      if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
>>>>          if (shipGroupSeqId) {
>>>> +            if (shipment) {
>>>>
>>>>              // Generate the shipment cost estimate for the ship   
>>>> group
>>>>              productStoreId = orh.getProductStoreId();
>>>> @@ -145,13 +156,16 @@
>>>>                  //context.put("itemInfos", shippableItemInfo);
>>>>              }
>>>>          } else {
>>>> -                request.setAttribute("errorMessageList", ['No  
>>>> ship  group sequence ID. Cannot process.']);
>>>> +                request.setAttribute("_ERROR_MESSAGE_",   
>>>> UtilProperties.getMessage("OrderErrorUiLabels",  
>>>> "OrderErrorOrderNotVerifiedForPacking", [orderId : orderId],   
>>>> locale));
>>>> +            }
>>>> +            } else {
>>>> +                request.setAttribute("_ERROR_MESSAGE_",   
>>>> UtilProperties.getMessage("ProductErrorUiLabels",  
>>>> "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>>>>          }
>>>>      } else {
>>>> -            request.setAttribute("errorMessageList", ["Order #"  
>>>> +  orderId + " is not approved for packing."]);
>>>> +            request.setAttribute("_ERROR_MESSAGE_",   
>>>> UtilProperties.getMessage("OrderErrorUiLabels",  
>>>> "OrderErrorOrderNotApprovedForPacking", [orderId : orderId],   
>>>> locale));
>>>>      }
>>>>  } else {
>>>> -        request.setAttribute("errorMessageList", ["Order #" +   
>>>> orderId + " cannot be found."]);
>>>> +        request.setAttribute("_ERROR_MESSAGE_",   
>>>> UtilProperties.getMessage("OrderErrorUiLabels",   
>>>> "OrderErrorOrderIdNotFound", [orderId : orderId], locale));
>>>>  }
>>>> }
>>>>
>>>>
>>>> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB- 
>>>> INF/ actions/shipment/VerifyPick.groovy
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/  
>>>> actions/shipment/VerifyPick.groovy (original)
>>>> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/  
>>>> actions/shipment/VerifyPick.groovy Wed Apr 22 06:50:16 2009
>>>> @@ -17,9 +17,10 @@
>>>> * under the License.
>>>> */
>>>>
>>>> -import org.ofbiz.order.order.OrderReadHelper;
>>>> +import org.ofbiz.base.util.UtilProperties;
>>>> import org.ofbiz.entity.util.EntityUtil;
>>>> import org.ofbiz.entity.condition.EntityCondition;
>>>> +import org.ofbiz.order.order.OrderReadHelper;
>>>> import org.ofbiz.shipment.verify.VerifyPickSession;
>>>>
>>>> verifyPickSession = session.getAttribute("verifyPickSession");
>>>> @@ -42,6 +43,7 @@
>>>>      invoiceIds =   
>>>> EntityUtil.getFieldListFromEntityList(shipmentItemBillingList,   
>>>> "invoiceId", true);
>>>>      if (invoiceIds) {
>>>>          context.invoiceIds = invoiceIds;
>>>> +            parameters.orderId = null;
>>>>      }
>>>>  }
>>>> }
>>>> @@ -90,14 +92,18 @@
>>>>          if (shipGroupSeqId) {
>>>>              productStoreId = orh.getProductStoreId();
>>>>              context.productStoreId = productStoreId;
>>>> +                shipments = delegator.findByAnd("Shipment",   
>>>> [primaryOrderId : orderId, statusId : "SHIPMENT_PICKED"]);
>>>> +                if (shipments) {
>>>> +                    request.setAttribute("_ERROR_MESSAGE_",   
>>>> UtilProperties.getMessage("OrderErrorUiLabels",  
>>>> "OrderErrorAllItemsOfOrderAreAlreadyVerified", [orderId :  
>>>> orderId],  locale));
>>>> +                }
>>>>          } else {
>>>> -                request.setAttribute("errorMessageList", ['No  
>>>> ship  group sequence ID. Cannot process.']);
>>>> +                request.setAttribute("_ERROR_MESSAGE_",   
>>>> UtilProperties.getMessage("ProductErrorUiLabels",  
>>>> "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>>>>          }
>>>>      } else {
>>>> -            request.setAttribute("errorMessageList", ["Order #"  
>>>> +  orderId + " is not approved for picking."]);
>>>> +            request.setAttribute("_ERROR_MESSAGE_",   
>>>> UtilProperties.getMessage("OrderErrorUiLabels",  
>>>> "OrderErrorOrderNotApprovedForPicking", [orderId : orderId],   
>>>> locale));
>>>>      }
>>>>  } else {
>>>> -        request.setAttribute("errorMessageList", ["Order #" +   
>>>> orderId + " cannot be found."]);
>>>> +        request.setAttribute("_ERROR_MESSAGE_",   
>>>> UtilProperties.getMessage("OrderErrorUiLabels",   
>>>> "OrderErrorOrderIdNotFound", [orderId : orderId], locale));
>>>>  }
>>>> }
>>>> context.verifyPickSession = verifyPickSession;
>>>> \ No newline at end of file
>>>>
>>>> Modified: ofbiz/trunk/applications/product/webapp/facility/ 
>>>> shipment/ PackOrder.ftl
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl?rev=767394&r1=767393&r2=767394&view=diff
>>>> = = = = = = = = =  
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/product/webapp/facility/shipment/  
>>>> PackOrder.ftl (original)
>>>> +++ ofbiz/trunk/applications/product/webapp/facility/shipment/  
>>>> PackOrder.ftl Wed Apr 22 06:50:16 2009
>>>> @@ -21,7 +21,7 @@
>>>>  <#assign showInput = requestParameters.showInput?default("Y")>
>>>>  <#assign hideGrid = requestParameters.hideGrid?default("N")>
>>>>
>>>> -    <#if (requestParameters.forceComplete?has_content && !  
>>>> shipmentId?has_content)>
>>>> +    <#if (requestParameters.forceComplete?has_content && !  
>>>> invoiceIds?has_content)>
>>>>      <#assign forceComplete = "true">
>>>>      <#assign showInput = "Y">
>>>>  </#if>
>>>> @@ -33,12 +33,11 @@
>>>>          <br class="clear"/>
>>>>      </div>
>>>>      <div class="screenlet-body">
>>>> -            <#if shipmentId?has_content>
>>>> +            <#if shipmentId?has_content && invoiceIds?exists &&   
>>>> invoiceIds?has_content>
>>>>              <div>
>>>>              ${uiLabelMap.CommonView} <a href="<@ofbizUrl>/  
>>>> PackingSlip.pdf?shipmentId=${shipmentId}</...@ofbizUrl>"  
>>>> target="_blank" class="buttontext">$  
>>>> {uiLabelMap.ProductPackingSlip}</a> ${uiLabelMap.CommonOr}
>>>>              ${uiLabelMap.CommonView} <a href="<@ofbizUrl>/  
>>>> ShipmentBarCode.pdf?shipmentId=${shipmentId}</...@ofbizUrl>"  
>>>> target="_blank" class="buttontext">${uiLabelMap.ProductBarcode}</ 
>>>> a>  ${uiLabelMap.CommonFor} ${uiLabelMap.ProductShipmentId} <a  
>>>> href="<@ofbizUrl>/ViewShipment?shipmentId=${shipmentId}</  
>>>> @ofbizUrl>" class="buttontext">${shipmentId}</a>
>>>>              </div>
>>>> -                <#if invoiceIds?exists && invoiceIds?has_content>
>>>>              <div>
>>>>                  <p>${uiLabelMap.AccountingInvoices}:</p>
>>>>                  <ul>
>>>> @@ -50,7 +49,6 @@
>>>>                  </#list>
>>>>                  </ul>
>>>>              </div>
>>>> -                </#if>
>>>>          </#if>
>>>>          <br/>
>>>>
>>>> @@ -115,6 +113,7 @@
>>>>      </div>
>>>>  </div>
>>>>
>>>> +    <#if ((shipment?has_content) && (shipment.shipmentId)?exists)>
>>>>  <#if showInput != "N" && ((orderHeader?exists && orderHeader?  
>>>> has_content))>
>>>>  <div class="screenlet">
>>>>      <div class="screenlet-title-bar">
>>>> @@ -329,6 +328,8 @@
>>>>                <input type="hidden" name="facilityId" value="$  
>>>> {facilityId?if_exists}"/>
>>>>                <input type="hidden" name="forceComplete" value="$  
>>>> {forceComplete?default('false')}"/>
>>>>                <input type="hidden" name="weightUomId" value="$  
>>>> {defaultWeightUomId}"/>
>>>> +                  <input type="hidden" name="shipmentId"  
>>>> value="$ {(shipment.shipmentId)?default("")}"/>
>>>> +                  <input type="hidden" name="invoiceId" value="$  
>>>> {(invoice.invoiceId)?default("")}"/>
>>>>                <input type="hidden" name="showInput" value="N"/>
>>>>                <hr>
>>>>                <table class="basic-table" cellpadding="2"   
>>>> cellspacing='0'>
>>>> @@ -490,6 +491,7 @@
>>>> </#if>
>>>> </div>
>>>> </div>
>>>> +  </#if>
>>>> <#else>
>>>> <h3>${uiLabelMap.ProductFacilityViewPermissionError}</h3>
>>>> </#if>
>>>> \ No newline at end of file
>>>>
>>>
>>>
>>
>>
>>
>


Re: svn commit: r767394 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/invoice/ order/config/ product/config/ product/servicedef/ product/src/org/ofbiz/shipment/packing/ product/src/org/ofbiz/s

Posted by Vikas Mayur <vi...@hotwaxmedia.com>.
Hi Jacques, Does that mean you agree with doing a back port for this  
commit to release09.04 branch? IMO, this can be part of release branch  
as described.

Vikas

On Apr 22, 2009, at 5:28 PM, Jacques Le Roux wrote:

> From: "Vikas Mayur" <vi...@hotwaxmedia.com>
> Hi Jacques,
> This is part of Verify Pick feature added recently in trunk. This
> commit is integral part of this feature and make this new feature
> complete.
> Now about the problem description:
> With this commit, now it becomes necessary to do a Verify Pick before
> Packing. Being said that, user will also not be able to create a
> shipment until all the items of an order are verified.
>
> Thanks for clarification Vikas
>
> Btw, I did not understand your last sentence {quote} On the other hand
> we could have a short period while such changes could be accepted...
> {quote}. Does it mean that new features can also be ported back to the
> release branch for few more days (like for example the https://issues.apache.org/jira/browse/OFBIZ-2225)?
>
> Not I don"t think so. It was a proposition related to this commit.  
> Because I was not completly aware of the feature, but I felt that  
> you were asking for something needed.
>
> Jacques
>
> Vikas
>
> On Apr 22, 2009, at 4:14 PM, Jacques Le Roux wrote:
>
>> Is this really a bug fix ? On the other hand we could have a short   
>> period while such changes could be accepted...
>>
>> Jacques
>>
>>
>> From: <mo...@apache.org>
>>> Author: mor
>>> Date: Wed Apr 22 06:50:16 2009
>>> New Revision: 767394
>>>
>>> URL: http://svn.apache.org/viewvc?rev=767394&view=rev
>>> Log:
>>> Facilitate packing screen to use verified orders from Verify Pick   
>>> screen by using existing shipment and invoice.
>>> Patch from Akash Jain (reviewed and tested by Pranay Pandey),  
>>> Part  of OFBIZ-2329 (https://issues.apache.org/jira/browse/OFBIZ-2329 
>>> ).
>>>
>>> Note: I have done little modifications to the new labels part of   
>>> this patch.
>>>
>>> This issue completes the functionality of the Verify Pick feature   
>>> added recently. I would like to port these changes to  
>>> release09.04  later today
>>> if I do not see any objections.
>>>
>>>
>>>
>>> Modified:
>>>  ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
>>>  ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
>>>  ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/  
>>> invoice/InvoiceServices.java
>>>  ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml
>>>  ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
>>>  ofbiz/trunk/applications/product/servicedef/services_shipment.xml
>>>  ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/  
>>> PackingServices.java
>>>  ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/  
>>> PackingSession.java
>>>  ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/  
>>> VerifyPickSession.java
>>>  ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/  
>>> VerifyPickSessionRow.java
>>>  ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/  
>>> shipment/PackOrder.groovy
>>>  ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/  
>>> shipment/VerifyPick.groovy
>>>  ofbiz/trunk/applications/product/webapp/facility/shipment/  
>>> PackOrder.ftl
>>>
>>> Modified: ofbiz/trunk/applications/accounting/config/  
>>> AccountingUiLabels.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/accounting/config/  
>>> AccountingUiLabels.xml (original)
>>> +++ ofbiz/trunk/applications/accounting/config/  
>>> AccountingUiLabels.xml Wed Apr 22 06:50:16 2009
>>> @@ -6390,6 +6390,9 @@
>>>       <value xml:lang="th">à¸>ภ
>>> ±à¸Ÿà¸«à¸”มีà¸oลà¸.à’^ภ  
>>> à’,à¸>à¸£à’™à¸™à¸£à¸¡à¸>ระภ
>>> ¢à¸¸à¸™à¸.à’Oà’fà¸Sà’?นดภ 
>>> £à¸Sณระà’?à¸?ภ
>>> ´à¸Tสณหรัà¸sรหภ
>>> ±à¸ªà¸™à¸”ภ£à¸Sณระà’?à¸?ภ
>>> ´à¸T [${invoiceId}]</value>
>>>       <value xml:lang="zh">为å∂'票çπ-å∂·[$  
>>> {invoiceId}]èZ·å≤-æ"¯ä»~åº"ç"¨æ-¶å?ºé"T</value>
>>>   </property>
>>> +    <property key="AccountingProblemGettingShipmentItemBilling">
>>> +        <value xml:lang="en">Problem getting ShipmentItemBilling   
>>> records</value>
>>> +    </property>
>>>   <property key="AccountingProblemLookingUpOrderItemBilling">
>>>       <value xml:lang="en">Problem looking up OrderItemBilling   
>>> records for ${billFields}</value>
>>>       <value xml:lang="es">Problema buscando Elemento de orden de   
>>> facturaciÓn para ${billFields}</value>
>>>
>>> Modified: ofbiz/trunk/applications/accounting/servicedef/  
>>> services_invoice.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/accounting/servicedef/  
>>> services_invoice.xml (original)
>>> +++ ofbiz/trunk/applications/accounting/servicedef/  
>>> services_invoice.xml Wed Apr 22 06:50:16 2009
>>> @@ -152,7 +152,7 @@
>>>       </description>
>>>       <attribute name="orderId" type="String" mode="IN"   
>>> optional="false"/>
>>>       <attribute name="billItems" type="List" mode="IN"   
>>> optional="false"/>
>>> -        <attribute name="invoiceId" type="String" mode="OUT"   
>>> optional="true"/>
>>> +        <attribute name="invoiceId" type="String" mode="INOUT"   
>>> optional="true"/>
>>>       <attribute name="invoiceTypeId" type="String" mode="OUT"   
>>> optional="true"/>
>>>   </service>
>>>   <service name="createInvoiceFromReturn" engine="java"
>>>
>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/  
>>> accounting/invoice/InvoiceServices.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/  
>>> invoice/InvoiceServices.java (original)
>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/  
>>> invoice/InvoiceServices.java Wed Apr 22 06:50:16 2009
>>> @@ -151,6 +151,7 @@
>>>
>>>       String orderId = (String) context.get("orderId");
>>>       List billItems = (List) context.get("billItems");
>>> +        String invoiceId = (String) context.get("invoiceId");
>>>       boolean previousInvoiceFound = false;
>>>
>>>       if (billItems == null || billItems.size() == 0) {
>>> @@ -241,6 +242,7 @@
>>>           }
>>>
>>>           // create the invoice record
>>> +            if (UtilValidate.isEmpty(invoiceId)) {
>>>           Map createInvoiceContext = FastMap.newInstance();
>>>           createInvoiceContext.put("partyId",   
>>> billToCustomerPartyId);
>>>           createInvoiceContext.put("partyIdFrom",   
>>> billFromVendorPartyId);
>>> @@ -260,7 +262,8 @@
>>>           }
>>>
>>>           // call service, not direct entity op:   
>>> delegator.create(invoice);
>>> -            String invoiceId = (String)   
>>> createInvoiceResult.get("invoiceId");
>>> +            invoiceId = (String)   
>>> createInvoiceResult.get("invoiceId");
>>> +            }
>>>
>>>           // order roles to invoice roles
>>>           List orderRoles = orderHeader.getRelated("OrderRole");
>>> @@ -491,6 +494,8 @@
>>>                   }
>>>
>>>                   if   
>>> ("ItemIssuance".equals(currentValue.getEntityName())) {
>>> +                    List<GenericValue> shipmentItemBillings =   
>>> delegator.findByAnd("ShipmentItemBilling",  
>>> UtilMisc.toMap("shipmentId", currentValue.get("shipmentId")));
>>> +                    if   
>>> (UtilValidate.isEmpty(shipmentItemBillings)) {
>>>
>>>                       // create the ShipmentItemBilling record
>>>                       GenericValue shipmentItemBilling =   
>>> delegator.makeValue("ShipmentItemBilling",  
>>> UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId",   
>>> invoiceItemSeqId));
>>> @@ -498,6 +503,7 @@
>>>                        
>>> shipmentItemBilling.put("shipmentItemSeqId",   
>>> currentValue.get("shipmentItemSeqId"));
>>>                       shipmentItemBilling.create();
>>>                   }
>>> +                    }
>>>
>>>                   String parentInvoiceItemSeqId = invoiceItemSeqId;
>>>                   // increment the counter
>>> @@ -1538,8 +1544,22 @@
>>>               Debug.logInfo(UtilProperties.getMessage(resource,   
>>> "AccountingIgnoringAdditionalShipCharges",  
>>> productStore.getAllFields(), locale), module);
>>>           }
>>>
>>> +            String invoiceId = null;
>>> +            List<GenericValue> shipmentItemBillings = null;
>>> +            String shipmentId = (String) shipmentIds.get(0);
>>> +            try {
>>> +                shipmentItemBillings =   
>>> delegator.findByAnd("ShipmentItemBilling",   
>>> UtilMisc.toMap("shipmentId", shipmentId));
>>> +            } catch ( GenericEntityException e ) {
>>> +                String errMsg =   
>>> UtilProperties.getMessage(resource,   
>>> "AccountingProblemGettingShipmentItemBilling", locale);
>>> +                return ServiceUtil.returnError(errMsg);
>>> +            }
>>> +            if (UtilValidate.isNotEmpty(shipmentItemBillings)) {
>>> +                GenericValue shipmentItemBilling =   
>>> EntityUtil.getFirst(shipmentItemBillings);
>>> +                invoiceId =   
>>> shipmentItemBilling.getString("invoiceId");
>>> +            }
>>> +
>>>           // call the createInvoiceForOrder service for each order
>>> -            Map serviceContext = UtilMisc.toMap("orderId",   
>>> orderId, "billItems", toBillItems, "userLogin",  
>>> context.get("userLogin"));
>>> +            Map serviceContext = UtilMisc.toMap("orderId",   
>>> orderId, "billItems", toBillItems, "invoiceId", invoiceId,  
>>> "userLogin", context.get("userLogin"));
>>>           try {
>>>               Map result =   
>>> dispatcher.runSync("createInvoiceForOrder", serviceContext);
>>>               invoicesCreated.add(result.get("invoiceId"));
>>>
>>> Modified: ofbiz/trunk/applications/order/config/  
>>> OrderErrorUiLabels.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml   
>>> (original)
>>> +++ ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml   
>>> Wed Apr 22 06:50:16 2009
>>> @@ -334,6 +334,9 @@
>>>       <value xml:lang="th">ERROR : à¸,à’?ภà¸oภ
>>> ´à¸"à¸zลดà¸" ! </value>
>>>       <value xml:lang="zh">é"T误ïπs</value>
>>>   </property>
>>> +    <property key="OrderErrorAllItemsOfOrderAreAlreadyVerified">
>>> +        <value xml:lang="en">ERROR: All items of order #$ 
>>> {orderId}  are already verified</value>
>>> +    </property>
>>>   <property   
>>> key="OrderErrorCallingCountProductQuantityOrderedService">
>>>       <value xml:lang="en">Error calling   
>>> countProductQuantityOrdered service : </value>
>>>       <value xml:lang="es">Error al llamar al servicio   
>>> countProductQuantityOrdered:</value>
>>> @@ -685,6 +688,12 @@
>>>       <value xml:lang="ru">‹z‹¨‹~‹'‹s‹∆:  
>>> ‹Y‹≤‹·‹¸Ñ?‹¸Ñ∂ ‹·‹°‹º‹°‹·‹ °  
>>> Ñ™ ‹º‹≤‹´‹≤‹π [${orderId}] ‹¸ orderItemSeqId  
>>> [${orderItemSeqId}]  ܸܵ  
>>> ‹∏‹°‹’‹´‹µ‹∏Ñ<</value>
>>>       <value xml:lang="th">ERROR : à¸,à’?ภà¸oภ
>>> ´à¸"à¸zภ¥à¸”à¸" ! รดภ
>>> ¢à¸™à¸”รสัà’^à¸?à¸<ืà’?ภ 
>>> à¸"à’?วยภ£à¸«à¸±à¸ª [${orderId}]  
>>> à’™à¸¥à¸°à¸£à¸«à¸±à¸ªà¸£à¸”à¸ 
>>> ¢à¸™à¸”รสภ±à’^à¸?à¸<ืà’?ภ 
>>> [${orderItemSeqId}] à’"มà’^à¸zà¸s</value>
>>>   </property>
>>> +    <property key="OrderErrorOrderNotApprovedForPacking">
>>> +        <value xml:lang="en">ERROR: Order #${orderId} is not   
>>> approved for packing</value>
>>> +    </property>
>>> +    <property key="OrderErrorOrderNotApprovedForPicking">
>>> +        <value xml:lang="en">ERROR: Order #${orderId} is not   
>>> approved for picking</value>
>>> +    </property>
>>>   <property key="OrderErrorOrderNotPurchaseOrder">
>>>       <value xml:lang="en">Order ${orderId} is not a Purchase   
>>> Order</value>
>>>       <value xml:lang="es">El pedido ${orderId} no es un pedido  
>>> de  compra</value>
>>> @@ -693,6 +702,9 @@
>>>       <value xml:lang="ru">‹-‹°‹º‹°‹· ${orderId}  
>>> ‹∏‹µ  Ñ∂‹”‹»Ñ∂‹µÑ,Ñ™Ñ∂  
>>> ‹·‹°‹ºÑf‹¿‹≤Ñ?‹∏Ñ<‹π  
>>> ‹·‹°‹º‹°‹·‹≤‹π</value>
>>>       <value xml:lang="th">à’fà¸sสัà’^à¸? 
>>> à¸<ืà’?ภสภ´à¸Tà¸"à’?ด $ 
>>> {orderId} à’"มà’^à’?à¸>à’?à¸Tรดภ
>>> ¢à¸™à¸”ภ£à¸ªà¸±à’^à¸?à¸<ืà’?ภ 
>>> </value>
>>>   </property>
>>> +    <property key="OrderErrorOrderNotVerifiedForPacking">
>>> +        <value xml:lang="en">ERROR: Order #${orderId} is not   
>>> verified for packing</value>
>>> +    </property>
>>>   <property key="OrderErrorOrderTypeLookupFailed">
>>>       <value xml:lang="en">ERROR : OrderType lookup failed : </  
>>> value>
>>>       <value xml:lang="es">ERROR: La búsqueda ha fallado :</ 
>>> value>
>>>
>>> Modified: ofbiz/trunk/applications/product/config/  
>>> ProductErrorUiLabels.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/config/  
>>> ProductErrorUiLabels.xml (original)
>>> +++ ofbiz/trunk/applications/product/config/  
>>> ProductErrorUiLabels.xml Wed Apr 22 06:50:16 2009
>>> @@ -55,6 +55,9 @@
>>>       <value xml:lang="en">Error Inventory Item Label Id Not   
>>> Found</value>
>>>       <value xml:lang="it">Errore riga etichetta inventario non   
>>> trovata</value>
>>>   </property>
>>> +    <property   
>>> key="ProductErrorNoShipGroupSequenceIdFoundCannotProcess">
>>> +        <value xml:lang="en">ERROR: No ship group sequence Id   
>>> found cannot process</value>
>>> +    </property>
>>>   <property key="ProductFeatureTypeIdMustContainsLettersAndDigits">
>>>       <value xml:lang="de">Die Produktmerkmal Typ ID darf nur   
>>> Buchstaben, Zahlen und _ enthalten. Bitte erneut eingeben.</value>
>>>       <value xml:lang="en">The Product Feature TypeId must   
>>> contains only letters, underscore and digits. Please re-enter</ 
>>> value>
>>>
>>> Modified: ofbiz/trunk/applications/product/servicedef/  
>>> services_shipment.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/servicedef/  
>>> services_shipment.xml (original)
>>> +++ ofbiz/trunk/applications/product/servicedef/  
>>> services_shipment.xml Wed Apr 22 06:50:16 2009
>>> @@ -562,6 +562,9 @@
>>>           location="org.ofbiz.shipment.packing.PackingServices"   
>>> invoke="completePack" auth="true">
>>>       <description>Complete the packging set the shipment to   
>>> PACKED</description>
>>>       <attribute name="packingSession"   
>>> type="org.ofbiz.shipment.packing.PackingSession" mode="IN"   
>>> optional="false"/>
>>> +        <attribute name="orderId" type="String" mode="IN"   
>>> optional="true"/>
>>> +        <attribute name="invoiceId" type="String" mode="IN"   
>>> optional="true"/>
>>> +        <attribute name="shipmentId" type="String" mode="IN"   
>>> optional="true"/>
>>>       <attribute name="handlingInstructions" type="String"   
>>> mode="IN" optional="true"/>
>>>       <attribute name="pickerPartyId" type="String" mode="IN"   
>>> optional="true"/>
>>>       <attribute name="additionalShippingCharge"  
>>> type="BigDecimal"  mode="IN" optional="true"/>
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/  
>>> packing/PackingServices.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> packing/ PackingServices.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> packing/ PackingServices.java Wed Apr 22 06:50:16 2009
>>> @@ -271,11 +271,16 @@
>>>       PackingSession session = (PackingSession)   
>>> context.get("packingSession");
>>>
>>>       // set the instructions -- will clear out previous if now null
>>> +        String orderId = (String) context.get("orderId");
>>> +        String shipmentId = (String) context.get("shipmentId");
>>> +        String invoiceId = (String) context.get("invoiceId");
>>>       String instructions = (String)   
>>> context.get("handlingInstructions");
>>>       String pickerPartyId = (String) context.get("pickerPartyId");
>>>       BigDecimal additionalShippingCharge = (BigDecimal)   
>>> context.get("additionalShippingCharge");
>>>       Map<String, String> packageWeights =   
>>> UtilGenerics.checkMap(context.get("packageWeights"));
>>>       String weightUomId = (String) context.get("weightUomId");
>>> +        session.setShipmentId(shipmentId);
>>> +        session.setInvoiceId(invoiceId);
>>>       session.setHandlingInstructions(instructions);
>>>       session.setPickerPartyId(pickerPartyId);
>>>       session.setAdditionalShippingCharge(additionalShippingCharge);
>>> @@ -287,9 +292,8 @@
>>>           force = Boolean.FALSE;
>>>       }
>>>
>>> -        String shipmentId = null;
>>>       try {
>>> -            shipmentId = session.complete(force);
>>> +            shipmentId = session.complete(force, orderId);
>>>       } catch (GeneralException e) {
>>>           Debug.logError(e, module);
>>>           return ServiceUtil.returnError(e.getMessage(),   
>>> e.getMessageList());
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/  
>>> packing/PackingSession.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> packing/ PackingSession.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> packing/ PackingSession.java Wed Apr 22 06:50:16 2009
>>> @@ -60,6 +60,7 @@
>>>   protected String shipmentId = null;
>>>   protected String instructions = null;
>>>   protected String weightUomId = null;
>>> +    protected String invoiceId = null;
>>>   protected BigDecimal additionalShippingCharge = null;
>>>   protected Map<Integer, BigDecimal> packageWeights = null;
>>>   protected List<PackingEvent> packEvents = null;
>>> @@ -367,6 +368,18 @@
>>>       return this.shipmentId;
>>>   }
>>>
>>> +    public void setShipmentId(String shipmentId) {
>>> +        this.shipmentId = shipmentId;
>>> +    }
>>> +
>>> +    public String getInvoiceId() {
>>> +        return this.invoiceId;
>>> +    }
>>> +
>>> +    public void setInvoiceId(String invoiceId) {
>>> +        this.invoiceId = invoiceId;
>>> +    }
>>> +
>>>   public List<PackingSessionLine> getLines() {
>>>       return this.packLines;
>>>   }
>>> @@ -613,7 +626,7 @@
>>>       this.runEvents(PackingEvent.EVENT_CODE_CLEAR);
>>>   }
>>>
>>> -    public String complete(boolean force) throws GeneralException {
>>> +    public String complete(boolean force, String orderId) throws   
>>> GeneralException {
>>>       // clear out empty lines
>>>       // this.checkEmptyLines(); // removing, this seems to be   
>>> causeing issues -  mja
>>>
>>> @@ -622,12 +635,16 @@
>>>           return "EMPTY";
>>>       }
>>>
>>> +        this.checkPackedQty(orderId);
>>>       // check for errors
>>>       this.checkReservations(force);
>>>       // set the status to 0
>>>       this.status = 0;
>>>       // create the shipment
>>> -        this.createShipment();
>>> +        String shipmentId = this.getShipmentId();
>>> +        if (UtilValidate.isEmpty(shipmentId)) {
>>> +            this.createShipment();
>>> +        }
>>>       // create the packages
>>>       this.createPackages();
>>>       // issue the items
>>> @@ -646,6 +663,27 @@
>>>       return this.shipmentId;
>>>   }
>>>
>>> +    protected void checkPackedQty(String orderId) throws   
>>> GeneralException {
>>> +        int counter = 0;
>>> +        List<GenericValue> orderItems = null;
>>> +        for (PackingSessionLine line : this.getLines()) {
>>> +            orderItems =   
>>> this.getDelegator().findByAnd("OrderItem",   
>>> UtilMisc.toMap("orderId", orderId));
>>> +            for (GenericValue orderItem : orderItems) {
>>> +                if (orderId.equals(line.getOrderId())) {
>>> +                    if   
>>> ((orderItem 
>>>  .get("orderItemSeqId")).equals(line.getOrderItemSeqId())) {
>>> +                        BigDecimal packedQty =   
>>> this.getPackedQuantity(line.getOrderId(),  
>>> line.getOrderItemSeqId(), line.getShipGroupSeqId(),  
>>> line.getProductId());
>>> +                        if   
>>> ((packedQty.compareTo(orderItem.getBigDecimal("quantity"))) == 0 ) {
>>> +                            counter++;
>>> +                        }
>>> +                    }
>>> +                }
>>> +            }
>>> +        }
>>> +        if (((this.getLines().size()) != (orderItems.size())) ||   
>>> (counter != (orderItems.size()))) {
>>> +            throw new GeneralException("All order items are not   
>>> packed");
>>> +        }
>>> +    }
>>> +
>>>   protected void checkReservations(boolean ignore) throws   
>>> GeneralException {
>>>       List<String> errors = FastList.newInstance();
>>>       for (PackingSessionLine line: this.getLines()) {
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/  
>>> verify/VerifyPickSession.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> verify/ VerifyPickSession.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> verify/ VerifyPickSession.java Wed Apr 22 06:50:16 2009
>>> @@ -140,14 +140,11 @@
>>>   }
>>>
>>>   public String complete(String orderId) throws GeneralException {
>>> -        String shipmentId = null;
>>>       String shipmentItemSeqId = null;
>>>       String invoiceId = null;
>>>       String invoiceItemSeqId = null;
>>> -        for (VerifyPickSessionRow line:  
>>> this.getPickRows(orderId)) {
>>> -            shipmentId = this.createShipment(line);
>>> -            break;
>>> -        }
>>> +        this.checkVerifiedQty(orderId);
>>> +        String shipmentId =   
>>> this.createShipment((this.getPickRows(orderId)).get(0));
>>>       for (VerifyPickSessionRow line: this.getPickRows(orderId)) {
>>>           shipmentItemSeqId =   
>>> this.createShipmentItem(line,shipmentId);
>>>           line.setShipmentItemSeqId(shipmentItemSeqId);
>>> @@ -160,6 +157,24 @@
>>>       return shipmentId;
>>>   }
>>>
>>> +    protected void checkVerifiedQty(String orderId) throws   
>>> GeneralException {
>>> +        int counter = 0;
>>> +        List<GenericValue> orderItems = null;
>>> +        for (VerifyPickSessionRow line :   
>>> this.getPickRows(orderId)) {
>>> +            orderItems =   
>>> this.getDelegator().findByAnd("OrderItem",   
>>> UtilMisc.toMap("orderId", orderId));
>>> +            for (GenericValue orderItem : orderItems) {
>>> +                if   
>>> ((orderItem.get("orderItemSeqId")).equals(line.getOrderSeqId())) {
>>> +                    if  (((line .getReadyToVerifyQty  
>>> ()).compareTo(orderItem.getBigDecimal("quantity"))) == 0 ) {
>>> +                        counter++;
>>> +                    }
>>> +                }
>>> +            }
>>> +        }
>>> +        if (counter != (orderItems.size())) {
>>> +            throw new GeneralException("All order items are not   
>>> verified");
>>> +        }
>>> +    }
>>> +
>>>   protected String createShipment(VerifyPickSessionRow line)   
>>> throws GeneralException {
>>>       Map<String, Object> newShipment = FastMap.newInstance();
>>>       newShipment.put("originFacilityId", line.getFacilityId());
>>> @@ -202,11 +217,17 @@
>>>   }
>>>
>>>   protected String createInvoice(String orderId) throws   
>>> GeneralException {
>>> +        GenericDelegator delegator = this.getDelegator();
>>>       Map createInvoiceContext = FastMap.newInstance();
>>> -        createInvoiceContext.put("partyId",   
>>> (EntityUtil.getFirst(this.getDelegator().findByAnd("OrderRole",  
>>> UtilMisc.toMap("orderId", orderId, "roleTypeId",   
>>> "BILL_TO_CUSTOMER")))).getString("partyId"));
>>> -        createInvoiceContext.put("partyIdFrom",   
>>> (EntityUtil.getFirst(this.getDelegator().findByAnd("OrderRole",  
>>> UtilMisc.toMap("orderId", orderId, "roleTypeId",   
>>> "BILL_FROM_VENDOR")))).getString("partyId"));
>>> +        GenericValue orderHeader =   
>>> delegator.findOne("OrderHeader", UtilMisc.toMap("orderId",   
>>> orderId), false);
>>> +        GenericValue billingAccount =   
>>> orderHeader.getRelatedOne("BillingAccount");
>>> +        String billingAccountId = billingAccount != null ?   
>>> billingAccount.getString("billingAccountId") : null;
>>> +        createInvoiceContext.put("partyId",   
>>> (EntityUtil.getFirst(delegator.findByAnd("OrderRole",   
>>> UtilMisc.toMap("orderId", orderId, "roleTypeId",   
>>> "BILL_TO_CUSTOMER")))).getString("partyId"));
>>> +        createInvoiceContext.put("partyIdFrom",   
>>> (EntityUtil.getFirst(delegator.findByAnd("OrderRole",  
>>> UtilMisc.toMap("orderId", orderId, "roleTypeId",   
>>> "BILL_FROM_VENDOR")))).getString("partyId"));
>>> +        createInvoiceContext.put("billingAccountId",   
>>> billingAccountId);
>>>       createInvoiceContext.put("invoiceTypeId", "SALES_INVOICE");
>>>       createInvoiceContext.put("statusId", "INVOICE_IN_PROCESS");
>>> +        createInvoiceContext.put("currencyUomId",   
>>> orderHeader.getString("currencyUom"));
>>>       createInvoiceContext.put("userLogin", this.getUserLogin());
>>>       Map createInvoiceResult =   
>>> this.getDispatcher().runSync("createInvoice", createInvoiceContext);
>>>       if (ServiceUtil.isError(createInvoiceResult)) {
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/  
>>> verify/VerifyPickSessionRow.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> verify/ VerifyPickSessionRow.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> verify/ VerifyPickSessionRow.java Wed Apr 22 06:50:16 2009
>>> @@ -50,6 +50,7 @@
>>>       this.orderItem = orderItem;
>>>       this.rowItem = rowItem;
>>>       this.shipmentItemSeqId = null;
>>> +        this.invoiceItemSeqId = null;
>>>   }
>>>
>>>   public String getOrderId() {
>>>
>>> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB- 
>>> INF/ actions/shipment/PackOrder.groovy
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/  
>>> actions/shipment/PackOrder.groovy (original)
>>> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/  
>>> actions/shipment/PackOrder.groovy Wed Apr 22 06:50:16 2009
>>> @@ -115,6 +115,16 @@
>>> context.shipGroupSeqId = shipGroupSeqId;
>>> context.picklistBinId = picklistBinId;
>>>
>>> +shipment = EntityUtil.getFirst(delegator.findByAnd("Shipment",   
>>> [primaryOrderId : orderId, statusId : "SHIPMENT_PICKED"]));
>>> +context.shipment = shipment;
>>> +
>>> +if (shipment) {
>>> +    invoice =   
>>> EntityUtil.getFirst(delegator.findByAnd("ShipmentItemBilling",   
>>> [shipmentId : shipment.shipmentId]));
>>> +    context.invoice = invoice;
>>> +} else {
>>> +    context.invoice = null;
>>> +}
>>> +
>>> // grab the order information
>>> if (orderId) {
>>>   orderHeader = delegator.findOne("OrderHeader", [orderId :   
>>> orderId], false);
>>> @@ -128,6 +138,7 @@
>>>
>>>       if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
>>>           if (shipGroupSeqId) {
>>> +            if (shipment) {
>>>
>>>               // Generate the shipment cost estimate for the ship   
>>> group
>>>               productStoreId = orh.getProductStoreId();
>>> @@ -145,13 +156,16 @@
>>>                   //context.put("itemInfos", shippableItemInfo);
>>>               }
>>>           } else {
>>> -                request.setAttribute("errorMessageList", ['No  
>>> ship  group sequence ID. Cannot process.']);
>>> +                request.setAttribute("_ERROR_MESSAGE_",   
>>> UtilProperties.getMessage("OrderErrorUiLabels",  
>>> "OrderErrorOrderNotVerifiedForPacking", [orderId : orderId],   
>>> locale));
>>> +            }
>>> +            } else {
>>> +                request.setAttribute("_ERROR_MESSAGE_",   
>>> UtilProperties.getMessage("ProductErrorUiLabels",  
>>> "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>>>           }
>>>       } else {
>>> -            request.setAttribute("errorMessageList", ["Order #"  
>>> +  orderId + " is not approved for packing."]);
>>> +            request.setAttribute("_ERROR_MESSAGE_",   
>>> UtilProperties.getMessage("OrderErrorUiLabels",  
>>> "OrderErrorOrderNotApprovedForPacking", [orderId : orderId],   
>>> locale));
>>>       }
>>>   } else {
>>> -        request.setAttribute("errorMessageList", ["Order #" +   
>>> orderId + " cannot be found."]);
>>> +        request.setAttribute("_ERROR_MESSAGE_",   
>>> UtilProperties.getMessage("OrderErrorUiLabels",   
>>> "OrderErrorOrderIdNotFound", [orderId : orderId], locale));
>>>   }
>>> }
>>>
>>>
>>> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB- 
>>> INF/ actions/shipment/VerifyPick.groovy
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/  
>>> actions/shipment/VerifyPick.groovy (original)
>>> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/  
>>> actions/shipment/VerifyPick.groovy Wed Apr 22 06:50:16 2009
>>> @@ -17,9 +17,10 @@
>>> * under the License.
>>> */
>>>
>>> -import org.ofbiz.order.order.OrderReadHelper;
>>> +import org.ofbiz.base.util.UtilProperties;
>>> import org.ofbiz.entity.util.EntityUtil;
>>> import org.ofbiz.entity.condition.EntityCondition;
>>> +import org.ofbiz.order.order.OrderReadHelper;
>>> import org.ofbiz.shipment.verify.VerifyPickSession;
>>>
>>> verifyPickSession = session.getAttribute("verifyPickSession");
>>> @@ -42,6 +43,7 @@
>>>       invoiceIds =   
>>> EntityUtil.getFieldListFromEntityList(shipmentItemBillingList,   
>>> "invoiceId", true);
>>>       if (invoiceIds) {
>>>           context.invoiceIds = invoiceIds;
>>> +            parameters.orderId = null;
>>>       }
>>>   }
>>> }
>>> @@ -90,14 +92,18 @@
>>>           if (shipGroupSeqId) {
>>>               productStoreId = orh.getProductStoreId();
>>>               context.productStoreId = productStoreId;
>>> +                shipments = delegator.findByAnd("Shipment",   
>>> [primaryOrderId : orderId, statusId : "SHIPMENT_PICKED"]);
>>> +                if (shipments) {
>>> +                    request.setAttribute("_ERROR_MESSAGE_",   
>>> UtilProperties.getMessage("OrderErrorUiLabels",  
>>> "OrderErrorAllItemsOfOrderAreAlreadyVerified", [orderId :  
>>> orderId],  locale));
>>> +                }
>>>           } else {
>>> -                request.setAttribute("errorMessageList", ['No  
>>> ship  group sequence ID. Cannot process.']);
>>> +                request.setAttribute("_ERROR_MESSAGE_",   
>>> UtilProperties.getMessage("ProductErrorUiLabels",  
>>> "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>>>           }
>>>       } else {
>>> -            request.setAttribute("errorMessageList", ["Order #"  
>>> +  orderId + " is not approved for picking."]);
>>> +            request.setAttribute("_ERROR_MESSAGE_",   
>>> UtilProperties.getMessage("OrderErrorUiLabels",  
>>> "OrderErrorOrderNotApprovedForPicking", [orderId : orderId],   
>>> locale));
>>>       }
>>>   } else {
>>> -        request.setAttribute("errorMessageList", ["Order #" +   
>>> orderId + " cannot be found."]);
>>> +        request.setAttribute("_ERROR_MESSAGE_",   
>>> UtilProperties.getMessage("OrderErrorUiLabels",   
>>> "OrderErrorOrderIdNotFound", [orderId : orderId], locale));
>>>   }
>>> }
>>> context.verifyPickSession = verifyPickSession;
>>> \ No newline at end of file
>>>
>>> Modified: ofbiz/trunk/applications/product/webapp/facility/ 
>>> shipment/ PackOrder.ftl
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl?rev=767394&r1=767393&r2=767394&view=diff
>>> = = = = = = = = =  
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/webapp/facility/shipment/  
>>> PackOrder.ftl (original)
>>> +++ ofbiz/trunk/applications/product/webapp/facility/shipment/  
>>> PackOrder.ftl Wed Apr 22 06:50:16 2009
>>> @@ -21,7 +21,7 @@
>>>   <#assign showInput = requestParameters.showInput?default("Y")>
>>>   <#assign hideGrid = requestParameters.hideGrid?default("N")>
>>>
>>> -    <#if (requestParameters.forceComplete?has_content && !  
>>> shipmentId?has_content)>
>>> +    <#if (requestParameters.forceComplete?has_content && !  
>>> invoiceIds?has_content)>
>>>       <#assign forceComplete = "true">
>>>       <#assign showInput = "Y">
>>>   </#if>
>>> @@ -33,12 +33,11 @@
>>>           <br class="clear"/>
>>>       </div>
>>>       <div class="screenlet-body">
>>> -            <#if shipmentId?has_content>
>>> +            <#if shipmentId?has_content && invoiceIds?exists &&   
>>> invoiceIds?has_content>
>>>               <div>
>>>               ${uiLabelMap.CommonView} <a href="<@ofbizUrl>/  
>>> PackingSlip.pdf?shipmentId=${shipmentId}</...@ofbizUrl>"  
>>> target="_blank" class="buttontext">$  
>>> {uiLabelMap.ProductPackingSlip}</a> ${uiLabelMap.CommonOr}
>>>               ${uiLabelMap.CommonView} <a href="<@ofbizUrl>/  
>>> ShipmentBarCode.pdf?shipmentId=${shipmentId}</...@ofbizUrl>"  
>>> target="_blank" class="buttontext">${uiLabelMap.ProductBarcode}</ 
>>> a>  ${uiLabelMap.CommonFor} ${uiLabelMap.ProductShipmentId} <a  
>>> href="<@ofbizUrl>/ViewShipment?shipmentId=${shipmentId}</  
>>> @ofbizUrl>" class="buttontext">${shipmentId}</a>
>>>               </div>
>>> -                <#if invoiceIds?exists && invoiceIds?has_content>
>>>               <div>
>>>                   <p>${uiLabelMap.AccountingInvoices}:</p>
>>>                   <ul>
>>> @@ -50,7 +49,6 @@
>>>                   </#list>
>>>                   </ul>
>>>               </div>
>>> -                </#if>
>>>           </#if>
>>>           <br/>
>>>
>>> @@ -115,6 +113,7 @@
>>>       </div>
>>>   </div>
>>>
>>> +    <#if ((shipment?has_content) && (shipment.shipmentId)?exists)>
>>>   <#if showInput != "N" && ((orderHeader?exists && orderHeader?  
>>> has_content))>
>>>   <div class="screenlet">
>>>       <div class="screenlet-title-bar">
>>> @@ -329,6 +328,8 @@
>>>                 <input type="hidden" name="facilityId" value="$  
>>> {facilityId?if_exists}"/>
>>>                 <input type="hidden" name="forceComplete" value="$  
>>> {forceComplete?default('false')}"/>
>>>                 <input type="hidden" name="weightUomId" value="$  
>>> {defaultWeightUomId}"/>
>>> +                  <input type="hidden" name="shipmentId" value="$  
>>> {(shipment.shipmentId)?default("")}"/>
>>> +                  <input type="hidden" name="invoiceId" value="$  
>>> {(invoice.invoiceId)?default("")}"/>
>>>                 <input type="hidden" name="showInput" value="N"/>
>>>                 <hr>
>>>                 <table class="basic-table" cellpadding="2"   
>>> cellspacing='0'>
>>> @@ -490,6 +491,7 @@
>>> </#if>
>>> </div>
>>> </div>
>>> +  </#if>
>>> <#else>
>>> <h3>${uiLabelMap.ProductFacilityViewPermissionError}</h3>
>>> </#if>
>>> \ No newline at end of file
>>>
>>
>>
>
>
>


Re: svn commit: r767394 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/invoice/ order/config/ product/config/ product/servicedef/ product/src/org/ofbiz/shipment/packing/ product/src/org/ofbiz/s

Posted by Jacques Le Roux <ja...@les7arts.com>.
From: "Vikas Mayur" <vi...@hotwaxmedia.com>
Hi Jacques,
This is part of Verify Pick feature added recently in trunk. This
commit is integral part of this feature and make this new feature
complete.
Now about the problem description:
With this commit, now it becomes necessary to do a Verify Pick before
Packing. Being said that, user will also not be able to create a
shipment until all the items of an order are verified.

Thanks for clarification Vikas

Btw, I did not understand your last sentence {quote} On the other hand
we could have a short period while such changes could be accepted...
{quote}. Does it mean that new features can also be ported back to the
release branch for few more days (like for example the https://issues.apache.org/jira/browse/OFBIZ-2225)?

Not I don"t think so. It was a proposition related to this commit. Because I was not completly aware of the feature, but I felt that 
you were asking for something needed.

Jacques

Vikas

On Apr 22, 2009, at 4:14 PM, Jacques Le Roux wrote:

> Is this really a bug fix ? On the other hand we could have a short  period while such changes could be accepted...
>
> Jacques
>
>
> From: <mo...@apache.org>
>> Author: mor
>> Date: Wed Apr 22 06:50:16 2009
>> New Revision: 767394
>>
>> URL: http://svn.apache.org/viewvc?rev=767394&view=rev
>> Log:
>> Facilitate packing screen to use verified orders from Verify Pick  screen by using existing shipment and invoice.
>> Patch from Akash Jain (reviewed and tested by Pranay Pandey), Part  of OFBIZ-2329 
>> (https://issues.apache.org/jira/browse/OFBIZ-2329).
>>
>> Note: I have done little modifications to the new labels part of  this patch.
>>
>> This issue completes the functionality of the Verify Pick feature  added recently. I would like to port these changes to 
>> release09.04  later today
>> if I do not see any objections.
>>
>>
>>
>> Modified:
>>   ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
>>   ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
>>   ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ invoice/InvoiceServices.java
>>   ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml
>>   ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
>>   ofbiz/trunk/applications/product/servicedef/services_shipment.xml
>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ PackingServices.java
>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ PackingSession.java
>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ VerifyPickSession.java
>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ VerifyPickSessionRow.java
>>   ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/ shipment/PackOrder.groovy
>>   ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/ shipment/VerifyPick.groovy
>>   ofbiz/trunk/applications/product/webapp/facility/shipment/ PackOrder.ftl
>>
>> Modified: ofbiz/trunk/applications/accounting/config/ AccountingUiLabels.xml
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/accounting/config/ AccountingUiLabels.xml (original)
>> +++ ofbiz/trunk/applications/accounting/config/ AccountingUiLabels.xml Wed Apr 22 06:50:16 2009
>> @@ -6390,6 +6390,9 @@
>>        <value xml:lang="th">à¸>ัญหามีà¸oลà¸.à¹^ภ à¹,à¸>รแกรมà¸>ระยุกà¸.à¹Oà¹fà¸Sà¹?กาภ
>> £à¸Sำระà¹?à¸?ิà¸Tสำหรัà¸sรหัสกาภ£à¸Sำระà¹?à¸?ิà¸T [${invoiceId}]</value>
>>        <value xml:lang="zh">为å'票ç¼-号[$ {invoiceId}]èZ·å¾-æ"¯ä»~åº"ç"¨æ-¶å?ºé"T</value>
>>    </property>
>> +    <property key="AccountingProblemGettingShipmentItemBilling">
>> +        <value xml:lang="en">Problem getting ShipmentItemBilling  records</value>
>> +    </property>
>>    <property key="AccountingProblemLookingUpOrderItemBilling">
>>        <value xml:lang="en">Problem looking up OrderItemBilling  records for ${billFields}</value>
>>        <value xml:lang="es">Problema buscando Elemento de orden de  facturación para ${billFields}</value>
>>
>> Modified: ofbiz/trunk/applications/accounting/servicedef/ services_invoice.xml
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/accounting/servicedef/ services_invoice.xml (original)
>> +++ ofbiz/trunk/applications/accounting/servicedef/ services_invoice.xml Wed Apr 22 06:50:16 2009
>> @@ -152,7 +152,7 @@
>>        </description>
>>        <attribute name="orderId" type="String" mode="IN"  optional="false"/>
>>        <attribute name="billItems" type="List" mode="IN"  optional="false"/>
>> -        <attribute name="invoiceId" type="String" mode="OUT"  optional="true"/>
>> +        <attribute name="invoiceId" type="String" mode="INOUT"  optional="true"/>
>>        <attribute name="invoiceTypeId" type="String" mode="OUT"  optional="true"/>
>>    </service>
>>    <service name="createInvoiceFromReturn" engine="java"
>>
>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/ accounting/invoice/InvoiceServices.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ invoice/InvoiceServices.java (original)
>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ invoice/InvoiceServices.java Wed Apr 22 06:50:16 2009
>> @@ -151,6 +151,7 @@
>>
>>        String orderId = (String) context.get("orderId");
>>        List billItems = (List) context.get("billItems");
>> +        String invoiceId = (String) context.get("invoiceId");
>>        boolean previousInvoiceFound = false;
>>
>>        if (billItems == null || billItems.size() == 0) {
>> @@ -241,6 +242,7 @@
>>            }
>>
>>            // create the invoice record
>> +            if (UtilValidate.isEmpty(invoiceId)) {
>>            Map createInvoiceContext = FastMap.newInstance();
>>            createInvoiceContext.put("partyId",  billToCustomerPartyId);
>>            createInvoiceContext.put("partyIdFrom",  billFromVendorPartyId);
>> @@ -260,7 +262,8 @@
>>            }
>>
>>            // call service, not direct entity op:  delegator.create(invoice);
>> -            String invoiceId = (String)  createInvoiceResult.get("invoiceId");
>> +            invoiceId = (String)  createInvoiceResult.get("invoiceId");
>> +            }
>>
>>            // order roles to invoice roles
>>            List orderRoles = orderHeader.getRelated("OrderRole");
>> @@ -491,6 +494,8 @@
>>                    }
>>
>>                    if  ("ItemIssuance".equals(currentValue.getEntityName())) {
>> +                    List<GenericValue> shipmentItemBillings =  delegator.findByAnd("ShipmentItemBilling", 
>> UtilMisc.toMap("shipmentId", currentValue.get("shipmentId")));
>> +                    if  (UtilValidate.isEmpty(shipmentItemBillings)) {
>>
>>                        // create the ShipmentItemBilling record
>>                        GenericValue shipmentItemBilling =  delegator.makeValue("ShipmentItemBilling", 
>> UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId",  invoiceItemSeqId));
>> @@ -498,6 +503,7 @@
>>                        shipmentItemBilling.put("shipmentItemSeqId",  currentValue.get("shipmentItemSeqId"));
>>                        shipmentItemBilling.create();
>>                    }
>> +                    }
>>
>>                    String parentInvoiceItemSeqId = invoiceItemSeqId;
>>                    // increment the counter
>> @@ -1538,8 +1544,22 @@
>>                Debug.logInfo(UtilProperties.getMessage(resource,  "AccountingIgnoringAdditionalShipCharges", 
>> productStore.getAllFields(), locale), module);
>>            }
>>
>> +            String invoiceId = null;
>> +            List<GenericValue> shipmentItemBillings = null;
>> +            String shipmentId = (String) shipmentIds.get(0);
>> +            try {
>> +                shipmentItemBillings =  delegator.findByAnd("ShipmentItemBilling",  UtilMisc.toMap("shipmentId", shipmentId));
>> +            } catch ( GenericEntityException e ) {
>> +                String errMsg =  UtilProperties.getMessage(resource,  "AccountingProblemGettingShipmentItemBilling", locale);
>> +                return ServiceUtil.returnError(errMsg);
>> +            }
>> +            if (UtilValidate.isNotEmpty(shipmentItemBillings)) {
>> +                GenericValue shipmentItemBilling =  EntityUtil.getFirst(shipmentItemBillings);
>> +                invoiceId =  shipmentItemBilling.getString("invoiceId");
>> +            }
>> +
>>            // call the createInvoiceForOrder service for each order
>> -            Map serviceContext = UtilMisc.toMap("orderId",  orderId, "billItems", toBillItems, "userLogin", 
>> context.get("userLogin"));
>> +            Map serviceContext = UtilMisc.toMap("orderId",  orderId, "billItems", toBillItems, "invoiceId", invoiceId, 
>> "userLogin", context.get("userLogin"));
>>            try {
>>                Map result =  dispatcher.runSync("createInvoiceForOrder", serviceContext);
>>                invoicesCreated.add(result.get("invoiceId"));
>>
>> Modified: ofbiz/trunk/applications/order/config/ OrderErrorUiLabels.xml
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml  (original)
>> +++ ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml  Wed Apr 22 06:50:16 2009
>> @@ -334,6 +334,9 @@
>>        <value xml:lang="th">ERROR : à¸,à¹?ภà¸oิà¸"à¸zลาà¸" ! </value>
>>        <value xml:lang="zh">é"T误ï¼s</value>
>>    </property>
>> +    <property key="OrderErrorAllItemsOfOrderAreAlreadyVerified">
>> +        <value xml:lang="en">ERROR: All items of order #${orderId}  are already verified</value>
>> +    </property>
>>    <property  key="OrderErrorCallingCountProductQuantityOrderedService">
>>        <value xml:lang="en">Error calling  countProductQuantityOrdered service : </value>
>>        <value xml:lang="es">Error al llamar al servicio  countProductQuantityOrdered:</value>
>> @@ -685,6 +688,12 @@
>>        <value xml:lang="ru">ÐzШÐ~Ð'ÐsА: ÐYозиÑ?ия заказР° с кодом [${orderId}] и orderItemSeqId 
>> [${orderItemSeqId}]  не найденÑ<</value>
>>        <value xml:lang="th">ERROR : à¸,à¹?ภà¸oิà¸"à¸zภ¥à¸²à¸" ! รายการสัà¹^à¸?à¸<ืà¹?ภà¸"à¹?วยภ
>> £à¸«à¸±à¸ª [${orderId}] และรหัสรายการสภ±à¹^à¸?à¸<ืà¹?ภ[${orderItemSeqId}] 
>> à¹"มà¹^à¸zà¸s</value>
>>    </property>
>> +    <property key="OrderErrorOrderNotApprovedForPacking">
>> +        <value xml:lang="en">ERROR: Order #${orderId} is not  approved for packing</value>
>> +    </property>
>> +    <property key="OrderErrorOrderNotApprovedForPicking">
>> +        <value xml:lang="en">ERROR: Order #${orderId} is not  approved for picking</value>
>> +    </property>
>>    <property key="OrderErrorOrderNotPurchaseOrder">
>>        <value xml:lang="en">Order ${orderId} is not a Purchase  Order</value>
>>        <value xml:lang="es">El pedido ${orderId} no es un pedido de  compra</value>
>> @@ -693,6 +702,9 @@
>>        <value xml:lang="ru">Ð-аказ ${orderId} не  являеÑ,ся закÑfпоÑ?нÑ<м заказом</value>
>>        <value xml:lang="th">à¹fà¸sสัà¹^à¸?à¸<ืà¹?ภสภ´à¸Tà¸"à¹?า ${orderId} à¹"มà¹^à¹?à¸>à¹?à¸Tรายกาภ
>> £à¸ªà¸±à¹^à¸?à¸<ืà¹?ภ</value>
>>    </property>
>> +    <property key="OrderErrorOrderNotVerifiedForPacking">
>> +        <value xml:lang="en">ERROR: Order #${orderId} is not  verified for packing</value>
>> +    </property>
>>    <property key="OrderErrorOrderTypeLookupFailed">
>>        <value xml:lang="en">ERROR : OrderType lookup failed : </ value>
>>        <value xml:lang="es">ERROR: La búsqueda ha fallado :</value>
>>
>> Modified: ofbiz/trunk/applications/product/config/ ProductErrorUiLabels.xml
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/product/config/ ProductErrorUiLabels.xml (original)
>> +++ ofbiz/trunk/applications/product/config/ ProductErrorUiLabels.xml Wed Apr 22 06:50:16 2009
>> @@ -55,6 +55,9 @@
>>        <value xml:lang="en">Error Inventory Item Label Id Not  Found</value>
>>        <value xml:lang="it">Errore riga etichetta inventario non  trovata</value>
>>    </property>
>> +    <property  key="ProductErrorNoShipGroupSequenceIdFoundCannotProcess">
>> +        <value xml:lang="en">ERROR: No ship group sequence Id  found cannot process</value>
>> +    </property>
>>    <property key="ProductFeatureTypeIdMustContainsLettersAndDigits">
>>        <value xml:lang="de">Die Produktmerkmal Typ ID darf nur  Buchstaben, Zahlen und _ enthalten. Bitte erneut 
>> eingeben.</value>
>>        <value xml:lang="en">The Product Feature TypeId must  contains only letters, underscore and digits. Please 
>> re-enter</value>
>>
>> Modified: ofbiz/trunk/applications/product/servicedef/ services_shipment.xml
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/product/servicedef/ services_shipment.xml (original)
>> +++ ofbiz/trunk/applications/product/servicedef/ services_shipment.xml Wed Apr 22 06:50:16 2009
>> @@ -562,6 +562,9 @@
>>            location="org.ofbiz.shipment.packing.PackingServices"  invoke="completePack" auth="true">
>>        <description>Complete the packging set the shipment to  PACKED</description>
>>        <attribute name="packingSession"  type="org.ofbiz.shipment.packing.PackingSession" mode="IN"  optional="false"/>
>> +        <attribute name="orderId" type="String" mode="IN"  optional="true"/>
>> +        <attribute name="invoiceId" type="String" mode="IN"  optional="true"/>
>> +        <attribute name="shipmentId" type="String" mode="IN"  optional="true"/>
>>        <attribute name="handlingInstructions" type="String"  mode="IN" optional="true"/>
>>        <attribute name="pickerPartyId" type="String" mode="IN"  optional="true"/>
>>        <attribute name="additionalShippingCharge" type="BigDecimal"  mode="IN" optional="true"/>
>>
>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ packing/PackingServices.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ PackingServices.java (original)
>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ PackingServices.java Wed Apr 22 06:50:16 2009
>> @@ -271,11 +271,16 @@
>>        PackingSession session = (PackingSession)  context.get("packingSession");
>>
>>        // set the instructions -- will clear out previous if now null
>> +        String orderId = (String) context.get("orderId");
>> +        String shipmentId = (String) context.get("shipmentId");
>> +        String invoiceId = (String) context.get("invoiceId");
>>        String instructions = (String)  context.get("handlingInstructions");
>>        String pickerPartyId = (String) context.get("pickerPartyId");
>>        BigDecimal additionalShippingCharge = (BigDecimal)  context.get("additionalShippingCharge");
>>        Map<String, String> packageWeights =  UtilGenerics.checkMap(context.get("packageWeights"));
>>        String weightUomId = (String) context.get("weightUomId");
>> +        session.setShipmentId(shipmentId);
>> +        session.setInvoiceId(invoiceId);
>>        session.setHandlingInstructions(instructions);
>>        session.setPickerPartyId(pickerPartyId);
>>        session.setAdditionalShippingCharge(additionalShippingCharge);
>> @@ -287,9 +292,8 @@
>>            force = Boolean.FALSE;
>>        }
>>
>> -        String shipmentId = null;
>>        try {
>> -            shipmentId = session.complete(force);
>> +            shipmentId = session.complete(force, orderId);
>>        } catch (GeneralException e) {
>>            Debug.logError(e, module);
>>            return ServiceUtil.returnError(e.getMessage(),  e.getMessageList());
>>
>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ packing/PackingSession.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ PackingSession.java (original)
>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ PackingSession.java Wed Apr 22 06:50:16 2009
>> @@ -60,6 +60,7 @@
>>    protected String shipmentId = null;
>>    protected String instructions = null;
>>    protected String weightUomId = null;
>> +    protected String invoiceId = null;
>>    protected BigDecimal additionalShippingCharge = null;
>>    protected Map<Integer, BigDecimal> packageWeights = null;
>>    protected List<PackingEvent> packEvents = null;
>> @@ -367,6 +368,18 @@
>>        return this.shipmentId;
>>    }
>>
>> +    public void setShipmentId(String shipmentId) {
>> +        this.shipmentId = shipmentId;
>> +    }
>> +
>> +    public String getInvoiceId() {
>> +        return this.invoiceId;
>> +    }
>> +
>> +    public void setInvoiceId(String invoiceId) {
>> +        this.invoiceId = invoiceId;
>> +    }
>> +
>>    public List<PackingSessionLine> getLines() {
>>        return this.packLines;
>>    }
>> @@ -613,7 +626,7 @@
>>        this.runEvents(PackingEvent.EVENT_CODE_CLEAR);
>>    }
>>
>> -    public String complete(boolean force) throws GeneralException {
>> +    public String complete(boolean force, String orderId) throws  GeneralException {
>>        // clear out empty lines
>>        // this.checkEmptyLines(); // removing, this seems to be  causeing issues -  mja
>>
>> @@ -622,12 +635,16 @@
>>            return "EMPTY";
>>        }
>>
>> +        this.checkPackedQty(orderId);
>>        // check for errors
>>        this.checkReservations(force);
>>        // set the status to 0
>>        this.status = 0;
>>        // create the shipment
>> -        this.createShipment();
>> +        String shipmentId = this.getShipmentId();
>> +        if (UtilValidate.isEmpty(shipmentId)) {
>> +            this.createShipment();
>> +        }
>>        // create the packages
>>        this.createPackages();
>>        // issue the items
>> @@ -646,6 +663,27 @@
>>        return this.shipmentId;
>>    }
>>
>> +    protected void checkPackedQty(String orderId) throws  GeneralException {
>> +        int counter = 0;
>> +        List<GenericValue> orderItems = null;
>> +        for (PackingSessionLine line : this.getLines()) {
>> +            orderItems =  this.getDelegator().findByAnd("OrderItem",  UtilMisc.toMap("orderId", orderId));
>> +            for (GenericValue orderItem : orderItems) {
>> +                if (orderId.equals(line.getOrderId())) {
>> +                    if  ((orderItem .get("orderItemSeqId")).equals(line.getOrderItemSeqId())) {
>> +                        BigDecimal packedQty =  this.getPackedQuantity(line.getOrderId(), line.getOrderItemSeqId(), 
>> line.getShipGroupSeqId(), line.getProductId());
>> +                        if  ((packedQty.compareTo(orderItem.getBigDecimal("quantity"))) == 0 ) {
>> +                            counter++;
>> +                        }
>> +                    }
>> +                }
>> +            }
>> +        }
>> +        if (((this.getLines().size()) != (orderItems.size())) ||  (counter != (orderItems.size()))) {
>> +            throw new GeneralException("All order items are not  packed");
>> +        }
>> +    }
>> +
>>    protected void checkReservations(boolean ignore) throws  GeneralException {
>>        List<String> errors = FastList.newInstance();
>>        for (PackingSessionLine line: this.getLines()) {
>>
>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ verify/VerifyPickSession.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ VerifyPickSession.java (original)
>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ VerifyPickSession.java Wed Apr 22 06:50:16 2009
>> @@ -140,14 +140,11 @@
>>    }
>>
>>    public String complete(String orderId) throws GeneralException {
>> -        String shipmentId = null;
>>        String shipmentItemSeqId = null;
>>        String invoiceId = null;
>>        String invoiceItemSeqId = null;
>> -        for (VerifyPickSessionRow line: this.getPickRows(orderId)) {
>> -            shipmentId = this.createShipment(line);
>> -            break;
>> -        }
>> +        this.checkVerifiedQty(orderId);
>> +        String shipmentId =  this.createShipment((this.getPickRows(orderId)).get(0));
>>        for (VerifyPickSessionRow line: this.getPickRows(orderId)) {
>>            shipmentItemSeqId =  this.createShipmentItem(line,shipmentId);
>>            line.setShipmentItemSeqId(shipmentItemSeqId);
>> @@ -160,6 +157,24 @@
>>        return shipmentId;
>>    }
>>
>> +    protected void checkVerifiedQty(String orderId) throws  GeneralException {
>> +        int counter = 0;
>> +        List<GenericValue> orderItems = null;
>> +        for (VerifyPickSessionRow line :  this.getPickRows(orderId)) {
>> +            orderItems =  this.getDelegator().findByAnd("OrderItem",  UtilMisc.toMap("orderId", orderId));
>> +            for (GenericValue orderItem : orderItems) {
>> +                if  ((orderItem.get("orderItemSeqId")).equals(line.getOrderSeqId())) {
>> +                    if  (((line .getReadyToVerifyQty ()).compareTo(orderItem.getBigDecimal("quantity"))) == 0 ) {
>> +                        counter++;
>> +                    }
>> +                }
>> +            }
>> +        }
>> +        if (counter != (orderItems.size())) {
>> +            throw new GeneralException("All order items are not  verified");
>> +        }
>> +    }
>> +
>>    protected String createShipment(VerifyPickSessionRow line)  throws GeneralException {
>>        Map<String, Object> newShipment = FastMap.newInstance();
>>        newShipment.put("originFacilityId", line.getFacilityId());
>> @@ -202,11 +217,17 @@
>>    }
>>
>>    protected String createInvoice(String orderId) throws  GeneralException {
>> +        GenericDelegator delegator = this.getDelegator();
>>        Map createInvoiceContext = FastMap.newInstance();
>> -        createInvoiceContext.put("partyId",  (EntityUtil.getFirst(this.getDelegator().findByAnd("OrderRole", 
>> UtilMisc.toMap("orderId", orderId, "roleTypeId",  "BILL_TO_CUSTOMER")))).getString("partyId"));
>> -        createInvoiceContext.put("partyIdFrom",  (EntityUtil.getFirst(this.getDelegator().findByAnd("OrderRole", 
>> UtilMisc.toMap("orderId", orderId, "roleTypeId",  "BILL_FROM_VENDOR")))).getString("partyId"));
>> +        GenericValue orderHeader =  delegator.findOne("OrderHeader", UtilMisc.toMap("orderId",  orderId), false);
>> +        GenericValue billingAccount =  orderHeader.getRelatedOne("BillingAccount");
>> +        String billingAccountId = billingAccount != null ?  billingAccount.getString("billingAccountId") : null;
>> +        createInvoiceContext.put("partyId",  (EntityUtil.getFirst(delegator.findByAnd("OrderRole",  UtilMisc.toMap("orderId", 
>> orderId, "roleTypeId",  "BILL_TO_CUSTOMER")))).getString("partyId"));
>> +        createInvoiceContext.put("partyIdFrom",  (EntityUtil.getFirst(delegator.findByAnd("OrderRole", 
>> UtilMisc.toMap("orderId", orderId, "roleTypeId",  "BILL_FROM_VENDOR")))).getString("partyId"));
>> +        createInvoiceContext.put("billingAccountId",  billingAccountId);
>>        createInvoiceContext.put("invoiceTypeId", "SALES_INVOICE");
>>        createInvoiceContext.put("statusId", "INVOICE_IN_PROCESS");
>> +        createInvoiceContext.put("currencyUomId",  orderHeader.getString("currencyUom"));
>>        createInvoiceContext.put("userLogin", this.getUserLogin());
>>        Map createInvoiceResult =  this.getDispatcher().runSync("createInvoice", createInvoiceContext);
>>        if (ServiceUtil.isError(createInvoiceResult)) {
>>
>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ verify/VerifyPickSessionRow.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ VerifyPickSessionRow.java (original)
>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ VerifyPickSessionRow.java Wed Apr 22 06:50:16 2009
>> @@ -50,6 +50,7 @@
>>        this.orderItem = orderItem;
>>        this.rowItem = rowItem;
>>        this.shipmentItemSeqId = null;
>> +        this.invoiceItemSeqId = null;
>>    }
>>
>>    public String getOrderId() {
>>
>> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ actions/shipment/PackOrder.groovy
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ actions/shipment/PackOrder.groovy (original)
>> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ actions/shipment/PackOrder.groovy Wed Apr 22 06:50:16 2009
>> @@ -115,6 +115,16 @@
>> context.shipGroupSeqId = shipGroupSeqId;
>> context.picklistBinId = picklistBinId;
>>
>> +shipment = EntityUtil.getFirst(delegator.findByAnd("Shipment",  [primaryOrderId : orderId, statusId : "SHIPMENT_PICKED"]));
>> +context.shipment = shipment;
>> +
>> +if (shipment) {
>> +    invoice =  EntityUtil.getFirst(delegator.findByAnd("ShipmentItemBilling",  [shipmentId : shipment.shipmentId]));
>> +    context.invoice = invoice;
>> +} else {
>> +    context.invoice = null;
>> +}
>> +
>> // grab the order information
>> if (orderId) {
>>    orderHeader = delegator.findOne("OrderHeader", [orderId :  orderId], false);
>> @@ -128,6 +138,7 @@
>>
>>        if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
>>            if (shipGroupSeqId) {
>> +            if (shipment) {
>>
>>                // Generate the shipment cost estimate for the ship  group
>>                productStoreId = orh.getProductStoreId();
>> @@ -145,13 +156,16 @@
>>                    //context.put("itemInfos", shippableItemInfo);
>>                }
>>            } else {
>> -                request.setAttribute("errorMessageList", ['No ship  group sequence ID. Cannot process.']);
>> +                request.setAttribute("_ERROR_MESSAGE_",  UtilProperties.getMessage("OrderErrorUiLabels", 
>> "OrderErrorOrderNotVerifiedForPacking", [orderId : orderId],  locale));
>> +            }
>> +            } else {
>> +                request.setAttribute("_ERROR_MESSAGE_",  UtilProperties.getMessage("ProductErrorUiLabels", 
>> "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>>            }
>>        } else {
>> -            request.setAttribute("errorMessageList", ["Order #" +  orderId + " is not approved for packing."]);
>> +            request.setAttribute("_ERROR_MESSAGE_",  UtilProperties.getMessage("OrderErrorUiLabels", 
>> "OrderErrorOrderNotApprovedForPacking", [orderId : orderId],  locale));
>>        }
>>    } else {
>> -        request.setAttribute("errorMessageList", ["Order #" +  orderId + " cannot be found."]);
>> +        request.setAttribute("_ERROR_MESSAGE_",  UtilProperties.getMessage("OrderErrorUiLabels",  "OrderErrorOrderIdNotFound", 
>> [orderId : orderId], locale));
>>    }
>> }
>>
>>
>> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ actions/shipment/VerifyPick.groovy
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ actions/shipment/VerifyPick.groovy (original)
>> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ actions/shipment/VerifyPick.groovy Wed Apr 22 06:50:16 2009
>> @@ -17,9 +17,10 @@
>> * under the License.
>> */
>>
>> -import org.ofbiz.order.order.OrderReadHelper;
>> +import org.ofbiz.base.util.UtilProperties;
>> import org.ofbiz.entity.util.EntityUtil;
>> import org.ofbiz.entity.condition.EntityCondition;
>> +import org.ofbiz.order.order.OrderReadHelper;
>> import org.ofbiz.shipment.verify.VerifyPickSession;
>>
>> verifyPickSession = session.getAttribute("verifyPickSession");
>> @@ -42,6 +43,7 @@
>>        invoiceIds =  EntityUtil.getFieldListFromEntityList(shipmentItemBillingList,  "invoiceId", true);
>>        if (invoiceIds) {
>>            context.invoiceIds = invoiceIds;
>> +            parameters.orderId = null;
>>        }
>>    }
>> }
>> @@ -90,14 +92,18 @@
>>            if (shipGroupSeqId) {
>>                productStoreId = orh.getProductStoreId();
>>                context.productStoreId = productStoreId;
>> +                shipments = delegator.findByAnd("Shipment",  [primaryOrderId : orderId, statusId : "SHIPMENT_PICKED"]);
>> +                if (shipments) {
>> +                    request.setAttribute("_ERROR_MESSAGE_",  UtilProperties.getMessage("OrderErrorUiLabels", 
>> "OrderErrorAllItemsOfOrderAreAlreadyVerified", [orderId : orderId],  locale));
>> +                }
>>            } else {
>> -                request.setAttribute("errorMessageList", ['No ship  group sequence ID. Cannot process.']);
>> +                request.setAttribute("_ERROR_MESSAGE_",  UtilProperties.getMessage("ProductErrorUiLabels", 
>> "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>>            }
>>        } else {
>> -            request.setAttribute("errorMessageList", ["Order #" +  orderId + " is not approved for picking."]);
>> +            request.setAttribute("_ERROR_MESSAGE_",  UtilProperties.getMessage("OrderErrorUiLabels", 
>> "OrderErrorOrderNotApprovedForPicking", [orderId : orderId],  locale));
>>        }
>>    } else {
>> -        request.setAttribute("errorMessageList", ["Order #" +  orderId + " cannot be found."]);
>> +        request.setAttribute("_ERROR_MESSAGE_",  UtilProperties.getMessage("OrderErrorUiLabels",  "OrderErrorOrderIdNotFound", 
>> [orderId : orderId], locale));
>>    }
>> }
>> context.verifyPickSession = verifyPickSession;
>> \ No newline at end of file
>>
>> Modified: ofbiz/trunk/applications/product/webapp/facility/shipment/ PackOrder.ftl
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl?rev=767394&r1=767393&r2=767394&view=diff
>> = = = = = = = = = =====================================================================
>> --- ofbiz/trunk/applications/product/webapp/facility/shipment/ PackOrder.ftl (original)
>> +++ ofbiz/trunk/applications/product/webapp/facility/shipment/ PackOrder.ftl Wed Apr 22 06:50:16 2009
>> @@ -21,7 +21,7 @@
>>    <#assign showInput = requestParameters.showInput?default("Y")>
>>    <#assign hideGrid = requestParameters.hideGrid?default("N")>
>>
>> -    <#if (requestParameters.forceComplete?has_content && ! shipmentId?has_content)>
>> +    <#if (requestParameters.forceComplete?has_content && ! invoiceIds?has_content)>
>>        <#assign forceComplete = "true">
>>        <#assign showInput = "Y">
>>    </#if>
>> @@ -33,12 +33,11 @@
>>            <br class="clear"/>
>>        </div>
>>        <div class="screenlet-body">
>> -            <#if shipmentId?has_content>
>> +            <#if shipmentId?has_content && invoiceIds?exists &&  invoiceIds?has_content>
>>                <div>
>>                ${uiLabelMap.CommonView} <a href="<@ofbizUrl>/ PackingSlip.pdf?shipmentId=${shipmentId}</...@ofbizUrl>" 
>> target="_blank" class="buttontext">$ {uiLabelMap.ProductPackingSlip}</a> ${uiLabelMap.CommonOr}
>>                ${uiLabelMap.CommonView} <a href="<@ofbizUrl>/ ShipmentBarCode.pdf?shipmentId=${shipmentId}</...@ofbizUrl>" 
>> target="_blank" class="buttontext">${uiLabelMap.ProductBarcode}</a>  ${uiLabelMap.CommonFor} ${uiLabelMap.ProductShipmentId} <a 
>> href="<@ofbizUrl>/ViewShipment?shipmentId=${shipmentId}</ @ofbizUrl>" class="buttontext">${shipmentId}</a>
>>                </div>
>> -                <#if invoiceIds?exists && invoiceIds?has_content>
>>                <div>
>>                    <p>${uiLabelMap.AccountingInvoices}:</p>
>>                    <ul>
>> @@ -50,7 +49,6 @@
>>                    </#list>
>>                    </ul>
>>                </div>
>> -                </#if>
>>            </#if>
>>            <br/>
>>
>> @@ -115,6 +113,7 @@
>>        </div>
>>    </div>
>>
>> +    <#if ((shipment?has_content) && (shipment.shipmentId)?exists)>
>>    <#if showInput != "N" && ((orderHeader?exists && orderHeader? has_content))>
>>    <div class="screenlet">
>>        <div class="screenlet-title-bar">
>> @@ -329,6 +328,8 @@
>>                  <input type="hidden" name="facilityId" value="$ {facilityId?if_exists}"/>
>>                  <input type="hidden" name="forceComplete" value="$ {forceComplete?default('false')}"/>
>>                  <input type="hidden" name="weightUomId" value="$ {defaultWeightUomId}"/>
>> +                  <input type="hidden" name="shipmentId" value="$ {(shipment.shipmentId)?default("")}"/>
>> +                  <input type="hidden" name="invoiceId" value="$ {(invoice.invoiceId)?default("")}"/>
>>                  <input type="hidden" name="showInput" value="N"/>
>>                  <hr>
>>                  <table class="basic-table" cellpadding="2"  cellspacing='0'>
>> @@ -490,6 +491,7 @@
>>  </#if>
>>  </div>
>>  </div>
>> +  </#if>
>> <#else>
>>  <h3>${uiLabelMap.ProductFacilityViewPermissionError}</h3>
>> </#if>
>> \ No newline at end of file
>>
>
>




Re: svn commit: r767394 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/invoice/ order/config/ product/config/ product/servicedef/ product/src/org/ofbiz/shipment/packing/ product/src/org/ofbiz/s

Posted by Vikas Mayur <vi...@hotwaxmedia.com>.
Hi Jacques,

This is part of Verify Pick feature added recently in trunk. This  
commit is integral part of this feature and make this new feature  
complete.

Now about the problem description:

With this commit, now it becomes necessary to do a Verify Pick before  
Packing. Being said that, user will also not be able to create a  
shipment until all the items of an order are verified.

Btw, I did not understand your last sentence {quote} On the other hand  
we could have a short period while such changes could be accepted...  
{quote}. Does it mean that new features can also be ported back to the  
release branch for few more days (like for example the https://issues.apache.org/jira/browse/OFBIZ-2225)?

Vikas

On Apr 22, 2009, at 4:14 PM, Jacques Le Roux wrote:

> Is this really a bug fix ? On the other hand we could have a short  
> period while such changes could be accepted...
>
> Jacques
>
>
> From: <mo...@apache.org>
>> Author: mor
>> Date: Wed Apr 22 06:50:16 2009
>> New Revision: 767394
>>
>> URL: http://svn.apache.org/viewvc?rev=767394&view=rev
>> Log:
>> Facilitate packing screen to use verified orders from Verify Pick  
>> screen by using existing shipment and invoice.
>> Patch from Akash Jain (reviewed and tested by Pranay Pandey), Part  
>> of OFBIZ-2329 (https://issues.apache.org/jira/browse/OFBIZ-2329).
>>
>> Note: I have done little modifications to the new labels part of  
>> this patch.
>>
>> This issue completes the functionality of the Verify Pick feature  
>> added recently. I would like to port these changes to release09.04  
>> later today
>> if I do not see any objections.
>>
>>
>>
>> Modified:
>>   ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
>>   ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
>>   ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ 
>> invoice/InvoiceServices.java
>>   ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml
>>   ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
>>   ofbiz/trunk/applications/product/servicedef/services_shipment.xml
>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
>> PackingServices.java
>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
>> PackingSession.java
>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>> VerifyPickSession.java
>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>> VerifyPickSessionRow.java
>>   ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/ 
>> shipment/PackOrder.groovy
>>   ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/ 
>> shipment/VerifyPick.groovy
>>   ofbiz/trunk/applications/product/webapp/facility/shipment/ 
>> PackOrder.ftl
>>
>> Modified: ofbiz/trunk/applications/accounting/config/ 
>> AccountingUiLabels.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/accounting/config/ 
>> AccountingUiLabels.xml (original)
>> +++ ofbiz/trunk/applications/accounting/config/ 
>> AccountingUiLabels.xml Wed Apr 22 06:50:16 2009
>> @@ -6390,6 +6390,9 @@
>>        <value xml:lang="th">ปัญหามีผลต่ภ 
>> โปรแกรมประยุกต์ใช้กาภ
>> £à¸Šà¸³à¸£à¸°à¹€à¸‡à¸´à¸™à¸ªà¸³à¸«à¸£à¸±à¸šà¸£à¸«à¸±à¸ªà¸à¸²à¸ 
>> £à¸Šà¸³à¸£à¸°à¹€à¸‡à¸´à¸™ [${invoiceId}]</value>
>>        <value xml:lang="zh">为发票编号[$ 
>> {invoiceId}]获得支付应用时出错</value>
>>    </property>
>> +    <property key="AccountingProblemGettingShipmentItemBilling">
>> +        <value xml:lang="en">Problem getting ShipmentItemBilling  
>> records</value>
>> +    </property>
>>    <property key="AccountingProblemLookingUpOrderItemBilling">
>>        <value xml:lang="en">Problem looking up OrderItemBilling  
>> records for ${billFields}</value>
>>        <value xml:lang="es">Problema buscando Elemento de orden de  
>> facturación para ${billFields}</value>
>>
>> Modified: ofbiz/trunk/applications/accounting/servicedef/ 
>> services_invoice.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/accounting/servicedef/ 
>> services_invoice.xml (original)
>> +++ ofbiz/trunk/applications/accounting/servicedef/ 
>> services_invoice.xml Wed Apr 22 06:50:16 2009
>> @@ -152,7 +152,7 @@
>>        </description>
>>        <attribute name="orderId" type="String" mode="IN"  
>> optional="false"/>
>>        <attribute name="billItems" type="List" mode="IN"  
>> optional="false"/>
>> -        <attribute name="invoiceId" type="String" mode="OUT"  
>> optional="true"/>
>> +        <attribute name="invoiceId" type="String" mode="INOUT"  
>> optional="true"/>
>>        <attribute name="invoiceTypeId" type="String" mode="OUT"  
>> optional="true"/>
>>    </service>
>>    <service name="createInvoiceFromReturn" engine="java"
>>
>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/ 
>> accounting/invoice/InvoiceServices.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ 
>> invoice/InvoiceServices.java (original)
>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ 
>> invoice/InvoiceServices.java Wed Apr 22 06:50:16 2009
>> @@ -151,6 +151,7 @@
>>
>>        String orderId = (String) context.get("orderId");
>>        List billItems = (List) context.get("billItems");
>> +        String invoiceId = (String) context.get("invoiceId");
>>        boolean previousInvoiceFound = false;
>>
>>        if (billItems == null || billItems.size() == 0) {
>> @@ -241,6 +242,7 @@
>>            }
>>
>>            // create the invoice record
>> +            if (UtilValidate.isEmpty(invoiceId)) {
>>            Map createInvoiceContext = FastMap.newInstance();
>>            createInvoiceContext.put("partyId",  
>> billToCustomerPartyId);
>>            createInvoiceContext.put("partyIdFrom",  
>> billFromVendorPartyId);
>> @@ -260,7 +262,8 @@
>>            }
>>
>>            // call service, not direct entity op:  
>> delegator.create(invoice);
>> -            String invoiceId = (String)  
>> createInvoiceResult.get("invoiceId");
>> +            invoiceId = (String)  
>> createInvoiceResult.get("invoiceId");
>> +            }
>>
>>            // order roles to invoice roles
>>            List orderRoles = orderHeader.getRelated("OrderRole");
>> @@ -491,6 +494,8 @@
>>                    }
>>
>>                    if  
>> ("ItemIssuance".equals(currentValue.getEntityName())) {
>> +                    List<GenericValue> shipmentItemBillings =  
>> delegator.findByAnd("ShipmentItemBilling",  
>> UtilMisc.toMap("shipmentId", currentValue.get("shipmentId")));
>> +                    if  
>> (UtilValidate.isEmpty(shipmentItemBillings)) {
>>
>>                        // create the ShipmentItemBilling record
>>                        GenericValue shipmentItemBilling =  
>> delegator.makeValue("ShipmentItemBilling",  
>> UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId",  
>> invoiceItemSeqId));
>> @@ -498,6 +503,7 @@
>>                        shipmentItemBilling.put("shipmentItemSeqId",  
>> currentValue.get("shipmentItemSeqId"));
>>                        shipmentItemBilling.create();
>>                    }
>> +                    }
>>
>>                    String parentInvoiceItemSeqId = invoiceItemSeqId;
>>                    // increment the counter
>> @@ -1538,8 +1544,22 @@
>>                Debug.logInfo(UtilProperties.getMessage(resource,  
>> "AccountingIgnoringAdditionalShipCharges",  
>> productStore.getAllFields(), locale), module);
>>            }
>>
>> +            String invoiceId = null;
>> +            List<GenericValue> shipmentItemBillings = null;
>> +            String shipmentId = (String) shipmentIds.get(0);
>> +            try {
>> +                shipmentItemBillings =  
>> delegator.findByAnd("ShipmentItemBilling",  
>> UtilMisc.toMap("shipmentId", shipmentId));
>> +            } catch ( GenericEntityException e ) {
>> +                String errMsg =  
>> UtilProperties.getMessage(resource,  
>> "AccountingProblemGettingShipmentItemBilling", locale);
>> +                return ServiceUtil.returnError(errMsg);
>> +            }
>> +            if (UtilValidate.isNotEmpty(shipmentItemBillings)) {
>> +                GenericValue shipmentItemBilling =  
>> EntityUtil.getFirst(shipmentItemBillings);
>> +                invoiceId =  
>> shipmentItemBilling.getString("invoiceId");
>> +            }
>> +
>>            // call the createInvoiceForOrder service for each order
>> -            Map serviceContext = UtilMisc.toMap("orderId",  
>> orderId, "billItems", toBillItems, "userLogin",  
>> context.get("userLogin"));
>> +            Map serviceContext = UtilMisc.toMap("orderId",  
>> orderId, "billItems", toBillItems, "invoiceId", invoiceId,  
>> "userLogin", context.get("userLogin"));
>>            try {
>>                Map result =  
>> dispatcher.runSync("createInvoiceForOrder", serviceContext);
>>                invoicesCreated.add(result.get("invoiceId"));
>>
>> Modified: ofbiz/trunk/applications/order/config/ 
>> OrderErrorUiLabels.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml  
>> (original)
>> +++ ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml  
>> Wed Apr 22 06:50:16 2009
>> @@ -334,6 +334,9 @@
>>        <value xml:lang="th">ERROR : ข้ภผิดพลาด ! 
>> </value>
>>        <value xml:lang="zh">错误:</value>
>>    </property>
>> +    <property key="OrderErrorAllItemsOfOrderAreAlreadyVerified">
>> +        <value xml:lang="en">ERROR: All items of order #${orderId}  
>> are already verified</value>
>> +    </property>
>>    <property  
>> key="OrderErrorCallingCountProductQuantityOrderedService">
>>        <value xml:lang="en">Error calling  
>> countProductQuantityOrdered service : </value>
>>        <value xml:lang="es">Error al llamar al servicio  
>> countProductQuantityOrdered:</value>
>> @@ -685,6 +688,12 @@
>>        <value xml:lang="ru">ОШИБКА: Позиция заказР
>> ° с кодом [${orderId}] и orderItemSeqId [${orderItemSeqId}]  
>> не найдены</value>
>>        <value xml:lang="th">ERROR : ข้ภผิดพภ
>> ¥à¸²à¸” ! รายการสั่งซื้ภด้วยภ
>> £à¸«à¸±à¸ª [${orderId}] และรหัสรายการสภ
>> ±à¹ˆà¸‡à¸‹à¸·à¹‰à¸ [${orderItemSeqId}] ไม่พบ</value>
>>    </property>
>> +    <property key="OrderErrorOrderNotApprovedForPacking">
>> +        <value xml:lang="en">ERROR: Order #${orderId} is not  
>> approved for packing</value>
>> +    </property>
>> +    <property key="OrderErrorOrderNotApprovedForPicking">
>> +        <value xml:lang="en">ERROR: Order #${orderId} is not  
>> approved for picking</value>
>> +    </property>
>>    <property key="OrderErrorOrderNotPurchaseOrder">
>>        <value xml:lang="en">Order ${orderId} is not a Purchase  
>> Order</value>
>>        <value xml:lang="es">El pedido ${orderId} no es un pedido de  
>> compra</value>
>> @@ -693,6 +702,9 @@
>>        <value xml:lang="ru">Заказ ${orderId} не  
>> является закупочным заказом</value>
>>        <value xml:lang="th">ใบสั่งซื้ภสภ
>> ´à¸™à¸„้า ${orderId} ไม่เป็นรายกาภ
>> £à¸ªà¸±à¹ˆà¸‡à¸‹à¸·à¹‰à¸ </value>
>>    </property>
>> +    <property key="OrderErrorOrderNotVerifiedForPacking">
>> +        <value xml:lang="en">ERROR: Order #${orderId} is not  
>> verified for packing</value>
>> +    </property>
>>    <property key="OrderErrorOrderTypeLookupFailed">
>>        <value xml:lang="en">ERROR : OrderType lookup failed : </ 
>> value>
>>        <value xml:lang="es">ERROR: La búsqueda ha fallado :</value>
>>
>> Modified: ofbiz/trunk/applications/product/config/ 
>> ProductErrorUiLabels.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/product/config/ 
>> ProductErrorUiLabels.xml (original)
>> +++ ofbiz/trunk/applications/product/config/ 
>> ProductErrorUiLabels.xml Wed Apr 22 06:50:16 2009
>> @@ -55,6 +55,9 @@
>>        <value xml:lang="en">Error Inventory Item Label Id Not  
>> Found</value>
>>        <value xml:lang="it">Errore riga etichetta inventario non  
>> trovata</value>
>>    </property>
>> +    <property  
>> key="ProductErrorNoShipGroupSequenceIdFoundCannotProcess">
>> +        <value xml:lang="en">ERROR: No ship group sequence Id  
>> found cannot process</value>
>> +    </property>
>>    <property key="ProductFeatureTypeIdMustContainsLettersAndDigits">
>>        <value xml:lang="de">Die Produktmerkmal Typ ID darf nur  
>> Buchstaben, Zahlen und _ enthalten. Bitte erneut eingeben.</value>
>>        <value xml:lang="en">The Product Feature TypeId must  
>> contains only letters, underscore and digits. Please re-enter</value>
>>
>> Modified: ofbiz/trunk/applications/product/servicedef/ 
>> services_shipment.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/product/servicedef/ 
>> services_shipment.xml (original)
>> +++ ofbiz/trunk/applications/product/servicedef/ 
>> services_shipment.xml Wed Apr 22 06:50:16 2009
>> @@ -562,6 +562,9 @@
>>            location="org.ofbiz.shipment.packing.PackingServices"  
>> invoke="completePack" auth="true">
>>        <description>Complete the packging set the shipment to  
>> PACKED</description>
>>        <attribute name="packingSession"  
>> type="org.ofbiz.shipment.packing.PackingSession" mode="IN"  
>> optional="false"/>
>> +        <attribute name="orderId" type="String" mode="IN"  
>> optional="true"/>
>> +        <attribute name="invoiceId" type="String" mode="IN"  
>> optional="true"/>
>> +        <attribute name="shipmentId" type="String" mode="IN"  
>> optional="true"/>
>>        <attribute name="handlingInstructions" type="String"  
>> mode="IN" optional="true"/>
>>        <attribute name="pickerPartyId" type="String" mode="IN"  
>> optional="true"/>
>>        <attribute name="additionalShippingCharge" type="BigDecimal"  
>> mode="IN" optional="true"/>
>>
>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>> packing/PackingServices.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
>> PackingServices.java (original)
>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
>> PackingServices.java Wed Apr 22 06:50:16 2009
>> @@ -271,11 +271,16 @@
>>        PackingSession session = (PackingSession)  
>> context.get("packingSession");
>>
>>        // set the instructions -- will clear out previous if now null
>> +        String orderId = (String) context.get("orderId");
>> +        String shipmentId = (String) context.get("shipmentId");
>> +        String invoiceId = (String) context.get("invoiceId");
>>        String instructions = (String)  
>> context.get("handlingInstructions");
>>        String pickerPartyId = (String) context.get("pickerPartyId");
>>        BigDecimal additionalShippingCharge = (BigDecimal)  
>> context.get("additionalShippingCharge");
>>        Map<String, String> packageWeights =  
>> UtilGenerics.checkMap(context.get("packageWeights"));
>>        String weightUomId = (String) context.get("weightUomId");
>> +        session.setShipmentId(shipmentId);
>> +        session.setInvoiceId(invoiceId);
>>        session.setHandlingInstructions(instructions);
>>        session.setPickerPartyId(pickerPartyId);
>>        session.setAdditionalShippingCharge(additionalShippingCharge);
>> @@ -287,9 +292,8 @@
>>            force = Boolean.FALSE;
>>        }
>>
>> -        String shipmentId = null;
>>        try {
>> -            shipmentId = session.complete(force);
>> +            shipmentId = session.complete(force, orderId);
>>        } catch (GeneralException e) {
>>            Debug.logError(e, module);
>>            return ServiceUtil.returnError(e.getMessage(),  
>> e.getMessageList());
>>
>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>> packing/PackingSession.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
>> PackingSession.java (original)
>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
>> PackingSession.java Wed Apr 22 06:50:16 2009
>> @@ -60,6 +60,7 @@
>>    protected String shipmentId = null;
>>    protected String instructions = null;
>>    protected String weightUomId = null;
>> +    protected String invoiceId = null;
>>    protected BigDecimal additionalShippingCharge = null;
>>    protected Map<Integer, BigDecimal> packageWeights = null;
>>    protected List<PackingEvent> packEvents = null;
>> @@ -367,6 +368,18 @@
>>        return this.shipmentId;
>>    }
>>
>> +    public void setShipmentId(String shipmentId) {
>> +        this.shipmentId = shipmentId;
>> +    }
>> +
>> +    public String getInvoiceId() {
>> +        return this.invoiceId;
>> +    }
>> +
>> +    public void setInvoiceId(String invoiceId) {
>> +        this.invoiceId = invoiceId;
>> +    }
>> +
>>    public List<PackingSessionLine> getLines() {
>>        return this.packLines;
>>    }
>> @@ -613,7 +626,7 @@
>>        this.runEvents(PackingEvent.EVENT_CODE_CLEAR);
>>    }
>>
>> -    public String complete(boolean force) throws GeneralException {
>> +    public String complete(boolean force, String orderId) throws  
>> GeneralException {
>>        // clear out empty lines
>>        // this.checkEmptyLines(); // removing, this seems to be  
>> causeing issues -  mja
>>
>> @@ -622,12 +635,16 @@
>>            return "EMPTY";
>>        }
>>
>> +        this.checkPackedQty(orderId);
>>        // check for errors
>>        this.checkReservations(force);
>>        // set the status to 0
>>        this.status = 0;
>>        // create the shipment
>> -        this.createShipment();
>> +        String shipmentId = this.getShipmentId();
>> +        if (UtilValidate.isEmpty(shipmentId)) {
>> +            this.createShipment();
>> +        }
>>        // create the packages
>>        this.createPackages();
>>        // issue the items
>> @@ -646,6 +663,27 @@
>>        return this.shipmentId;
>>    }
>>
>> +    protected void checkPackedQty(String orderId) throws  
>> GeneralException {
>> +        int counter = 0;
>> +        List<GenericValue> orderItems = null;
>> +        for (PackingSessionLine line : this.getLines()) {
>> +            orderItems =  
>> this.getDelegator().findByAnd("OrderItem",  
>> UtilMisc.toMap("orderId", orderId));
>> +            for (GenericValue orderItem : orderItems) {
>> +                if (orderId.equals(line.getOrderId())) {
>> +                    if  
>> ((orderItem 
>> .get("orderItemSeqId")).equals(line.getOrderItemSeqId())) {
>> +                        BigDecimal packedQty =  
>> this.getPackedQuantity(line.getOrderId(), line.getOrderItemSeqId(),  
>> line.getShipGroupSeqId(), line.getProductId());
>> +                        if  
>> ((packedQty.compareTo(orderItem.getBigDecimal("quantity"))) == 0 ) {
>> +                            counter++;
>> +                        }
>> +                    }
>> +                }
>> +            }
>> +        }
>> +        if (((this.getLines().size()) != (orderItems.size())) ||  
>> (counter != (orderItems.size()))) {
>> +            throw new GeneralException("All order items are not  
>> packed");
>> +        }
>> +    }
>> +
>>    protected void checkReservations(boolean ignore) throws  
>> GeneralException {
>>        List<String> errors = FastList.newInstance();
>>        for (PackingSessionLine line: this.getLines()) {
>>
>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>> verify/VerifyPickSession.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>> VerifyPickSession.java (original)
>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>> VerifyPickSession.java Wed Apr 22 06:50:16 2009
>> @@ -140,14 +140,11 @@
>>    }
>>
>>    public String complete(String orderId) throws GeneralException {
>> -        String shipmentId = null;
>>        String shipmentItemSeqId = null;
>>        String invoiceId = null;
>>        String invoiceItemSeqId = null;
>> -        for (VerifyPickSessionRow line: this.getPickRows(orderId)) {
>> -            shipmentId = this.createShipment(line);
>> -            break;
>> -        }
>> +        this.checkVerifiedQty(orderId);
>> +        String shipmentId =  
>> this.createShipment((this.getPickRows(orderId)).get(0));
>>        for (VerifyPickSessionRow line: this.getPickRows(orderId)) {
>>            shipmentItemSeqId =  
>> this.createShipmentItem(line,shipmentId);
>>            line.setShipmentItemSeqId(shipmentItemSeqId);
>> @@ -160,6 +157,24 @@
>>        return shipmentId;
>>    }
>>
>> +    protected void checkVerifiedQty(String orderId) throws  
>> GeneralException {
>> +        int counter = 0;
>> +        List<GenericValue> orderItems = null;
>> +        for (VerifyPickSessionRow line :  
>> this.getPickRows(orderId)) {
>> +            orderItems =  
>> this.getDelegator().findByAnd("OrderItem",  
>> UtilMisc.toMap("orderId", orderId));
>> +            for (GenericValue orderItem : orderItems) {
>> +                if  
>> ((orderItem.get("orderItemSeqId")).equals(line.getOrderSeqId())) {
>> +                    if  
>> (((line 
>> .getReadyToVerifyQty 
>> ()).compareTo(orderItem.getBigDecimal("quantity"))) == 0 ) {
>> +                        counter++;
>> +                    }
>> +                }
>> +            }
>> +        }
>> +        if (counter != (orderItems.size())) {
>> +            throw new GeneralException("All order items are not  
>> verified");
>> +        }
>> +    }
>> +
>>    protected String createShipment(VerifyPickSessionRow line)  
>> throws GeneralException {
>>        Map<String, Object> newShipment = FastMap.newInstance();
>>        newShipment.put("originFacilityId", line.getFacilityId());
>> @@ -202,11 +217,17 @@
>>    }
>>
>>    protected String createInvoice(String orderId) throws  
>> GeneralException {
>> +        GenericDelegator delegator = this.getDelegator();
>>        Map createInvoiceContext = FastMap.newInstance();
>> -        createInvoiceContext.put("partyId",  
>> (EntityUtil.getFirst(this.getDelegator().findByAnd("OrderRole",  
>> UtilMisc.toMap("orderId", orderId, "roleTypeId",  
>> "BILL_TO_CUSTOMER")))).getString("partyId"));
>> -        createInvoiceContext.put("partyIdFrom",  
>> (EntityUtil.getFirst(this.getDelegator().findByAnd("OrderRole",  
>> UtilMisc.toMap("orderId", orderId, "roleTypeId",  
>> "BILL_FROM_VENDOR")))).getString("partyId"));
>> +        GenericValue orderHeader =  
>> delegator.findOne("OrderHeader", UtilMisc.toMap("orderId",  
>> orderId), false);
>> +        GenericValue billingAccount =  
>> orderHeader.getRelatedOne("BillingAccount");
>> +        String billingAccountId = billingAccount != null ?  
>> billingAccount.getString("billingAccountId") : null;
>> +        createInvoiceContext.put("partyId",  
>> (EntityUtil.getFirst(delegator.findByAnd("OrderRole",  
>> UtilMisc.toMap("orderId", orderId, "roleTypeId",  
>> "BILL_TO_CUSTOMER")))).getString("partyId"));
>> +        createInvoiceContext.put("partyIdFrom",  
>> (EntityUtil.getFirst(delegator.findByAnd("OrderRole",  
>> UtilMisc.toMap("orderId", orderId, "roleTypeId",  
>> "BILL_FROM_VENDOR")))).getString("partyId"));
>> +        createInvoiceContext.put("billingAccountId",  
>> billingAccountId);
>>        createInvoiceContext.put("invoiceTypeId", "SALES_INVOICE");
>>        createInvoiceContext.put("statusId", "INVOICE_IN_PROCESS");
>> +        createInvoiceContext.put("currencyUomId",  
>> orderHeader.getString("currencyUom"));
>>        createInvoiceContext.put("userLogin", this.getUserLogin());
>>        Map createInvoiceResult =  
>> this.getDispatcher().runSync("createInvoice", createInvoiceContext);
>>        if (ServiceUtil.isError(createInvoiceResult)) {
>>
>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>> verify/VerifyPickSessionRow.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSessionRow.java?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>> VerifyPickSessionRow.java (original)
>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>> VerifyPickSessionRow.java Wed Apr 22 06:50:16 2009
>> @@ -50,6 +50,7 @@
>>        this.orderItem = orderItem;
>>        this.rowItem = rowItem;
>>        this.shipmentItemSeqId = null;
>> +        this.invoiceItemSeqId = null;
>>    }
>>
>>    public String getOrderId() {
>>
>> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ 
>> actions/shipment/PackOrder.groovy
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ 
>> actions/shipment/PackOrder.groovy (original)
>> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ 
>> actions/shipment/PackOrder.groovy Wed Apr 22 06:50:16 2009
>> @@ -115,6 +115,16 @@
>> context.shipGroupSeqId = shipGroupSeqId;
>> context.picklistBinId = picklistBinId;
>>
>> +shipment = EntityUtil.getFirst(delegator.findByAnd("Shipment",  
>> [primaryOrderId : orderId, statusId : "SHIPMENT_PICKED"]));
>> +context.shipment = shipment;
>> +
>> +if (shipment) {
>> +    invoice =  
>> EntityUtil.getFirst(delegator.findByAnd("ShipmentItemBilling",  
>> [shipmentId : shipment.shipmentId]));
>> +    context.invoice = invoice;
>> +} else {
>> +    context.invoice = null;
>> +}
>> +
>> // grab the order information
>> if (orderId) {
>>    orderHeader = delegator.findOne("OrderHeader", [orderId :  
>> orderId], false);
>> @@ -128,6 +138,7 @@
>>
>>        if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
>>            if (shipGroupSeqId) {
>> +            if (shipment) {
>>
>>                // Generate the shipment cost estimate for the ship  
>> group
>>                productStoreId = orh.getProductStoreId();
>> @@ -145,13 +156,16 @@
>>                    //context.put("itemInfos", shippableItemInfo);
>>                }
>>            } else {
>> -                request.setAttribute("errorMessageList", ['No ship  
>> group sequence ID. Cannot process.']);
>> +                request.setAttribute("_ERROR_MESSAGE_",  
>> UtilProperties.getMessage("OrderErrorUiLabels",  
>> "OrderErrorOrderNotVerifiedForPacking", [orderId : orderId],  
>> locale));
>> +            }
>> +            } else {
>> +                request.setAttribute("_ERROR_MESSAGE_",  
>> UtilProperties.getMessage("ProductErrorUiLabels",  
>> "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>>            }
>>        } else {
>> -            request.setAttribute("errorMessageList", ["Order #" +  
>> orderId + " is not approved for packing."]);
>> +            request.setAttribute("_ERROR_MESSAGE_",  
>> UtilProperties.getMessage("OrderErrorUiLabels",  
>> "OrderErrorOrderNotApprovedForPacking", [orderId : orderId],  
>> locale));
>>        }
>>    } else {
>> -        request.setAttribute("errorMessageList", ["Order #" +  
>> orderId + " cannot be found."]);
>> +        request.setAttribute("_ERROR_MESSAGE_",  
>> UtilProperties.getMessage("OrderErrorUiLabels",  
>> "OrderErrorOrderIdNotFound", [orderId : orderId], locale));
>>    }
>> }
>>
>>
>> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ 
>> actions/shipment/VerifyPick.groovy
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ 
>> actions/shipment/VerifyPick.groovy (original)
>> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/ 
>> actions/shipment/VerifyPick.groovy Wed Apr 22 06:50:16 2009
>> @@ -17,9 +17,10 @@
>> * under the License.
>> */
>>
>> -import org.ofbiz.order.order.OrderReadHelper;
>> +import org.ofbiz.base.util.UtilProperties;
>> import org.ofbiz.entity.util.EntityUtil;
>> import org.ofbiz.entity.condition.EntityCondition;
>> +import org.ofbiz.order.order.OrderReadHelper;
>> import org.ofbiz.shipment.verify.VerifyPickSession;
>>
>> verifyPickSession = session.getAttribute("verifyPickSession");
>> @@ -42,6 +43,7 @@
>>        invoiceIds =  
>> EntityUtil.getFieldListFromEntityList(shipmentItemBillingList,  
>> "invoiceId", true);
>>        if (invoiceIds) {
>>            context.invoiceIds = invoiceIds;
>> +            parameters.orderId = null;
>>        }
>>    }
>> }
>> @@ -90,14 +92,18 @@
>>            if (shipGroupSeqId) {
>>                productStoreId = orh.getProductStoreId();
>>                context.productStoreId = productStoreId;
>> +                shipments = delegator.findByAnd("Shipment",  
>> [primaryOrderId : orderId, statusId : "SHIPMENT_PICKED"]);
>> +                if (shipments) {
>> +                    request.setAttribute("_ERROR_MESSAGE_",  
>> UtilProperties.getMessage("OrderErrorUiLabels",  
>> "OrderErrorAllItemsOfOrderAreAlreadyVerified", [orderId : orderId],  
>> locale));
>> +                }
>>            } else {
>> -                request.setAttribute("errorMessageList", ['No ship  
>> group sequence ID. Cannot process.']);
>> +                request.setAttribute("_ERROR_MESSAGE_",  
>> UtilProperties.getMessage("ProductErrorUiLabels",  
>> "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>>            }
>>        } else {
>> -            request.setAttribute("errorMessageList", ["Order #" +  
>> orderId + " is not approved for picking."]);
>> +            request.setAttribute("_ERROR_MESSAGE_",  
>> UtilProperties.getMessage("OrderErrorUiLabels",  
>> "OrderErrorOrderNotApprovedForPicking", [orderId : orderId],  
>> locale));
>>        }
>>    } else {
>> -        request.setAttribute("errorMessageList", ["Order #" +  
>> orderId + " cannot be found."]);
>> +        request.setAttribute("_ERROR_MESSAGE_",  
>> UtilProperties.getMessage("OrderErrorUiLabels",  
>> "OrderErrorOrderIdNotFound", [orderId : orderId], locale));
>>    }
>> }
>> context.verifyPickSession = verifyPickSession;
>> \ No newline at end of file
>>
>> Modified: ofbiz/trunk/applications/product/webapp/facility/shipment/ 
>> PackOrder.ftl
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl?rev=767394&r1=767393&r2=767394&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/product/webapp/facility/shipment/ 
>> PackOrder.ftl (original)
>> +++ ofbiz/trunk/applications/product/webapp/facility/shipment/ 
>> PackOrder.ftl Wed Apr 22 06:50:16 2009
>> @@ -21,7 +21,7 @@
>>    <#assign showInput = requestParameters.showInput?default("Y")>
>>    <#assign hideGrid = requestParameters.hideGrid?default("N")>
>>
>> -    <#if (requestParameters.forceComplete?has_content && ! 
>> shipmentId?has_content)>
>> +    <#if (requestParameters.forceComplete?has_content && ! 
>> invoiceIds?has_content)>
>>        <#assign forceComplete = "true">
>>        <#assign showInput = "Y">
>>    </#if>
>> @@ -33,12 +33,11 @@
>>            <br class="clear"/>
>>        </div>
>>        <div class="screenlet-body">
>> -            <#if shipmentId?has_content>
>> +            <#if shipmentId?has_content && invoiceIds?exists &&  
>> invoiceIds?has_content>
>>                <div>
>>                ${uiLabelMap.CommonView} <a href="<@ofbizUrl>/ 
>> PackingSlip.pdf?shipmentId=${shipmentId}</...@ofbizUrl>"  
>> target="_blank" class="buttontext">$ 
>> {uiLabelMap.ProductPackingSlip}</a> ${uiLabelMap.CommonOr}
>>                ${uiLabelMap.CommonView} <a href="<@ofbizUrl>/ 
>> ShipmentBarCode.pdf?shipmentId=${shipmentId}</...@ofbizUrl>"  
>> target="_blank" class="buttontext">${uiLabelMap.ProductBarcode}</a>  
>> ${uiLabelMap.CommonFor} ${uiLabelMap.ProductShipmentId} <a  
>> href="<@ofbizUrl>/ViewShipment?shipmentId=${shipmentId}</ 
>> @ofbizUrl>" class="buttontext">${shipmentId}</a>
>>                </div>
>> -                <#if invoiceIds?exists && invoiceIds?has_content>
>>                <div>
>>                    <p>${uiLabelMap.AccountingInvoices}:</p>
>>                    <ul>
>> @@ -50,7 +49,6 @@
>>                    </#list>
>>                    </ul>
>>                </div>
>> -                </#if>
>>            </#if>
>>            <br/>
>>
>> @@ -115,6 +113,7 @@
>>        </div>
>>    </div>
>>
>> +    <#if ((shipment?has_content) && (shipment.shipmentId)?exists)>
>>    <#if showInput != "N" && ((orderHeader?exists && orderHeader? 
>> has_content))>
>>    <div class="screenlet">
>>        <div class="screenlet-title-bar">
>> @@ -329,6 +328,8 @@
>>                  <input type="hidden" name="facilityId" value="$ 
>> {facilityId?if_exists}"/>
>>                  <input type="hidden" name="forceComplete" value="$ 
>> {forceComplete?default('false')}"/>
>>                  <input type="hidden" name="weightUomId" value="$ 
>> {defaultWeightUomId}"/>
>> +                  <input type="hidden" name="shipmentId" value="$ 
>> {(shipment.shipmentId)?default("")}"/>
>> +                  <input type="hidden" name="invoiceId" value="$ 
>> {(invoice.invoiceId)?default("")}"/>
>>                  <input type="hidden" name="showInput" value="N"/>
>>                  <hr>
>>                  <table class="basic-table" cellpadding="2"  
>> cellspacing='0'>
>> @@ -490,6 +491,7 @@
>>  </#if>
>>  </div>
>>  </div>
>> +  </#if>
>> <#else>
>>  <h3>${uiLabelMap.ProductFacilityViewPermissionError}</h3>
>> </#if>
>> \ No newline at end of file
>>
>
>