diff --git a/src/main/java/de/metas/ui/web/window/model/Document.java b/src/main/java/de/metas/ui/web/window/model/Document.java index fed6535c4..1d6bf62d7 100644 --- a/src/main/java/de/metas/ui/web/window/model/Document.java +++ b/src/main/java/de/metas/ui/web/window/model/Document.java @@ -1349,6 +1349,24 @@ public void assertNewDocumentAllowed(final DetailId detailId) return false; } + + /* package */ boolean isActive() + { + final IDocumentFieldView isActiveField = getFieldOrNull(WindowConstants.FIELDNAME_IsActive); + if (isActiveField != null) + { + return isActiveField.getValueAsBoolean(); + } + + final Document parentDocument = getParentDocument(); + if (parentDocument != null) + { + return parentDocument.isActive(); + } + + return false; + } + /** * Set Dynamic Attribute. diff --git a/src/main/java/de/metas/ui/web/window/model/IncludedDocumentsCollection.java b/src/main/java/de/metas/ui/web/window/model/IncludedDocumentsCollection.java index eeda97b1f..b1efa5533 100644 --- a/src/main/java/de/metas/ui/web/window/model/IncludedDocumentsCollection.java +++ b/src/main/java/de/metas/ui/web/window/model/IncludedDocumentsCollection.java @@ -323,6 +323,11 @@ public LogicExpressionResult getAllowCreateNewDocument() return LOGICRESULT_FALSE_ParentDocumentProcessed; } + if (!parentDocument.isActive()) + { + return LogicExpressionResult.namedConstant("ParentDocumentNotActive", false); + } + if(parentDocument.isNew()) { return LogicExpressionResult.namedConstant("ParentDocumentNew", false); @@ -358,6 +363,11 @@ private LogicExpressionResult getAllowDeleteDocument() { return LOGICRESULT_FALSE_ParentDocumentProcessed; } + + if (!parentDocument.isActive()) + { + return LogicExpressionResult.namedConstant("ParentDocumentNotActive", false); + } final ILogicExpression allowDeleteLogic = entityDescriptor.getAllowDeleteLogic(); final LogicExpressionResult allowDelete = allowDeleteLogic.evaluateToResult(parentDocument.asEvaluatee(), OnVariableNotFound.ReturnNoResult);