Commit 9a14d14c authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #4343 Forbidding underscores in country names

parent ab444fa0
......@@ -808,7 +808,7 @@ class ObjectClassBooleanAttribute extends BooleanAttribute
*/
class StringAttribute extends Attribute
{
private $pattern;
protected $pattern;
protected $example;
/*! \brief The constructor of StringAttribute
......@@ -833,6 +833,11 @@ class StringAttribute extends Attribute
$this->example = $example;
}
function setPattern ($pattern)
{
$this->pattern = $pattern;
}
function renderFormInput ()
{
$id = $this->getHtmlId();
......
......@@ -50,6 +50,8 @@ class country extends department
$attributesInfo = parent::getDepartmentAttributesInfo(_('country'), self::$namingAttr);
unset($attributesInfo['location']);
unset($attributesInfo['properties']['attrs'][3]); // category
/* Country c attribut cannot contain any underscore */
$attributesInfo['properties']['attrs'][1]->setPattern('/^[a-z0-9\.-]+$/i');
return $attributesInfo;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment