* Finish task #71836.

This commit is contained in:
zhouxin
2022-10-10 15:23:22 +08:00
parent f9f49755c1
commit 0cfb69ac5b
6 changed files with 152 additions and 8 deletions
+12 -8
View File
@@ -1734,10 +1734,11 @@ class block extends control
if(common::hasPriv('bug', 'view') and $this->config->vision != 'lite') $hasViewPriv['bug'] = true;
if($this->config->URAndSR and common::hasPriv('story', 'view') and $this->config->vision != 'lite') $hasViewPriv['requirement'] = true;
if(common::hasPriv('story', 'view') and $this->config->vision != 'lite') $hasViewPriv['story'] = true;
if(common::hasPriv('risk', 'view') and $this->config->edition == 'max' and $this->config->vision != 'lite') $hasViewPriv['risk'] = true;
if(common::hasPriv('issue', 'view') and $this->config->edition == 'max' and $this->config->vision != 'lite') $hasViewPriv['issue'] = true;
if(common::hasPriv('meeting', 'view') and $this->config->edition == 'max' and $this->config->vision != 'lite') $hasViewPriv['meeting'] = true;
if(common::hasPriv('risk', 'view') and $this->config->edition == 'max' and $this->config->vision != 'lite') $hasViewPriv['risk'] = true;
if(common::hasPriv('issue', 'view') and $this->config->edition == 'max' and $this->config->vision != 'lite') $hasViewPriv['issue'] = true;
if(common::hasPriv('meeting', 'view') and $this->config->edition == 'max' and $this->config->vision != 'lite') $hasViewPriv['meeting'] = true;
if(common::hasPriv('feedback', 'view') and in_array($this->config->edition, array('max', 'biz'))) $hasViewPriv['feedback'] = true;
if(common::hasPriv('ticket', 'view') and in_array($this->config->edition, array('max', 'biz'))) $hasViewPriv['ticket'] = true;
$params = $this->get->param;
$params = json_decode(base64_decode($params));
@@ -1746,14 +1747,14 @@ class block extends control
$objectCountList = array('todo' => 'todoCount', 'task' => 'taskCount', 'bug' => 'bugCount', 'story' => 'storyCount', 'requirement' => 'requirementCount');
if($this->config->edition == 'max')
{
$objectList += array('risk' => 'risks', 'issue' => 'issues', 'feedback' => 'feedbacks');
$objectCountList += array('risk' => 'riskCount', 'issue' => 'issueCount', 'feedback' => 'feedbackCount');
$objectList += array('risk' => 'risks', 'issue' => 'issues', 'feedback' => 'feedbacks', 'ticket' => 'tickets');
$objectCountList += array('risk' => 'riskCount', 'issue' => 'issueCount', 'feedback' => 'feedbackCount', 'ticket' => 'ticketCount');
}
if($this->config->edition == 'biz')
{
$objectList += array('feedback' => 'feedbacks');
$objectCountList += array('feedback' => 'feedbackCount');
$objectList += array('feedback' => 'feedbacks', 'ticket' => 'tickets');
$objectCountList += array('feedback' => 'feedbackCount', 'ticket' => 'ticketCount');
}
$tasks = $this->loadModel('task')->getUserSuspendedTasks($this->app->user->account);
@@ -1769,6 +1770,7 @@ class block extends control
->beginIF($objectType == 'bug')->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')->fi()
->beginIF($objectType == 'task')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution=t2.id')->fi()
->beginIF($objectType == 'issue' or $objectType == 'risk')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')->fi()
->beginIF($objectType == 'ticket')->leftJoin(TABLE_USER)->alias('t2')->on('t1.openedBy = t2.account')->fi()
->where('t1.deleted')->eq(0)
->andWhere('t1.assignedTo')->eq($this->app->user->account)->fi()
->beginIF($objectType == 'story')->andWhere('t1.type')->eq('story')->andWhere('t2.deleted')->eq('0')->fi()
@@ -1779,6 +1781,7 @@ class block extends control
->beginIF($objectType != 'todo')->andWhere('t1.status')->ne('closed')->fi()
->beginIF($objectType == 'feedback')->andWhere('t1.status')->in('wait, noreview')->fi()
->beginIF($objectType == 'issue' or $objectType == 'risk')->andWhere('t2.deleted')->eq(0)->fi()
->beginIF($objectType == 'ticket')->andWhere('t1.status')->in('wait,doing')->fi()
->orderBy($orderBy)
->beginIF($limitCount)->limit($limitCount)->fi()
->fetchAll();
@@ -1823,9 +1826,10 @@ class block extends control
if($objectType == 'risk') $this->app->loadLang('risk');
if($objectType == 'issue') $this->app->loadLang('issue');
if($objectType == 'feedback')
if($objectType == 'feedback' or $objectType == 'ticket')
{
$this->app->loadLang('feedback');
$this->app->loadLang('ticket');
$this->view->users = $this->loadModel('user')->getPairs('all,noletter');
$this->view->products = $this->dao->select('id, name')->from(TABLE_PRODUCT)->where('deleted')->eq('0')->fetchPairs('id', 'name');
}
+2
View File
@@ -358,6 +358,7 @@ $lang->block->availableBlocks->risk = '风险';
$lang->block->availableBlocks->issue = '问题';
$lang->block->availableBlocks->meeting = '会议';
$lang->block->availableBlocks->feedback = '反馈';
$lang->block->availableBlocks->ticket = '工单';
if($config->systemMode == 'new') $lang->block->moduleList['project'] = '项目';
$lang->block->moduleList['product'] = $lang->productCommon;
@@ -478,6 +479,7 @@ $lang->block->issueCount = '问题数';
$lang->block->storyCount = '需求数';
$lang->block->meetingCount = '会议数';
$lang->block->feedbackCount = '反馈数';
$lang->block->ticketCount = '工单数';
$lang->block->typeList = new stdclass();
+36
View File
@@ -0,0 +1,36 @@
<?php if(empty($tickets)): ?>
<div class='empty-tip'><?php echo $lang->block->emptyTip;?></div>
<?php else:?>
<style>
.block-tickets .c-id {width: 50px;}
</style>
<div class='panel-body has-table scrollbar-hover'>
<table class='table table-borderless table-fixed table-fixed-head table-hover tablesorter block-tickets <?php if(!$longBlock) echo 'block-sm'?>'>
<thead>
<tr>
<th class='c-id'><?php echo $lang->idAB?></th>
<th class='c-product'><?php echo $lang->ticket->product;?></th>
<th class='c-title'><?php echo $lang->ticket->title?></th>
<th class='c-type'><?php echo $lang->ticket->type;?></th>
<th class='c-openedBy'><?php echo $lang->ticket->createdBy;?></th>
<th class='c-openedDate'><?php echo $lang->ticket->createdDate;?></th>
</tr>
</thead>
<tbody>
<?php foreach($tickets as $ticket):?>
<?php
$appid = isset($_GET['entry']) ? "class='app-btn' data-id='{$this->get->entry}'" : '';
?>
<tr>
<td><?php echo sprintf('%03d', $ticket->id);?></td>
<td><?php echo zget($products, $ticket->product);?></td>
<td class='c-title' title='<?php echo $ticket->title?>'><?php echo html::a($this->createLink('ticket', 'view', "ticketID=$ticket->id"), $ticket->title, '', "data-app='my'")?></td>
<td><?php echo zget($lang->ticket->typeList, $ticket->type)?></td>
<td><?php echo zget($users, $ticket->openedBy)?></td>
<td><?php echo $ticket->openedDate;?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<?php endif;?>
+37
View File
@@ -108,6 +108,7 @@ class my extends control
$this->loadModel('bug');
$this->loadModel('testcase');
$this->loadModel('testtask');
$this->loadModel('ticket');
/* Load pager. */
$this->app->loadClass('pager', $static = true);
@@ -198,6 +199,9 @@ class my extends control
/* Get the number of meetings assigned to me. */
$meetings = $this->meeting->getListByUser('futureMeeting', 'id_desc', 0, $pager);
$meetingCount = $pager->recTotal;
$ticketList = $this->ticket->getList('assignedtome', 'id_desc', $pager);
$ticketCount = $pager->recTotal;
}
echo <<<EOF
@@ -223,6 +227,7 @@ if(isMax !== 0)
var reviewCount = $reviewCount;
var qaCount = $qaCount;
var meetingCount = $meetingCount;
var ticketCount = $ticketCount;
}
</script>
EOF;
@@ -1208,6 +1213,38 @@ EOF;
$this->display();
}
/**
* My ticket.
*
* @param string $browseType
* @param string $param
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function ticket($browseType = 'assignedtome', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->loadModel('ticket');
$this->session->set('ticketList', $this->app->getURI(true), 'feedback');
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$tickets = $this->ticket->getList($browseType, $orderBy, $pager);
$this->view->title = $this->lang->ticket->browse;
$this->view->products = $this->loadModel('feedback')->getGrantProducts();
$this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
$this->view->tickets = $tickets;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->browseType = $browseType;
$this->display();
}
/**
* My team.
*
+1
View File
@@ -21,6 +21,7 @@ $(function()
$("#subNavbar li[data-id='audit'] a").append('<span class="label label-light label-badge">' + reviewCount + '</span>');
$("#subNavbar li[data-id='nc'] a").append('<span class="label label-light label-badge">' + qaCount + '</span>');
$("#subNavbar li[data-id='myMeeting'] a").append('<span class="label label-light label-badge">' + meetingCount + '</span>');
$("#subNavbar li[data-id='ticket'] a").append('<span class="label label-light label-badge">' + ticketCount + '</span>');
}
}
}
+64
View File
@@ -0,0 +1,64 @@
<?php
/**
* The ticket view file of my module of ZenTaoPMS.
*
* @copyright Copyright 2009-2022 青岛易软天创网络科技有限公司(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)
* @author Xin Zhou <zhouxin@cnezsoft.com>
* @package my
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
<?php js::set('mode', 'ticket');?>
<?php js::set('rawMethod', $app->rawMethod);?>
<div id='mainMenu' class="clearfix">
</div>
<div id='mainContent' class="main-row fade">
<?php if(empty($tickets)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->ticket->noTicket;?></span>
<?php echo html::a(inlink('browse', "browseType=$type"), "<i class='icon icon-plus'></i> " . $lang->ticket->create, '', "class='btn btn-info'")?>
</p>
</div>
<?php else:?>
<form class='main-table' id='opportunityForm' method='post' data-ride="table">
<table class="table has-sort-head" id='ticketList'>
<?php $vars = "browseType=$browseType&param=0&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<?php $canView = common::hasPriv('ticket', 'view');?>
<thead>
<th class="c-id"><?php common::printOrderLink('id', $orderBy, $vars, $lang->ticket->idAB);?></th>
<th class="c-product"><?php common::printOrderLink('product', $orderBy, $vars, $lang->ticket->product);?></th>
<th class='c-title'><?php common::printOrderLink('title', $orderBy, $vars, $lang->ticket->title);?></th>
<th class='c-pri' title='<?php echo $lang->pri;?>'><?php common::printOrderLink('pri', $orderBy, $vars, $lang->ticket->priAB);?></th>
<th class='c-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->ticket->status);?></th>
<th class="c-type"><?php common::printOrderLink('type', $orderBy, $vars, $lang->ticket->type);?></th>
<th class='c-openedBy'><?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->ticket->createdBy);?></th>
<th class='c-openedDate'><?php common::printOrderLink('openedDate', $orderBy, $vars, $lang->ticket->createdDate);?></th>
<th class='c-assignedTo'><?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->ticket->assignedTo);?></th>
<th class='c-actions'><?php echo $lang->actions;?></th>
</thead>
<tbody>
<?php foreach($tickets as $ticket): ?>
<tr>
<td class='text-center'><?php echo $canView ? html::a($this->createLink('ticket', 'view', "id={$ticket->id}"), $ticket->id) : $ticket->id;?></td>
<td><?php echo zget($products, $ticket->product);?></td>
<td><?php echo $canView ? html::a($this->createLink('ticket', 'view', "id={$ticket->id}"), $ticket->title) : $ticket->title;?></td>
<td><?php echo zget($lang->ticket->priList, $ticket->pri);?></td>
<td><?php echo zget($lang->ticket->statusList, $ticket->status);?></td>
<td><?php echo zget($lang->ticket->typeList, $ticket->type);?></td>
<td><?php echo zget($users, $ticket->openedBy);?></td>
<td><?php echo $ticket->openedDate;?></td>
<td><?php echo zget($users, $ticket->assignedTo);?></td>
<td class='c-actions'><?php echo $this->ticket->buildOperateBrowseMenu($ticket->id);?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
</form>
<?php endif;?>
</div>
<?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>