[Ils-source] r1323 - trunk/webapp/api/group/put

scribe at crosswire.org scribe at crosswire.org
Sun Jun 7 20:50:19 MST 2015


Author: scribe
Date: 2015-06-07 20:50:19 -0700 (Sun, 07 Jun 2015)
New Revision: 1323

Modified:
   trunk/webapp/api/group/put/index.jsp
Log:
added special batch operation to update status ID for all members of a group


Modified: trunk/webapp/api/group/put/index.jsp
===================================================================
--- trunk/webapp/api/group/put/index.jsp	2015-06-08 03:24:58 UTC (rev 1322)
+++ trunk/webapp/api/group/put/index.jsp	2015-06-08 03:50:19 UTC (rev 1323)
@@ -104,14 +104,27 @@
 		return;
 	}
 
+	int updateCount = -1;
 	if (orig.getGroupID() > 0) {
 		current.save(orig);
+		int statusID = -1; try { statusID = Integer.parseInt(request.getParameter("allMembersSetStatusID")); } catch (Exception e) {}
+		if (statusID != -1) {
+			updateCount = 0;
+			for (UserProfile u : current.getGroupUsers()) {
+				UserProfile uorig = (UserProfile)u.clone();
+				if (u.getUserProfileStatusID() != statusID) {
+					u.setUserProfileStatusID(statusID);
+					u.save(ilsSession, uorig);
+					++updateCount;
+				}
+			}
+		}
 	}
 	else {
 		current = current.saveNew(ilsSession);
 	}
 %>
-<success groupID="<%=current.getGroupID()%>"/>
+<success groupID="<%=current.getGroupID()%>"<%= updateCount > -1 ? (" membersUpdated=\""+updateCount+"\"") : ""%>/>
 <%
 	return;
 
@@ -146,6 +159,7 @@
 <tr><th>termDate</th><td>Date Terminated</td></tr>
 <tr><th>accessLevel</th><td>User Access Level</td></tr>
 <tr><th>accessMode</th><td>User Access Mode</td></tr>
+<tr><th>allMembersSetStatusID</th><td>Sets the statusID for all User Profiles in this group</td></tr>
 <tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
 <tr><th>ILSPASSWD</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
 </tbody>




More information about the Ils-source mailing list