*Fix bug#18898.

This commit is contained in:
孙华伟
2022-04-19 15:17:50 +08:00
parent 02c3d19c3f
commit dcfe09867f
3 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -184,7 +184,7 @@ function loadPlans(product, branchID)
var branchID = typeof(branchID) == 'undefined' ? 0 : branchID;
var index = $(product).attr('id').replace('products', '');
$.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=0,' + branchID + '&planID=0&fieldID&needCreate=&expired=' + (config.currentMethod == 'create' ? 'unexpired' : '') + '&param=skipParent'), function(data)
$.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=0,' + branchID + '&planID=0&fieldID&needCreate=&expired=noclosed|' + (config.currentMethod == 'create' ? 'unexpired' : '') + '&param=skipParent'), function(data)
{
if(data)
{
+6 -4
View File
@@ -181,12 +181,12 @@ class productplanModel extends model
*
* @param array|int $product
* @param int|string|array $branch
* @param string $expired
* @param string $param unexpired|noclosed
* @param bool $skipParent
* @access public
* @return array
*/
public function getPairs($product = 0, $branch = '', $expired = '', $skipParent = false)
public function getPairs($product = 0, $branch = '', $param = '', $skipParent = false)
{
$date = date('Y-m-d');
$plans = $this->dao->select('t1.id,t1.title,t1.parent,t1.begin,t1.end,t2.name as branchName,t3.type as productType')->from(TABLE_PRODUCTPLAN)->alias('t1')
@@ -195,7 +195,8 @@ class productplanModel extends model
->where('t1.product')->in($product)
->andWhere('t1.deleted')->eq(0)
->beginIF($branch !== '')->andWhere('t1.branch')->in($branch)->fi()
->beginIF($expired == 'unexpired')->andWhere('t1.end')->ge($date)->fi()
->beginIF(strpos($param, 'unexpired') !== false)->andWhere('t1.end')->ge($date)->fi()
->beginIF(strpos($param, 'noclosed') !== false)->andWhere('t1.status')->ne('closed')->fi()
->orderBy('t1.begin desc')
->fetchAll('id');
@@ -223,7 +224,7 @@ class productplanModel extends model
*
* @param array|int $product
* @param int $branch
* @param string $param skipParent|withMainPlan|unexpired
* @param string $param skipParent|withMainPlan|unexpired|noclosed
* @access public
* @return array
*/
@@ -236,6 +237,7 @@ class productplanModel extends model
->where('product')->in($product)
->andWhere('deleted')->eq(0)
->beginIF(strpos($param, 'unexpired') !== false)->andWhere('end')->ge($date)->fi()
->beginIF(strpos($param, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
->beginIF($branch !== 'all' or $branch !== '')->andWhere("branch")->in($branch)->fi()
->orderBy('begin desc')
->fetchAll('id');
+1 -1
View File
@@ -224,7 +224,7 @@ function loadPlans(product, branchID)
if(productID != 0)
{
$.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=0,' + branchID + '&planID=0&fieldID&needCreate=&expired=unexpired&param=skipParent'), function(data)
$.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=0,' + branchID + '&planID=0&fieldID&needCreate=&expired=unexpired|noclosed&param=skipParent'), function(data)
{
if(data)
{