diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl index b572b81729..6687f6ed55 100644 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl @@ -2,6 +2,10 @@ <#escape x as jsonUtils.encodeJSONString(x)> { - "data": <@rmconstraintLib.constraintJSON constraint=constraint /> + <#if !errorMessage??> + "data": <@rmconstraintLib.constraintJSON constraint=constraint /> + <#else> + "message" : "${msg(errorMessage, title)}" + } \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js index 4c8b5a0804..ad822a97e7 100644 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js @@ -19,7 +19,7 @@ function main() { for (var x = 0; x < values.length(); x++) { - allowedValues[i++] = values.get(x); + allowedValues[i++] = values.get(x); } } } @@ -38,10 +38,33 @@ function main() title = name; } - var constraint = caveatConfig.createConstraint(name, title, allowedValues); + + var constraints = caveatConfig.allConstraints; - // Pass the constraint detail to the template - model.constraint = constraint; + // Check for existing constraint... + var alreadyExists = false; + for (var i=0; i