Merge branch 'sprint/170_hufangzhou_43899' into 'sprint/170'

* Finish task #43899.

See merge request easycorp/zentaopms!305
This commit is contained in:
李玉春
2021-11-04 05:04:03 +00:00
4 changed files with 34 additions and 4 deletions
+20 -3
View File
@@ -78,9 +78,10 @@ class productplan extends control
$this->view->position[] = $this->lang->productplan->common;
$this->view->position[] = $this->lang->productplan->create;
$this->view->lastPlan = $lastPlan;
$this->view->branch = $branchID;
$this->view->parent = $parent;
$this->view->productID = $productID;
$this->view->lastPlan = $lastPlan;
$this->view->branch = $branchID;
$this->view->parent = $parent;
$this->display();
}
@@ -632,4 +633,20 @@ class productplan extends control
foreach($this->post->unlinkBugs as $bugID) $this->productplan->unlinkBug($bugID);
die(js::locate($this->createLink('productplan', 'view', "planID=$planID&type=bug&orderBy=$orderBy"), 'parent'));
}
/**
* AJAX: Get last plan.
*
* @param int $productID
* @param int $branch
* @param int $parent
* @access public
* @return object
*/
public function ajaxGetLast($productID, $branch = 0, $parent = 0)
{
$lastPlan = $this->productplan->getLast($productID, $branch, $parent);
echo json_encode($lastPlan);
}
}
+12
View File
@@ -62,3 +62,15 @@ $('#future').on('change', function()
$('#end').removeAttr('disabled').parents('tr').show();
}
});
$('#branch').change(function()
{
var branchID = $(this).val();
var link = createLink('productplan', 'ajaxGetLast', "productID=" + productID + "&branch=" + branchID);
$.post(link, function(data)
{
data = JSON.parse(data);
if(data) $('#title').parent().next('td').html('(' + data.title + ')');
})
})
+1 -1
View File
@@ -60,7 +60,7 @@ class productplanModel extends model
->beginIF($parent > 0)->andWhere('parent')->eq((int)$parent)->fi()
->andWhere('product')->eq((int)$productID)
->andWhere('end')->ne('2030-01-01')
->beginIF($branch)->andWhere('branch')->eq($branch)->fi()
->andWhere('branch')->eq($branch)
->orderBy('end desc')
->limit(1)
->fetch();
+1
View File
@@ -13,6 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::set('weekend', $config->execution->weekend);?>
<?php js::set('productID', $productID);?>
<?php js::import($jsRoot . 'misc/date.js');?>
<div id='mainContent'class='main-content'>
<div class='center-block'>