Copy over all project properties, except a few scm settings and very
project-specific ones, when a new project is based on another one.
This commit is contained in:
parent
839444cc8a
commit
64c6674762
@ -20,6 +20,11 @@ or newer to run properly!
|
|||||||
foreign key relation. Adding project tags was not possible for a similar
|
foreign key relation. Adding project tags was not possible for a similar
|
||||||
reason. This has been fixed (issue 800, continued).
|
reason. This has been fixed (issue 800, continued).
|
||||||
|
|
||||||
|
- If a project was created based on the settings of an existing project,
|
||||||
|
not all settings, like for example the new notification settings, have
|
||||||
|
been copied. This has been changed insofar that now all properties except
|
||||||
|
the project's URL, logo and individual SCM settings are copied by default.
|
||||||
|
|
||||||
# InDefero 1.3.2 - Wed May 09 20:05 2012 UTC
|
# InDefero 1.3.2 - Wed May 09 20:05 2012 UTC
|
||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
@ -84,7 +84,7 @@ class IDF_Conf extends Pluf_Model
|
|||||||
|
|
||||||
function initCache()
|
function initCache()
|
||||||
{
|
{
|
||||||
$this->datacache = new ArrayObject();
|
$this->datacache = array();
|
||||||
$sql = new Pluf_SQL('project=%s', $this->_project->id);
|
$sql = new Pluf_SQL('project=%s', $this->_project->id);
|
||||||
foreach ($this->getList(array('filter' => $sql->gen())) as $val) {
|
foreach ($this->getList(array('filter' => $sql->gen())) as $val) {
|
||||||
$this->datacache[$val->vkey] = $val->vdesc;
|
$this->datacache[$val->vkey] = $val->vdesc;
|
||||||
@ -129,4 +129,12 @@ class IDF_Conf extends Pluf_Model
|
|||||||
$this->initCache();
|
$this->initCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getKeys()
|
||||||
|
{
|
||||||
|
if ($this->datacache === null) {
|
||||||
|
$this->initCache();
|
||||||
|
}
|
||||||
|
return array_keys($this->datacache);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,44 +360,34 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
|||||||
|
|
||||||
$conf = new IDF_Conf();
|
$conf = new IDF_Conf();
|
||||||
$conf->setProject($project);
|
$conf->setProject($project);
|
||||||
$keys = array('scm', 'svn_remote_url', 'svn_username',
|
|
||||||
'svn_password', 'mtn_master_branch', 'external_project_url');
|
|
||||||
foreach ($keys as $key) {
|
|
||||||
$this->cleaned_data[$key] = (!empty($this->cleaned_data[$key])) ?
|
|
||||||
$this->cleaned_data[$key] : '';
|
|
||||||
$conf->setVal($key, $this->cleaned_data[$key]);
|
|
||||||
}
|
|
||||||
if ($this->cleaned_data['template'] != '--') {
|
if ($this->cleaned_data['template'] != '--') {
|
||||||
$tmplconf = new IDF_Conf();
|
$tmplconf = new IDF_Conf();
|
||||||
$tmplconf->setProject($tmpl);
|
$tmplconf->setProject($tmpl);
|
||||||
// We need to get all the configuration variables we want from
|
|
||||||
// the old project and put them into the new project.
|
$allKeys = $tmplconf->getKeys();
|
||||||
$props = array(
|
$scm = $this->cleaned_data['scm'];
|
||||||
'labels_download_predefined' => IDF_Form_UploadConf::init_predefined,
|
$ignoreKeys = array('scm', 'external_project_url', 'logo');
|
||||||
'labels_download_one_max' => IDF_Form_UploadConf::init_one_max,
|
|
||||||
'labels_wiki_predefined' => IDF_Form_WikiConf::init_predefined,
|
// copy over all existing variables, except scm-related data and
|
||||||
'labels_wiki_one_max' => IDF_Form_WikiConf::init_one_max,
|
// the project url / logo
|
||||||
'labels_issue_template' => IDF_Form_IssueTrackingConf::init_template,
|
foreach ($allKeys as $key) {
|
||||||
'labels_issue_open' => IDF_Form_IssueTrackingConf::init_open,
|
if (in_array($key, $ignoreKeys) || strpos($key, $scm.'_') === 0) {
|
||||||
'labels_issue_closed' => IDF_Form_IssueTrackingConf::init_closed,
|
continue;
|
||||||
'labels_issue_predefined' => IDF_Form_IssueTrackingConf::init_predefined,
|
|
||||||
'labels_issue_one_max' => IDF_Form_IssueTrackingConf::init_one_max,
|
|
||||||
'issue_relations' => IDF_Form_IssueTrackingConf::init_relations,
|
|
||||||
'webhook_url' => '',
|
|
||||||
'downloads_access_rights' => 'all',
|
|
||||||
'review_access_rights' => 'all',
|
|
||||||
'wiki_access_rights' => 'all',
|
|
||||||
'source_access_rights' => 'all',
|
|
||||||
'issues_access_rights' => 'all',
|
|
||||||
'downloads_notification_email' => '',
|
|
||||||
'review_notification_email' => '',
|
|
||||||
'wiki_notification_email' => '',
|
|
||||||
'source_notification_email' => '',
|
|
||||||
'issues_notification_email' => '',
|
|
||||||
);
|
|
||||||
foreach ($props as $prop => $def) {
|
|
||||||
$conf->setVal($prop, $tmplconf->getVal($prop, $def));
|
|
||||||
}
|
}
|
||||||
|
$conf->setVal($key, $tmplconf->getVal($key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$keys = array(
|
||||||
|
'scm', 'svn_remote_url', 'svn_username',
|
||||||
|
'svn_password', 'mtn_master_branch',
|
||||||
|
'external_project_url'
|
||||||
|
);
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$this->cleaned_data[$key] = !empty($this->cleaned_data[$key]) ?
|
||||||
|
$this->cleaned_data[$key] : '';
|
||||||
|
$conf->setVal($key, $this->cleaned_data[$key]);
|
||||||
}
|
}
|
||||||
$project->created();
|
$project->created();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user