svn commit: r1772347 - in /ofbiz/branches/release16.11: ./ applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1772347 - in /ofbiz/branches/release16.11: ./ applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java

Deepak Dixit-5
Author: deepak
Date: Fri Dec  2 14:04:08 2016
New Revision: 1772347

URL: http://svn.apache.org/viewvc?rev=1772347&view=rev
Log:
Applied fix from trunk for revision: 1772346
===

Fixed: Added missing code to get the ItemIssuance in setInvoicesToReadyFromShipment service. This bug was introduced at r#1628288 while delegator to EntityQuery convertion. Also added complete code to check null shipment on setInvoicesToReadyFromShipment, code was incompletely implemented.

Modified:
    ofbiz/branches/release16.11/   (props changed)
    ofbiz/branches/release16.11/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java

Propchange: ofbiz/branches/release16.11/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Dec  2 14:04:08 2016
@@ -10,4 +10,4 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/trunk:1770481,1770490,1770540,1771440,1771448,1771516,1771935
+/ofbiz/trunk:1770481,1770490,1770540,1771440,1771448,1771516,1771935,1772346

Modified: ofbiz/branches/release16.11/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release16.11/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java?rev=1772347&r1=1772346&r2=1772347&view=diff
==============================================================================
--- ofbiz/branches/release16.11/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/branches/release16.11/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java Fri Dec  2 14:04:08 2016
@@ -1205,19 +1205,24 @@ public class InvoiceServices {
         // 2. For every order check the invoice
         // 2.a If the invoice is in In-Process status, then move its status to ready and capture the payment.
         // 2.b If the invoice is in status other then IN-Process, skip this. These would be already paid and captured.
-
+        GenericValue shipment = null;
         try {
-            EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne();
+            shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Trouble getting Shipment entity for shipment " + shipmentId, module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                     "AccountingTroubleGettingShipmentEntity",
                     UtilMisc.toMap("shipmentId", shipmentId), locale));
         }
+        if (shipment == null) {
+            Debug.logError(UtilProperties.getMessage(resource, "AccountingShipmentNotFound", locale), module);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingShipmentNotFound", locale));
+        }
+
         List<GenericValue> itemIssuances = new LinkedList<GenericValue>();
         try {
             itemIssuances = EntityQuery.use(delegator).select("orderId", "shipmentId")
-                    .from("ItemIssuance").orderBy("orderId").distinct().queryList();
+                    .from("ItemIssuance").where("shipmentId", shipmentId).orderBy("orderId").distinct().queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Problem getting issued items from shipments", module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource,