diff --git a/module/build/control.php b/module/build/control.php index 24a0928485..aaeac97b4b 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -129,14 +129,13 @@ class build extends control $this->view->title = "BUILD #$build->id $build->name - " . $projects[$build->project]; $this->view->position[] = html::a($this->createLink('project', 'task', "projectID=$build->project"), $projects[$build->project]); $this->view->position[] = $this->lang->build->view; - $this->view->products = $this->project->getProducts($build->project); $this->view->generatedBugs = $this->bug->getProjectBugs($build->project, 'status_desc,id_desc', null, $build->id); $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->build = $build; $this->view->stories = $stories; $this->view->bugs = $bugs; $this->view->actions = $this->loadModel('action')->getList('build', $buildID); - $this->view->type = $type; + $this->view->type = $type; $this->view->link = $link; $this->view->param = $param; $this->display(); diff --git a/module/doc/control.php b/module/doc/control.php index 24ab81e289..8b15ab4e85 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -316,7 +316,7 @@ class doc extends control $this->view->moduleID = $moduleID; $this->view->productID = $productID; $this->view->projectID = $projectID; - $this->view->products = $projectID == 0 ? $this->product->getPairs() : $this->project->getProducts($projectID); + $this->view->products = $projectID == 0 ? $this->product->getPairs() : $this->project->getProducts($projectID, false); $this->view->projects = $this->loadModel('project')->getPairs('all'); $this->display(); @@ -370,7 +370,7 @@ class doc extends control $this->view->libID = $libID; $this->view->libs = $this->libs; $this->view->moduleOptionMenu = $moduleOptionMenu; - $this->view->products = $doc->project == 0 ? $this->product->getPairs() : $this->project->getProducts($doc->project); + $this->view->products = $doc->project == 0 ? $this->product->getPairs() : $this->project->getProducts($doc->project, false); $this->view->projects = $this->loadModel('project')->getPairs('all'); $this->display(); } diff --git a/module/mail/control.php b/module/mail/control.php index 7fe9157115..dd246f25fb 100755 --- a/module/mail/control.php +++ b/module/mail/control.php @@ -295,6 +295,10 @@ class mail extends control $log = ''; foreach($queueList as $queue) { + $mailStatus = $this->dao->select('*')->from(TABLE_MAILQUEUE)->where('id')->eq($queue->id)->fetch('status'); + if($mailStatus != 'wait') break; + + $this->dao->update(TABLE_MAILQUEUE)->set('status')->eq('sending')->where('id')->eq($queue->id)->exec(); $this->mail->send($queue->toList, $queue->subject, $queue->body, $queue->ccList); $data = new stdclass(); diff --git a/module/project/control.php b/module/project/control.php index cdcaf998db..80e84c6706 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -904,7 +904,6 @@ class project extends control $whitelist = ''; $acl = 'open'; - $productIDList = array(); if($copyProjectID) { $copyProject = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($copyProjectID)->fetch(); @@ -914,7 +913,6 @@ class project extends control $acl = $copyProject->acl; $whitelist = $copyProject->whitelist; $products = $this->project->getProducts($copyProjectID); - foreach($products as $product) $productIDList[$product->id] = $product->id; } if(!empty($_POST)) @@ -941,7 +939,7 @@ class project extends control $this->view->whitelist = $whitelist; $this->view->acl = $acl ; $this->view->copyProjectID = $copyProjectID; - $this->view->branchGroups = $this->loadModel('branch')->getByProducts($productIDList); + $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products)); $this->display(); } @@ -991,11 +989,9 @@ class project extends control $allProducts = array(0 => '') + $this->loadModel('product')->getPairs('noclosed|nocode'); $linkedProducts = $this->project->getProducts($project->id); - $productIDList = array(); foreach($linkedProducts as $product) { if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name; - $productIDList[$product->id] = $product->id; } $this->view->title = $title; @@ -1009,7 +1005,7 @@ class project extends control $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->allProducts = $allProducts; $this->view->linkedProducts = $linkedProducts; - $this->view->branchGroups = $this->loadModel('branch')->getByProducts($productIDList); + $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts)); $this->display(); } @@ -1351,14 +1347,10 @@ class project extends control $allProducts = $this->product->getPairs('noclosed|nocode'); $linkedProducts = $this->project->getProducts($project->id); // Merge allProducts and linkedProducts for closed product. - $products = array(); foreach($linkedProducts as $product) { if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name; - if(!isset($products[$product->id])) $products[$product->id] = $product; - $products[$product->id]->branches[$product->branch] = $product->branch; } - $linkedProducts = $products; /* Assign. */ $this->view->title = $title; @@ -1556,7 +1548,9 @@ class project extends control } else { - $allStories = $this->story->getProductStories(array_keys($products), 0, $moduleID = '0', $status = 'active'); + $branches = array(0 => 0); + foreach($products as $product) $branches += $product->branches; + $allStories = $this->story->getProductStories(array_keys($products), $branches, $moduleID = '0', $status = 'active'); } $prjStories = $this->story->getProjectStoryPairs($projectID); @@ -1709,7 +1703,7 @@ class project extends control */ public function ajaxGetProducts($projectID) { - $products = $this->project->getProducts($projectID); + $products = $this->project->getProducts($projectID, false); die(html::select('product', $products, '', 'class="form-control"')); } diff --git a/module/project/model.php b/module/project/model.php index 53788eacca..1f2fba6ea3 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -631,7 +631,7 @@ class projectModel extends model * @access public * @return void */ - public function getProjectStats($status = 'undone', $productID = 0, $branch, $itemCounts = 30, $orderBy = 'order_desc', $pager = null) + public function getProjectStats($status = 'undone', $productID = 0, $itemCounts = 30, $orderBy = 'order_desc', $pager = null) { /* Init vars. */ $projects = $this->getList($status, 0, $productID, $branch); @@ -788,13 +788,23 @@ class projectModel extends model * @access public * @return array */ - public function getProducts($projectID) + public function getProducts($projectID, $withBranch = true) { - return $this->dao->select('t2.id, t2.name, t2.type, t1.branch')->from(TABLE_PROJECTPRODUCT)->alias('t1') + $query = $this->dao->select('t2.id, t2.name, t2.type, t1.branch')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2') ->on('t1.product = t2.id') - ->where('t1.project')->eq((int)$projectID) - ->fetchAll(); + ->where('t1.project')->eq((int)$projectID); + if(!$withBranch) return $query->fetchPairs('id', 'name'); + $products = $query->fetchAll(); + $productGroups = array(); + foreach($products as $product) + { + if(!isset($productGroups[$product->id])) $productGroups[$product->id] = $product; + $productGroups[$product->id]->branches[$product->branch] = $product->branch; + unset($productGroups[$product->id]->branch); + } + + return $productGroups; } /** diff --git a/module/project/view/linkstory.html.php b/module/project/view/linkstory.html.php index 700679590d..e52156f0f7 100644 --- a/module/project/view/linkstory.html.php +++ b/module/project/view/linkstory.html.php @@ -45,7 +45,7 @@ id));?>