svn commit: r1752233 - in /ofbiz/trunk/applications: datamodel/entitydef/shipment-entitymodel.xml product/minilang/shipment/shipment/ShipmentServices.xml product/servicedef/services_shipment.xml

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

svn commit: r1752233 - in /ofbiz/trunk/applications: datamodel/entitydef/shipment-entitymodel.xml product/minilang/shipment/shipment/ShipmentServices.xml product/servicedef/services_shipment.xml

nmalin
Author: nmalin
Date: Mon Jul 11 23:14:35 2016
New Revision: 1752233

URL: http://svn.apache.org/viewvc?rev=1752233&view=rev
Log:
Add changeByUserLoginId field for ShipmentStatus and use entity-auto service to create values. Thanks Nameet Jain for the original submit on OFBIZ-7618 and Charles STELTZLEN to finish this issue

Modified:
    ofbiz/trunk/applications/datamodel/entitydef/shipment-entitymodel.xml
    ofbiz/trunk/applications/product/minilang/shipment/shipment/ShipmentServices.xml
    ofbiz/trunk/applications/product/servicedef/services_shipment.xml

Modified: ofbiz/trunk/applications/datamodel/entitydef/shipment-entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/datamodel/entitydef/shipment-entitymodel.xml?rev=1752233&r1=1752232&r2=1752233&view=diff
==============================================================================
--- ofbiz/trunk/applications/datamodel/entitydef/shipment-entitymodel.xml (original)
+++ ofbiz/trunk/applications/datamodel/entitydef/shipment-entitymodel.xml Mon Jul 11 23:14:35 2016
@@ -1399,6 +1399,7 @@ under the License.
       <field name="statusId" type="id-ne"></field>
       <field name="shipmentId" type="id-ne"></field>
       <field name="statusDate" type="date-time"></field>
+      <field name="changeByUserLoginId" type="id-vlong"/>
       <prim-key field="statusId"/>
       <prim-key field="shipmentId"/>
       <relation type="one" fk-name="SHPMNT_STTS_STTS" rel-entity-name="StatusItem">
@@ -1407,6 +1408,9 @@ under the License.
       <relation type="one" fk-name="SHPMNT_STTS_SHMT" rel-entity-name="Shipment">
         <key-map field-name="shipmentId"/>
       </relation>
+      <relation type="one" fk-name="SHPMNT_STTS_USRLGN" title="ChangeBy" rel-entity-name="UserLogin">
+          <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
+      </relation>
     </entity>
     <entity entity-name="ShipmentType"
             package-name="org.ofbiz.shipment.shipment"

Modified: ofbiz/trunk/applications/product/minilang/shipment/shipment/ShipmentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/minilang/shipment/shipment/ShipmentServices.xml?rev=1752233&r1=1752232&r2=1752233&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/minilang/shipment/shipment/ShipmentServices.xml (original)
+++ ofbiz/trunk/applications/product/minilang/shipment/shipment/ShipmentServices.xml Mon Jul 11 23:14:35 2016
@@ -105,11 +105,9 @@ under the License.
 
         <!-- get the ShipmentStatus history started -->
         <if-not-empty field="newEntity.statusId">
-            <make-value entity-name="ShipmentStatus" value-field="newStatusValue"/>
-            <set from-field="newEntity.statusId" field="newStatusValue.statusId"/>
-            <set from-field="newEntity.shipmentId" field="newStatusValue.shipmentId"/>
-            <now-timestamp field="newStatusValue.statusDate"/>
-            <create-value value-field="newStatusValue"/>
+            <set field="createShipmentStatusMap.shipmentId" from-field="newEntity.shipmentId" />
+            <set field="createShipmentStatusMap.statusId" from-field="newEntity.statusId" />
+            <call-service service-name="createShipmentStatus" in-map-name="createShipmentStatusMap"/>
         </if-not-empty>
     </simple-method>
     
@@ -134,29 +132,12 @@ under the License.
                 <if-empty field="checkStatusValidChange">
                     <string-to-list string="ERROR: Changing the status from ${lookedUpValue.statusId} to ${parameters.statusId} is not allowed." list="error_list"/>
                 </if-empty>
-                <entity-one entity-name="ShipmentStatus" value-field="shipmentStatus"/>
-                <if-empty field="shipmentStatus">
-                    <make-value entity-name="ShipmentStatus" value-field="newStatusValue"/>
-                    <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>
-                    <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>
+                <set field="createShipmentStatusMap.shipmentId" from-field="parameters.shipmentId" />
+                <set field="createShipmentStatusMap.statusId" from-field="parameters.statusId" />
+                <if-not-empty field="parameters.eventDate">
+                    <set field="createShipmentStatusMap.statusDate" from-field="parameters.eventDate"/>
+                </if-not-empty>
+                <call-service service-name="createShipmentStatus" in-map-name="createShipmentStatusMap"/>
             </if-compare-field>
         </if-not-empty>
 

Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=1752233&r1=1752232&r2=1752233&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Mon Jul 11 23:14:35 2016
@@ -162,6 +162,12 @@ under the License.
         <permission-service service-name="facilityGenericPermission" main-action="DELETE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
+    <service name="createShipmentStatus" default-entity-name="ShipmentStatus" engine="entity-auto" invoke="create" auth="true">
+        <description>Create Shipment Status</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <override name="statusDate" mode="IN" optional="true"/>
+    </service>
     <service name="setShipmentSettingsFromPrimaryOrder" engine="simple"
             location="component://product/minilang/shipment/shipment/ShipmentServices.xml" invoke="setShipmentSettingsFromPrimaryOrder" auth="true">
         <description>Set Shipment Settings From Primary Order</description>