* Adjust codes.

This commit is contained in:
daitingting
2018-07-03 16:26:44 +08:00
parent 7712dd4eab
commit 537699060f
7 changed files with 16 additions and 6 deletions
+4 -3
View File
@@ -375,12 +375,13 @@ class product extends control
*/
public function view($productID)
{
$this->product->setMenu($this->products, $productID);
$product = $this->product->getStatByID($productID);
$product->desc = $this->loadModel('file')->setImgSize($product->desc);
if(!$product) die(js::error($this->lang->notFound) . js::locate('back'));
$product->desc = $this->loadModel('file')->setImgSize($product->desc);
$this->product->setMenu($this->products, $productID);
$actions = $this->dao->select('*')->from(TABLE_ACTION)->where('product')->like("%,$productID,%")->orderBy('date_desc')->limit(6)->fetchAll();
if($actions) $this->loadModel('action')->transformActions($actions);
+1 -1
View File
@@ -726,7 +726,7 @@ class productModel extends model
public function getStatByID($productID)
{
$product = $this->getById($productID);
if(!$this->checkPriv($product)) return false;
if(!$product || !$this->checkPriv($product)) return false;
$stories = $this->dao->select('product, status, count(status) AS count')->from(TABLE_STORY)->where('deleted')->eq(0)->andWhere('product')->eq($productID)->groupBy('product, status')->fetchAll('status');
/* Padding the stories to sure all status have records. */
foreach(array_keys($this->lang->story->statusList) as $status)
+3 -2
View File
@@ -226,6 +226,9 @@ class productplan extends control
*/
public function view($planID = 0, $type = 'story', $orderBy = 'id_desc', $link = 'false', $param = '')
{
$plan = $this->productplan->getByID($planID, true);
if(!$plan) die(js::error($this->lang->notFound) . js::locate('back'));
$this->session->set('storyList', $this->app->getURI(true) . '&type=' . 'story');
$this->session->set('bugList', $this->app->getURI(true) . '&type=' . 'bug');
@@ -239,8 +242,6 @@ class productplan extends control
/* Append id for secend sort. */
$sort = $this->loadModel('common')->appendOrder($orderBy);
$plan = $this->productplan->getByID($planID, true);
if(!$plan) die(js::error($this->lang->notFound) . js::locate('back'));
$this->commonAction($plan->product, $plan->branch);
$products = $this->product->getPairs();
+2
View File
@@ -24,6 +24,8 @@ class productplanModel extends model
public function getByID($planID, $setImgSize = false)
{
$plan = $this->dao->findByID((int)$planID)->from(TABLE_PRODUCTPLAN)->fetch();
if(!$plan) return false;
$plan = $this->loadModel('file')->replaceImgURL($plan, 'desc');
if($setImgSize) $plan->desc = $this->file->setImgSize($plan->desc);
return $plan;
+2
View File
@@ -354,6 +354,8 @@ class testreport extends control
public function view($reportID, $from = 'product')
{
$report = $this->testreport->getById($reportID);
if(!$report) die(js::error($this->lang->notFound) . js::locate('back'));
$project = $this->project->getById($report->project);
if($from == 'product' and is_numeric($report->product))
{
+2
View File
@@ -158,6 +158,8 @@ class testreportModel extends model
public function getById($reportID)
{
$report = $this->dao->select('*')->from(TABLE_TESTREPORT)->where('id')->eq($reportID)->fetch();
if(!$report) return false;
$report = $this->loadModel('file')->replaceImgURL($report, 'report');
$report->files = $this->file->getByObject('testreport', $reportID);
return $report;
+2
View File
@@ -265,6 +265,8 @@ class testtaskModel extends model
->fetch();
}
if(!$task) return false;
$task = $this->loadModel('file')->replaceImgURL($task, 'desc');
if($setImgSize) $task->desc = $this->loadModel('file')->setImgSize($task->desc);
return $task;