mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ALF-1501: regex constraint on text field should allow blank if mandatory not set
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19911 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1056,13 +1056,29 @@ public abstract class ContentModelFormProcessor<ItemType, PersistType> extends
|
|||||||
else if ((value instanceof String) && ((String) value).length() == 0)
|
else if ((value instanceof String) && ((String) value).length() == 0)
|
||||||
{
|
{
|
||||||
// make sure empty strings stay as empty strings,
|
// make sure empty strings stay as empty strings,
|
||||||
// everything else
|
// everything else should be represented as null
|
||||||
// should be represented as null
|
if (!propDef.getDataType().getName().equals(DataTypeDefinition.TEXT) &&
|
||||||
if (!propDef.getDataType().getName().equals(DataTypeDefinition.TEXT)
|
!propDef.getDataType().getName().equals(DataTypeDefinition.MLTEXT))
|
||||||
&& !propDef.getDataType().getName().equals(DataTypeDefinition.MLTEXT))
|
|
||||||
{
|
{
|
||||||
value = null;
|
value = null;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if the text property has a regex constraint set the empty
|
||||||
|
// string to null otherwise the integrity checker will reject it
|
||||||
|
List<ConstraintDefinition> constraints = propDef.getConstraints();
|
||||||
|
if (constraints != null && constraints.size() > 0)
|
||||||
|
{
|
||||||
|
for (ConstraintDefinition constraintDef : constraints)
|
||||||
|
{
|
||||||
|
if ("REGEX".equals(constraintDef.getConstraint().getType()))
|
||||||
|
{
|
||||||
|
value = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the property to the map
|
// add the property to the map
|
||||||
|
Reference in New Issue
Block a user