svn commit: r804510 - in /ofbiz/trunk/applications: accounting/script/org/ofbiz/accounting/ledger/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/invoice/ product/script/org/ofbiz/shipment/shipment/ product/servicedef/

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

svn commit: r804510 - in /ofbiz/trunk/applications: accounting/script/org/ofbiz/accounting/ledger/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/invoice/ product/script/org/ofbiz/shipment/shipment/ product/servicedef/

jacopoc
Author: jacopoc
Date: Sat Aug 15 18:21:47 2009
New Revision: 804510

URL: http://svn.apache.org/viewvc?rev=804510&view=rev
Log:
Added support for eventDate parameter to the quickShipEntireOrder (and related services) to specify a date different from now; this makes the service more flexible (for example when used by import scripts).

Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
    ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml
    ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
    ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml
    ofbiz/trunk/applications/product/servicedef/services_shipment.xml

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=804510&r1=804509&r2=804510&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Sat Aug 15 18:21:47 2009
@@ -2117,6 +2117,7 @@
             <set field="createAcctgTransAndEntriesInMap.acctgTransTypeId" value="SALES_INVOICE"/>
             <set field="createAcctgTransAndEntriesInMap.invoiceId" from-field="parameters.invoiceId"/>
             <set field="createAcctgTransAndEntriesInMap.acctgTransEntries" from-field="acctgTransEntries"/>
+            <set field="createAcctgTransAndEntriesInMap.transactionDate" from-field="invoice.invoiceDate"/>
             <call-service service-name="createAcctgTransAndEntries" in-map-name="createAcctgTransAndEntriesInMap">
                 <result-to-field result-name="acctgTransId"/>
             </call-service>

Modified: ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml?rev=804510&r1=804509&r2=804510&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml Sat Aug 15 18:21:47 2009
@@ -95,7 +95,7 @@
         <action service="createAcctgTransAndEntriesForIncomingPayment" mode="sync"/>
     </eca>
 
-    <!-- attemp to create AcctgTrans for Purchase Invoice -->
+    <!-- attempt to create AcctgTrans for Purchase Invoice -->
     <eca service="setInvoiceStatus" event="commit">
         <condition field-name="invoiceId" operator="is-not-empty"/>
         <condition field-name="statusId" operator="equals" value="INVOICE_READY"/>
@@ -104,7 +104,7 @@
         <action service="createAcctgTransForPurchaseInvoice" mode="sync"/>
     </eca>
 
-    <!-- attemp to create AcctgTrans for Sales Invoice -->
+    <!-- attempt to create AcctgTrans for Sales Invoice -->
     <eca service="setInvoiceStatus" event="commit">
         <condition field-name="invoiceId" operator="is-not-empty"/>
         <condition field-name="statusId" operator="equals" value="INVOICE_READY"/>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=804510&r1=804509&r2=804510&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml Sat Aug 15 18:21:47 2009
@@ -152,6 +152,7 @@
         </description>
         <attribute name="orderId" type="String" mode="IN" optional="false"/>
         <attribute name="billItems" type="List" mode="IN" optional="false"/>
+        <attribute name="eventDate" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="invoiceId" type="String" mode="INOUT" optional="true"/>
         <attribute name="invoiceTypeId" type="String" mode="OUT" optional="true"/>
     </service>
@@ -199,6 +200,7 @@
             invoicesCreated = List of invoiceIds which were created by this service
         </description>
         <attribute name="shipmentId" type="String" mode="IN" optional="false"/>
+        <attribute name="eventDate" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="invoicesCreated" type="List" mode="OUT" optional="true"/>
     </service>
     <service name="setInvoicesToReadyFromShipment" engine="java"
@@ -229,6 +231,7 @@
         </description>
         <attribute name="shipmentIds" type="List" mode="IN" optional="false"/>
         <attribute name="createSalesInvoicesForDropShipments" type="Boolean" mode="IN" optional="true"/>
+        <attribute name="eventDate" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="invoicesCreated" type="List" mode="OUT" optional="true"/>
     </service>
     <service name="createInvoicesFromReturnShipment" 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=804510&r1=804509&r2=804510&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 Sat Aug 15 18:21:47 2009
@@ -234,8 +234,11 @@
             GenericValue billingAccount = orderHeader.getRelatedOne("BillingAccount");
             String billingAccountId = billingAccount != null ? billingAccount.getString("billingAccountId") : null;
 
-            // TODO: ideally this should be the same time as when a shipment is sent and be passed in as a parameter
-            Timestamp invoiceDate = UtilDateTime.nowTimestamp();
+            Timestamp invoiceDate = (Timestamp)context.get("eventDate");
+            if (UtilValidate.isEmpty(invoiceDate)) {
+                // TODO: ideally this should be the same time as when a shipment is sent and be passed in as a parameter
+                invoiceDate = UtilDateTime.nowTimestamp();
+            }
             // TODO: perhaps consider billing account net days term as well?
             Long orderTermNetDays = orh.getOrderTermNetDays();
             Timestamp dueDate = null;
@@ -1085,7 +1088,7 @@
         Locale locale = (Locale) context.get("locale");
         List invoicesCreated = new ArrayList();
 
-        Map serviceContext = UtilMisc.toMap("shipmentIds", UtilMisc.toList(shipmentId), "userLogin", context.get("userLogin"));
+        Map serviceContext = UtilMisc.toMap("shipmentIds", UtilMisc.toList(shipmentId), "eventDate", context.get("eventDate"), "userLogin", context.get("userLogin"));
         try {
             Map result = dispatcher.runSync("createInvoicesFromShipments", serviceContext);
             invoicesCreated = (List) result.get("invoicesCreated");
@@ -1704,7 +1707,7 @@
             }
 
             // call the createInvoiceForOrder service for each order
-            Map serviceContext = UtilMisc.toMap("orderId", orderId, "billItems", toBillItems, "invoiceId", invoiceId, "userLogin", context.get("userLogin"));
+            Map serviceContext = UtilMisc.toMap("orderId", orderId, "billItems", toBillItems, "invoiceId", invoiceId, "eventDate", context.get("eventDate"), "userLogin", context.get("userLogin"));
             try {
                 Map result = dispatcher.runSync("createInvoiceForOrder", serviceContext);
                 invoicesCreated.add(result.get("invoiceId"));

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml?rev=804510&r1=804509&r2=804510&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml Sat Aug 15 18:21:47 2009
@@ -132,9 +132,20 @@
                     <set from-field="parameters.statusId" field="newStatusValue.statusId"/>
                     <set from-field="parameters.shipmentId" field="newStatusValue.shipmentId"/>
                     <now-timestamp field="newStatusValue.statusDate"/>
+                    <if-empty field="parameters.eventDate">
+                        <now-timestamp field="newStatusValue.statusDate"/>
+                    <else>
+                        <set field="newStatusValue.statusDate" from-field="parameters.eventDate"/>
+                    </else>
+                    </if-empty>
                     <create-value value-field="newStatusValue"/>
                 <else>
-                    <now-timestamp field="shipmentStatus.statusDate"/>
+                    <if-empty field="parameters.eventDate">
+                        <now-timestamp field="shipmentStatus.statusDate"/>
+                    <else>
+                        <set field="shipmentStatus.statusDate" from-field="parameters.eventDate"/>
+                    </else>
+                    </if-empty>
                     <store-value value-field="shipmentStatus"/>
                 </else>
                 </if-empty>
@@ -1350,6 +1361,7 @@
             </entity-one>
             <!-- should never be empty - referential integrity enforced -->
 
+            <set field="eventDate" from-field="parameters.eventDate"/>
             <call-simple-method method-name="createShipmentForFacilityAndShipGroup"/>
         </iterate>
 
@@ -1568,6 +1580,7 @@
                   <then>
                     <!-- update the shipment status to packed -->
                     <set from-field="shipment.shipmentId" field="packedContext.shipmentId"/>
+                    <set from-field="eventDate" field="packedContext.eventDate"/>
                     <set value="SHIPMENT_PACKED" field="packedContext.statusId"/>
                     <call-service service-name="updateShipment" in-map-name="packedContext"/>
                     <!-- update the shipment status to shipped -->

Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=804510&r1=804509&r2=804510&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Sat Aug 15 18:21:47 2009
@@ -76,6 +76,7 @@
         <attribute name="orderId" type="String" mode="IN" optional="false"/>
         <attribute name="originFacilityId" type="String" mode="IN" optional="true"/>
         <attribute name="setPackedOnly" type="String" mode="IN" optional="true"/>
+        <attribute name="eventDate" type="Timestamp" mode="IN" optional="true"/>
         <!-- A List of Maps, each with a shipmentId,a facilityId, and a shipGroupSeqId for each shipment created -->
         <attribute name="shipmentShipGroupFacilityList" type="List" mode="OUT" optional="false"/>
     </service>
@@ -153,6 +154,7 @@
             <exclude field-name="lastModifiedByUserLogin"/>
         </auto-attributes>
         <attribute name="shipmentTypeId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="eventDate" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="oldStatusId" type="String" mode="OUT" optional="true"/>
         <attribute name="oldPrimaryOrderId" type="String" mode="OUT" optional="true"/>
         <attribute name="oldOriginFacilityId" type="String" mode="OUT" optional="true"/>