diff --git a/api/src/org/labkey/api/data/Container.java b/api/src/org/labkey/api/data/Container.java index 41361cedd06..218abe6ed91 100644 --- a/api/src/org/labkey/api/data/Container.java +++ b/api/src/org/labkey/api/data/Container.java @@ -1033,9 +1033,13 @@ public FolderType getFolderType() @NotNull public Boolean getAuditCommentsRequired() { - Map 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 props = PropertyManager.getProperties(container, AUDIT_SETTINGS_PROPERTY_SET_NAME); return Boolean.parseBoolean(props.getOrDefault(REQUIRE_USER_COMMENTS_PROPERTY_NAME, "false")); } diff --git a/query/src/org/labkey/query/controllers/QueryController.java b/query/src/org/labkey/query/controllers/QueryController.java index 896d7577221..d29353ae270 100644 --- a/query/src/org/labkey/query/controllers/QueryController.java +++ b/query/src/org/labkey/query/controllers/QueryController.java @@ -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 { @@ -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);