bugfix: do not validate the custom branch field in the project creation
formular if we should set the project up with another SCM
This commit is contained in:
parent
f3268b3d37
commit
8decc383aa
@ -167,16 +167,29 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
|||||||
|
|
||||||
public function clean_mtn_master_branch()
|
public function clean_mtn_master_branch()
|
||||||
{
|
{
|
||||||
|
// do not validate, but empty the field if a different
|
||||||
|
// SCM should be used
|
||||||
|
if ($this->cleaned_data['scm'] != 'mtn')
|
||||||
|
return '';
|
||||||
|
|
||||||
$mtn_master_branch = mb_strtolower($this->cleaned_data['mtn_master_branch']);
|
$mtn_master_branch = mb_strtolower($this->cleaned_data['mtn_master_branch']);
|
||||||
if (!preg_match('/^([\w\d]+([-][\w\d]+)*)(\.[\w\d]+([-][\w\d]+)*)*$/', $mtn_master_branch)) {
|
if (!preg_match('/^([\w\d]+([-][\w\d]+)*)(\.[\w\d]+([-][\w\d]+)*)*$/',
|
||||||
throw new Pluf_Form_Invalid(__('This master branch contains illegal characters, please use only letters, digits, dashs and dots as separators.'));
|
$mtn_master_branch)) {
|
||||||
|
throw new Pluf_Form_Invalid(__(
|
||||||
|
'The master branch is empty or contains illegal characters, '.
|
||||||
|
'please use only letters, digits, dashs and dots as separators.'
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = new Pluf_SQL('vkey=%s AND vdesc=%s', array("mtn_master_branch", $mtn_master_branch));
|
$sql = new Pluf_SQL('vkey=%s AND vdesc=%s',
|
||||||
|
array("mtn_master_branch", $mtn_master_branch));
|
||||||
$l = Pluf::factory('IDF_Conf')->getList(array('filter'=>$sql->gen()));
|
$l = Pluf::factory('IDF_Conf')->getList(array('filter'=>$sql->gen()));
|
||||||
if ($l->count() > 0) {
|
if ($l->count() > 0) {
|
||||||
throw new Pluf_Form_Invalid(__('This master branch is already used. Please select another one.'));
|
throw new Pluf_Form_Invalid(__(
|
||||||
|
'This master branch is already used. Please select another one.'
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $mtn_master_branch;
|
return $mtn_master_branch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user