[ofbiz-framework] branch trunk updated (f15c037 -> 70ff1c5)

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

[ofbiz-framework] branch trunk updated (f15c037 -> 70ff1c5)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git.


    from f15c037  Fixed: Open FTL File from browser (OFBIZ-12018)
     new 7b01534  Fixed: createPartyGroupRoleAndContactMechs service not working (OFBIZ-11986)
     new 8675993  Fixed: Geo Location functionality of facility contact information screen is not working (OFBIZ-7343)
     new 70ff1c5  Fixed: createPartyGroupRoleAndContactMechs service not working (OFBIZ-11986)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../groovyScripts/sfa/lead/LeadServices.groovy     |  8 ++-
 applications/marketing/servicedef/services.xml     | 15 +++---
 .../groovyScripts/party/PartySimpleMethods.groovy  | 62 +++++++++++-----------
 .../party/minilang/party/PartySimpleMethods.xml    | 19 ++++---
 applications/party/servicedef/services.xml         |  6 +--
 .../party/template/party/profileblocks/Contact.ftl |  2 +-
 6 files changed, 61 insertions(+), 51 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] 01/03: Fixed: createPartyGroupRoleAndContactMechs service not working (OFBIZ-11986)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 7b01534208ca83e4c890791821cad54a89ea4a23
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sun Sep 27 13:41:52 2020 +0200

    Fixed: createPartyGroupRoleAndContactMechs service not working (OFBIZ-11986)
   
    While researched on ticket OFBIZ-11896 identified that groovy version of
    createPartyGroupRoleAndContactMechs service (converted from mini lang at rev
    8af7cf877583acf100d1229260e62fe7f4c92563 ) is not working.
   
    Identify these two reasons,
        resolvePartyGroupMap called incorrectly
        resolvePostalAddressMap and resolveTelecomNumberMap implemented incorrectly
    as 'postalAddress' and 'telecomNumber' map processor not available into PartyMapProcs.xml.
   
    There may be more reasons along with these two reasons.
   
    Thanks: Akash Jain for report, Sourabh Jain for incomplete patch (missed 2nd
    point from Akash
---
 .../party/groovyScripts/party/PartySimpleMethods.groovy   | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/applications/party/groovyScripts/party/PartySimpleMethods.groovy b/applications/party/groovyScripts/party/PartySimpleMethods.groovy
index 7e934ec..20605cb 100644
--- a/applications/party/groovyScripts/party/PartySimpleMethods.groovy
+++ b/applications/party/groovyScripts/party/PartySimpleMethods.groovy
@@ -31,7 +31,7 @@ import org.apache.ofbiz.service.ServiceUtil
  */
 def createPartyGroupRoleAndContactMechs() {
     try {
-        parameters.partyGroupContext = resolvePartyGroupMap(parameters)
+        parameters.partyGroupContext = resolvePartyGroupMap()
         if (parameters.address1) {
             parameters.postalAddressContext = resolvePostalAddressMap()
         }
@@ -76,22 +76,21 @@ def createPartyGroupRoleAndContactMechs() {
 
 // TODO need to convert from MapProcessor
 def resolvePartyGroupMap() {
-    return resolvePartyProcessMap('partyGroup')
+    return resolvePartyProcessMap("party/minilang/party/PartyMapProcs.xml", 'partyGroup')
 }
 def resolvePostalAddressMap() {
-    return resolvePartyProcessMap('postalAddress')
+    return resolvePartyProcessMap("party/minilang/contact/PartyContactMechMapProcs.xml", 'postalAddress')
 }
 def resolveTelecomNumberMap() {
-    return resolvePartyProcessMap('telecomNumber')
+    return resolvePartyProcessMap("party/minilang/contact/PartyContactMechMapProcs.xml", 'telecomNumber')
 }
-def resolvePartyProcessMap(String processMapName) {
+def resolvePartyProcessMap(String mapProcessorPath, String processMapName) {
     List messages = []
     Map resultMap = [:]
-    SimpleMapProcessor.runSimpleMapProcessor('component://party/minilang/party/PartyMapProcs.xml',
-            processMapName, parameters, resultMap, messages, context.locale)
+    SimpleMapProcessor.runSimpleMapProcessor('component://' + mapProcessorPath, processMapName, parameters, resultMap, messages, context.locale)
     // Check errors
     if (messages) {
         throw new GenericServiceException(messages.join(','))
     }
     return resultMap
-}
\ No newline at end of file
+}

Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] 02/03: Fixed: Geo Location functionality of facility contact information screen is not working (OFBIZ-7343)

jleroux@apache.org
In reply to this post by jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 8675993ac3667c7054dd3d52abd9c01e230494b9
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Mon Sep 28 10:48:01 2020 +0200

    Fixed: Geo Location functionality of facility contact information screen is not working (OFBIZ-7343)
   
    Long ago I spotted an issue:
   
    <<In French I got this js error message in console (else nothing apears anywhere)
   
    SyntaxError: missing ) after argument list
    ...=9000&partyId=Company', 'Adresse d'expédition - Géolocalisation', '450', '550')
   
    It's due to the quote in "Adresse d'expédition"
    We could though commit by escaping the popUptitle, but I also think we should
    change from the popup (and everywhere the same is used) to a modal layered
    window.>>
   
    Turned out that:
    <<I had a quick look to see if we could not use a modal layer instead of a popup,
    but it's not obvious to use modal layer from Freemarker. This does not mean that
    it can't be done... I'll see later...>>
   
    Here is a late workaround :)
