diff --git a/module/productplan/config.php b/module/productplan/config.php index c9c405e5d0..2be831f271 100644 --- a/module/productplan/config.php +++ b/module/productplan/config.php @@ -15,3 +15,21 @@ $config->productplan->editor->view = array('id' => 'lastComment', 'tools' => ' $config->productplan->laneColorList = array('#32C5FF', '#006AF1', '#9D28B2', '#FF8F26', '#FFC20E', '#00A78E', '#7FBB00', '#424BAC', '#C0E9FF', '#EC2761'); $config->productplan->future = '2030-01-01'; + +global $app, $lang; +$app->loadLang('productplan'); +$config->productplan->search['module'] = 'productplan'; + +$config->productplan->search['fields']['id'] = $lang->productplan->id; +$config->productplan->search['fields']['title'] = $lang->productplan->title; +$config->productplan->search['fields']['branch'] = $lang->productplan->branch; +$config->productplan->search['fields']['status'] = $lang->productplan->status; +$config->productplan->search['fields']['begin'] = $lang->productplan->begin; +$config->productplan->search['fields']['end'] = $lang->productplan->end; + +$config->productplan->search['params']['id'] = array('operator' => '=', 'control' => 'input', 'values' => ''); +$config->productplan->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); +$config->productplan->search['params']['branch'] = array('operator' => '=', 'control' => 'select', 'values' => ''); +$config->productplan->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->productplan->statusList); +$config->productplan->search['params']['begin'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); +$config->productplan->search['params']['end'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); diff --git a/module/productplan/control.php b/module/productplan/control.php index a0607f5396..2a9c567d20 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -283,15 +283,16 @@ class productplan extends control * * @param int $productID * @param int $branch - * @param string $orderBy * @param string $browseType + * @param int $queryID + * @param string $orderBy * @param int $recTotal * @param int $recPerPage * @param int $pageID * @access public * @return void */ - public function browse($productID = 0, $branch = '', $browseType = 'undone', $orderBy = 'begin_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1 ) + public function browse($productID = 0, $branch = '', $browseType = 'undone', $queryID = 0, $orderBy = 'begin_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1 ) { $branchID = $branch === '' ? 'all' : $branch; if(!$branch) $branch = 0; @@ -313,6 +314,11 @@ class productplan extends control $branchStatusList = array(); foreach($branchList as $productBranch) $branchStatusList[$productBranch->id] = $productBranch->status; + /* Build the search form. */ + $queryID = $browseType == 'bySearch' ? (int)$queryID : 0; + $actionURL = $this->createLink('productplan', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=$queryID&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID"); + $this->productplan->buildSearchForm($queryID, $actionURL, $productID); + if($viewType == 'kanban') { $branches = array(); @@ -353,10 +359,11 @@ class productplan extends control $this->view->browseType = $browseType; $this->view->viewType = $viewType; $this->view->orderBy = $orderBy; - $this->view->plans = $this->productplan->getList($productID, $branch, $browseType, $pager, $sort); + $this->view->plans = $this->productplan->getList($productID, $branch, $browseType, $pager, $sort, "", $queryID); $this->view->pager = $pager; $this->view->projects = $this->product->getProjectPairsByProduct($productID, $branch); $this->view->statusList = $this->lang->productplan->featureBar['browse']; + $this->view->queryID = $queryID; $this->display(); } diff --git a/module/productplan/model.php b/module/productplan/model.php index 1b5e2d5487..6df219af91 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -3,7 +3,7 @@ * The model file of productplan module of ZenTaoPMS. * * @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com) - * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html) + * @license ZPL (http://zpl.pub/page/zplv12.html) * @author Chunsheng Wang * @package productplan * @version $Id: model.php 4639 2013-04-11 02:06:35Z chencongzhi520@gmail.com $ @@ -78,14 +78,35 @@ class productplanModel extends model * @access public * @return object */ - public function getList($product = 0, $branch = 0, $browseType = 'undone', $pager = null, $orderBy = 'begin_desc', $param = '') + public function getList($product = 0, $branch = 0, $browseType = 'undone', $pager = null, $orderBy = 'begin_desc', $param = '', $queryID = 0) { + if(!empty($queryID)) + { + $query = $this->loadModel('search')->getQuery($queryID); + if($query) + { + $this->session->set('productplanQuery', $query->sql); + $this->session->set('productplanForm', $query->form); + } + else + { + $this->session->set('productplanQuery', ' 1 = 1'); + } + } + else + { + if($this->session->productplanQuery == false) $this->session->set('productplanQuery', ' 1 = 1'); + } + + $productplanQuery = $this->session->productplanQuery; + $date = date('Y-m-d'); $plans = $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('product')->eq($product) ->andWhere('deleted')->eq(0) ->beginIF(!empty($branch) and $branch != 'all')->andWhere('branch')->eq($branch)->fi() - ->beginIF(strpos(',all,undone,', ",$browseType,") === false)->andWhere('status')->eq($browseType)->fi() + ->beginIF(strpos(',all,undone,bySearch,', ",$browseType,") === false)->andWhere('status')->eq($browseType)->fi() ->beginIF($browseType == 'undone')->andWhere('status')->in('wait,doing')->fi() + ->beginIF($browseType == 'bySearch')->andWhere($productplanQuery)->fi() ->beginIF(strpos($param, 'skipparent') !== false)->andWhere('parent')->ne(-1)->fi() ->orderBy($orderBy) ->page($pager) @@ -1182,4 +1203,22 @@ class productplanModel extends model return $menu; } + + /** + * Build search form. + * + * @param int $queryID + * @param string $actionURL + * @param int $productID + * @access public + * @return void + */ + public function buildSearchForm($queryID, $actionURL, $productID) + { + $this->config->productplan->search['actionURL'] = $actionURL; + $this->config->productplan->search['queryID'] = $queryID; + + $this->config->productplan->search['params']['branch']['values'] = array('' => '', '0' => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($productID, 'noempty'); + $this->loadModel('search')->setSearchParams($this->config->productplan->search); + } } diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index 2667fce216..f399b26b96 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -19,6 +19,7 @@ name == $browseType ? 'btn-active-text' : '';?> inlink('browse', "productID=$productID&branch=&browseType={$menuItem->name}"), $label, '', "class='btn btn-link $active' id='{$menuItem->name}'");?> + searchAB;?>
@@ -30,6 +31,7 @@
+
@@ -44,7 +46,7 @@
id&branch=$branch")?>'> - recTotal}&recPerPage={$pager->recPerPage}"; ?> + recTotal}&recPerPage={$pager->recPerPage}"; ?>