[ofbiz-framework] branch release18.12 updated: Fixed: Service calls of "createPartyContactMech" now include the needed contactMechTypeId (OFBIZ-12175) (#292)

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

[ofbiz-framework] branch release18.12 updated: Fixed: Service calls of "createPartyContactMech" now include the needed contactMechTypeId (OFBIZ-12175) (#292)

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

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


The following commit(s) were added to refs/heads/release18.12 by this push:
     new a477b32  Fixed: Service calls of "createPartyContactMech" now include the needed contactMechTypeId (OFBIZ-12175) (#292)
a477b32 is described below

commit a477b324396d47f6268940aee244413accc9789a
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Thu Apr 8 13:47:47 2021 +0200

    Fixed: Service calls of "createPartyContactMech" now include the needed contactMechTypeId (OFBIZ-12175) (#292)
   
    Accidentally removed PartyServices::createRoleType
---
 .../apache/ofbiz/party/party/PartyServices.java    | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java
index 8e44a20c..570021f 100644
--- a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java
+++ b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java
@@ -998,6 +998,29 @@ public class PartyServices {
         return result;
     }
 
+    public static Map<String, Object> createRoleType(DispatchContext dctx, Map<String, ? extends Object> context) {
+        Map<String, Object> result = new HashMap<>();
+        Delegator delegator = dctx.getDelegator();
+        Locale locale = (Locale) context.get("locale");
+        GenericValue roleType = null;
+
+        try {
+            roleType = delegator.makeValue("RoleType");
+            roleType.setPKFields(context);
+            roleType.setNonPKFields(context);
+            roleType = delegator.create(roleType);
+        } catch (GenericEntityException e) {
+            Debug.logError(e, MODULE);
+            return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
+                    "PartyCannotCreateRoleTypeEntity",
+                    UtilMisc.toMap("errMessage", e.getMessage()), locale));
+        }
+        if (roleType != null) {
+            result.put("roleType", roleType);
+        }
+        return result;
+    }
+
     @Deprecated // migration from ftl to widget in process.
     public static Map<String, Object> findParty(DispatchContext dctx, Map<String, ? extends Object> context) {
         Map<String, Object> result = ServiceUtil.returnSuccess();