Author: jleroux
Date: Mon Nov 27 17:55:54 2017
New Revision: 1816481

URL: http://svn.apache.org/viewvc?rev=1816481&view=rev
Log:
Implemented: Add ability to store latitude and longitude as well while creating 
postal address
(OFBIZ-9980)

While creating a postal address for any party or facility, we can enable 
service 
to store its latitude and longitude if available and create a geo point for the 
same. 

Later screens using this feature will be created with OFBIZ-10022

Thanks: Suraj Khurana

Modified:
    
ofbiz/ofbiz-framework/trunk/applications/party/minilang/contact/PartyContactMechServices.xml
    ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml
    
ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/storage/FacilityContactMechServices.xml
    
ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_facility.xml

Modified: 
ofbiz/ofbiz-framework/trunk/applications/party/minilang/contact/PartyContactMechServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/minilang/contact/PartyContactMechServices.xml?rev=1816481&r1=1816480&r2=1816481&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/party/minilang/contact/PartyContactMechServices.xml
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/applications/party/minilang/contact/PartyContactMechServices.xml
 Mon Nov 27 17:55:54 2017
@@ -167,37 +167,49 @@ under the License.
         <if-empty field="parameters.partyId">
             <set field="parameters.partyId" from-field="userLogin.partyId"/>
         </if-empty>
-
+        <if-not-empty field="parameters.latitude">
+            <if-not-empty field="parameters.longitude">
+                <set-service-fields service-name="createGeoPoint" 
map="parameters" to-map="createGeoPointMap"/>
+                <call-service in-map-name="createGeoPointMap" 
service-name="createGeoPoint">
+                    <result-to-field result-name="geoPointId" 
field="parameters.geoPointId"/>
+                </call-service>
+                <check-errors/>
+            </if-not-empty>
+        </if-not-empty>
         <set-service-fields service-name="createPostalAddress" 
map="parameters" to-map="createPostalAddressMap"/>
         <call-service in-map-name="createPostalAddressMap" 
service-name="createPostalAddress">
             <default-message resource="PartyUiLabels" 
property="PartyPostalAddressSuccessfullyCreated"/>
             <result-to-field result-name="contactMechId" 
field="newPartyContactMech.contactMechId"/>
         </call-service>
-
         <check-errors/>
         <set-service-fields service-name="createPartyContactMech" 
map="parameters" to-map="createPartyContactMechMap"/>
         <set field="createPartyContactMechMap.contactMechId" 
from-field="newPartyContactMech.contactMechId"/>
         <set field="createPartyContactMechMap.contactMechTypeId" 
value="POSTAL_ADDRESS"/>
-
         <call-service service-name="createPartyContactMech" 
in-map-name="createPartyContactMechMap" break-on-error="true">
             <default-message resource="PartyUiLabels" 
property="PartyPostalAddressSuccessfullyCreated"/>
         </call-service>
         <field-to-request field="newPartyContactMech.contactMechId" 
request-name="contactMechId"/>
         <field-to-result field="newPartyContactMech.contactMechId" 
result-name="contactMechId"/>
     </simple-method>
-
     <simple-method method-name="updatePartyPostalAddress" 
short-description="Update a PostalAddress for party">
         <make-value entity-name="PartyContactMech" 
value-field="newPartyContactMech"/>
         <if-empty field="parameters.partyId">
             <set field="parameters.partyId" from-field="userLogin.partyId"/>
         </if-empty>
-
+        <if-not-empty field="parameters.latitude">
+            <if-not-empty field="parameters.longitude">
+                <set-service-fields service-name="createGeoPoint" 
map="parameters" to-map="createGeoPointMap"/>
+                <call-service in-map-name="createGeoPointMap" 
service-name="createGeoPoint">
+                    <result-to-field result-name="geoPointId" 
field="parameters.geoPointId"/>
+                </call-service>
+                <check-errors/>
+            </if-not-empty>
+        </if-not-empty>
         <set-service-fields service-name="updatePostalAddress" 
map="parameters" to-map="updatePostalAddressMap"/>
         <call-service in-map-name="updatePostalAddressMap" 
service-name="updatePostalAddress">
             <default-message resource="PartyUiLabels" 
property="PartyPostalAddressSuccessfullyUpdated"/>
             <result-to-field result-name="contactMechId" 
field="newPartyContactMech.contactMechId"/>
         </call-service>
-
         <set-service-fields service-name="updatePartyContactMech" 
map="parameters" to-map="updatePartyContactMechMap"/>
         <set field="updatePartyContactMechMap.newContactMechId" 
from-field="newPartyContactMech.contactMechId"/>
         <set field="updatePartyContactMechMap.contactMechTypeId" 
value="POSTAL_ADDRESS"/>

