From 3d1ac97dc34ed13e646dc3fc5b2780095f2135f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20d=27Anterroches?= Date: Wed, 11 Aug 2010 14:50:32 +0200 Subject: [PATCH] Correctly uses the private/description from the template project. --- src/IDF/Form/Admin/ProjectCreate.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/IDF/Form/Admin/ProjectCreate.php b/src/IDF/Form/Admin/ProjectCreate.php index 93470f2..a8017b8 100644 --- a/src/IDF/Form/Admin/ProjectCreate.php +++ b/src/IDF/Form/Admin/ProjectCreate.php @@ -231,8 +231,18 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form $project = new IDF_Project(); $project->name = $this->cleaned_data['name']; $project->shortname = $this->cleaned_data['shortname']; - $project->private = $this->cleaned_data['private_project']; - $project->description = __('Click on the Project Management tab to set the description of your project.'); + + if ($this->cleaned_data['template'] != '--') { + // Find the template project + $sql = new Pluf_SQL('shortname=%s', + array($this->cleaned_data['template'])); + $tmpl = Pluf::factory('IDF_Project')->getOne(array('filter' => $sql->gen())); + $project->private = $tmpl->private; + $project->description = $tmpl->description; + } else { + $project->private = $this->cleaned_data['private_project']; + $project->description = __('Click on the Project Management tab to set the description of your project.'); + } $project->create(); $conf = new IDF_Conf(); $conf->setProject($project); @@ -244,12 +254,6 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form $conf->setVal($key, $this->cleaned_data[$key]); } if ($this->cleaned_data['template'] != '--') { - // Find the template project - $sql = new Pluf_SQL('shortname=%s', - array($this->cleaned_data['template'])); - $tmpl = Pluf::factory('IDF_Project')->getOne(array('filter' => $sql->gen())); - $project->private = $tmpl->private; - $project->description = $tmpl->description; $tmplconf = new IDF_Conf(); $tmplconf->setProject($tmpl); // We need to get all the configuration variables we want from