Fixed to allow the dash (-) in the shortname of a project.
The dash is not allowed as first or last character of the name.
This commit is contained in:
parent
c8d1b66c91
commit
c949672e53
@ -126,9 +126,15 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
||||
public function clean_shortname()
|
||||
{
|
||||
$shortname = $this->cleaned_data['shortname'];
|
||||
if (preg_match('/[^A-Za-z0-9]/', $shortname)) {
|
||||
if (preg_match('/[^\-A-Za-z0-9]/', $shortname)) {
|
||||
throw new Pluf_Form_Invalid(__('This shortname contains illegal characters, please use only letters and digits.'));
|
||||
}
|
||||
if (mb_substr($shortname, 0, 1) == '-') {
|
||||
throw new Pluf_Form_Invalid(__('The shortname cannot start with the dash (-) character.'));
|
||||
}
|
||||
if (mb_substr($shortname, -1) == '-') {
|
||||
throw new Pluf_Form_Invalid(__('The shortname cannot end with the dash (-) character.'));
|
||||
}
|
||||
$sql = new Pluf_SQL('shortname=%s', array($shortname));
|
||||
$l = Pluf::factory('IDF_Project')->getList(array('filter'=>$sql->gen()));
|
||||
if ($l->count() > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user