Modified: ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml?rev=1816481&r1=1816480&r2=1816481&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml 
(original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml Mon 
Nov 27 17:55:54 2017
@@ -463,6 +463,8 @@ under the License.
         <attribute name="paymentMethodId" type="String" mode="IN" 
optional="true"/>
         <attribute name="contactMechPurposeTypeId" type="String" mode="IN" 
optional="true"/>
         <attribute name="contactMechId" type="String" mode="OUT" 
optional="false"/>
+        <attribute name="latitude" type="String" mode="IN" optional="true"/>
+        <attribute name="longitude" type="String" mode="IN" optional="true"/>
         <override name="address1" optional="false"/>
         <override name="city" optional="false"/>
         <override name="postalCode" optional="false"/>
@@ -475,6 +477,8 @@ under the License.
         <attribute name="directions" type="String" mode="IN" optional="true"/> 
<!-- ?? -->
         <attribute name="oldContactMechId" type="String" mode="OUT" 
optional="false"/> <!-- this is the id of the old address -->
         <attribute name="partyId" type="String" mode="IN" optional="true"/>
+        <attribute name="latitude" type="String" mode="IN" optional="true"/>
+        <attribute name="longitude" type="String" mode="IN" optional="true"/>
         <override name="address1" optional="false"/>
         <override name="city" optional="false"/>
         <override name="postalCode" optional="false"/>

Modified: 
ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/storage/FacilityContactMechServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/storage/FacilityContactMechServices.xml?rev=1816481&r1=1816480&r2=1816481&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/storage/FacilityContactMechServices.xml
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/applications/product/minilang/product/storage/FacilityContactMechServices.xml
 Mon Nov 27 17:55:54 2017
@@ -143,6 +143,15 @@ under the License.
     </simple-method>
 
     <simple-method method-name="createFacilityPostalAddress" 
short-description="Create a PostalAddress for facility">
+        <if-not-empty field="parameters.latitude">
+            <if-not-empty field="parameters.longitude">
+                <set-service-fields service-name="createGeoPoint" 
map="parameters" to-map="createGeoPointMap"/>
+                <call-service in-map-name="createGeoPointMap" 
service-name="createGeoPoint">
+                    <result-to-field result-name="geoPointId" 
field="parameters.geoPointId"/>
+                </call-service>
+                <check-errors/>
+            </if-not-empty>
+        </if-not-empty>
         <set-service-fields service-name="createPostalAddress" 
map="parameters" to-map="createPostalAddressMap"/>
         <call-service in-map-name="createPostalAddressMap" 
service-name="createPostalAddress">
             <default-message resource="PartyUiLabels" 
property="PartyPostalAddressSuccessfullyCreated"/>
@@ -162,6 +171,15 @@ under the License.
     </simple-method>
 
     <simple-method method-name="updateFacilityPostalAddress" 
short-description="Update a PostalAddress for facility">
+        <if-not-empty field="parameters.latitude">
+            <if-not-empty field="parameters.longitude">
+                <set-service-fields service-name="createGeoPoint" 
map="parameters" to-map="createGeoPointMap"/>
+                <call-service in-map-name="createGeoPointMap" 
service-name="createGeoPoint">
+                    <result-to-field result-name="geoPointId" 
field="parameters.geoPointId"/>
+                </call-service>
+                <check-errors/>
+            </if-not-empty>
+        </if-not-empty>
         <make-value entity-name="FacilityContactMech" 
value-field="newFacilityContactMech"/>
         <set-service-fields service-name="updatePostalAddress" 
map="parameters" to-map="updatePostalAddressMap"/>
         <call-service in-map-name="updatePostalAddressMap" 
service-name="updatePostalAddress">

Modified: 
ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_facility.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_facility.xml?rev=1816481&r1=1816480&r2=1816481&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_facility.xml
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_facility.xml
 Mon Nov 27 17:55:54 2017
@@ -994,6 +994,8 @@ under the License.
         <attribute name="paymentMethodId" type="String" mode="IN" 
optional="true"/>
         <attribute name="contactMechPurposeTypeId" type="String" mode="IN" 
optional="true"/>
         <attribute name="contactMechId" type="String" mode="OUT" 
optional="false"/>
+        <attribute name="latitude" type="String" mode="IN" optional="true"/>
+        <attribute name="longitude" type="String" mode="IN" optional="true"/>
         <override name="address1" optional="false"/>
         <override name="city" optional="false"/>
         <override name="postalCode" optional="true"/>
@@ -1004,6 +1006,8 @@ under the License.
         <permission-service service-name="facilityPermissionCheck" 
main-action="UPDATE"/>
         <auto-attributes entity-name="FacilityContactMech" include="all" 
mode="IN" optional="true"/>
         <auto-attributes entity-name="PostalAddress" include="nonpk" mode="IN" 
optional="true"/>
+        <attribute name="latitude" type="String" mode="IN" optional="true"/>
+        <attribute name="longitude" type="String" mode="IN" optional="true"/>
         <attribute name="contactMechId" type="String" mode="INOUT" 
optional="false"/>
         <attribute name="directions" type="String" mode="IN" optional="true"/>
     </service>


Reply via email to