|
|
@ -389,10 +389,18 @@ public class EditPeopleControlSet implements TaskEditControlSet {
|
|
|
|
boolean dirty = false;
|
|
|
|
boolean dirty = false;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
JSONObject userJson = null;
|
|
|
|
JSONObject userJson = null;
|
|
|
|
if(assignedCustom.getVisibility() == View.VISIBLE)
|
|
|
|
TextView assignedView = null;
|
|
|
|
|
|
|
|
if(assignedCustom.getVisibility() == View.VISIBLE) {
|
|
|
|
userJson = PeopleContainer.createUserJson(assignedCustom);
|
|
|
|
userJson = PeopleContainer.createUserJson(assignedCustom);
|
|
|
|
else if(assignedSpinner.getSelectedItem() != null)
|
|
|
|
assignedView = assignedCustom;
|
|
|
|
|
|
|
|
} else if(assignedSpinner.getSelectedItem() != null) {
|
|
|
|
userJson = ((AssignedToUser) assignedSpinner.getSelectedItem()).user;
|
|
|
|
userJson = ((AssignedToUser) assignedSpinner.getSelectedItem()).user;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userJson != null && userJson.optString("email").indexOf('@') == -1) {
|
|
|
|
|
|
|
|
throw new ParseSharedException(assignedView,
|
|
|
|
|
|
|
|
activity.getString(R.string.actfm_EPA_invalid_email, userJson.optString("email")));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(userJson == null || userJson.optLong("id", -1) == 0) {
|
|
|
|
if(userJson == null || userJson.optLong("id", -1) == 0) {
|
|
|
|
dirty = task.getValue(Task.USER_ID) == 0L ? dirty : true;
|
|
|
|
dirty = task.getValue(Task.USER_ID) == 0L ? dirty : true;
|
|
|
@ -446,8 +454,10 @@ public class EditPeopleControlSet implements TaskEditControlSet {
|
|
|
|
} catch (JSONException e) {
|
|
|
|
} catch (JSONException e) {
|
|
|
|
exceptionService.displayAndReportError(activity, "save-people", e);
|
|
|
|
exceptionService.displayAndReportError(activity, "save-people", e);
|
|
|
|
} catch (ParseSharedException e) {
|
|
|
|
} catch (ParseSharedException e) {
|
|
|
|
|
|
|
|
if(e.view != null) {
|
|
|
|
e.view.setTextColor(Color.RED);
|
|
|
|
e.view.setTextColor(Color.RED);
|
|
|
|
e.view.requestFocus();
|
|
|
|
e.view.requestFocus();
|
|
|
|
|
|
|
|
}
|
|
|
|
DialogUtilities.okDialog(activity, e.message, null);
|
|
|
|
DialogUtilities.okDialog(activity, e.message, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -613,6 +623,10 @@ public class EditPeopleControlSet implements TaskEditControlSet {
|
|
|
|
values.add(task.getValue(Task.USER_ID));
|
|
|
|
values.add(task.getValue(Task.USER_ID));
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
JSONObject user = new JSONObject(task.getValue(Task.USER));
|
|
|
|
JSONObject user = new JSONObject(task.getValue(Task.USER));
|
|
|
|
|
|
|
|
String userEmail = user.getString("email");
|
|
|
|
|
|
|
|
if (userEmail.indexOf('@') == -1)
|
|
|
|
|
|
|
|
values.add("");
|
|
|
|
|
|
|
|
else
|
|
|
|
values.add(user.getString("email"));
|
|
|
|
values.add(user.getString("email"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|