+1, not every person is a contact and not every party group is an account.

Regards
Scott

On 23/06/2009, at 2:54 PM, Anil Patel wrote:

Hans,
I have objection to your modifications in PartyServices.java.

I don't think its good idea to HARD CODE to add every Person in CONTACT role similarly I don't think we should add every PartyGroup in ACCOUNT role.

We have lots of examples in ofbiz where we first create Person and then assign a role to that party. In case you have special need then its better to write a service that first creates Person and then assigns it CONTACT role.

Or write a seca in your hotdeploy application that will trigger service to assign CONTACT role to person every time a person is created. You can do similar thing for PartyGroup as well.

Regards
Anil Patel


Begin forwarded message:

From: [email protected]
Date: June 22, 2009 10:19:48 PM EDT
To: [email protected]
Subject: svn commit: r787518 - /ofbiz/trunk/applications/party/src/ org/ofbiz/party/party/PartyServices.java
Reply-To: [email protected]

Author: hansbak
Date: Tue Jun 23 02:19:48 2009
New Revision: 787518

URL: http://svn.apache.org/viewvc?rev=787518&view=rev
Log:
add standard the contact role to person and the account to partygroup so that they appear in sfa and the contact/company relationship can be created more easy

Modified:
ofbiz/trunk/applications/party/src/org/ofbiz/party/party/ PartyServices.java

Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/ PartyServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=787518&r1=787517&r2=787518&view=diff
= = = = = = = = = ===================================================================== --- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/ PartyServices.java (original) +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/ PartyServices.java Tue Jun 23 02:19:48 2009
@@ -180,6 +180,10 @@
person = delegator.makeValue("Person", UtilMisc.toMap("partyId", partyId));
       person.setNonPKFields(context);
       toBeStored.add(person);
+
+        // standard add the role of "contact"
+ GenericValue partyRole = delegator.makeValue("PartyRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "CONTACT"));
+        toBeStored.add(partyRole);

       try {
           delegator.storeAll(toBeStored);
@@ -414,6 +418,12 @@
partyGroup = delegator.makeValue("PartyGroup", UtilMisc.toMap("partyId", partyId));
           partyGroup.setNonPKFields(context);
           partyGroup.create();
+
+            // standard add the role of "Account"
+ GenericValue partyRole = delegator.makeValue("PartyRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "ACCOUNT"));
+            partyRole.create();
+
+
       } catch (GenericEntityException e) {
           Debug.logWarning(e, module);
Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.getMessage());




Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to