* Fix bug of get dynamic count.

This commit is contained in:
liumengyi
2023-08-11 15:01:23 +08:00
parent c6566cd21e
commit b0d27c83ec
13 changed files with 64 additions and 37 deletions
+16 -1
View File
@@ -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;
}
}
+3 -1
View File
@@ -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;
+2 -2
View File
@@ -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&param=$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&param=$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&param=$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&param=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . "&direction=next&userID=$userID&productID=$productID&projectID=$projectID&executionID=$executionID&orderBy=$orderBy") : 'javascript:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>
+3 -1
View File
@@ -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();
}
+5 -5
View File
@@ -1,12 +1,12 @@
<?php
/**
* The action->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 <chunsheng@cnezsoft.com>
* @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&param=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "executionID=$executionID&type=$type&param=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
$preLink = $hasPre ? inlink('dynamic', "executionID=$executionID&type=$type&param=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "executionID=$executionID&type=$type&param=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>
+8 -6
View File
@@ -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();
}
+3 -3
View File
@@ -20,7 +20,7 @@
if($period == $type)
{
$active = 'btn-active-text';
$label .= " <span class='label label-light label-badge'>{$originTotal}</span>";
$label .= " <span class='label label-light label-badge'>{$recTotal}</span>";
}
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:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>
+3 -1
View File
@@ -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();
}
+5 -5
View File
@@ -1,12 +1,12 @@
<?php
/**
* The action->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 <chunsheng@cnezsoft.com>
* @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&param=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "productID=$productID&type=$type&param=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
$preLink = $hasPre ? inlink('dynamic', "productID=$productID&type=$type&param=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "productID=$productID&type=$type&param=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>
+3 -1
View File
@@ -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();
}
+5 -5
View File
@@ -1,12 +1,12 @@
<?php
/**
* The action->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 <chunsheng@cnezsoft.com>
* @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&param=$param&recTotal=0&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type&param=$param&recTotal=0&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
$preLink = $hasPre ? inlink('dynamic', "projectID=$projectID&type=$type&param=$param&recTotal={$recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;';
$nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type&param=$param&recTotal={$recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>
+3 -1
View File
@@ -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;
+5 -5
View File
@@ -1,12 +1,12 @@
<?php
/**
* The action->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 <chunsheng@cnezsoft.com>
* @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:;';
?>
<?php if($hasPre or $hasNext):?>
<div id="mainActions" class='main-actions'>