You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2010/10/04 17:14:18 UTC
svn commit: r1004281 -
/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
Author: jonesde
Date: Mon Oct 4 15:14:16 2010
New Revision: 1004281
URL: http://svn.apache.org/viewvc?rev=1004281&view=rev
Log:
Fixed bug in getPostalAddressPostalCodeGeoId method so it doesn't try to modify and save GenericValue objects coming from the cache
Modified:
ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java?rev=1004281&r1=1004280&r2=1004281&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java Mon Oct 4 15:14:16 2010
@@ -907,8 +907,14 @@ public class ContactMechWorker {
GenericValue geo = delegator.findByPrimaryKeyCache("Geo", UtilMisc.toMap("geoId", postalAddress.getString("countryGeoId") + "-" + postalAddress.getString("postalCode")));
if (geo != null) {
// save the value to the database for quicker future reference
- postalAddress.set("postalCodeGeoId", geo.getString("geoId"));
- postalAddress.store();
+ if (postalAddress.isMutable()) {
+ postalAddress.set("postalCodeGeoId", geo.getString("geoId"));
+ postalAddress.store();
+ } else {
+ GenericValue mutablePostalAddress = delegator.findByPrimaryKey("PostalAddress", UtilMisc.toMap("contactMechId", postalAddress.getString("contactMechId")));
+ mutablePostalAddress.set("postalCodeGeoId", geo.getString("geoId"));
+ mutablePostalAddress.store();
+ }
return geo.getString("geoId");
}
@@ -919,8 +925,14 @@ public class ContactMechWorker {
GenericValue geoAssocAndGeoTo = EntityUtil.getFirst(geoAssocAndGeoToList);
if (geoAssocAndGeoTo != null) {
// save the value to the database for quicker future reference
- postalAddress.set("postalCodeGeoId", geoAssocAndGeoTo.getString("geoId"));
- postalAddress.store();
+ if (postalAddress.isMutable()) {
+ postalAddress.set("postalCodeGeoId", geoAssocAndGeoTo.getString("geoId"));
+ postalAddress.store();
+ } else {
+ GenericValue mutablePostalAddress = delegator.findByPrimaryKey("PostalAddress", UtilMisc.toMap("contactMechId", postalAddress.getString("contactMechId")));
+ mutablePostalAddress.set("postalCodeGeoId", geoAssocAndGeoTo.getString("geoId"));
+ mutablePostalAddress.store();
+ }
return geoAssocAndGeoTo.getString("geoId");
}