---
 applications/party/template/party/profileblocks/Contact.ftl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/applications/party/template/party/profileblocks/Contact.ftl b/applications/party/template/party/profileblocks/Contact.ftl
index 7467fe4..c917c68 100644
--- a/applications/party/template/party/profileblocks/Contact.ftl
+++ b/applications/party/template/party/profileblocks/Contact.ftl
@@ -65,7 +65,7 @@ under the License.
                       <#if contactMechPurposeType?has_content>
                         <#assign popUptitle = contactMechPurposeType.get("description", locale) + uiLabelMap.CommonGeoLocation>
                       </#if>
-                      <a href="javascript:popUp('<@ofbizUrl>GetPartyGeoLocation?geoPointId=${postalAddress.geoPointId}&partyId=${partyId}</@ofbizUrl>', '${popUptitle!}', '450', '550')" class="buttontext">${uiLabelMap.CommonGeoLocation}</a>
+                      <a href="javascript:popUp('<@ofbizUrl>GetPartyGeoLocation?geoPointId=${postalAddress.geoPointId}&partyId=${partyId}</@ofbizUrl>', '${StringUtil.wrapString(popUptitle)!}', '450', '550')" class="buttontext">${uiLabelMap.CommonGeoLocation}</a>
                     </#if>
                   </#if>
                 <#elseif "TELECOM_NUMBER" = contactMech.contactMechTypeId>

Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] 03/03: Fixed: createPartyGroupRoleAndContactMechs service not working (OFBIZ-11986)

jleroux@apache.org
In reply to this post by jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 70ff1c500665ae400c077f0e0c9f875afa6d4b3d
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Wed Sep 30 14:27:13 2020 +0200

    Fixed: createPartyGroupRoleAndContactMechs service not working (OFBIZ-11986)
   
    As Akash Jain reported:
   
    <<While researched on ticket OFBIZ-11896 identified that groovy version of
    createPartyGroupRoleAndContactMechs service (converted from mini lang at rev
    8af7cf877583acf100d1229260e62fe7f4c92563 ) is not working.
    Identify these two reasons,
        resolvePartyGroupMap called incorrectly
        resolvePostalAddressMap and resolveTelecomNumberMap implemented incorrectly
    as 'postalAddress' and 'telecomNumber' map processor
    not available into PartyMapProcs.xml.
   
    There may be more reasons along with these two reasons.>>
   
    He was so true to say the later!
   
    There are also some intentionally or automated formattings.
   
    Thanks: Akash for report, Sourabh Jain for shy tentative :)
---
 .../groovyScripts/sfa/lead/LeadServices.groovy     |  8 ++--
 applications/marketing/servicedef/services.xml     | 15 ++++---
 .../groovyScripts/party/PartySimpleMethods.groovy  | 47 ++++++++++++----------
 .../party/minilang/party/PartySimpleMethods.xml    | 19 ++++++---
 applications/party/servicedef/services.xml         |  6 +--
 5 files changed, 53 insertions(+), 42 deletions(-)

