svn commit: r431032 - /incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r431032 - /incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java

jonesde
Author: jonesde
Date: Sat Aug 12 06:23:11 2006
New Revision: 431032

URL: http://svn.apache.org/viewvc?rev=431032&view=rev
Log:
Updated VisitHandler to work w/wout partyId

Modified:
    incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java

Modified: incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java?rev=431032&r1=431031&r2=431032&view=diff
==============================================================================
--- incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java (original)
+++ incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java Sat Aug 12 06:23:11 2006
@@ -31,6 +31,7 @@
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.model.ModelEntity;
 
 /**
  * Handles saving and maintaining visit information
@@ -93,11 +94,14 @@
 
     public static void setUserLogin(HttpSession session, GenericValue userLogin, boolean userCreated) {
         if (userLogin == null) return;
+        ModelEntity modelUserLogin = userLogin.getModelEntity();
 
         GenericValue visitor = (GenericValue) session.getAttribute("visitor");
         if (visitor != null) {
             visitor.set("userLoginId", userLogin.get("userLoginId"));
-            visitor.set("partyId", userLogin.get("partyId"));
+            if (modelUserLogin.isField("partyId")) {
+                visitor.set("partyId", userLogin.get("partyId"));
+            }
             try {
                 visitor.store();
             } catch (GenericEntityException e) {
@@ -108,7 +112,9 @@
         GenericValue visit = getVisit(session);
         if (visit != null) {
             visit.set("userLoginId", userLogin.get("userLoginId"));
-            visit.set("partyId", userLogin.get("partyId"));
+            if (modelUserLogin.isField("partyId")) {
+                visit.set("partyId", userLogin.get("partyId"));
+            }
             visit.set("userCreated", new Boolean(userCreated));
             
             // make sure the visitorId is still in place