Author: hansbak
Date: Tue Jun 23 04:31:35 2009 New Revision: 787538 URL: http://svn.apache.org/viewvc?rev=787538&view=rev Log: as commented by scott and anil here a better implementation of r787518 Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml ofbiz/trunk/applications/party/servicedef/services.xml ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml?rev=787538&r1=787537&r2=787538&view=diff ============================================================================== --- ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml (original) +++ ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml Tue Jun 23 04:31:35 2009 @@ -811,6 +811,22 @@ <remove-value value-field="lookedUpValue"/> </simple-method> + <simple-method method-name="createPartyRelationshipContactAccount" short-description="create a company/contact relationship and add the related roles"> + <set field="roleMap.partyId" from-field="parameters.accountPartyId"/> + <set field="roleMap.roleTypeId" value="ACCOUNT"/> + <call-service service-name="createPartyRole" in-map-name="roleMap"/> + <set field="roleMap.partyId" from-field="parameters.contactPartyId"/> + <set field="roleMap.roleTypeId" value="CONTACT"/> + <call-service service-name="createPartyRole" in-map-name="roleMap"/> + <set field="relMap.partyIdFrom" from-field="parameters.accountPartyId"/> + <set field="relMap.roleTypeIdFrom" value="ACCOUNT"/> + <set field="relMap.partyIdTo" from-field="parameters.contactPartyId"/> + <set field="relMap.roleTypeIdTo" value="CONTACT"/> + <set field="relMap.partyRelationshipTypeId" value="EMPLOYMENT"/> + <set field="relMap.comments" from-field="parameters.comments"/> + <call-service service-name="createPartyRelationship" in-map-name="relMap"/> + </simple-method> + <simple-method method-name="createPartyCarrierAccount" short-description="Create PartyCarrierAccount"> <make-value entity-name="PartyCarrierAccount" value-field="newEntity"/> <set-pk-fields map="parameters" value-field="newEntity"/> @@ -939,11 +955,9 @@ </simple-method> <simple-method method-name="createUpdatePerson" short-description="Create and update a person" login-required="false"> - <log level="info" message="========= Inside create update person ============="/> <call-map-processor xml-resource="component://party/script/org/ofbiz/party/party/PartyMapProcs.xml" processor-name="person" in-map-name="parameters" out-map-name="personMap"/> <check-errors/> - <log level="info" message="==================map-processor successfully ran ================${personMap}========================"/> <set field="partyId" from-field="parameters.partyId"/> <set-service-fields service-name="createPerson" map="personMap" to-map="personContext"/> <if-empty field="partyId"> @@ -959,4 +973,5 @@ </if-empty> <field-to-result field="partyId"/> </simple-method> + </simple-methods> Modified: ofbiz/trunk/applications/party/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=787538&r1=787537&r2=787538&view=diff ============================================================================== --- ofbiz/trunk/applications/party/servicedef/services.xml (original) +++ ofbiz/trunk/applications/party/servicedef/services.xml Tue Jun 23 04:31:35 2009 @@ -336,6 +336,14 @@ <auto-attributes include="nonpk" mode="IN" optional="true"/> <override name="partyRelationshipName" optional="false"/> </service> + + <service name="createPartyRelationshipContactAccount" engine="simple" + location="component://party/script/org/ofbiz/party/party/PartyServices.xml" invoke="createPartyRelationshipContactAccount" auth="true"> + <description>create a company/contact relationship and add the related roles</description> + <attribute name="accountPartyId" type="String" mode="IN"/> + <attribute name="contactPartyId" type="String" mode="IN"/> + <attribute name="comments" type="String" mode="IN" optional="true" allow-html="safe"/> + </service> <!-- ContactMech services --> <service name="createContactMech" engine="simple" 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=787538&r1=787537&r2=787538&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 04:31:35 2009 @@ -181,10 +181,6 @@ 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); } catch (GenericEntityException e) { @@ -419,11 +415,6 @@ 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()); Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml?rev=787538&r1=787537&r2=787538&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml Tue Jun 23 04:31:35 2009 @@ -662,6 +662,12 @@ <response name="success" type="view" value="EditPartyRelationships"/> <response name="error" type="view" value="EditPartyRelationships"/> </request-map> + <request-map uri="createPartyRelationshipContactAccount"> + <security https="true" auth="true"/> + <event type="service" path="" invoke="createPartyRelationshipContactAccount"/> + <response name="success" type="view" value="EditPartyRelationships"/> + <response name="error" type="view" value="EditPartyRelationships"/> + </request-map> <request-map uri="updatePartyRelationship"> <security https="true" auth="true"/> <event type="service" path="" invoke="updatePartyRelationship"/> Modified: ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml?rev=787538&r1=787537&r2=787538&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml Tue Jun 23 04:31:35 2009 @@ -837,25 +837,19 @@ <field name="submitButton"><submit button-type="button"/></field> </form> - <form name="AddAccount" type="single" target="createPartyRelationship"> + <form name="AddAccount" type="single" target="createPartyRelationshipContactAccount"> <field name="partyId"><hidden value="${parameters.partyId}"/></field> - <field name="partyIdFrom"><lookup target-form-name="LookupAccount"/></field> + <field name="accountPartyId"><lookup target-form-name="LookupAccount"/></field> + <field name="contactPartyId"><hidden value="${parameters.partyId}"/></field> <field name="comments"><text/></field> - <field name="roleTypeIdFrom"><hidden value="ACCOUNT"/></field> - <field name="partyIdTo"><hidden value="${parameters.partyId}"/></field> - <field name="roleTypeIdTo"><hidden value="CONTACT"/></field> - <field name="partyRelationshipTypeId"><hidden value="EMPLOYMENT"/></field> <field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit button-type="button"/></field> </form> - <form name="AddContact" type="single" target="createPartyRelationship"> + <form name="AddContact" type="single" target="createPartyRelationshipContactAccount"> <field name="partyId"><hidden value="${parameters.partyId}"/></field> - <field name="partyIdFrom"><hidden value="${parameters.partyId}"/></field> - <field name="roleTypeIdFrom"><hidden value="ACCOUNT"/></field> - <field name="partyIdTo"><lookup target-form-name="LookupContact"/></field> + <field name="accountPartyId"><hidden value="${parameters.partyId}"/></field> + <field name="contactPartyId"><lookup target-form-name="LookupContact"/></field> <field name="comments"><text/></field> - <field name="roleTypeIdTo"><hidden value="CONTACT"/></field> - <field name="partyRelationshipTypeId"><hidden value="EMPLOYMENT"/></field> <field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit button-type="button"/></field> </form> |
Free forum by Nabble | Edit this page |