Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion api/src/org/labkey/api/data/Container.java
Original file line number Diff line number Diff line change
Expand Up @@ -1033,9 +1033,13 @@ public FolderType getFolderType()
@NotNull
public Boolean getAuditCommentsRequired()
{
Map<String, String> props = PropertyManager.getProperties(this, AUDIT_SETTINGS_PROPERTY_SET_NAME);
if (!ProductRegistry.isProductFeatureEnabled(ProductFeature.DataChangeCommentRequirement))
return false;
// the audit setting is stored on the app home folder, which is the project only when product folders are enabled
Container container = isAppHomeFolder() ? this : getProject();
if (container == null) // shouldn't ever happen
return false;
Map<String, String> props = PropertyManager.getProperties(container, AUDIT_SETTINGS_PROPERTY_SET_NAME);
return Boolean.parseBoolean(props.getOrDefault(REQUIRE_USER_COMMENTS_PROPERTY_NAME, "false"));
}

Expand Down
5 changes: 4 additions & 1 deletion query/src/org/labkey/query/controllers/QueryController.java
Original file line number Diff line number Diff line change
Expand Up @@ -5002,7 +5002,7 @@ public void validateForm(MoveRowsForm form, Errors errors)
else
{
// Since we are moving between containers, we know we have product folders enabled
if (getContainer().getProject().getAuditCommentsRequired() && StringUtils.isBlank(json.optString("auditUserComment")))
if (getContainer().getAuditCommentsRequired() && StringUtils.isBlank(json.optString("auditUserComment")))
errors.reject(ERROR_GENERIC, "A reason for the move of data is required.");
else
{
Expand Down Expand Up @@ -8101,6 +8101,9 @@ public void validateForm(QueryImportTemplateForm form, Errors errors)
{
User user = getUser();
Container container = getContainer();

if (container != null && container.getAuditCommentsRequired() && StringUtils.isBlank(form.getAuditUserComment()))
errors.reject(ERROR_GENERIC, "A reason for the template update is required.");
String domainURI = PropertyService.get().getDomainURI(form.getSchemaName(), form.getQueryName(), container, user);
_kind = PropertyService.get().getDomainKind(domainURI);
_domain = PropertyService.get().getDomain(container, domainURI);
Expand Down