Author: jonesde
Date: Sat Aug 12 06:18:20 2006 New Revision: 431031 URL: http://svn.apache.org/viewvc?rev=431031&view=rev Log: Fixed a couple more places that need to work with/without partyId Modified: incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/includes/envsetup.bsh Modified: incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=431031&r1=431030&r2=431031&view=diff ============================================================================== --- incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original) +++ incubator/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Sat Aug 12 06:18:20 2006 @@ -467,9 +467,13 @@ GenericValue person = null; GenericValue group = null; if (autoUserLogin != null) { - person = delegator.findByPrimaryKey("Person", UtilMisc.toMap("partyId", autoUserLogin.getString("partyId"))); - group = delegator.findByPrimaryKey("PartyGroup", UtilMisc.toMap("partyId", autoUserLogin.getString("partyId"))); session.setAttribute("autoUserLogin", autoUserLogin); + + ModelEntity modelUserLogin = autoUserLogin.getModelEntity(); + if (modelUserLogin.isField("partyId")) { + person = delegator.findByPrimaryKey("Person", UtilMisc.toMap("partyId", autoUserLogin.getString("partyId"))); + group = delegator.findByPrimaryKey("PartyGroup", UtilMisc.toMap("partyId", autoUserLogin.getString("partyId"))); + } } if (person != null) { session.setAttribute("autoName", person.getString("firstName") + " " + person.getString("lastName")); Modified: incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/includes/envsetup.bsh URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/includes/envsetup.bsh?rev=431031&r1=431030&r2=431031&view=diff ============================================================================== --- incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/includes/envsetup.bsh (original) +++ incubator/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/includes/envsetup.bsh Sat Aug 12 06:18:20 2006 @@ -26,15 +26,21 @@ person = session.getAttribute("_PERSON_"); partyGroup = session.getAttribute("_PARTY_GROUP_"); -if (person == null) { - person = userLogin == null ? null : userLogin.getRelatedOne("Person"); - if (person != null) session.setAttribute("_PERSON_", person); +if (person == null && userLogin != null) { + modelUserLogin = userLogin.getModelEntity(); + if (modelUserLogin.isField("partyId")) { + person = userLogin.getRelatedOne("Person"); + if (person != null) session.setAttribute("_PERSON_", person); + } } if (person != null) { request.setAttribute("person", person); -} else if (partyGroup == null) { - partyGroup = userLogin == null ? null : userLogin.getRelatedOne("PartyGroup"); - if (partyGroup != null) session.setAttribute("_PARTY_GROUP_", partyGroup); +} else if (partyGroup == null && userLogin != null) { + modelUserLogin = userLogin.getModelEntity(); + if (modelUserLogin.isField("partyId")) { + partyGroup = userLogin.getRelatedOne("PartyGroup"); + if (partyGroup != null) session.setAttribute("_PARTY_GROUP_", partyGroup); + } } if (partyGroup != null) request.setAttribute("partyGroup", partyGroup); |
Free forum by Nabble | Edit this page |