@Override
@Transactional(readOnly = true)
public boolean canBePromoted(final Study study) {
- return resultDocsAtLeast(study, ProgressState.inDRAFT);
+ boolean res;
+ if (study.getProgressState().compareTo(ProgressState.inDRAFT) < 0) {
+ res = resultDocsAtLeast(study, ProgressState.inDRAFT);
+ } else {
+ res = canBeReviewed(study);
+ }
+ return res;
}
/**
// Check that all study result documents have the state APPROVED or more.
for (Publication pub : getProjectElementService().getLastStep(study)
.getResultDocuments()) {
- res = pub.getProgressState().compareTo(ProgressState.APPROVED) >= 0;
+ res = pub.getProgressState().compareTo(state) >= 0;
if (!res) {
break;
}
package org.splat.simer;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
} catch (InvalidParameterException e) {
LOG.error(e.getMessage(), e);
}
+
+ removeValidCycleFromStaff();
setActionType("edibutor");
return SUCCESS;
}
}
_staff.removeAll(readers);
+ removeValidCycleFromStaff();
setActionType("editReaders");
return SUCCESS;
}
+
+ /**
+ * Remove validation cycle members from potential readers or contributors.
+ */
+ private void removeValidCycleFromStaff() {
+ if(_staff != null) {
+ for(DocumentType type : _documentTypeService.selectAllTypes()) {
+ User[] users = getStudyService()
+ .getValidationCycleOf(getOpenStudy().getStudyObject(), type).getAllActors();
+ _staff.removeAll(Arrays.asList(users));
+ }
+ }
+ }
/**
* Add or edit a document validation cycle for the selected study.
return SUCCESS;
}
-
+
/**
* Prepare form for the upload users action.
+ *
* @return SUCCESS
*/
public String doInitializeSysAdmin() {
/**
* Get fileName with url special symbols canceled for usage in struts.xml.
+ *
* @return the encoded uploaded file name.
*/
public String getCanceledFileName() {
}
return res;
}
-
+
/**
* Get the action to which the uploaded file is passed.
*
}
/**
- * Cancel the uploading.
+ * Set the flag to cancel the uploading.
*
* @param back
+ * not used parameter
*/
public void setCancel(final boolean back) {
this._action = ToDo.cancel;
* Set the flag to perform uploading.
*
* @param upload
+ * not used parameter
*/
public void setDoIt(final boolean upload) {
this._action = ToDo.upload;