svn commit: r1758041 - /ofbiz/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java

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

svn commit: r1758041 - /ofbiz/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java

ashish-18
Author: ashish
Date: Sat Aug 27 14:09:10 2016
New Revision: 1758041

URL: http://svn.apache.org/viewvc?rev=1758041&view=rev
Log:
Applied patch from jira issue - OFBIZ-5024 - Modifying data retrieval and storage logic.
Thanks Sumit for creating the issue and providing initial patch. Thanks Ravi for providing the latest patch.

Modified:
    ofbiz/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java

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=1758041&r1=1758040&r2=1758041&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 Sat Aug 27 14:09:10 2016
@@ -253,13 +253,16 @@ public class PartyServices {
 
                 // disable all userlogins for this user when the new status is disabled
                 if (("PARTY_DISABLED").equals(statusId)) {
-                    List <GenericValue> userLogins = EntityQuery.use(delegator).from("UserLogin").where("partyId", partyId).queryList();
+                    EntityCondition cond = EntityCondition.makeCondition(
+                            EntityCondition.makeCondition("partyId", partyId),
+                            EntityCondition.makeCondition("enabled", EntityOperator.NOT_EQUAL, "N")
+                            );
+                    List <GenericValue> userLogins = EntityQuery.use(delegator).from("UserLogin").where(cond).queryList();
                     for (GenericValue userLogin : userLogins) {
-                        if (!"N".equals(userLogin.getString("enabled"))) {
-                            userLogin.set("enabled", "N");
-                            userLogin.store();
-                        }
+                        userLogin.set("enabled", "N");
+                        userLogin.set("disabledDateTime", UtilDateTime.nowTimestamp());
                     }
+                    delegator.storeAll(userLogins);
                 }
             }