Merge branch 'Zentao_app1.1'

This commit is contained in:
zhujinyong
2022-03-22 10:55:09 +08:00
16 changed files with 160 additions and 38 deletions

View File

@@ -21,6 +21,7 @@ class buildsEntry extends entry
public function get($projectID = 0)
{
if(empty($projectID)) $projectID = $this->param('project', 0);
if(empty($projectID)) return $this->sendError(400, "Need project id.");
$control = $this->loadController('project', 'build');
$control->build($projectID, $this->param('type', 'all'), $this->param('param', 0), $this->param('order', 't1.date_desc,t1.id_desc'));

View File

@@ -64,6 +64,14 @@ class executionEntry extends Entry
{
switch($field)
{
case 'modules':
$control = $this->loadController('tree', 'browsetask');
$control->browsetask($executionID);
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$execution->modules = $data->data->tree;
}
case 'builds':
$execution->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,noterminate,nodone', $executionID, 'execution');
break;

View File

@@ -1,25 +0,0 @@
<?php
/**
* The execution cases entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class executionMembersEntry extends entry
{
public function get($executionID = 0)
{
if(!$executionID) $executionID = $this->param('execution', 0);
if(empty($executionID)) return $this->sendError(400, 'Need execution id.');
$members = $this->loadModel('execution')->getTeamMembers($executionID);
if(isset($members))
{
foreach($members as $member) $result[] = $this->format($member, 'join:date');
}
return $this->send(200, array('members' => $result));
}
}

View File

@@ -34,7 +34,6 @@ class executionStoriesEntry extends entry
$result = array();
foreach($stories as $story)
{
$story->name =$story->title;
$result[] = $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'stories' => $result));

View File

@@ -15,16 +15,15 @@ class moduleStoriesEntry extends Entry
{
$executionID = $this->param('executionID', 0);
if(empty($executionID)) return $this->sendError(400, 'Need execution id.');
$control = $this->loadController('story', 'ajaxGetExecutionStories');
$control->ajaxGetExecutionStories($executionID, $this->param('productID', 0), $this->param('branchID', 0), $moduleID);
$control = $this->loadController('execution', 'story');
$control->story($executionID, 'order_desc', 'byModule', $moduleID);
$data = $this->getData();
$this->loadModel('story');
$result = [];
foreach($data as $storyID => $storyName)
foreach($data->data->stories as $story)
{
if(empty($storyID)) continue;
$story = $this->story->getById($storyID);
$result[] = $this->filterFields($story, 'id,title,module,pri,status,stage,estimate');
}
return $this->send(200, array('stories' => $result));

View File

@@ -36,7 +36,6 @@ class productplansEntry extends entry
foreach($plans as $plan)
{
$plan->name = $plan->title;
if($plan->parent > 0 and isset($result[$plan->parent]))
{
$parentPlan = $result[$plan->parent];

View File

@@ -35,7 +35,6 @@ class storiesEntry extends entry
$result = array();
foreach($stories as $story)
{
$story->name =$story->title;
if(isset($story->children)) $story->children = array_values((array)$story->children);
$result[] = $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList');
}
@@ -55,7 +54,7 @@ class storiesEntry extends entry
if(!$productID and isset($this->requestBody->product)) $productID = $this->requestBody->product;
if(!$productID) return $this->sendError(400, 'Need product id.');
$fields = 'title,spec,verify,reviewer,type,plan,module,moduleOptionMenu,source,sourceNote,category,pri,estimate,mailto,keywords';
$fields = 'title,spec,verify,reviewer,type,plan,module,moduleOptionMenu,source,sourceNote,category,pri,estimate,mailto,keywords,notifyemail,uid';
$this->batchSetPost($fields);
/* If reviewer is not post, set needNotReview. */

View File

@@ -95,7 +95,7 @@ class storyEntry extends Entry
$oldStory = $this->loadModel('story')->getByID($storyID);
/* Set $_POST variables. */
$fields = 'title,product,reviewer,type,plan,module,source,sourceNote,category,pri,estimate,mailto,keywords';
$fields = 'title,product,reviewer,type,plan,module,source,sourceNote,category,pri,estimate,mailto,keywords,uid';
$this->batchSetPost($fields, $oldStory);
$this->setPost('parent', 0);

View File

@@ -0,0 +1,30 @@
<?php
/**
* The story recall entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class storyRecallEntry extends Entry
{
/**
* Delete method.
*
* @param int $storyID
* @access public
* @return void
*/
public function delete($storyID)
{
$control = $this->loadController('story', 'recall');
$control->recall($storyID);
$this->getData();
$this->sendSuccess(200, 'success');
}
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* The story review of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
**/
class storyReviewEntry extends Entry
{
/**
* POST method.
*
* @param int $storyID
* @access public
* @return void
*/
public function post($storyID)
{
$oldStory = $this->loadModel('story')->getByID($storyID);
$fields = 'reviewedDate,result,closedReason,pri,estimate,';
$this->batchSetPost($fields);
$control = $this->loadController('story', 'review');
$control->review($storyID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$story = $this->loadModel('story')->getByID($storyID);
$this->send(200, $story);
}
}

View File

@@ -50,7 +50,10 @@ class tabsEntry extends baseEntry
if($menuKey == 'requirement' and empty($this->config->URAndSR)) continue;
if(isset($this->lang->product->menu->$menuKey))
{
list($label, $module, $method) = explode('|', $this->lang->product->menu->$menuKey['link']);
$menuName = $this->lang->product->menu->$menuKey;
if(!isset($menuName['link'])) continue;
list($label, $module, $method) = explode('|', $menuName['link']);
if(!common::hasPriv($module, $method)) continue;
}
else

View File

@@ -102,7 +102,7 @@ class taskEntry extends Entry
$oldTask = $this->loadModel('task')->getByID($taskID);
/* Set $_POST variables. */
$fields = 'name,type,desc,assignedTo,pri,estimate,left,consumed,story,parent,execution,module,closedReason,status,estStarted,deadline,team,teamEstimate,multiple,mailto';
$fields = 'name,type,desc,assignedTo,pri,estimate,left,consumed,story,parent,execution,module,closedReason,status,estStarted,deadline,team,teamEstimate,multiple,mailto,uid';
$this->batchSetPost($fields, $oldTask);
$control = $this->loadController('task', 'edit');

View File

@@ -0,0 +1,45 @@
<?php
/**
* The task component entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class taskComponentEntry extends Entry
{
/**
* POST method.
*
* @param int $taskID
* @access public
* @return void
*/
public function post($taskID)
{
$fields = 'name,color,type,assignedTo,parent,estimate,story,module,pri,desc,estStarted,deadline';
$this->batchSetPost($fields);
$fields = explode(',', $fields);
foreach($fields as $field) $this->setArrayPost($field);
$task = $this->loadModel('task')->getById($taskID);
$control = $this->loadController('task', 'batchCreate');
$control->batchCreate($task->execution, 0, 0, $taskID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$task = $this->task->getById($data->idList[0]);
$this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList'));
}
public function setArrayPost($field)
{
$_POST[$field] = array('0' => $_POST[$field]);
}
}

View File

@@ -50,6 +50,8 @@ $routes['/stories/:id/active'] = 'storyActive';
$routes['/stories/:id/assign'] = 'storyAssignto';
$routes['/stories/:id/recordEstimate'] = 'storyRecordEstimate';
$routes['/stories/:id/child'] = 'storyChild';
$routes['/stories/:id/recall'] = 'storyRecall';
$routes['/stories/:id/review'] = 'storyReview';
$routes['/module/:id/stories'] = 'moduleStories';

View File

@@ -1023,4 +1023,20 @@ class fileModel extends model
return array($info->ImageWidth->value, $info->ImageHeight->value, 'img');
}
}
/**
* Get file pairs.
*
* @param int $IDs
* @param string $value
* @access public
* @return void
*/
public function getPairs($IDs, $value = 'title')
{
return $this->dao->select("id,$value")->from(TABLE_FILE)
->where('id')->in($IDs)
->andWhere('deleted')->eq('0')
->fetchPairs();
}
}

View File

@@ -459,6 +459,10 @@ class task extends control
$changes = $this->task->update($taskID);
if(dao::isError()) return print(js::error(dao::getError()));
$files = $this->loadModel('file')->saveUpload('task', $taskID);
if(empty($files) and $this->post->uid != '')
{
$files = $this->file->getPairs($_SESSION['album']['used'][$this->post->uid]);
}
}
$task = $this->task->getById($taskID);