Hi Nicolas,

Le 03/02/2016 08:27, [email protected] a écrit :
Modified: 
ofbiz/trunk/applications/product/script/org/ofbiz/product/storage/StorageServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/storage/StorageServices.xml?rev=1728261&r1=1728260&r2=1728261&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/script/org/ofbiz/product/storage/StorageServices.xml
 (original)
+++ 
ofbiz/trunk/applications/product/script/org/ofbiz/product/storage/StorageServices.xml
 Wed Feb  3 07:27:21 2016
[...]
-    <!-- Facility Role / Facility Group Role Services -->
-    <simple-method method-name="addPartyToFacility" short-description="Add Party to 
Facility">
-        <set from-field="parameters.partyId" field="lookupPKMap.partyId"/>
-        <set from-field="parameters.roleTypeId" 
field="lookupPKMap.roleTypeId"/>
-        <find-by-primary-key entity-name="PartyRole" map="lookupPKMap" 
value-field="partyRole"/>
-        <if-empty field="partyRole">
-            <make-value value-field="partyRole" entity-name="PartyRole"/>
-            <set-pk-fields map="lookupPKMap" value-field="partyRole"/>
-            <create-value value-field="partyRole"/>
-        </if-empty>
-        <make-value value-field="newEntity" entity-name="FacilityParty"/>
-        <set-pk-fields map="parameters" value-field="newEntity"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-             <if-empty field="newEntity.fromDate">
-                 <now-timestamp field="newEntity.fromDate"/>
-             </if-empty>
-        <create-value value-field="newEntity"/>
-    </simple-method>
-
[...]
-    <service name="addPartyToFacility" engine="simple"
-                location="component://product/script/org/ofbiz/product/storage/StorageServices.xml" 
invoke="addPartyToFacility" auth="true" default-entity-name="FacilityParty">
+    <service name="addPartyToFacility" default-entity-name="FacilityParty" engine="entity-auto" 
invoke="create" auth="true">
          <description>Create a FacilityParty record</description>
          <permission-service service-name="facilityGenericPermission" 
main-action="CREATE"/>
          <auto-attributes include="pk" mode="IN" optional="false"/>
          <auto-attributes include="nonpk" mode="IN" optional="true"/>
          <override name="fromDate" optional="true"/>
      </service>
The PartyRole creation (when missing) is lost here, this is the kind of error 
you get:

Parameter Name Parameter Value Save Value ? errorMessage Error doing entity-auto operation for entity FacilityParty in service addPartyToFacility: org.ofbiz.entity.GenericEntityException: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:FacilityParty][createdStamp,2016-02-14 11:34:22.906(java.sql.Timestamp)][createdTxStamp,2016-02-14 11:34:22.628(java.sql.Timestamp)][facilityId,WebStoreWarehouse(java.lang.String)][fromDate,2016-02-14 11:34:22.906(java.sql.Timestamp)][lastUpdatedStamp,2016-02-14 11:34:22.906(java.sql.Timestamp)][lastUpdatedTxStamp,2016-02-14 11:34:22.628(java.sql.Timestamp)][partyId,admin(java.lang.String)][roleTypeId,CONTENT_ADMIN(java.lang.String)][thruDate,null()] (SQL Exception while executing the following:INSERT INTO OFBIZ.FACILITY_PARTY (FACILITY_ID, PARTY_ID, ROLE_TYPE_ID, FROM_DATE, THRU_DATE, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT on table 'FACILITY_PARTY' caused a violation of foreign key constraint 'FACILITY_PRTY_ROLE' for key (admin,CONTENT_ADMIN). The statement has been rolled back.)) (Error while inserting: [GenericEntity:FacilityParty][createdStamp,2016-02-14 11:34:22.906(java.sql.Timestamp)][createdTxStamp,2016-02-14 11:34:22.628(java.sql.Timestamp)][facilityId,WebStoreWarehouse(java.lang.String)][fromDate,2016-02-14 11:34:22.906(java.sql.Timestamp)][lastUpdatedStamp,2016-02-14 11:34:22.906(java.sql.Timestamp)][lastUpdatedTxStamp,2016-02-14 11:34:22.628(java.sql.Timestamp)][partyId,admin(java.lang.String)][roleTypeId,CONTENT_ADMIN(java.lang.String)][thruDate,null()] (SQL Exception while executing the following:INSERT INTO OFBIZ.FACILITY_PARTY (FACILITY_ID, PARTY_ID, ROLE_TYPE_ID, FROM_DATE, THRU_DATE, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT on table 'FACILITY_PARTY' caused a violation of foreign key constraint 'FACILITY_PRTY_ROLE' for key (admin,CONTENT_ADMIN). The statement has been rolled back.))

Jacques

Reply via email to