You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by pr...@apache.org on 2016/05/21 10:30:36 UTC

svn commit: r1744892 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java

Author: pranayp
Date: Sat May 21 10:30:36 2016
New Revision: 1744892

URL: http://svn.apache.org/viewvc?rev=1744892&view=rev
Log:
[OFBIZ-7099] Fixed: Service entity auto not having duplicate record check when we pass single primary key. 

Thanks  Amardeep Singh Jhajj for reporting the issue and providing patch.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java?rev=1744892&r1=1744891&r2=1744892&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/EntityAutoEngine.java Sat May 21 10:30:36 2016
@@ -228,6 +228,10 @@ public final class EntityAutoEngine exte
                 }
             }
             newEntity.set(singlePkModeField.getName(), pkValue);
+            GenericValue lookedUpValue = PrimaryKeyFinder.runFind(modelEntity, parameters, dctx.getDelegator(), false, true, null, null);
+            if (lookedUpValue != null) {
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ServiceValueFound", UtilMisc.toMap("pkFields", newEntity.getPkShortValueString()), locale));
+            }
         } else if (isDoublePk && doublePkPrimaryInParam != null && doublePkSecondaryOutParam != null) {
             /*
              **** secondary sequenced primary key ****