Author: deepak
Date: Fri Sep 2 18:55:06 2016 New Revision: 1759012 URL: http://svn.apache.org/viewvc?rev=1759012&view=rev Log: (OFBIZ-7616) Applied patch from jira issue ================================= Add "changeByUserLoginId" field for PartyStatus ================================= Thanks Nameet for your contribution. Modified: ofbiz/trunk/applications/datamodel/entitydef/party-entitymodel.xml ofbiz/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java Modified: ofbiz/trunk/applications/datamodel/entitydef/party-entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/datamodel/entitydef/party-entitymodel.xml?rev=1759012&r1=1759011&r2=1759012&view=diff ============================================================================== --- ofbiz/trunk/applications/datamodel/entitydef/party-entitymodel.xml (original) +++ ofbiz/trunk/applications/datamodel/entitydef/party-entitymodel.xml Fri Sep 2 18:55:06 2016 @@ -2639,6 +2639,7 @@ under the License. <field name="statusId" type="id-ne"></field> <field name="partyId" type="id-ne"></field> <field name="statusDate" type="date-time"></field> + <field name="changeByUserLoginId" type="id-vlong"></field> <prim-key field="statusId"/> <prim-key field="partyId"/> <prim-key field="statusDate"/> @@ -2648,6 +2649,9 @@ under the License. <relation type="one" fk-name="PARTY_STS_PARTY" rel-entity-name="Party"> <key-map field-name="partyId"/> </relation> + <relation type="one" fk-name="PARTY_STTS_USRLGN" title="ChangeBy" rel-entity-name="UserLogin"> + <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/> + </relation> </entity> <entity entity-name="OldPartyTaxInfo" table-name="PARTY_TAX_INFO" package-name="org.apache.ofbiz.party.party" Modified: ofbiz/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java?rev=1759012&r1=1759011&r2=1759012&view=diff ============================================================================== --- ofbiz/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java (original) +++ ofbiz/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java Fri Sep 2 18:55:06 2016 @@ -173,6 +173,9 @@ public class PartyServices { // create the status history GenericValue statusRec = delegator.makeValue("PartyStatus", UtilMisc.toMap("partyId", partyId, "statusId", statusId, "statusDate", now)); + if (userLogin != null) { + statusRec.put("changeByUserLoginId", userLogin.get("userLoginId")); + } toBeStored.add(statusRec); } @@ -213,6 +216,7 @@ public class PartyServices { public static Map<String, Object> setPartyStatus(DispatchContext ctx, Map<String, ? extends Object> context) { Delegator delegator = ctx.getDelegator(); Locale locale = (Locale) context.get("locale"); + GenericValue loggedInUserLogin = (GenericValue) context.get("userLogin"); String partyId = (String) context.get("partyId"); String statusId = (String) context.get("statusId"); @@ -249,6 +253,9 @@ public class PartyServices { // record this status change in PartyStatus table GenericValue partyStatus = delegator.makeValue("PartyStatus", UtilMisc.toMap("partyId", partyId, "statusId", statusId, "statusDate", statusDate)); + if (loggedInUserLogin != null) { + partyStatus.put("changeByUserLoginId", loggedInUserLogin.get("userLoginId")); + } partyStatus.create(); // disable all userlogins for this user when the new status is disabled @@ -429,6 +436,9 @@ public class PartyServices { // create the status history GenericValue partyStat = delegator.makeValue("PartyStatus", UtilMisc.toMap("partyId", partyId, "statusId", statusId, "statusDate", now)); + if (userLogin != null) { + partyStat.put("changeByUserLoginId", userLogin.get("userLoginId")); + } partyStat.create(); } |
Free forum by Nabble | Edit this page |