From ad1a24089df2fc50dde598d596dd5ee8990a5cf6 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 22 Mar 2018 15:00:55 +0800 Subject: [PATCH] * code for plan getpairs with unexpired. --- module/productplan/model.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/module/productplan/model.php b/module/productplan/model.php index 2a47aa9f13..a4ac4410a7 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -117,16 +117,18 @@ class productplanModel extends model ->where('product')->in($product) ->andWhere('deleted')->eq(0) ->beginIF($branch)->andWhere("branch")->in("0,$branch")->fi() - ->beginIF($expired == 'unexpired')->andWhere('end')->gt($date)->fi() + ->beginIF($expired == 'unexpired')->andWhere('end')->ge($date)->fi() ->orderBy('begin desc') ->fetchPairs(); - if($expired == 'unexpired' and empty($plans)) + if($expired == 'unexpired') { - $plans = $this->dao->select('id,CONCAT(title, " [", begin, " ~ ", end, "]") as title')->from(TABLE_PRODUCTPLAN) + $plans += $this->dao->select('id,CONCAT(title, " [", begin, " ~ ", end, "]") as title')->from(TABLE_PRODUCTPLAN) ->where('product')->in($product) ->andWhere('deleted')->eq(0) + ->andWhere('end')->lt($date) ->beginIF($branch)->andWhere("branch")->in("0,$branch")->fi() + ->beginIF($plans)->andWhere("id")->notIN(array_keys($plans))->fi() ->orderBy('begin desc') ->limit(5) ->fetchPairs();