diff --git a/applications/marketing/groovyScripts/sfa/lead/LeadServices.groovy b/applications/marketing/groovyScripts/sfa/lead/LeadServices.groovy
index 61d1e93..7594ce5 100644
--- a/applications/marketing/groovyScripts/sfa/lead/LeadServices.groovy
+++ b/applications/marketing/groovyScripts/sfa/lead/LeadServices.groovy
@@ -32,11 +32,9 @@ def createLead() {
     String partyGroupPartyId
     // Check if Person or PartyGroup name is supplied
     if ((!parameters.firstName || !parameters.lastName) && !parameters.groupName) {
-        return error(UtilProperties.getMessage("MarketingUiLabels",
-                "SfaFirstNameLastNameAndCompanyNameMissingError", locale))
+        return error(UtilProperties.getMessage("MarketingUiLabels", "SfaFirstNameLastNameAndCompanyNameMissingError", locale))
     }
-    run service: "ensurePartyRole", with: [partyId: userLogin.partyId,
-                                           roleTypeId: "OWNER"]
+    run service: "ensurePartyRole", with: [partyId: userLogin.partyId, roleTypeId: "OWNER"]
     // PartyRole check end
     parameters.roleTypeId = "LEAD"
 
@@ -202,4 +200,4 @@ def resolvePartyProcessMap() {
         throw new GenericServiceException(messages.join(','))
     }
     return resultMap
-}
\ No newline at end of file
+}
diff --git a/applications/marketing/servicedef/services.xml b/applications/marketing/servicedef/services.xml
index 28a646b..55e1281 100644
--- a/applications/marketing/servicedef/services.xml
+++ b/applications/marketing/servicedef/services.xml
@@ -289,21 +289,21 @@ under the License.
     <service name="updateCommStatusFromCommEvent" engine="simple"
             location="component://marketing/minilang/marketing/contact/ContactListServices.xml" invoke="updateCommStatusFromCommEvent">
         <attribute name="communicationEventId" type="String" mode="IN"/>
-        <attribute name="statusId" type="String" mode="IN"/>        
-    </service>
+        <attribute name="statusId" type="String" mode="IN"/>
+    </service>
     
     <!-- WebSiteContactList services -->
-    <service name="createWebSiteContactList" engine="simple" default-entity-name="WebSiteContactList"
+    <service name="createWebSiteContactList" engine="simple" default-entity-name="WebSiteContactList"
         location="component://marketing/minilang/marketing/contact/ContactListServices.xml" invoke="createWebSiteContactList">
         <auto-attributes mode="IN" include="pk" optional="false"/>
         <auto-attributes mode="IN" include="nonpk" optional="true"/>
     </service>
-    <service name="updateWebSiteContactList" engine="simple" default-entity-name="WebSiteContactList"
+    <service name="updateWebSiteContactList" engine="simple" default-entity-name="WebSiteContactList"
         location="component://marketing/minilang/marketing/contact/ContactListServices.xml" invoke="updateWebSiteContactList">
         <auto-attributes mode="IN" include="pk" optional="false"/>
         <auto-attributes mode="IN" include="nonpk" optional="true"/>
     </service>
-    <service name="deleteWebSiteContactList" engine="simple" default-entity-name="WebSiteContactList"
+    <service name="deleteWebSiteContactList" engine="simple" default-entity-name="WebSiteContactList"
         location="component://marketing/minilang/marketing/contact/ContactListServices.xml" invoke="deleteWebSiteContactList">
         <auto-attributes mode="IN" include="pk" optional="false"/>
     </service>
@@ -484,7 +484,10 @@ under the License.
     <service name="createLead" engine="groovy" location="component://marketing/groovyScripts/sfa/lead/LeadServices.groovy" invoke="createLead">
         <description>
             Sales Lead can be just a person or a person representing a company or a company (party group).
-            createLead works 1) If person information is passed. 2) If company (party group) information is passed. 3) If Person and company (party group) information is passed.
+            createLead works
+            1) If person information is passed.
+            2) If company (party group) information is passed.
+            3) If Person and company (party group) information is passed.
         </description>
         <auto-attributes entity-name="Person" mode="IN" optional="true">
             <exclude field-name="partyId"/>
diff --git a/applications/party/groovyScripts/party/PartySimpleMethods.groovy b/applications/party/groovyScripts/party/PartySimpleMethods.groovy
index 20605cb..a261b3f 100644
--- a/applications/party/groovyScripts/party/PartySimpleMethods.groovy
+++ b/applications/party/groovyScripts/party/PartySimpleMethods.groovy
@@ -23,36 +23,18 @@ import org.apache.ofbiz.minilang.SimpleMapProcessor
 import org.apache.ofbiz.service.GenericServiceException
 import org.apache.ofbiz.service.ServiceUtil
 
