From b0d27c83ecb71f4014e6ee0ec0cce99252ce4b2e Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 11 Aug 2023 15:01:23 +0800 Subject: [PATCH] * Fix bug of get dynamic count. --- module/action/model.php | 17 ++++++++++++++++- module/company/control.php | 4 +++- module/company/view/dynamic.html.php | 4 ++-- module/execution/control.php | 4 +++- module/execution/view/dynamic.html.php | 10 +++++----- module/my/control.php | 14 ++++++++------ module/my/view/dynamic.html.php | 6 +++--- module/product/control.php | 4 +++- module/product/view/dynamic.html.php | 10 +++++----- module/project/control.php | 4 +++- module/project/view/dynamic.html.php | 10 +++++----- module/user/control.php | 4 +++- module/user/view/dynamic.html.php | 10 +++++----- 13 files changed, 64 insertions(+), 37 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index 4e5a7d3b32..6d9f8d39ed 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -1185,8 +1185,8 @@ class actionModel extends model ->beginIF($period != 'all')->andWhere('date')->gt($begin)->fi() ->beginIF($period != 'all')->andWhere('date')->lt($end)->fi() ->beginIF($date)->andWhere('date' . ($direction == 'next' ? '<' : '>') . "'{$date}'")->fi() - ->beginIF($account != 'all')->andWhere('actor')->eq($account)->fi() ->beginIF($beginDate)->andWhere('date')->ge($beginDate)->fi() + ->beginIF($account != 'all')->andWhere('actor')->eq($account)->fi() ->beginIF($endDate)->andWhere('date')->le($endDate)->fi() ->beginIF(is_numeric($productID))->andWhere('product')->like("%,$productID,%")->fi() ->andWhere('1=1', true) @@ -2424,4 +2424,19 @@ class actionModel extends model $this->dao->delete()->from(TABLE_ACTIONLATEST)->where('date')->lt($lastMonth)->exec(); return !dao::isError(); } + + /** + * Get dynamic count. + * + * @access public + * @return void + */ + public function getDynamicCount() + { + $condition = $this->session->actionQueryCondition; + $count = $this->dao->select('count(1) as count')->from(TABLE_ACTION) + ->where($condition) + ->fetch('count'); + return $count; + } } diff --git a/module/company/control.php b/module/company/control.php index 80ddf5025e..0861c045ee 100755 --- a/module/company/control.php +++ b/module/company/control.php @@ -283,8 +283,10 @@ class company extends control $dateGroups = $this->action->buildDateGroup($actions, $direction, $browseType, $orderBy); + if(empty($recTotal)) $recTotal = count($dateGroups) < 2 ? count($actions) : $this->action->getDynamicCount(); + /* Assign. */ - $this->view->recTotal = count($dateGroups, 1) - count($dateGroups); + $this->view->recTotal = $recTotal; $this->view->browseType = $browseType; $this->view->account = $account; $this->view->accountPairs = $accountPairs; diff --git a/module/company/view/dynamic.html.php b/module/company/view/dynamic.html.php index f7748405da..9c1c15b96f 100644 --- a/module/company/view/dynamic.html.php +++ b/module/company/view/dynamic.html.php @@ -115,8 +115,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "browseType=$browseType¶m=$param&recTotal=0&date=" . strtotime($firstDate) . "&direction=pre&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy") : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "browseType=$browseType¶m=$param&recTotal=0&date=" . strtotime($lastDate) . "&direction=next&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy") : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "browseType=$browseType¶m=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . "&direction=pre&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy") : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "browseType=$browseType¶m=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . "&direction=next&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy") : 'javascript:;'; ?>
diff --git a/module/execution/control.php b/module/execution/control.php index fd7e5a7f09..c36932cd50 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -3730,6 +3730,8 @@ class execution extends control $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, 50, 'all', 'all', $executionID, $date, $direction); $dateGroups = $this->action->buildDateGroup($actions, $direction, $type); + if(empty($recTotal)) $recTotal = count($dateGroups) < 2 ? count($actions) : $this->action->getDynamicCount(); + $execution = $this->execution->getByID($executionID); /* Assign. */ @@ -3743,7 +3745,7 @@ class execution extends control $this->view->param = $param; $this->view->dateGroups = $dateGroups; $this->view->direction = $direction; - $this->view->recTotal = count($dateGroups, 1) - count($dateGroups); + $this->view->recTotal = $recTotal; $this->display(); } diff --git a/module/execution/view/dynamic.html.php b/module/execution/view/dynamic.html.php index da42a22efc..acf69c3689 100755 --- a/module/execution/view/dynamic.html.php +++ b/module/execution/view/dynamic.html.php @@ -1,12 +1,12 @@ dynamic view file of dashboard module of ZenTaoPMS. + * The dynamic view file of execution module of ZenTaoPMS. * * @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) 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) * @author Chunsheng Wang - * @package dashboard - * @version $Id: action->dynamic.html.php 1477 2011-03-01 15:25:50Z wwccss $ + * @package execution + * @version $Id: dynamic.html.php 1477 2011-03-01 15:25:50Z wwccss $ * @link http://www.zentao.net */ ?> @@ -107,8 +107,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "executionID=$executionID&type=$type¶m=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "executionID=$executionID&type=$type¶m=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "executionID=$executionID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "executionID=$executionID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; ?>
diff --git a/module/my/control.php b/module/my/control.php index 77fc446418..6062f97f31 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -1566,7 +1566,7 @@ EOF; * @access public * @return void */ - public function dynamic($type = 'today', $recTotal = 0, $date = '', $direction = 'next', $originTotal = 0) + public function dynamic($type = 'today', $recTotal = 0, $date = '', $direction = 'next') { /* Save session. */ $uri = $this->app->getURI(true); @@ -1612,12 +1612,14 @@ EOF; $actions = $this->loadModel('action')->getDynamic($this->app->user->account, $type, $orderBy, 50, 'all', 'all', 'all', $date, $direction); $dateGroups = $this->action->buildDateGroup($actions, $direction, $type); + if(empty($recTotal)) $recTotal = count($dateGroups) < 2 ? count($actions) : $this->action->getDynamicCount(); + /* Assign. */ - $this->view->type = $type; - $this->view->orderBy = $orderBy; - $this->view->dateGroups = $dateGroups; - $this->view->direction = $direction; - $this->view->originTotal = count($dateGroups, 1) - count($dateGroups); + $this->view->type = $type; + $this->view->orderBy = $orderBy; + $this->view->dateGroups = $dateGroups; + $this->view->direction = $direction; + $this->view->recTotal = $recTotal; $this->display(); } diff --git a/module/my/view/dynamic.html.php b/module/my/view/dynamic.html.php index 1e17fa3a4d..0188838827 100644 --- a/module/my/view/dynamic.html.php +++ b/module/my/view/dynamic.html.php @@ -20,7 +20,7 @@ if($period == $type) { $active = 'btn-active-text'; - $label .= " {$originTotal}"; + $label .= " {$recTotal}"; } echo html::a(inlink('dynamic', "type=$period"), $label, '', "class='btn btn-link $active' id='{$period}'") ?> @@ -102,8 +102,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "type=$type&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre&originTotal=' . $originTotal) : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "type=$type&recTotal=0&date=" . strtotime($lastDate) . '&direction=next&originTotal=' . $originTotal) : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "type={$type}&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "type={$type}&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; ?>
diff --git a/module/product/control.php b/module/product/control.php index bb9fd3f95a..102cc13b16 100755 --- a/module/product/control.php +++ b/module/product/control.php @@ -878,6 +878,8 @@ class product extends control $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, 50, $productID, 'all', 'all', $date, $direction); $dateGroups = $this->action->buildDateGroup($actions, $direction, $type); + if(empty($recTotal)) $recTotal = count($dateGroups) < 2 ? count($actions) : $this->action->getDynamicCount(); + /* Assign. */ $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->product->dynamic; $this->view->userIdPairs = $this->loadModel('user')->getPairs('noletter|nodeleted|noclosed|useid'); @@ -890,7 +892,7 @@ class product extends control $this->view->param = $param; $this->view->dateGroups = $dateGroups; $this->view->direction = $direction; - $this->view->recTotal = count($dateGroups, 1) - count($dateGroups); + $this->view->recTotal = $recTotal; $this->display(); } diff --git a/module/product/view/dynamic.html.php b/module/product/view/dynamic.html.php index 7c8df358d6..37bbfc2623 100755 --- a/module/product/view/dynamic.html.php +++ b/module/product/view/dynamic.html.php @@ -1,12 +1,12 @@ dynamic view file of dashboard module of ZenTaoPMS. + * The dynamic view file of product module of ZenTaoPMS. * * @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) 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) * @author Chunsheng Wang - * @package dashboard - * @version $Id: action->dynamic.html.php 1477 2011-03-01 15:25:50Z wwccss $ + * @package product + * @version $Id: dynamic.html.php 1477 2011-03-01 15:25:50Z wwccss $ * @link http://www.zentao.net */ ?> @@ -105,8 +105,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "productID=$productID&type=$type¶m=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "productID=$productID&type=$type¶m=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "productID=$productID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "productID=$productID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; ?>
diff --git a/module/project/control.php b/module/project/control.php index 34f97d38b3..f8fa91219c 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -1034,6 +1034,8 @@ class project extends control $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, 50, 'all', $projectID, 'all', $date, $direction); $dateGroups = $this->action->buildDateGroup($actions, $direction, $type); + if(empty($recTotal)) $recTotal = count($dateGroups) < 2 ? count($actions) : $this->action->getDynamicCount(); + $project = $this->project->getByID($projectID); /* Assign. */ @@ -1047,7 +1049,7 @@ class project extends control $this->view->param = $param; $this->view->dateGroups = $dateGroups; $this->view->direction = $direction; - $this->view->recTotal = count($dateGroups, 1) - count($dateGroups); + $this->view->recTotal = $recTotal; $this->display(); } diff --git a/module/project/view/dynamic.html.php b/module/project/view/dynamic.html.php index 6fedb51d7a..7f7389fbfc 100755 --- a/module/project/view/dynamic.html.php +++ b/module/project/view/dynamic.html.php @@ -1,12 +1,12 @@ dynamic view file of dashboard module of ZenTaoPMS. + * The dynamic view file of project module of ZenTaoPMS. * * @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) 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) * @author Chunsheng Wang - * @package dashboard - * @version $Id: action->dynamic.html.php 1477 2011-03-01 15:25:50Z wwccss $ + * @package project + * @version $Id: dynamic.html.php 1477 2011-03-01 15:25:50Z wwccss $ * @link http://www.zentao.net */ ?> @@ -106,8 +106,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; ?>
diff --git a/module/user/control.php b/module/user/control.php index 551037b2d5..38a6039f52 100755 --- a/module/user/control.php +++ b/module/user/control.php @@ -1239,11 +1239,13 @@ class user extends control $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, 50, 'all', 'all', 'all', $date, $direction); $dateGroups = $this->action->buildDateGroup($actions, $direction, $period); + if(empty($recTotal)) $recTotal = count($dateGroups) < 2 ? count($actions) : $this->action->getDynamicCount(); + /* Assign. */ $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->dynamic; $this->view->type = $period; $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->recTotal = count($dateGroups, 1) - count($dateGroups); + $this->view->recTotal = $recTotal; $this->view->user = $user; $this->view->dateGroups = $dateGroups; $this->view->direction = $direction; diff --git a/module/user/view/dynamic.html.php b/module/user/view/dynamic.html.php index d0d2b90a37..941b6260a6 100644 --- a/module/user/view/dynamic.html.php +++ b/module/user/view/dynamic.html.php @@ -1,12 +1,12 @@ dynamic view file of dashboard module of ZenTaoPMS. + * The dynamic view file of user module of ZenTaoPMS. * * @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) 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) * @author Chunsheng Wang - * @package dashboard - * @version $Id: action->dynamic.html.php 1477 2011-03-01 15:25:50Z wwccss $ + * @package user + * @version $Id: dynamic.html.php 1477 2011-03-01 15:25:50Z wwccss $ * @link http://www.zentao.net */ ?> @@ -76,8 +76,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "userID={$user->id}&type=$type&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "userID={$user->id}&type=$type&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "userID={$user->id}&type=$type&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "userID={$user->id}&type=$type&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; ?>