* Code for port.
This commit is contained in:
@@ -319,7 +319,7 @@ $config->bug->datatable->fieldList['deadline']['title'] = 'deadline';
|
||||
$config->bug->datatable->fieldList['deadline']['fixed'] = 'no';
|
||||
$config->bug->datatable->fieldList['deadline']['width'] = '90';
|
||||
$config->bug->datatable->fieldList['deadline']['required'] = 'no';
|
||||
$config->bug->datatable->fieldList['deadline']['control'] = 'date';
|
||||
$config->bug->datatable->fieldList['deadline']['control'] = 'date';
|
||||
|
||||
$config->bug->datatable->fieldList['resolvedBy']['title'] = 'resolvedByAB';
|
||||
$config->bug->datatable->fieldList['resolvedBy']['fixed'] = 'no';
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
$config->port = new stdclass();
|
||||
|
||||
$config->port->fieldList['title'] = '';
|
||||
$config->port->fieldList['width'] = '';
|
||||
$config->port->fieldList['required'] = 'no';
|
||||
$config->port->fieldList['fixed'] = '';
|
||||
$config->port->fieldList['control'] = 'input';
|
||||
$config->port->fieldList['values'] = '';
|
||||
$config->port->fieldList['class'] = '';
|
||||
$config->port->fieldList['sort'] = '';
|
||||
$config->port->fieldList['title'] = '';
|
||||
$config->port->fieldList['width'] = '';
|
||||
$config->port->fieldList['required'] = 'no';
|
||||
$config->port->fieldList['fixed'] = '';
|
||||
$config->port->fieldList['control'] = 'input';
|
||||
$config->port->fieldList['values'] = '';
|
||||
$config->port->fieldList['class'] = '';
|
||||
$config->port->fieldList['sort'] = '';
|
||||
$config->port->fieldList['dataSource'] = array('module' => '', 'method' => '', 'params' => '', 'pairs' => '', 'lang' => '');
|
||||
|
||||
$config->port->initFunction = 'title,control,required,';
|
||||
@@ -18,6 +18,7 @@ $config->port->listFields = '';
|
||||
$config->port->sysLangFields = ',pri,status,type,mode,severity,os,browser,resolution,confirmed,source,reviewResult,stage,change';
|
||||
$config->port->sysDataFields = 'execution,product,user';
|
||||
$config->port->userFields = 'assignedTo,openedBy,finishedBy,canceledBy,closedBy,lastEditedBy,lastRunner,';
|
||||
|
||||
$config->port->import = new stdClass();
|
||||
|
||||
$config->port->dateMatch = '/[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/';
|
||||
|
||||
@@ -5,8 +5,6 @@ class port extends control
|
||||
* Export datas.
|
||||
*
|
||||
* @param string $model
|
||||
* @param string $params
|
||||
* @param array $rows
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
+1
-195
@@ -2503,7 +2503,7 @@ class story extends control
|
||||
{
|
||||
$this->session->set('storyPortParams', array('productID' => $productID, 'executionID' => $executionID));
|
||||
/* Create field lists. */
|
||||
$this->post->set('rows', $this->getExportStorys($executionID, $orderBy));
|
||||
$this->post->set('rows', $this->story->getExportStorys($executionID, $orderBy));
|
||||
$this->fetch('port', 'export', 'model=story');
|
||||
}
|
||||
|
||||
@@ -2534,200 +2534,6 @@ class story extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get export storys .
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExportStorys($executionID, $orderBy = 'id_desc')
|
||||
{
|
||||
$this->loadModel('file');
|
||||
$this->loadModel('branch');
|
||||
$storyLang = $this->lang->story;
|
||||
$storyConfig = $this->config->story;
|
||||
|
||||
/* Create field lists. */
|
||||
$fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $storyConfig->list->exportFields);
|
||||
foreach($fields as $key => $fieldName)
|
||||
{
|
||||
$fieldName = trim($fieldName);
|
||||
$fields[$fieldName] = isset($storyLang->$fieldName) ? $storyLang->$fieldName : $fieldName;
|
||||
unset($fields[$key]);
|
||||
}
|
||||
|
||||
/* Get stories. */
|
||||
$stories = array();
|
||||
if($this->session->storyOnlyCondition)
|
||||
{
|
||||
if($this->post->exportType == 'selected')
|
||||
{
|
||||
$stories = $this->dao->select('id,title,linkStories,childStories,parent,mailto,reviewedBy')->from(TABLE_STORY)->where('id')->in($this->cookie->checkedItem)->orderBy($orderBy)->fetchAll('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$stories = $this->dao->select('id,title,linkStories,childStories,parent,mailto,reviewedBy')->from(TABLE_STORY)->where($this->session->storyQueryCondition)->orderBy($orderBy)->fetchAll('id');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$field = $executionID ? 't2.id' : 't1.id';
|
||||
if($this->post->exportType == 'selected')
|
||||
{
|
||||
$stmt = $this->dbh->query("SELECT * FROM " . TABLE_STORY . "WHERE `id` IN({$this->cookie->checkedItem})" . " ORDER BY " . strtr($orderBy, '_', ' '));
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt = $this->dbh->query($this->session->storyQueryCondition . " ORDER BY " . strtr($orderBy, '_', ' '));
|
||||
}
|
||||
while($row = $stmt->fetch()) $stories[$row->id] = $row;
|
||||
}
|
||||
$storyIdList = array_keys($stories);
|
||||
|
||||
if($stories)
|
||||
{
|
||||
$children = array();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
if($story->parent > 0 and isset($stories[$story->parent]))
|
||||
{
|
||||
$children[$story->parent][$story->id] = $story;
|
||||
unset($stories[$story->id]);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($children))
|
||||
{
|
||||
$reorderStories = array();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$reorderStories[$story->id] = $story;
|
||||
if(isset($children[$story->id]))
|
||||
{
|
||||
foreach($children[$story->id] as $childrenID => $childrenStory)
|
||||
{
|
||||
$reorderStories[$childrenID] = $childrenStory;
|
||||
}
|
||||
}
|
||||
unset($stories[$story->id]);
|
||||
}
|
||||
$stories = $reorderStories;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get users, products and relations. */
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$products = $this->product->getPairs('nocode');
|
||||
$relatedStoryIds = array();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$relatedStoryIds[$story->id] = $story->id;
|
||||
}
|
||||
|
||||
|
||||
$storyTasks = $this->loadModel('task')->getStoryTaskCounts($relatedStoryIds);
|
||||
$storyBugs = $this->loadModel('bug')->getStoryBugCounts($relatedStoryIds);
|
||||
$storyCases = $this->loadModel('testcase')->getStoryCaseCounts($relatedStoryIds);
|
||||
|
||||
/* Get related objects title or names. */
|
||||
$relatedSpecs = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('`story`')->in($storyIdList)->orderBy('version desc')->fetchGroup('story');
|
||||
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$story->spec = '';
|
||||
$story->verify = '';
|
||||
if(isset($relatedSpecs[$story->id]))
|
||||
{
|
||||
$storySpec = $relatedSpecs[$story->id][0];
|
||||
$story->title = $storySpec->title;
|
||||
$story->spec = $storySpec->spec;
|
||||
$story->verify = $storySpec->verify;
|
||||
}
|
||||
|
||||
if($this->post->fileType == 'csv')
|
||||
{
|
||||
$story->spec = htmlspecialchars_decode($story->spec);
|
||||
$story->spec = str_replace("<br />", "\n", $story->spec);
|
||||
$story->spec = str_replace('"', '""', $story->spec);
|
||||
$story->spec = str_replace(' ', ' ', $story->spec);
|
||||
|
||||
$story->verify = htmlspecialchars_decode($story->verify);
|
||||
$story->verify = str_replace("<br />", "\n", $story->verify);
|
||||
$story->verify = str_replace('"', '""', $story->verify);
|
||||
$story->verify = str_replace(' ', ' ', $story->verify);
|
||||
}
|
||||
/* fill some field with useful value. */
|
||||
|
||||
if(isset($storyTasks[$story->id])) $story->taskCountAB = $storyTasks[$story->id];
|
||||
if(isset($storyBugs[$story->id])) $story->bugCountAB = $storyBugs[$story->id];
|
||||
if(isset($storyCases[$story->id])) $story->caseCountAB = $storyCases[$story->id];
|
||||
|
||||
if($story->linkStories)
|
||||
{
|
||||
$tmpLinkStories = array();
|
||||
$linkStoriesIdList = explode(',', $story->linkStories);
|
||||
foreach($linkStoriesIdList as $linkStoryID)
|
||||
{
|
||||
$linkStoryID = trim($linkStoryID);
|
||||
$tmpLinkStories[] = isset($relatedStories[$linkStoryID]) ? $relatedStories[$linkStoryID] : $linkStoryID;
|
||||
}
|
||||
$story->linkStories = join("; \n", $tmpLinkStories);
|
||||
}
|
||||
|
||||
if($story->childStories)
|
||||
{
|
||||
$tmpChildStories = array();
|
||||
$childStoriesIdList = explode(',', $story->childStories);
|
||||
foreach($childStoriesIdList as $childStoryID)
|
||||
{
|
||||
if(empty($childStoryID)) continue;
|
||||
|
||||
$childStoryID = trim($childStoryID);
|
||||
$tmpChildStories[] = isset($relatedStories[$childStoryID]) ? $relatedStories[$childStoryID] : $childStoryID;
|
||||
}
|
||||
$story->childStories = join("; \n", $tmpChildStories);
|
||||
}
|
||||
|
||||
/* Set related files. */
|
||||
$story->files = '';
|
||||
if(isset($relatedFiles[$story->id]))
|
||||
{
|
||||
foreach($relatedFiles[$story->id] as $file)
|
||||
{
|
||||
$fileURL = common::getSysURL() . helper::createLink('file', 'download', "fileID=$file->id");
|
||||
$story->files .= html::a($fileURL, $file->title, '_blank') . '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
$story->mailto = trim(trim($story->mailto), ',');
|
||||
$mailtos = explode(',', $story->mailto);
|
||||
$story->mailto = '';
|
||||
foreach($mailtos as $mailto)
|
||||
{
|
||||
$mailto = trim($mailto);
|
||||
if(isset($users[$mailto])) $story->mailto .= $users[$mailto] . ',';
|
||||
}
|
||||
$story->mailto = rtrim($story->mailto, ',');
|
||||
|
||||
$story->reviewedBy = trim(trim($story->reviewedBy), ',');
|
||||
$reviewedBys = explode(',', $story->reviewedBy);
|
||||
$story->reviewedBy = '';
|
||||
foreach($reviewedBys as $reviewedBy)
|
||||
{
|
||||
$reviewedBy = trim($reviewedBy);
|
||||
if(isset($users[$reviewedBy])) $story->reviewedBy .= $users[$reviewedBy] . ',';
|
||||
}
|
||||
$story->reviewedBy = rtrim($story->reviewedBy, ',');
|
||||
|
||||
/* Set child story title. */
|
||||
if($story->parent > 0 && strpos($story->title, htmlentities('>', ENT_COMPAT | ENT_HTML401, 'UTF-8')) !== 0) $story->title = '>' . $story->title;
|
||||
}
|
||||
|
||||
return $stories;
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get stories of a user in html select.
|
||||
*
|
||||
|
||||
+194
-7
@@ -5426,24 +5426,20 @@ class storyModel extends model
|
||||
* Get related objects id lists.
|
||||
*
|
||||
* @param int $object
|
||||
* @param string $name
|
||||
* @param string $pairs
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getRelatedObjects($object, $pairs = '')
|
||||
{
|
||||
/* Get bugs. */
|
||||
$storys = $this->dao->select('*')->from(TABLE_STORY)->where($this->session->storyQueryCondition)
|
||||
->fetchAll('id');
|
||||
$storys = $this->dao->select('*')->from(TABLE_STORY)->where($this->session->storyQueryCondition)->fetchAll('id');
|
||||
|
||||
/* Get related objects id lists. */
|
||||
$relatedObjectIdList = array();
|
||||
$relatedObjects = array();
|
||||
|
||||
foreach($storys as $story)
|
||||
{
|
||||
$relatedObjectIdList[$story->$object] = $story->$object;
|
||||
}
|
||||
foreach($storys as $story) $relatedObjectIdList[$story->$object] = $story->$object;
|
||||
|
||||
if($object == 'plan') $object = 'productplan';
|
||||
/* Get related objects title or names. */
|
||||
@@ -5451,4 +5447,195 @@ class storyModel extends model
|
||||
if($table) $relatedObjects = $this->dao->select($pairs)->from($table) ->where('id')->in($relatedObjectIdList)->fetchPairs();
|
||||
return $relatedObjects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get export storys .
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getExportStorys($executionID, $orderBy = 'id_desc')
|
||||
{
|
||||
$this->loadModel('file');
|
||||
$this->loadModel('branch');
|
||||
$storyLang = $this->lang->story;
|
||||
$storyConfig = $this->config->story;
|
||||
|
||||
/* Create field lists. */
|
||||
$fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $storyConfig->list->exportFields);
|
||||
foreach($fields as $key => $fieldName)
|
||||
{
|
||||
$fieldName = trim($fieldName);
|
||||
$fields[$fieldName] = isset($storyLang->$fieldName) ? $storyLang->$fieldName : $fieldName;
|
||||
unset($fields[$key]);
|
||||
}
|
||||
|
||||
/* Get stories. */
|
||||
$stories = array();
|
||||
if($this->session->storyOnlyCondition)
|
||||
{
|
||||
if($this->post->exportType == 'selected')
|
||||
{
|
||||
$stories = $this->dao->select('id,title,linkStories,childStories,parent,mailto,reviewedBy')->from(TABLE_STORY)->where('id')->in($this->cookie->checkedItem)->orderBy($orderBy)->fetchAll('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$stories = $this->dao->select('id,title,linkStories,childStories,parent,mailto,reviewedBy')->from(TABLE_STORY)->where($this->session->storyQueryCondition)->orderBy($orderBy)->fetchAll('id');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$field = $executionID ? 't2.id' : 't1.id';
|
||||
if($this->post->exportType == 'selected')
|
||||
{
|
||||
$stmt = $this->dbh->query("SELECT * FROM " . TABLE_STORY . "WHERE `id` IN({$this->cookie->checkedItem})" . " ORDER BY " . strtr($orderBy, '_', ' '));
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt = $this->dbh->query($this->session->storyQueryCondition . " ORDER BY " . strtr($orderBy, '_', ' '));
|
||||
}
|
||||
while($row = $stmt->fetch()) $stories[$row->id] = $row;
|
||||
}
|
||||
$storyIdList = array_keys($stories);
|
||||
|
||||
if($stories)
|
||||
{
|
||||
$children = array();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
if($story->parent > 0 and isset($stories[$story->parent]))
|
||||
{
|
||||
$children[$story->parent][$story->id] = $story;
|
||||
unset($stories[$story->id]);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($children))
|
||||
{
|
||||
$reorderStories = array();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$reorderStories[$story->id] = $story;
|
||||
if(isset($children[$story->id]))
|
||||
{
|
||||
foreach($children[$story->id] as $childrenID => $childrenStory)
|
||||
{
|
||||
$reorderStories[$childrenID] = $childrenStory;
|
||||
}
|
||||
}
|
||||
unset($stories[$story->id]);
|
||||
}
|
||||
$stories = $reorderStories;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get users, products and relations. */
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$products = $this->product->getPairs('nocode');
|
||||
$relatedStoryIds = array();
|
||||
|
||||
foreach($stories as $story) $relatedStoryIds[$story->id] = $story->id;
|
||||
|
||||
$storyTasks = $this->loadModel('task')->getStoryTaskCounts($relatedStoryIds);
|
||||
$storyBugs = $this->loadModel('bug')->getStoryBugCounts($relatedStoryIds);
|
||||
$storyCases = $this->loadModel('testcase')->getStoryCaseCounts($relatedStoryIds);
|
||||
|
||||
/* Get related objects title or names. */
|
||||
$relatedSpecs = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('`story`')->in($storyIdList)->orderBy('version desc')->fetchGroup('story');
|
||||
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$story->spec = '';
|
||||
$story->verify = '';
|
||||
if(isset($relatedSpecs[$story->id]))
|
||||
{
|
||||
$storySpec = $relatedSpecs[$story->id][0];
|
||||
$story->title = $storySpec->title;
|
||||
$story->spec = $storySpec->spec;
|
||||
$story->verify = $storySpec->verify;
|
||||
}
|
||||
|
||||
if($this->post->fileType == 'csv')
|
||||
{
|
||||
$story->spec = htmlspecialchars_decode($story->spec);
|
||||
$story->spec = str_replace("<br />", "\n", $story->spec);
|
||||
$story->spec = str_replace('"', '""', $story->spec);
|
||||
$story->spec = str_replace(' ', ' ', $story->spec);
|
||||
|
||||
$story->verify = htmlspecialchars_decode($story->verify);
|
||||
$story->verify = str_replace("<br />", "\n", $story->verify);
|
||||
$story->verify = str_replace('"', '""', $story->verify);
|
||||
$story->verify = str_replace(' ', ' ', $story->verify);
|
||||
}
|
||||
/* fill some field with useful value. */
|
||||
|
||||
if(isset($storyTasks[$story->id])) $story->taskCountAB = $storyTasks[$story->id];
|
||||
if(isset($storyBugs[$story->id])) $story->bugCountAB = $storyBugs[$story->id];
|
||||
if(isset($storyCases[$story->id])) $story->caseCountAB = $storyCases[$story->id];
|
||||
|
||||
if($story->linkStories)
|
||||
{
|
||||
$tmpLinkStories = array();
|
||||
$linkStoriesIdList = explode(',', $story->linkStories);
|
||||
foreach($linkStoriesIdList as $linkStoryID)
|
||||
{
|
||||
$linkStoryID = trim($linkStoryID);
|
||||
$tmpLinkStories[] = isset($relatedStories[$linkStoryID]) ? $relatedStories[$linkStoryID] : $linkStoryID;
|
||||
}
|
||||
$story->linkStories = join("; \n", $tmpLinkStories);
|
||||
}
|
||||
|
||||
if($story->childStories)
|
||||
{
|
||||
$tmpChildStories = array();
|
||||
$childStoriesIdList = explode(',', $story->childStories);
|
||||
foreach($childStoriesIdList as $childStoryID)
|
||||
{
|
||||
if(empty($childStoryID)) continue;
|
||||
|
||||
$childStoryID = trim($childStoryID);
|
||||
$tmpChildStories[] = isset($relatedStories[$childStoryID]) ? $relatedStories[$childStoryID] : $childStoryID;
|
||||
}
|
||||
$story->childStories = join("; \n", $tmpChildStories);
|
||||
}
|
||||
|
||||
/* Set related files. */
|
||||
$story->files = '';
|
||||
if(isset($relatedFiles[$story->id]))
|
||||
{
|
||||
foreach($relatedFiles[$story->id] as $file)
|
||||
{
|
||||
$fileURL = common::getSysURL() . helper::createLink('file', 'download', "fileID=$file->id");
|
||||
$story->files .= html::a($fileURL, $file->title, '_blank') . '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
$story->mailto = trim(trim($story->mailto), ',');
|
||||
$mailtos = explode(',', $story->mailto);
|
||||
$story->mailto = '';
|
||||
foreach($mailtos as $mailto)
|
||||
{
|
||||
$mailto = trim($mailto);
|
||||
if(isset($users[$mailto])) $story->mailto .= $users[$mailto] . ',';
|
||||
}
|
||||
$story->mailto = rtrim($story->mailto, ',');
|
||||
|
||||
$story->reviewedBy = trim(trim($story->reviewedBy), ',');
|
||||
$reviewedBys = explode(',', $story->reviewedBy);
|
||||
$story->reviewedBy = '';
|
||||
foreach($reviewedBys as $reviewedBy)
|
||||
{
|
||||
$reviewedBy = trim($reviewedBy);
|
||||
if(isset($users[$reviewedBy])) $story->reviewedBy .= $users[$reviewedBy] . ',';
|
||||
}
|
||||
$story->reviewedBy = rtrim($story->reviewedBy, ',');
|
||||
|
||||
/* Set child story title. */
|
||||
if($story->parent > 0 && strpos($story->title, htmlentities('>', ENT_COMPAT | ENT_HTML401, 'UTF-8')) !== 0) $story->title = '>' . $story->title;
|
||||
}
|
||||
|
||||
return $stories;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ $config->task->datatable->fieldList['id']['fixed'] = 'left';
|
||||
$config->task->datatable->fieldList['id']['width'] = '70';
|
||||
$config->task->datatable->fieldList['id']['required'] = 'yes';
|
||||
|
||||
$config->task->datatable->fieldList['module']['title'] = 'idAB';
|
||||
$config->task->datatable->fieldList['module']['title'] = 'idAB';
|
||||
$config->task->datatable->fieldList['module']['control'] = 'select';
|
||||
$config->task->datatable->fieldList['module']['dataSource'] = array('module' => 'tree', 'method' => 'getTaskOptionMenu', 'params' => '$executionID');
|
||||
|
||||
|
||||
@@ -2092,10 +2092,11 @@ class testcaseModel extends model
|
||||
/**
|
||||
* Append bugs and results.
|
||||
*
|
||||
* @param array $cases
|
||||
* @param string $type
|
||||
* @param int $cases
|
||||
* @param string $type
|
||||
* @param array $caseIdlist
|
||||
* @access public
|
||||
* @return array
|
||||
* @return void
|
||||
*/
|
||||
public function appendData($cases, $type = 'case', $caseIdlist = array())
|
||||
{
|
||||
@@ -2501,7 +2502,7 @@ class testcaseModel extends model
|
||||
/**
|
||||
* processDatas
|
||||
*
|
||||
* @param int $datas
|
||||
* @param array $datas
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user