Author: sascharodekamp
Date: Fri Oct 7 06:25:06 2011
New Revision: 1179943
URL:
http://svn.apache.org/viewvc?rev=1179943&view=revLog:
FIX: A patch from Leon which fixes the dependent State dropdown
https://issues.apache.org/jira/browse/OFBIZ-4349Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=1179943&r1=1179942&r2=1179943&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Fri Oct 7 06:25:06 2011
@@ -744,7 +744,7 @@ public class GenericEntity extends Obser
} else {
Debug.logWarning("The field name (or key) [" + name + "] is not valid for entity [" + this.getEntityName() + "], printing IllegalArgumentException instead of throwing it because Map interface specification does not allow throwing that exception.", module);
}
- fieldValue = null;
+ return null;
}
// In case of view entity first try to retrieve with View field names
@@ -816,20 +816,23 @@ public class GenericEntity extends Obser
// finish off by adding the values of all PK fields
if (modelEntity instanceof ModelViewEntity){
// retrieve pkNames of realEntity
- ModelViewEntity modelViewEntiy = (ModelViewEntity) modelEntity;
+ ModelViewEntity modelViewEntity = (ModelViewEntity) modelEntity;
List<String> pkNamesToUse = FastList.newInstance();
// iterate on realEntity for pkField
Iterator<ModelField> iter = modelEntityToUse.getPksIterator();
while (iter != null && iter.hasNext()) {
ModelField curField = iter.next();
String pkName = null;
- Iterator<ModelAlias> iterAlias = modelViewEntiy.getAliasesIterator();
+ Iterator<ModelAlias> iterAlias = modelViewEntity.getAliasesIterator();
//search aliasName for pkField of realEntity
while (iterAlias != null && iterAlias.hasNext()) {
ModelAlias aliasField = iterAlias.next();
if (aliasField.getField().equals(curField.getName())){
- pkName = aliasField.getName();
- break;
+ ModelEntity memberModelEntity = modelViewEntity.getMemberModelEntity(aliasField.getEntityAlias());
+ if (memberModelEntity.getEntityName().equals(modelEntityToUse.getEntityName())) {
+ pkName = aliasField.getName();
+ break;
+ }
}
}
if (pkName == null) pkName = curField.getName();