-// Simple method to create a party group, its role and basic contact mechs
 
 /**
  * Creates a party group, role and contactMechs
- * @return
+ * @return result
  */
 def createPartyGroupRoleAndContactMechs() {
     try {
         parameters.partyGroupContext = resolvePartyGroupMap()
-        if (parameters.address1) {
-            parameters.postalAddressContext = resolvePostalAddressMap()
-        }
-        if (parameters.contactNumber) {
-            parameters.telecomNumberContext = resolveTelecomNumberMap()
-        }
     } catch (GenericServiceException e) {
         return error(e.toString())
     }
 
-    if (parameters.emailAddress) {
-        Map emailAddressContext = [:]
-        if  (!UtilValidate.isEmail(parameters.emailAddress)) {
-            return error(UtilProperties.getMessage('PartyUiLabels',
-                    'PartyEmailAddressNotFormattedCorrectly', parameters.locale))
-        } else {
-            emailAddressContext.emailAddress = parameters.emailAddress
-        }
-        parameters.emailAddressContext = emailAddressContext
-    }
-
     parameters.partyGroupContext.partyTypeId = "PARTY_GROUP"
     Map serviceResult = run service: "createPartyGroup", with: parameters.partyGroupContext
     if (ServiceUtil.isError(serviceResult)) {
@@ -60,7 +42,8 @@ def createPartyGroupRoleAndContactMechs() {
     }
     Map result = success()
     result.partyId = serviceResult.partyId
-
+    parameters.partyId = serviceResult.partyId
+    
     if (parameters.roleTypeId) {
         Map serviceResultCPR = run service: "createPartyRole", with: [partyId: serviceResult.partyId,
                                                                      roleTypeId: parameters.roleTypeId]
@@ -68,9 +51,26 @@ def createPartyGroupRoleAndContactMechs() {
             return serviceResultCPR
         }
     }
+    try {
+        if (parameters.address1) {
+            parameters.postalAddressContext = resolvePostalAddressMap()
+        }
+        if (parameters.contactNumber) {
+            parameters.telecomNumberContext = resolveTelecomNumberMap()
+        }
+        if (parameters.emailAddress) {
+            resolveEmailAddressMap()
+            Map emailAddressContext = [:]
+            emailAddressContext.partyId = parameters.partyId
+            emailAddressContext.emailAddress = parameters.emailAddress
+            parameters.emailAddressContext = emailAddressContext
+        }
+    } catch (GenericServiceException e) {
+        return error(e.toString())
+    }
+    
 
-    run service:"createPartyContactMechs", with: parameters
-
+    run service: "createPartyContactMechs", with: parameters
     return result
 }
 
@@ -84,6 +84,9 @@ def resolvePostalAddressMap() {
 def resolveTelecomNumberMap() {
     return resolvePartyProcessMap("party/minilang/contact/PartyContactMechMapProcs.xml", 'telecomNumber')
 }
+def resolveEmailAddressMap() {
+    return resolvePartyProcessMap("party/minilang/contact/PartyContactMechMapProcs.xml", 'emailAddress')
+}
 def resolvePartyProcessMap(String mapProcessorPath, String processMapName) {
     List messages = []
     Map resultMap = [:]
diff --git a/applications/party/minilang/party/PartySimpleMethods.xml b/applications/party/minilang/party/PartySimpleMethods.xml
index ed7922a..91fb7c8 100644
--- a/applications/party/minilang/party/PartySimpleMethods.xml
+++ b/applications/party/minilang/party/PartySimpleMethods.xml
@@ -131,21 +131,23 @@ under the License.
             </call-map-processor>
         </if-not-empty>
         <check-errors/>
-
+        
         <call-service service-name="createPerson" in-map-name="personContext">
             <result-to-field result-name="partyId" field="partyId"/>
         </call-service>
-
+        <check-errors/>
+        <set field="emailAddressContext.partyId" from="partyId"/>
+        
         <if-not-empty field="parameters.roleTypeId">
             <set field="createPartyRoleCtx.partyId" from-field="partyId"/>
             <set field="createPartyRoleCtx.roleTypeId" from-field="parameters.roleTypeId"/>
             <call-service service-name="createPartyRole" in-map-name="createPartyRoleCtx"/>
         </if-not-empty>
-
+        <check-errors/>
         <set field="postalAddContactMechPurpTypeId" from-field="parameters.postalAddContactMechPurpTypeId"/>
         <set field="contactNumber" from-field="parameters.contactNumber"/>
         <set field="phoneContactMechPurpTypeId" from-field="parameters.phoneContactMechPurpTypeId"/>
-        <set field="emailAddress" from-field="parameters.emailAddress"/>
+        <set field="emailAddress" from-field="emailAddressContext"/>
         <set field="emailContactMechPurpTypeId" from-field="parameters.emailContactMechPurpTypeId"/>
         <call-simple-method method-name="createPartyContactMechs"/>
         <field-to-result field="partyId"/>
@@ -198,6 +200,12 @@ under the License.
     <!-- Simple method to create Party Postal Address, Telecom Number and Email Address, to be used by
          createPersonRoleAndContactMechs and createPartyGroupRoleAndContactMechs simple methods -->
     <simple-method method-name="createPartyContactMechs" short-description="Create Contact Mechs">
+        <set field="postalAddressContext" from-field="parameters.postalAddressContext"/>
+        <set field="postalAddContactMechPurpTypeId" from-field="parameters.postalAddContactMechPurpTypeId"/>
+        <set field="telecomNumberContext" from-field="parameters.telecomNumberContext" />
+        <set field="phoneContactMechPurpTypeId" from-field="parameters.phoneContactMechPurpTypeId"/>
+        <set field="emailAddressContext" from-field="parameters.emailAddressContext"/>
+        <set field="emailContactMechPurpTypeId" from-field="parameters.emailContactMechPurpTypeId"/>
         <!-- postal address -->
         <if-not-empty field="postalAddressContext">
             <set field="postalAddressContext.partyId" from-field="partyId"/>
@@ -225,12 +233,11 @@ under the License.
 
         <!-- email address -->
         <if-not-empty field="emailAddressContext">
-            <set field="emailAddressContext.partyId" from-field="partyId"/>
             <set field="emailAddressContext.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
             <if-not-empty field="emailContactMechPurpTypeId"> <!-- override with purpose present in parameters, if any (This field is not used now, just here for future implementations) -->
                 <set field="emailAddressContext.contactMechPurposeTypeId" from-field="emailContactMechPurpTypeId"/>
             </if-not-empty>
-            <call-service service-name="createPartyEmailAddress" in-map-name="emailAddressContext"/>
+            <call-service service-name="createPartyEmailAddress" in-map-name="emailAddressContext" />
         </if-not-empty>
     </simple-method>
 
diff --git a/applications/party/servicedef/services.xml b/applications/party/servicedef/services.xml
index 8a1f8ad..66ee5f2 100644
--- a/applications/party/servicedef/services.xml
+++ b/applications/party/servicedef/services.xml
@@ -73,7 +73,7 @@ under the License.
         <attribute name="description" type="String" mode="IN" optional="true"/>
         <attribute name="externalId" type="String" mode="IN" optional="true"/>
         <attribute name="statusId" type="String" mode="IN" optional="true"/>
-        <!-- First and Last names are here optional. This allows to implement simple create user login screen where user is able create account
+        <!-- First and Last names are here optional. This allows to implement simple create user login screen where user is able create account
             in system with username and password and then later populate rest of the account information. -->
 <!--        <override name="firstName" optional="false"/>
         <override name="lastName" optional="false"/>
@@ -124,7 +124,7 @@ under the License.
         <attribute name="postalAddContactMechPurpTypeId" type="String" mode="IN" optional="true"/>
         <attribute name="contactNumber" type="String" mode="IN" optional="true"/>
         <attribute name="phoneContactMechPurpTypeId" type="String" mode="IN" optional="true"/>
-        <attribute name="emailAddress" type="String" mode="IN" optional="true"/>
+        <attribute name="emailAddressContext" type="Map" mode="IN" optional="true"/>
         <attribute name="emailContactMechPurpTypeId" type="String" mode="IN" optional="true"/>
     </service>
     <service name="createPersonRoleAndContactMechs" engine="simple"
@@ -1271,7 +1271,7 @@ under the License.
         </description>
         <implements service="permissionInterface"/>
     </service>
-    <service name="basePermissionCheck" engine="groovy"
+    <service name="basePermissionCheck" engine="groovy"
             location="component://party/groovyScripts/party/PartyPermissionServices.groovy" invoke="basePermissionCheck">
         <description>
             Performs a basic security check. The user must have the base PARTYMGR  permission.