Merge branch 'master' of github.com:easysoft/zentaopms
This commit is contained in:
+104
-43
@@ -41,7 +41,7 @@ class project extends control
|
||||
{
|
||||
if($this->app->user->account == 'guest' or commonModel::isTutorialMode()) $this->config->project->homepage = 'index';
|
||||
if(!isset($this->config->project->homepage))
|
||||
{
|
||||
{
|
||||
if($this->projects and $this->app->viewType != 'mhtml') die($this->fetch('custom', 'ajaxSetHomepage', "module=project"));
|
||||
|
||||
$this->config->project->homepage = 'index';
|
||||
@@ -375,7 +375,7 @@ class project extends control
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->project->importTask;
|
||||
$this->view->position[] = html::a(inlink('browse', "projectID=$toProject"), $project->name);
|
||||
$this->view->position[] = $this->lang->project->importTask;
|
||||
$this->view->tasks2Imported = $tasks2Imported;
|
||||
$this->view->tasks2Imported = $tasks2Imported;
|
||||
$this->view->projects = $projects;
|
||||
$this->view->projectID = $project->id;
|
||||
$this->view->fromProject = $fromProject;
|
||||
@@ -600,16 +600,27 @@ class project extends control
|
||||
|
||||
/* Count T B C */
|
||||
$storyIdList = array_keys($stories);;
|
||||
$storyTasks = $this->loadModel('task')->getStoryTaskCounts($storyIdList,$projectID);
|
||||
$storyBugs = $this->loadModel('bug')->getStoryBugCounts($storyIdList,$projectID);
|
||||
$storyTasks = $this->loadModel('task')->getStoryTaskCounts($storyIdList, $projectID);
|
||||
$storyBugs = $this->loadModel('bug')->getStoryBugCounts($storyIdList, $projectID);
|
||||
$storyCases = $this->loadModel('testcase')->getStoryCaseCounts($storyIdList);
|
||||
|
||||
$plans = $this->project->getPlans($productID);
|
||||
$allPlans = array('' => '');
|
||||
if(!empty($plans))
|
||||
{
|
||||
foreach($plans as $productID => $plan)
|
||||
{
|
||||
$allPlans = $allPlans + $plan;
|
||||
}
|
||||
}
|
||||
|
||||
/* Assign. */
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->project = $project;
|
||||
$this->view->stories = $stories;
|
||||
$this->view->allPlans = $allPlans;
|
||||
$this->view->summary = $this->product->summary($stories);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->type = $type;
|
||||
@@ -823,8 +834,8 @@ class project extends control
|
||||
|
||||
/**
|
||||
* Fix burn for first date.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -870,14 +881,16 @@ class project extends control
|
||||
*
|
||||
* @param string $projectID
|
||||
* @param string $copyProjectID
|
||||
* @param int $planID
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($projectID = '', $copyProjectID = '')
|
||||
public function create($projectID = '', $copyProjectID = '', $planID = 0)
|
||||
{
|
||||
if($projectID)
|
||||
{
|
||||
if(!empty($planID)) $this->project->linkStories($projectID);
|
||||
$this->view->title = $this->lang->project->tips;
|
||||
$this->view->tips = $this->fetch('project', 'tips', "projectID=$projectID");
|
||||
$this->view->projectID = $projectID;
|
||||
@@ -885,12 +898,14 @@ class project extends control
|
||||
exit;
|
||||
}
|
||||
|
||||
$name = '';
|
||||
$code = '';
|
||||
$team = '';
|
||||
$products = array();
|
||||
$whitelist = '';
|
||||
$acl = 'open';
|
||||
$name = '';
|
||||
$code = '';
|
||||
$team = '';
|
||||
$products = array();
|
||||
$whitelist = '';
|
||||
$acl = 'open';
|
||||
$plan = new stdClass();
|
||||
$productPlan = new stdClass();
|
||||
|
||||
if($copyProjectID)
|
||||
{
|
||||
@@ -903,6 +918,16 @@ class project extends control
|
||||
$products = $this->project->getProducts($copyProjectID);
|
||||
}
|
||||
|
||||
if(!empty($planID))
|
||||
{
|
||||
$plan = $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('id')->eq($planID)->fetch();
|
||||
$products = $this->dao->select('t1.id, t1.name, t1.type, t2.branch')->from(TABLE_PRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id = t2.product')
|
||||
->where('t1.id')->eq($plan->product)
|
||||
->fetchAll('id');
|
||||
$productPlan = $this->loadModel('productplan')->getPairs($plan->product, 0, 'unexpired');
|
||||
}
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$projectID = $copyProjectID == '' ? $this->project->create() : $this->project->create($copyProjectID);
|
||||
@@ -910,7 +935,15 @@ class project extends control
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
$this->loadModel('action')->create('project', $projectID, 'opened');
|
||||
die(js::locate($this->createLink('project', 'create', "projectID=$projectID"), 'parent'));
|
||||
$url = $this->createLink('project', 'create', "projectID=$projectID");
|
||||
if(!empty($planID))
|
||||
{
|
||||
die(js::confirm($this->lang->project->importPlanStory, $url . '©ProjectID=&planID=' . $planID, $url, 'parent', 'parent'));
|
||||
}
|
||||
else
|
||||
{
|
||||
die(js::locate($url, 'parent'));
|
||||
}
|
||||
}
|
||||
|
||||
$this->project->setMenu($this->projects, key($this->projects));
|
||||
@@ -920,12 +953,14 @@ class project extends control
|
||||
$this->view->projects = array('' => '') + $this->projects;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->allProducts = array(0 => '') + $this->loadModel('product')->getPairs('noclosed|nocode');
|
||||
$this->view->acl = $acl;
|
||||
$this->view->plan = $plan;
|
||||
$this->view->name = $name;
|
||||
$this->view->code = $code;
|
||||
$this->view->team = $team;
|
||||
$this->view->products = $products ;
|
||||
$this->view->products = $products;
|
||||
$this->view->productPlan = $productPlan;
|
||||
$this->view->whitelist = $whitelist;
|
||||
$this->view->acl = $acl ;
|
||||
$this->view->copyProjectID = $copyProjectID;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
|
||||
$this->display();
|
||||
@@ -935,6 +970,9 @@ class project extends control
|
||||
* Edit a project.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $action
|
||||
* @param string $extra
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -991,6 +1029,7 @@ class project extends control
|
||||
$this->view->qdUsers = $this->user->getPairs('noclosed|nodeleted|qdfirst', $project->QD);
|
||||
$this->view->rdUsers = $this->user->getPairs('noclosed|nodeleted|devfirst', $project->RD);
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->plans = $this->project->getPlans(array_keys($linkedProducts));
|
||||
$this->view->allProducts = $allProducts;
|
||||
$this->view->linkedProducts = $linkedProducts;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts));
|
||||
@@ -1263,10 +1302,10 @@ class project extends control
|
||||
|
||||
/**
|
||||
* Kanban.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1310,8 +1349,8 @@ class project extends control
|
||||
/**
|
||||
* Tree view.
|
||||
* Product
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
@@ -1337,14 +1376,14 @@ class project extends control
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->level = $type;
|
||||
$this->view->tree = $tree;
|
||||
$this->display();
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Print kanban.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $orderBy
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1359,7 +1398,7 @@ class project extends control
|
||||
$storySpecs = $this->story->getStorySpecs(array_keys($stories));
|
||||
|
||||
$order = 1;
|
||||
foreach($stories as $story) $story->order = $order++;
|
||||
foreach($stories as $story) $story->order = $order++;
|
||||
|
||||
$kanbanTasks = $this->project->getKanbanTasks($projectID, "id");
|
||||
$kanbanBugs = $this->loadModel('bug')->getProjectBugs($projectID);
|
||||
@@ -1446,13 +1485,13 @@ class project extends control
|
||||
|
||||
$this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name);
|
||||
$this->view->position[] = $this->lang->project->printKanban;
|
||||
$this->display();
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Story kanban.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -1804,7 +1843,7 @@ class project extends control
|
||||
$this->project->unlinkStory($projectID, $storyID);
|
||||
|
||||
/* if kanban then reload and if ajax request then send result. */
|
||||
if(isonlybody())
|
||||
if(isonlybody())
|
||||
{
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
@@ -2016,8 +2055,8 @@ class project extends control
|
||||
|
||||
/**
|
||||
* Story sort.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -2076,11 +2115,11 @@ class project extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Export project.
|
||||
*
|
||||
* @param string $status
|
||||
* @param int $productID
|
||||
* @param string $orderBy
|
||||
* Export project.
|
||||
*
|
||||
* @param string $status
|
||||
* @param int $productID
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -2141,8 +2180,8 @@ class project extends control
|
||||
|
||||
/**
|
||||
* Kanban setting.
|
||||
*
|
||||
* @param int $projectID
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -2178,9 +2217,9 @@ class project extends control
|
||||
|
||||
/**
|
||||
* Ajax reset kanban setting
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $confirm
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $confirm
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
@@ -2204,4 +2243,26 @@ class project extends control
|
||||
|
||||
die(js::reload('parent.parent'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Import stories by plan.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $planID
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importPlanStories($projectID, $planID)
|
||||
{
|
||||
$planStories = $planProducts = array();
|
||||
$planStory = $this->loadModel('story')->getPlanStories($planID);
|
||||
if(!empty($planStory))
|
||||
{
|
||||
$planStories = array_keys($planStory);
|
||||
foreach($planStory as $story) $planProducts[$story->id] = $story->product;
|
||||
$this->project->linkStory($projectID, $planStories, $planProducts);
|
||||
}
|
||||
die(js::locate(helper::createLink('project', 'story', 'projectID=' . $projectID), 'parent'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user