+ tag of 2.0.
This commit is contained in:
2
Makefile
2
Makefile
@@ -24,7 +24,7 @@ tgz:
|
||||
cp -fr lib/ zentaopms/
|
||||
cp -fr config/config.php zentaopms/config/
|
||||
cp -fr module zentaopms/
|
||||
cp -fr www/*.ico www/fusioncharts www/*.php www/js www/*.txt www/theme zentaopms/www
|
||||
cp -fr www/*.ico www/fusioncharts www/*.php www/js www/*.txt www/theme www/.htaccess zentaopms/www
|
||||
cp bin/ztc* bin/computeburn.php bin/getbugs.php bin/initext.php bin/todo.php bin/convertopt.php zentaopms/bin
|
||||
cp -fr db zentaopms/
|
||||
cp -fr doc/* zentaopms/
|
||||
|
||||
@@ -73,5 +73,17 @@ $config->bug->list->allFields = 'id, module, project, story, task,
|
||||
lastEditedDate';
|
||||
$config->bug->list->defaultFields = 'id,severity,pri,title,openedBy,assignedTo,resolvedBy,resolution';
|
||||
|
||||
$config->bug->list->exportFields = 'id, product, module, project, story, task,
|
||||
title, keywords, severity, pri, type, os, browser,
|
||||
steps, status, mailto,
|
||||
openedBy, openedDate, openedBuild,
|
||||
assignedTo, assignedDate,
|
||||
resolvedBy, resolution, resolvedBuild, resolvedDate,
|
||||
closedBy, closedDate,
|
||||
duplicateBug, linkBug,
|
||||
case,
|
||||
lastEditedBy,
|
||||
lastEditedDate, files';
|
||||
|
||||
$config->bug->editor->create = array('id' => 'steps', 'tools' => 'bugTools');
|
||||
$config->bug->editor->edit = array('id' => 'steps', 'tools' => 'bugTools');
|
||||
|
||||
@@ -165,12 +165,6 @@ class bug extends control
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
|
||||
/* save session .*/
|
||||
$sql = $this->dao->get();
|
||||
$sql = explode('WHERE', $sql);
|
||||
$sql = explode('ORDER', $sql[1]);
|
||||
$this->session->set('bugReport', $sql[0]);
|
||||
|
||||
/* Process the sql, get the conditon partion, save it to session. Thus the report page can use the same condition. */
|
||||
if($browseType != 'needconfirm')
|
||||
{
|
||||
@@ -760,125 +754,169 @@ class bug extends control
|
||||
*/
|
||||
public function export($productID, $orderBy)
|
||||
{
|
||||
$fields = array();
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$products = $this->loadModel('product')->getPairs();
|
||||
$projects = $this->loadModel('project')->getPairs();
|
||||
$relatedStories = $this->dao->select('id,title')->from(TABLE_STORY)->fetchPairs();
|
||||
$relatedModule = $this->dao->select('id, name')->from(TABLE_MODULE)->fetchPairs();
|
||||
$relatedTasks = $this->dao->select('id, name')->from(TABLE_TASK)->fetchPairs();
|
||||
$relatedBugs = $this->dao->select('id, title')->from(TABLE_BUG)->fetchPairs();
|
||||
$relatedCases = $this->dao->select('id, title')->from(TABLE_CASE)->fetchPairs();
|
||||
|
||||
/* get the fields of bug module from lang. */
|
||||
$fields = array(
|
||||
'id' => $this->lang->bug->id,
|
||||
'product' => $this->lang->bug->product,
|
||||
'module' => $this->lang->bug->module,
|
||||
'project' => $this->lang->bug->project,
|
||||
'story' => $this->lang->bug->story,
|
||||
'storyVersion' => $this->lang->bug->storyVersion,
|
||||
'task' => $this->lang->bug->task,
|
||||
'title' => $this->lang->bug->title,
|
||||
'keywords' => $this->lang->bug->keywords,
|
||||
'severity' => $this->lang->bug->severity,
|
||||
'pri' => $this->lang->bug->pri,
|
||||
'type' => $this->lang->bug->type,
|
||||
'os' => $this->lang->bug->os,
|
||||
'browser' => $this->lang->bug->browser,
|
||||
'hardware' => $this->lang->bug->hardware,
|
||||
'found' => $this->lang->bug->found,
|
||||
'steps' => $this->lang->bug->steps,
|
||||
'status' => $this->lang->bug->status,
|
||||
'mailto' => $this->lang->bug->mailto,
|
||||
'openedBy' => $this->lang->bug->openedBy,
|
||||
'openedDate' => $this->lang->bug->openedDate,
|
||||
'openedBuild' => $this->lang->bug->openedBuild,
|
||||
'assignedTo' => $this->lang->bug->assignedTo,
|
||||
'assignedDate' => $this->lang->bug->assignedDate,
|
||||
'resolvedBy' => $this->lang->bug->resolvedBy,
|
||||
'resolution' => $this->lang->bug->resolution,
|
||||
'resolvedBuild' => $this->lang->bug->resolvedBuild,
|
||||
'resolvedDate' => $this->lang->bug->resolvedDate,
|
||||
'colsedBy' => $this->lang->bug->closedBy,
|
||||
'closedDate' => $this->lang->bug->closedDate,
|
||||
'duplicateBug' => $this->lang->bug->duplicateBug,
|
||||
'linkBug' => $this->lang->bug->linkBug,
|
||||
'case' => $this->lang->bug->case,
|
||||
'lastEditedBy' => $this->lang->bug->lastEditedBy,
|
||||
'lastEditedDate' => $this->lang->bug->lastEditedDate,
|
||||
);
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$bugs = $this->bug->getByQuery($productID, $this->session->bugReport, $orderBy);
|
||||
$bugLang = $this->lang->bug;
|
||||
$bugConfig = $this->config->bug;
|
||||
|
||||
/* Create field lists. */
|
||||
$fields = explode(',', $bugConfig->list->exportFields);
|
||||
foreach($fields as $key => $fieldName)
|
||||
{
|
||||
$fieldName = trim($fieldName);
|
||||
$fields[$fieldName] = isset($bugLang->$fieldName) ? $bugLang->$fieldName : $fieldName;
|
||||
unset($fields[$key]);
|
||||
}
|
||||
|
||||
/* Get bugs. */
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->alias('t1')->where($this->session->bugReportCondition)->orderBy($orderBy)->fetchAll('id');
|
||||
|
||||
/* Get users, products and projects. */
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$products = $this->loadModel('product')->getPairs();
|
||||
$projects = $this->loadModel('project')->getPairs('all');
|
||||
|
||||
/* Get related objects id lists. */
|
||||
$relatedModuleIdList = array();
|
||||
$relatedStoryIdList = array();
|
||||
$relatedTaskIdList = array();
|
||||
$relatedBugIdList = array();
|
||||
$relatedCaseIdList = array();
|
||||
$relatedBuildIdList = array();
|
||||
|
||||
foreach($bugs as $bug)
|
||||
{
|
||||
if($_POST['fileType'] == 'csv')
|
||||
$relatedModuleIdList[$bug->module] = $bug->module;
|
||||
$relatedStoryIdList[$bug->story] = $bug->story;
|
||||
$relatedTaskIdList[$bug->task] = $bug->task;
|
||||
$relatedCaseIdList[$bug->case] = $bug->case;
|
||||
$relatedBugIdList[$bug->duplicateBug] = $bug->duplicateBug;
|
||||
|
||||
/* Process link bugs. */
|
||||
$linkBugs = explode(',', $bug->linkBug);
|
||||
foreach($linkBugs as $linkBugID)
|
||||
{
|
||||
$bug->steps = str_replace("<br />", "\n", $bug->steps);
|
||||
if($linkBugID) $relatedBugIdList[$linkBugID] = trim($linkBugID);
|
||||
}
|
||||
|
||||
/* Process builds. */
|
||||
$builds = $bug->openedBuild . ',' . $bug->resolvedBuild;
|
||||
$builds = explode(',', $builds);
|
||||
foreach($builds as $buildID)
|
||||
{
|
||||
if($buildID) $relatedBuildIdList[$buildID] = trim($buildID);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get related objects title or names. */
|
||||
$relatedModules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in($relatedModuleIdList)->fetchPairs();
|
||||
$relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs();
|
||||
$relatedTasks = $this->dao->select('id, name')->from(TABLE_TASK)->where('id')->in($relatedTaskIdList)->fetchPairs();
|
||||
$relatedBugs = $this->dao->select('id, title')->from(TABLE_BUG)->where('id')->in($relatedBugIdList)->fetchPairs();
|
||||
$relatedCases = $this->dao->select('id, title')->from(TABLE_CASE)->where('id')->in($relatedCaseIdList)->fetchPairs();
|
||||
$relatedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($relatedBuildIdList)->fetchPairs();
|
||||
$relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('bug')->andWhere('objectID')->in(@array_keys($bugs))->fetchGroup('objectID');
|
||||
|
||||
foreach($bugs as $bug)
|
||||
{
|
||||
if($this->post->fileType == 'csv')
|
||||
{
|
||||
$bug->steps = htmlspecialchars_decode($bug->steps);
|
||||
$bug->steps = str_replace("<br />", "\n", $bug->steps);
|
||||
$bug->steps = str_replace(" ", " ", $bug->steps);
|
||||
$bug->steps = str_replace('"', '""', $bug->steps);
|
||||
}
|
||||
else if($_POST['fileType'] == 'html')
|
||||
|
||||
/* fill some field with useful value. */
|
||||
if(isset($products[$bug->product])) $bug->product = $products[$bug->product];
|
||||
if(isset($projects[$bug->project])) $bug->project = $projects[$bug->project];
|
||||
if(isset($relatedModules[$bug->module])) $bug->module = $relatedModules[$bug->module];
|
||||
if(isset($relatedStories[$bug->story])) $bug->story = $relatedStories[$bug->story];
|
||||
if(isset($relatedTasks[$bug->task])) $bug->task = $relatedTasks[$bug->task];
|
||||
if(isset($relatedBugs[$bug->duplicateBug])) $bug->duplicateBug = $relatedBugs[$bug->duplicateBug];
|
||||
if(isset($relatedCases[$bug->case])) $bug->case = $relatedCases[$bug->case];
|
||||
|
||||
if(isset($bugLang->priList[$bug->pri])) $bug->pri = $bugLang->priList[$bug->pri];
|
||||
if(isset($bugLang->typeList[$bug->type])) $bug->type = $bugLang->typeList[$bug->type];
|
||||
if(isset($bugLang->statusList[$bug->status])) $bug->status = $bugLang->statusList[$bug->status];
|
||||
if(isset($bugLang->resolutionList[$bug->resolution])) $bug->resolution = $bugLang->resolutionList[$bug->resolution];
|
||||
|
||||
if(isset($users[$bug->openedBy])) $bug->openedBy = $users[$bug->openedBy];
|
||||
if(isset($users[$bug->assignedTo])) $bug->assignedTo = $users[$bug->assignedTo];
|
||||
if(isset($users[$bug->resolvedBy])) $bug->resolvedBy = $users[$bug->resolvedBy];
|
||||
if(isset($users[$bug->lastEditedBy])) $bug->lastEditedBy = $users[$bug->lastEditedBy];
|
||||
if(isset($users[$bug->closedBy])) $bug->closedBy = $users[$bug->closedBy];
|
||||
|
||||
$bug->openedDate = substr($bug->openedDate, 0, 10);
|
||||
$bug->assignedDate = substr($bug->assignedDate, 0, 10);
|
||||
$bug->closedDate = substr($bug->closedDate, 0, 10);
|
||||
$bug->resolvedDate = substr($bug->resolvedDate, 0, 10);
|
||||
$bug->lastEditedDate = substr($bug->lastEditedDate, 0, 10);
|
||||
|
||||
if($bug->linkBug)
|
||||
{
|
||||
$legendAttatchs = $this->dao->select('pathname, title')->from(TABLE_FILE)->where('objectType')->eq('task')->andWhere('objectID')->eq($bug->id)->fetchAll();
|
||||
if($legendAttatchs)
|
||||
$tmpLinkBugs = array();
|
||||
$linkBugIdList = explode(',', $bug->linkBug);
|
||||
foreach($linkBugIdList as $linkBugID)
|
||||
{
|
||||
foreach($legendAttatchs as $legendAttatch)
|
||||
{
|
||||
$legendAttatch->pathname = "http://" . $_SERVER['HTTP_HOST'] . $this->config->webRoot . "data/upload/$bug->company/" . $legendAttatch->pathname;
|
||||
$task->legendAttatchs .= "<a href=$legendAttatch->pathname>" . $legendAttatch->title . "</a><br />";
|
||||
}
|
||||
$linkBugID = trim($linkBugID);
|
||||
$tmpLinkBugs[] = isset($relatedBugs[$linkBugID]) ? $relatedBugs[$linkBugID] : $linkBugID;
|
||||
}
|
||||
$bug->linkBug = join("; \n", $tmpLinkBugs);
|
||||
}
|
||||
|
||||
if($bug->openedBuild)
|
||||
{
|
||||
$tmpOpenedBuilds = array();
|
||||
$tmpResolvedBuilds = array();
|
||||
$buildIdList = explode(',', $bug->openedBuild);
|
||||
foreach($buildIdList as $buildID)
|
||||
{
|
||||
$buildID = trim($buildID);
|
||||
$tmpOpenedBuilds[] = isset($relatedBuilds[$buildID]) ? $relatedBuilds[$buildID] : $buildID;
|
||||
}
|
||||
$bug->openedBuild = join("; \n", $tmpOpenedBuilds);
|
||||
}
|
||||
|
||||
if($bug->resolvedBuild)
|
||||
{
|
||||
$buildIdList = explode(',', $bug->resolvedBuild);
|
||||
foreach($buildIdList as $buildID)
|
||||
{
|
||||
$buildID = trim($buildID);
|
||||
$tmpResolvedBuilds[] = isset($relatedBuilds[$buildID]) ? $relatedBuilds[$buildID] : $buildID;
|
||||
}
|
||||
$bug->resolvedBuild = join("; \n", $tmpResolvedBuilds);
|
||||
}
|
||||
|
||||
/* Set related files. */
|
||||
if(isset($relatedFiles[$bug->id]))
|
||||
{
|
||||
foreach($relatedFiles[$bug->id] as $file)
|
||||
{
|
||||
$fileURL = 'http://' . $this->server->http_host . $this->config->webRoot . "data/upload/$bug->company/" . $file->pathname;
|
||||
$bug->files .= html::a($fileURL, $file->title, '_blank') . '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
$bug->mailto = trim(trim($bug->mailto), ',');
|
||||
$mailtos = explode(',', $bug->mailto);
|
||||
$bug->mailto = '';
|
||||
foreach($mailtos as $mailto)
|
||||
{
|
||||
$mailto = trim($mailto);
|
||||
if(isset($users[$mailto])) $bug->mailto .= $users[$mailto] . ',';
|
||||
}
|
||||
|
||||
/* drop some field that is not needed. */
|
||||
unset($bug->company);
|
||||
unset($bug->caseVersion);
|
||||
unset($bug->result);
|
||||
|
||||
/* fill some field with useful value. */
|
||||
$bug->story = isset($relatedStories[$bug->story]) ? $relatedStories[$bug->story] : '';
|
||||
$bug->module = isset($relatedModules[$bug->module]) ? $relatedModules[$bug->module] : '';
|
||||
$bug->task = isset($relatedTasks[$bug->task]) ? $relatedTasks[$bug->task] : '';
|
||||
$bug->duplicateBug = isset($relatedBugs[$bug->duplicateBug]) ? $relatedBugs[$bug->duplicateBug] : '';
|
||||
$bug->linkBug = isset($relatedBugs[$bug->linkBug]) ? $relatedBugs[$bug->linkBug] : '';
|
||||
$bug->case = isset($relatedCases[$bug->case]) ? $relatedCases[$bug->case] : '';
|
||||
$bug->project = isset($projects[$bug->project]) ? $projects[$bug->project] : '';
|
||||
|
||||
$bug->product = $products[$bug->product];
|
||||
$bug->pri = $this->lang->bug->priList[$bug->pri];
|
||||
$bug->type = $this->lang->bug->typeList[$bug->type];
|
||||
$bug->status = $this->lang->bug->statusList[$bug->status];
|
||||
|
||||
$bug->mailto = trim(trim($bug->mailto), ',');
|
||||
$mailtos = explode(',', $bug->mailto);
|
||||
$bug->mailto = '';
|
||||
foreach($mailtos as $mailto)
|
||||
{
|
||||
if(isset($users[$mailto])) $bug->mailto .= $users[$mailto] . ',';
|
||||
}
|
||||
$bug->openedBy = $users[$bug->openedBy];
|
||||
$bug->openedDate = substr($bug->openedDate, 0, 10);
|
||||
if(isset($users[$bug->assignedTo]))$bug->assignedTo = $users[$bug->assignedTo];
|
||||
$bug->assignedDate = substr($bug->assignedDate, 0, 10);
|
||||
if(isset($users[$bug->resolvedBy])) $bug->resolvedBy = $users[$bug->resolvedBy];
|
||||
$bug->resolution = $this->lang->bug->resolutionList[$bug->resolution];
|
||||
$bug->resolvedDate = substr($bug->resolvedDate, 0, 10);
|
||||
$bug->closedBy = $users[$bug->closedBy];
|
||||
$bug->closedDate = substr($bug->closedDate, 0, 10);
|
||||
$bug->lastEditedBy = $users[$bug->lastEditedBy];
|
||||
$bug->lastEditedDate = substr($bug->lastEditedDate, 0, 10);
|
||||
unset($bug->deleted);
|
||||
}
|
||||
|
||||
$this->post->set('fields', $fields);
|
||||
$this->post->set('rows', $bugs);
|
||||
if($this->post->fileType == 'csv') $this->fetch('file', 'export2CSV', $_POST);
|
||||
if($this->post->fileType == 'xml') $this->fetch('file', 'export2XML', $_POST);
|
||||
if($this->post->fileType == 'html') $this->fetch('file', 'export2HTML', $_POST);
|
||||
$this->fetch('file', 'export2' . $this->post->fileType, $_POST);
|
||||
}
|
||||
|
||||
$this->display();
|
||||
|
||||
@@ -112,25 +112,6 @@ class bugModel extends model
|
||||
return $bug;
|
||||
}
|
||||
|
||||
/**
|
||||
* getByQuery
|
||||
*
|
||||
* @param string $productID
|
||||
* @param string $query
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getByQuery($productID, $query, $orderBy)
|
||||
{
|
||||
$tmpBugs = $this->dao->select('*')->from(TABLE_BUG)->alias('t1')->where($query)
|
||||
->andWhere('product')->eq((int)$productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)
|
||||
->fetchAll();
|
||||
return $tmpBugs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a bug.
|
||||
*
|
||||
@@ -233,6 +214,7 @@ class bugModel extends model
|
||||
->add('duplicateBug', 0)
|
||||
->add('lastEditedBy', $this->app->user->account)
|
||||
->add('lastEditedDate', $now)
|
||||
->join('openedBuild', ',')
|
||||
->remove('comment,files,labels')
|
||||
->get();
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
<th><?php echo $lang->extension->desc;?></th>
|
||||
<th><?php echo $lang->extension->author;?></th>
|
||||
<th class='w-id'><?php echo $lang->extension->downloads;?></th>
|
||||
<th><?php echo $lang->extension->public;?></th>
|
||||
<th><?php echo $lang->extension->compatible;?></th>
|
||||
<th class='w-80px'><?php echo $lang->extension->public;?></th>
|
||||
<th class='w-50px'><?php echo $lang->extension->compatible;?></th>
|
||||
<th class='w-150px'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -14,5 +14,11 @@
|
||||
echo '"'. implode('","', $fields) . '"' . "\n";
|
||||
foreach($rows as $row)
|
||||
{
|
||||
echo '"'. implode('","', (array)$row) . '"' . "\n";
|
||||
echo '"';
|
||||
foreach($fields as $fieldName => $fieldLabel)
|
||||
{
|
||||
isset($row->$fieldName) ? print($row->$fieldName) : print('');
|
||||
echo '","';
|
||||
}
|
||||
echo '"' . "\n";
|
||||
}
|
||||
|
||||
@@ -30,10 +30,11 @@ table, th, td{font-size:12px; border:1px solid gray; border-collapse:collapse;}
|
||||
<?php
|
||||
foreach($rows as $row)
|
||||
{
|
||||
echo "<tr>\n";
|
||||
foreach($row as $fieldName => $fieldValue)
|
||||
echo "<tr valign='top'>\n";
|
||||
foreach($fields as $fieldName => $fieldLabel)
|
||||
{
|
||||
echo "<td>$fieldValue</td>\n";
|
||||
$fieldValue = isset($row->$fieldName) ? $row->$fieldName : '';
|
||||
echo "<td><nobr>$fieldValue</nobr></td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ foreach($fields as $fieldName => $fieldLabel)
|
||||
foreach($rows as $row)
|
||||
{
|
||||
echo " <row>\n";
|
||||
foreach($row as $fieldName => $fieldValue)
|
||||
foreach($fields as $fieldName => $fieldLabel)
|
||||
{
|
||||
$fieldValue = htmlspecialchars($fieldValue);
|
||||
$fieldValue = isset($row->$fieldName) ? htmlspecialchars($row->$fieldName) : '';
|
||||
echo " <$fieldName>$fieldValue</$fieldName>\n";
|
||||
}
|
||||
echo " </row>\n";
|
||||
|
||||
@@ -11,6 +11,7 @@ if($config->mail->mta == 'smtp')
|
||||
$config->mail->smtp->auth = true; // Need auth or not.
|
||||
$config->mail->smtp->host = ''; // The smtp server host address.
|
||||
$config->mail->smtp->port = ''; // The smtp server host port.
|
||||
$config->mail->smtp->secure = ''; // The type to encode datas, 'ssl' or 'tls' allowed
|
||||
$config->mail->smtp->username = ''; // The smtp user, may be a full email adress.
|
||||
$config->mail->smtp->password = ''; // The smtp user's password.
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ class mailModel extends model
|
||||
$this->mta->Username = $this->config->mail->smtp->username;
|
||||
$this->mta->Password = $this->config->mail->smtp->password;
|
||||
if(isset($this->config->mail->smtp->port)) $this->mta->Port = $this->config->mail->smtp->port;
|
||||
if(isset($this->config->mail->smtp->secure) and !empty($this->config->mail->smtp->secure))$this->mta->SMTPSecure = strtolower($this->config->mail->smtp->secure);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -133,12 +133,10 @@ class product extends control
|
||||
$stories = $this->story->getByQuery($queryProductID, $storyQuery, $orderBy, $pager);
|
||||
}
|
||||
|
||||
/* Set session for report Query*/
|
||||
$storyReport = $this->session->reportQuery == false ? $this->dao->get() : $this->session->reportQuery;
|
||||
$sql = explode('WHERE', $storyReport);
|
||||
/* Set session for report query. */
|
||||
$sql = explode('WHERE', $this->session->storyReport);
|
||||
$sql = explode('ORDER', $sql[1]);
|
||||
$this->session->set('storyReport', str_replace(array('t1.','t2.'), '', $sql[0]));
|
||||
$this->session->set('reportQuery', '');
|
||||
|
||||
/* Build search form. */
|
||||
$this->config->product->search['actionURL'] = $this->createLink('product', 'browse', "productID=$productID&browseType=bySearch&queryID=myQueryID");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
$(function()
|
||||
{
|
||||
$('#' + browseType + 'Tab').addClass('active');
|
||||
if(browseType == 'bysearch')search();
|
||||
});
|
||||
|
||||
$(document).ready(function()
|
||||
|
||||
@@ -75,7 +75,12 @@ class releaseModel extends model
|
||||
{
|
||||
$oldRelease = $this->getByID($releaseID);
|
||||
$release = fixer::input('post')->stripTags('name')->get();
|
||||
$this->dao->update(TABLE_RELEASE)->data($release)->autoCheck()->batchCheck($this->config->release->edit->requiredFields, 'notempty')->where('id')->eq((int)$releaseID)->check('name','unique')->exec();
|
||||
$this->dao->update(TABLE_RELEASE)->data($release)
|
||||
->autoCheck()
|
||||
->batchCheck($this->config->release->edit->requiredFields, 'notempty')
|
||||
->check('name','unique', "id != $releaseID")
|
||||
->where('id')->eq((int)$releaseID)
|
||||
->exec();
|
||||
if(!dao::isError()) return common::createChanges($oldRelease, $release);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,3 +7,12 @@ $config->story->review->requiredFields = 'assignedTo,reviewedBy,result';
|
||||
|
||||
$config->story->editor->create = array('id' => 'spec,verify', 'tools' => 'simpleTools');
|
||||
$config->story->editor->change = array('id' => 'spec,verify', 'tools' => 'simpleTools');
|
||||
|
||||
$config->story->list->exportFields = '
|
||||
id, product, module, plan, title, spec, verify, keywords,
|
||||
pri, estimate, status, stage,
|
||||
openedBy, openedDate, assignedTo, assignedDate, mailto,
|
||||
reviewedBy, reviewedDate,
|
||||
closedBy, closedDate, closedReason,
|
||||
lastEditedBy, lastEditedDate,
|
||||
childStories, linkStories, duplicateStory, files';
|
||||
|
||||
@@ -552,132 +552,156 @@ class story extends control
|
||||
*/
|
||||
public function export($productID, $orderBy)
|
||||
{
|
||||
$relatedStories = '';
|
||||
$linkStories = array();
|
||||
$childStories = array();
|
||||
$fields = array();
|
||||
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$products = $this->loadModel('product')->getPairs();
|
||||
|
||||
/* get the fields of story module from lang. */
|
||||
$fields = array(
|
||||
'id' => $this->lang->story->id,
|
||||
'spec' => $this->lang->story->spec,
|
||||
'product' => $this->lang->story->product,
|
||||
'module' => $this->lang->story->module,
|
||||
'plan' => $this->lang->story->plan,
|
||||
'title' => $this->lang->story->title,
|
||||
'keywords' => $this->lang->story->keywords,
|
||||
'pri' => $this->lang->story->pri,
|
||||
'estimate' => $this->lang->story->estimate,
|
||||
'status' => $this->lang->story->status,
|
||||
'stage' => $this->lang->story->stage,
|
||||
'mailto' => $this->lang->story->mailto,
|
||||
'openedBy' => $this->lang->story->openedBy,
|
||||
'openedDate' => $this->lang->story->openedDate,
|
||||
'assignedTo' => $this->lang->story->assignedTo,
|
||||
'assignedDate' => $this->lang->story->assignedDate,
|
||||
'lastEditedBy' => $this->lang->story->lastEditedBy,
|
||||
'lastEditedDate' => $this->lang->story->lastEditedDate,
|
||||
'reviewedBy' => $this->lang->story->reviewedBy,
|
||||
'reviewedDate' => $this->lang->story->reviewedDate,
|
||||
'closedBy' => $this->lang->story->closedBy,
|
||||
'closedDate' => $this->lang->story->closedDate,
|
||||
'closedReason' => $this->lang->story->closedReason,
|
||||
'childStories' => $this->lang->story->childStories,
|
||||
'linkStories' => $this->lang->story->linkStories,
|
||||
'duplicateStory' => $this->lang->story->duplicateStory,
|
||||
'version' => $this->lang->story->version,
|
||||
'planTitle' => $this->lang->story->plan,
|
||||
'legendAttatch' => $this->lang->story->legendAttatch,
|
||||
);
|
||||
|
||||
/* format the fields of every story in order to export data. */
|
||||
if($_POST)
|
||||
{
|
||||
$stories = $this->story->getByQuery($productID, $this->session->storyReport, $orderBy);
|
||||
foreach($stories as $story)
|
||||
$storyLang = $this->lang->story;
|
||||
$storyConfig = $this->config->story;
|
||||
|
||||
/* Create field lists. */
|
||||
$fields = explode(',', $storyConfig->list->exportFields);
|
||||
foreach($fields as $key => $fieldName)
|
||||
{
|
||||
$relatedStories .= $story->childStories . ',' . $story->linkStories . ',' . $story->duplicateStory . ',';
|
||||
$fieldName = trim($fieldName);
|
||||
$fields[$fieldName] = isset($storyLang->$fieldName) ? $storyLang->$fieldName : $fieldName;
|
||||
unset($fields[$key]);
|
||||
}
|
||||
$relatedStories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($relatedStories)->fetchPairs('id', 'title');
|
||||
|
||||
/* Get stories. */
|
||||
$stories = $this->dao->select('*')->from(TABLE_STORY)->where($this->session->storyReport)->orderBy($orderBy)->fetchAll('id');
|
||||
|
||||
/* Get users, products and projects. */
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$products = $this->loadModel('product')->getPairs();
|
||||
|
||||
/* Get related objects id lists. */
|
||||
$relatedModuleIdList = array();
|
||||
$relatedStoryIdList = array();
|
||||
$relatedPlanIdList = array();
|
||||
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$childStories = explode(',', $story->childStories);
|
||||
$linkStories = explode(',', $story->linkStories);
|
||||
$module = $this->dao->select('name')->from(TABLE_MODULE)->where('id')->eq($story->module)->fetch();
|
||||
$storySpec = $this->dao->select('spec')->from(TABLE_STORYSPEC)->where('story')->eq($story->id)->fetch();
|
||||
$relatedModuleIdList[$story->module] = $story->module;
|
||||
$relatedPlanIdList[$story->plan] = $story->plan;
|
||||
|
||||
if($_POST['fileType'] == 'html')
|
||||
/* Process related stories. */
|
||||
$relatedStories = $story->childStories . ',' . $story->linkStories . ',' . $story->duplicateStory;
|
||||
$relatedStories = explode(',', $relatedStories);
|
||||
foreach($relatedStories as $storyID)
|
||||
{
|
||||
$legendAttatchs = $this->dao->select('pathname, title')->from(TABLE_FILE)->where('objectType')->eq('story')->andWhere('objectID')->eq($story->id)->fetchAll();
|
||||
|
||||
foreach($legendAttatchs as $legendAttatch)
|
||||
{
|
||||
$legendAttatch->pathname = "http://" . $_SERVER['HTTP_HOST'] . $this->config->webRoot . "data/upload/$story->company/" . $legendAttatch->pathname;
|
||||
$story->legendAttatchs .= "<a href=$legendAttatch->pathname>" . $legendAttatch->title . "</a><br />";
|
||||
}
|
||||
if($storyID) $relatedStoryIdList[$storyID] = trim($storyID);
|
||||
}
|
||||
else if($_POST['fileType'] == 'csv')
|
||||
}
|
||||
|
||||
/* Get related objects title or names. */
|
||||
$relatedModules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in($relatedModuleIdList)->fetchPairs();
|
||||
$relatedPlans = $this->dao->select('id, title')->from(TABLE_PRODUCTPLAN)->where('id')->in($relatedPlanIdList)->fetchPairs();
|
||||
$relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs();
|
||||
$relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('story')->andWhere('objectID')->in(@array_keys($stories))->fetchGroup('objectID');
|
||||
$relatedSpecs = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('`story`')->in(@array_keys($stories))->orderBy('version desc')->fetchGroup('story');
|
||||
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$story->spec = '';
|
||||
$story->verify = '';
|
||||
if(isset($relatedSpecs[$story->id]))
|
||||
{
|
||||
if(isset($storySpec->spec))
|
||||
{
|
||||
$storySpec->spec = str_replace("<br />", "\n", $storySpec->spec);
|
||||
$storySpec->spec = str_replace("<br />", "\n", $storySpec->spec);
|
||||
$storySpec->spec = str_replace(" ", " ", $storySpec->spec);
|
||||
$storySpec->spec = str_replace('"', '""', $storySpec->spec);
|
||||
}
|
||||
$storySpec = $relatedSpecs[$story->id][0];
|
||||
$story->title = $storySpec->title;
|
||||
$story->spec = $storySpec->spec;
|
||||
$story->verify = $storySpec->verify;
|
||||
}
|
||||
|
||||
foreach($childStories as $childStory)
|
||||
if($this->post->fileType == 'csv')
|
||||
{
|
||||
if(isset($relatedStories[$childStory])) $story->childStories .= $relatedStories[$childStory];
|
||||
}
|
||||
foreach($linkStories as $linkStory)
|
||||
{
|
||||
if(isset($relatedStories[$linkStory])) $story->linkStories .= $relatedStories[$linkStory];
|
||||
}
|
||||
if(isset($relatedStories[$story->duplicateStory])) $story->duplicateStory = $relatedStories[$story->duplicateStory];
|
||||
$story->spec = htmlspecialchars_decode($story->spec);
|
||||
$story->spec = str_replace("<br />", "\n", $story->spec);
|
||||
$story->spec = str_replace('"', '""', $story->spec);
|
||||
|
||||
/* drop some field that is not needed. */
|
||||
unset($story->fromBug);
|
||||
unset($story->type);
|
||||
unset($story->toBug);
|
||||
unset($story->deleted);
|
||||
$story->verify = htmlspecialchars_decode($story->verify);
|
||||
$story->verify = str_replace("<br />", "\n", $story->verify);
|
||||
$story->verify = str_replace('"', '""', $story->verify);
|
||||
}
|
||||
|
||||
/* fill some field with useful value. */
|
||||
$story->company = $storySpec ? $storySpec->spec : '';
|
||||
$story->product = $products[$story->product];
|
||||
$story->pri = $this->lang->story->priList[$story->pri];
|
||||
$story->module = $module ? $module->name : '';
|
||||
$story->status = $this->lang->story->statusList[$story->status];
|
||||
$story->stage = $this->lang->story->stageList[$story->stage];
|
||||
$story->openedBy = $users[$story->openedBy];
|
||||
if(isset($products[$story->product])) $story->product = $products[$story->product];
|
||||
if(isset($relatedModules[$story->module])) $story->module = $relatedModules[$story->module];
|
||||
if(isset($relatedPlans[$story->plan])) $story->plan = $relatedPlans[$story->plan];
|
||||
if(isset($relatedStories[$story->duplicateStory])) $story->duplicateStory = $relatedStories[$story->duplicateStory];
|
||||
|
||||
if(isset($storyLang->priList[$story->pri])) $story->pri = $storyLang->priList[$story->pri];
|
||||
if(isset($storyLang->statusList[$story->status])) $story->status = $storyLang->statusList[$story->status];
|
||||
if(isset($storyLang->stageList[$story->stage])) $story->stage = $storyLang->stageList[$story->stage];
|
||||
if(isset($storyLang->reasonList[$story->closedReason])) $story->closedReason = $storyLang->reasonList[$story->closedReason];
|
||||
|
||||
if(isset($users[$story->openedBy])) $story->openedBy = $users[$story->openedBy];
|
||||
if(isset($users[$story->assignedTo])) $story->assignedTo = $users[$story->assignedTo];
|
||||
if(isset($users[$story->lastEditedBy])) $story->lastEditedBy = $users[$story->lastEditedBy];
|
||||
if(isset($users[$story->closedBy])) $story->closedBy = $users[$story->closedBy];
|
||||
|
||||
$story->openedDate = substr($story->openedDate, 0, 10);
|
||||
$story->assignedTo = $users[$story->assignedTo];
|
||||
$story->assignedDate = substr($story->assignedDate, 0, 10);
|
||||
$story->lastEditedBy = $users[$story->lastEditedBy];
|
||||
$story->lastEditedDate = substr($story->lastEditedDate, 0, 10);
|
||||
|
||||
$story->reviewedBy = trim(trim($story->reviewedBy), ',');
|
||||
$reviewedBys = explode(',', $story->reviewedBy);
|
||||
$story->reviewedBy = '';
|
||||
$story->closedDate = substr($story->closedDate, 0, 10);
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
$childStoryID = trim($childStoryID);
|
||||
$tmpChildStories[] = isset($relatedStories[$childStoryID]) ? $relatedStories[$childStoryID] : $childStoryID;
|
||||
}
|
||||
$story->childStories = join("; \n", $tmpChildStories);
|
||||
}
|
||||
|
||||
/* Set related files. */
|
||||
if(isset($relatedFiles[$story->id]))
|
||||
{
|
||||
foreach($relatedFiles[$story->id] as $file)
|
||||
{
|
||||
$fileURL = 'http://' . $this->server->http_host . $this->config->webRoot . "data/upload/$story->company/" . $file->pathname;
|
||||
$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->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->closedBy = $users[$story->closedBy];
|
||||
$story->closedDate = substr($story->closedDate, 0, 10);
|
||||
$story->closedReason = $this->lang->story->reasonList[$story->closedReason];
|
||||
|
||||
}
|
||||
|
||||
$this->post->set('fields', $fields);
|
||||
$this->post->set('rows', $stories);
|
||||
if($this->post->fileType == 'csv') $this->fetch('file', 'export2CSV', $_POST);
|
||||
if($this->post->fileType == 'xml') $this->fetch('file', 'export2XML', $_POST);
|
||||
if($this->post->fileType == 'html') $this->fetch('file', 'export2HTML', $_POST);
|
||||
$this->fetch('file', 'export2' . $this->post->fileType, $_POST);
|
||||
}
|
||||
|
||||
$this->display();
|
||||
|
||||
@@ -436,7 +436,7 @@ class storyModel extends model
|
||||
*/
|
||||
public function getProductStories($productID = 0, $moduleIds = 0, $status = 'all', $orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
return $this->dao->select('t1.*, t2.title as planTitle')
|
||||
$stories = $this->dao->select('t1.*, t2.title as planTitle')
|
||||
->from(TABLE_STORY)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id')
|
||||
->where('t1.product')->in($productID)
|
||||
@@ -444,6 +444,11 @@ class storyModel extends model
|
||||
->beginIF($status != 'all')->andWhere('status')->in($status)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
|
||||
/* Set session for report query. */
|
||||
$this->session->set('storyReport', $this->dao->get());
|
||||
|
||||
return $stories;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -491,7 +496,7 @@ class storyModel extends model
|
||||
->fetchGroup('plan');
|
||||
|
||||
/* Set session for report query. */
|
||||
$this->session->set('reportQuery', $this->dao->get());
|
||||
$this->session->set('storyReport', $this->dao->get());
|
||||
|
||||
if(!$tmpStories) return array();
|
||||
$plans = $this->dao->select('id,title')->from(TABLE_PRODUCTPLAN)->where('id')->in(array_keys($tmpStories))->fetchPairs();
|
||||
|
||||
@@ -22,3 +22,14 @@ $config->task->search['params']['type'] = array('operator' => '=',
|
||||
|
||||
$config->task->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
|
||||
$config->task->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
|
||||
|
||||
$config->task->exportFields = '
|
||||
id, project, story,
|
||||
name, desc,
|
||||
type, pri, deadline, status,estimate, consumed, left,
|
||||
mailto,
|
||||
openedBy, openedDate, assignedTo, assignedDate,
|
||||
finishedBy, finishedDate, canceledBy, canceledDate,
|
||||
closedBy, closedDate, closedReason,
|
||||
lastEditedBy, lastEditedDate,files
|
||||
';
|
||||
|
||||
@@ -535,101 +535,81 @@ class task extends control
|
||||
*/
|
||||
public function export($projectID, $orderBy)
|
||||
{
|
||||
$fields = array();
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$projects = $this->loadModel('project')->getPairs();
|
||||
$relatedStories = $this->dao->select('id,title')->from(TABLE_STORY)->fetchPairs();
|
||||
|
||||
/* get the fields of task module from lang. */
|
||||
$fields = array(
|
||||
'id' => $this->lang->task->id,
|
||||
'project' => $this->lang->task->project,
|
||||
'story' => $this->lang->task->story,
|
||||
'storyVersion' => $this->lang->task->storyVersion,
|
||||
'name' => $this->lang->task->name,
|
||||
'type' => $this->lang->task->type,
|
||||
'pri' => $this->lang->task->pri,
|
||||
'estimate' => $this->lang->task->estimate,
|
||||
'consumed' => $this->lang->task->consumed,
|
||||
'left' => $this->lang->task->left,
|
||||
'deadline' => $this->lang->task->deadline,
|
||||
'status' => $this->lang->task->status,
|
||||
'statusCustom' => $this->lang->task->statusCustom,
|
||||
'mailto' => $this->lang->task->mailto,
|
||||
'desc' => $this->lang->task->desc,
|
||||
'openedBy' => $this->lang->task->openedBy,
|
||||
'openedDate' => $this->lang->task->openedDate,
|
||||
'assignedTo' => $this->lang->task->assignedTo,
|
||||
'assignedDate' => $this->lang->task->assignedDate,
|
||||
'finishedBy' => $this->lang->task->finishedBy,
|
||||
'finishedDate' => $this->lang->task->finishedDate,
|
||||
'canceledBy' => $this->lang->task->canceledBy,
|
||||
'canceledDate' => $this->lang->task->canceledDate,
|
||||
'closedBy' => $this->lang->task->closedBy,
|
||||
'closedDate' => $this->lang->task->closedDate,
|
||||
'closedReason' => $this->lang->task->closedReason,
|
||||
'lastEditedBy' => $this->lang->task->lastEditedBy,
|
||||
'lastEditedDate' => $this->lang->task->lastEditedDate,
|
||||
);
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$tasks = $this->task->getByQuery($projectID, $this->session->taskReport, $orderBy);
|
||||
$taskLang = $this->lang->task;
|
||||
$taskConfig = $this->config->task;
|
||||
|
||||
/* Create field lists. */
|
||||
$fields = explode(',', $taskConfig->exportFields);
|
||||
foreach($fields as $key => $fieldName)
|
||||
{
|
||||
$fieldName = trim($fieldName);
|
||||
$fields[$fieldName] = isset($taskLang->$fieldName) ? $taskLang->$fieldName : $fieldName;
|
||||
unset($fields[$key]);
|
||||
}
|
||||
|
||||
/* Get tasks. */
|
||||
$tasks = $this->dao->select('*')->from(TABLE_TASK)->alias('t1')->where($this->session->taskReportCondition)->orderBy($orderBy)->fetchAll('id');
|
||||
|
||||
/* Get users and projects. */
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$projects = $this->loadModel('project')->getPairs('all');
|
||||
|
||||
/* Get related objects id lists. */
|
||||
$relatedStoryIdList = array();
|
||||
foreach($tasks as $task) $relatedStoryIdList[$task->story] = $task->story;
|
||||
|
||||
/* Get related objects title or names. */
|
||||
$relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs();
|
||||
$relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('task')->andWhere('objectID')->in(@array_keys($tasks))->fetchGroup('objectID');
|
||||
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if($_POST['fileType'] == 'html')
|
||||
if($this->post->fileType == 'csv')
|
||||
{
|
||||
$legendAttatchs = $this->dao->select('pathname, title')->from(TABLE_FILE)->where('objectType')->eq('task')->andWhere('objectID')->eq($task->id)->fetchAll();
|
||||
if($legendAttatchs)
|
||||
{
|
||||
foreach($legendAttatchs as $legendAttatch)
|
||||
{
|
||||
$legendAttatch->pathname = "http://" . $_SERVER['HTTP_HOST'] . $this->config->webRoot . "data/upload/$task->company/" . $legendAttatch->pathname;
|
||||
$task->legendAttatchs .= "<a href=$legendAttatch->pathname>" . $legendAttatch->title . "</a><br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($_POST['fileType'] == 'csv')
|
||||
{
|
||||
$task->desc = str_replace("<br />", "\n", $task->desc);
|
||||
$task->desc = htmlspecialchars_decode($task->desc);
|
||||
$task->desc = str_replace("<br />", "\n", $task->desc);
|
||||
$task->desc = str_replace(" ", " ", $task->desc);
|
||||
$task->desc = str_replace('"', '""', $task->desc);
|
||||
}
|
||||
|
||||
/* drop some field that is not needed. */
|
||||
unset($task->company);
|
||||
|
||||
/* fill some field with useful value. */
|
||||
$task->story = isset($relatedStories[$task->story]) ? $relatedStories[$task->story] : '';
|
||||
|
||||
$task->project = $projects[$task->project];
|
||||
$task->type = $this->lang->task->typeList[$task->type];
|
||||
$task->pri = $this->lang->task->priList[$task->pri];
|
||||
$task->estimate = substr($task->estimate, 0, 10);
|
||||
$task->deadline = substr($task->deadline, 0, 10);
|
||||
$task->status = $this->lang->task->statusList[$task->status];
|
||||
$task->openedBy = $users[$task->openedBy];
|
||||
$task->openedDate = substr($task->openedDate, 0, 10);
|
||||
$task->assignedTo = $users[$task->assignedTo];
|
||||
$task->assignedDate = substr($task->assignedTo, 0, 10);
|
||||
$task->finishedBy = $users[$task->finishedBy];
|
||||
$task->finishedDate = substr($task->finishedDate, 0, 10);
|
||||
$task->canceledBy = $users[$task->canceledBy];
|
||||
$task->canceledDate = substr($task->canceledDate, 0, 10);
|
||||
$task->closedBy = $users[$task->closedBy];
|
||||
$task->closedDate = substr($task->closedDate, 0, 10);
|
||||
$task->closedReason = $this->lang->task->reasonList[$task->closedReason];
|
||||
$task->lastEditedBy = $users[$task->lastEditedBy];
|
||||
if(isset($projects[$task->project])) $task->project = $projects[$task->project];
|
||||
if(isset($taskLang->typeList[$task->type])) $task->type = $taskLang->typeList[$task->type];
|
||||
if(isset($taskLang->priList[$task->pri])) $task->pri = $taskLang->priList[$task->pri];
|
||||
if(isset($taskLang->statusList[$task->status])) $task->status = $taskLang->statusList[$task->status];
|
||||
if(isset($taskLang->reasonList[$task->closedReason])) $task->closedReason = $taskLang->reasonList[$task->closedReason];
|
||||
|
||||
if(isset($users[$task->openedBy])) $task->openedBy = $users[$task->openedBy];
|
||||
if(isset($users[$task->assignedTo])) $task->assignedTo = $users[$task->assignedTo];
|
||||
if(isset($users[$task->finishedBy])) $task->finishedBy = $users[$task->finishedBy];
|
||||
if(isset($users[$task->canceledBy])) $task->canceledBy = $users[$task->canceledBy];
|
||||
if(isset($users[$task->closedBy])) $task->closedBy = $users[$task->closedBy];
|
||||
if(isset($users[$task->lastEditedBy])) $task->lastEditedBy = $users[$task->lastEditedBy];
|
||||
|
||||
$task->openedDate = substr($task->openedDate, 0, 10);
|
||||
$task->assignedDate = substr($task->assignedTo, 0, 10);
|
||||
$task->finishedDate = substr($task->finishedDate, 0, 10);
|
||||
$task->canceledDate = substr($task->canceledDate, 0, 10);
|
||||
$task->closedDate = substr($task->closedDate, 0, 10);
|
||||
$task->lastEditedDate = substr($task->lastEditedDate, 0, 10);
|
||||
|
||||
/* Set related files. */
|
||||
if(isset($relatedFiles[$task->id]))
|
||||
{
|
||||
foreach($relatedFiles[$task->id] as $file)
|
||||
{
|
||||
$fileURL = 'http://' . $this->server->http_host . $this->config->webRoot . "data/upload/$task->company/" . $file->pathname;
|
||||
$task->files .= html::a($fileURL, $file->title, '_blank') . '<br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->post->set('fields', $fields);
|
||||
$this->post->set('rows', $tasks);
|
||||
if($this->post->fileType == 'csv') $this->fetch('file', 'export2CSV', $_POST);
|
||||
if($this->post->fileType == 'xml') $this->fetch('file', 'export2XML', $_POST);
|
||||
if($this->post->fileType == 'html') $this->fetch('file', 'export2HTML', $_POST);
|
||||
$this->fetch('file', 'export2' . $this->post->fileType, $_POST);
|
||||
}
|
||||
|
||||
$this->display();
|
||||
|
||||
@@ -299,26 +299,6 @@ class taskModel extends model
|
||||
return $this->processTask($task);
|
||||
}
|
||||
|
||||
/**
|
||||
* getByQuery
|
||||
*
|
||||
* @param string $projectID
|
||||
* @param string $query
|
||||
* @param string $orderBy
|
||||
* @param string $pager
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getByQuery($projectID, $query, $orderBy)
|
||||
{
|
||||
$tmpTasks = $this->dao->select('*')->from(TABLE_TASK)->alias('t1')->where($query)
|
||||
->andWhere('project')->eq((int)$projectID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)
|
||||
->fetchAll();
|
||||
return $tmpTasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tasks of a project.
|
||||
*
|
||||
|
||||
@@ -30,3 +30,10 @@ $config->testcase->defaultSteps = 3;
|
||||
|
||||
$config->testcase->create->requiredFields = 'title,type';
|
||||
$config->testcase->edit->requiredFields = 'title,type';
|
||||
|
||||
$config->testcase->exportFields = '
|
||||
id, product, module, story,
|
||||
title, steps, keywords,
|
||||
pri, type, stage, status, frequency,
|
||||
openedBy, openedDate, lastEditedBy, lastEditedDate,
|
||||
version,linkCase';
|
||||
|
||||
@@ -368,103 +368,103 @@ class testcase extends control
|
||||
*/
|
||||
public function export($productID, $orderBy)
|
||||
{
|
||||
$fields = array();
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$products = $this->loadModel('product')->getPairs();
|
||||
$relatedModules = $this->dao->select('id, name')->from(TABLE_MODULE)->fetchPairs();
|
||||
$relatedStories = $this->dao->select('id, title')->from(TABLE_STORY)->fetchPairs();
|
||||
$relatedCases = $this->dao->select('id, title')->from(TABLE_CASE)->fetchPairs();
|
||||
|
||||
/* get the fields of task module from lang. */
|
||||
$fields = array(
|
||||
'id' => $this->lang->testcase->id,
|
||||
'step' => $this->lang->testcase->stepDesc . $this->lang->testcase->stepExpect,
|
||||
'product' => $this->lang->testcase->product,
|
||||
'module' => $this->lang->testcase->module,
|
||||
'story' => $this->lang->testcase->story,
|
||||
'storyVersion' => $this->lang->testcase->storyVersion,
|
||||
'title' => $this->lang->testcase->title,
|
||||
'keywords' => $this->lang->testcase->keywords,
|
||||
'pri' => $this->lang->testcase->pri,
|
||||
'type' => $this->lang->testcase->type,
|
||||
'stage' => $this->lang->testcase->stage,
|
||||
'howRun' => $this->lang->testcase->howRun,
|
||||
'scriptedBy' => $this->lang->testcase->scriptedBy,
|
||||
'scriptedDate' => $this->lang->testcase->scriptedDate,
|
||||
'scriptStatus' => $this->lang->testcase->scriptedStatus,
|
||||
'scriptLocation' => $this->lang->testcase->scriptedLocation,
|
||||
'status' => $this->lang->testcase->status,
|
||||
'frequency' => $this->lang->testcase->frequency,
|
||||
'order' => $this->lang->testcase->order,
|
||||
'openedBy' => $this->lang->testcase->openedBy,
|
||||
'openedDate' => $this->lang->testcase->openedDate,
|
||||
'lastEditedBy' => $this->lang->testcase->lastEditedBy,
|
||||
'lastEditedDate' => $this->lang->testcase->lastEditedDate,
|
||||
'version' => $this->lang->testcase->version,
|
||||
'linkCase' => $this->lang->testcase->linkCase
|
||||
);
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$testcases = $this->testcase->getByQuery($productID, $this->session->testcaseReport, $orderBy);
|
||||
$caseLang = $this->lang->testcase;
|
||||
$caseConfig = $this->config->testcase;
|
||||
|
||||
foreach($testcases as $testcase)
|
||||
/* Create field lists. */
|
||||
$fields = explode(',', $caseConfig->exportFields);
|
||||
foreach($fields as $key => $fieldName)
|
||||
{
|
||||
$step = '';
|
||||
$i = 1;
|
||||
$testcaseSteps = $this->dao->select('`desc`, expect')->from(TABLE_CASESTEP)->where('`case`')->eq($testcase->id)->fetchAll();
|
||||
foreach($testcaseSteps as $testcaseStep)
|
||||
{
|
||||
$step .= $i . '、' . $this->lang->testcase->stepDesc . ':' . $testcaseStep->desc . '<br />' . $this->lang->testcase->stepExpect . ':' . $testcaseStep->expect . "<br />";
|
||||
$i++;
|
||||
}
|
||||
$testcase->step = $step;
|
||||
$fieldName = trim($fieldName);
|
||||
$fields[$fieldName] = isset($caseLang->$fieldName) ? $caseLang->$fieldName : $fieldName;
|
||||
unset($fields[$key]);
|
||||
}
|
||||
|
||||
if($_POST['fileType'] == 'html')
|
||||
/* Get cases. */
|
||||
$cases = $this->dao->select('*')->from(TABLE_CASE)->alias('t1')->where($this->session->testcaseReport)->orderBy($orderBy)->fetchAll('id');
|
||||
|
||||
/* Get users, products and projects. */
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
$products = $this->loadModel('product')->getPairs();
|
||||
|
||||
/* Get related objects id lists. */
|
||||
$relatedModuleIdList = array();
|
||||
$relatedStoryIdList = array();
|
||||
$relatedCaseIdList = array();
|
||||
|
||||
foreach($cases as $case)
|
||||
{
|
||||
$relatedModuleIdList[$case->module] = $case->module;
|
||||
$relatedStoryIdList[$case->story] = $case->story;
|
||||
$relatedCaseIdList[$case->linkCase] = $case->linkCase;
|
||||
|
||||
/* Process link cases. */
|
||||
$linkCases = explode(',', $case->linkCase);
|
||||
foreach($linkCases as $linkCaseID)
|
||||
{
|
||||
$legendAttatchs = $this->dao->select('pathname, title')->from(TABLE_FILE)->where('objectType')->eq('task')->andWhere('objectID')->eq($testcase->id)->fetchAll();
|
||||
if($legendAttatchs)
|
||||
if($linkCaseID) $relatedCaseIdList[$linkCaseID] = trim($linkCaseID);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get related objects title or names. */
|
||||
$relatedModules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in($relatedModuleIdList)->fetchPairs();
|
||||
$relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs();
|
||||
$relatedCases = $this->dao->select('id, title')->from(TABLE_CASE)->where('id')->in($relatedCaseIdList)->fetchPairs();
|
||||
$relatedSteps = $this->dao->select('`case`, version, `desc`, expect')->from(TABLE_CASESTEP)->where('`case`')->in(@array_keys($cases))->orderBy('version desc,id')->fetchGroup('case');
|
||||
|
||||
foreach($cases as $case)
|
||||
{
|
||||
$case->steps = '';
|
||||
if(isset($relatedSteps[$case->id]))
|
||||
{
|
||||
$i = 1;
|
||||
foreach($relatedSteps[$case->id] as $step)
|
||||
{
|
||||
foreach($legendAttatchs as $legendAttatch)
|
||||
{
|
||||
$legendAttatch->pathname = "http://" . $_SERVER['HTTP_HOST'] . $this->config->webRoot . "data/upload/$testcase->company/" . $legendAttatch->pathname;
|
||||
$testcase->legendAttatchs .= "<a href=$legendAttatch->pathname>" . $legendAttatch->title . "</a><br />";
|
||||
}
|
||||
$case->steps .= $i . ":" . $step->desc . '<br />' . $caseLang->stepExpect . ':' . $step->expect . '<br />';
|
||||
$i ++;
|
||||
if($step->version != $case->version) break;
|
||||
}
|
||||
}
|
||||
else if($_POST['fileType'] == 'csv')
|
||||
|
||||
if($this->post->fileType == 'csv')
|
||||
{
|
||||
$testcase->company = str_replace("<br />", "\n", $testcase->company);
|
||||
$testcase->company = str_replace("<br />", "\n", $testcase->company);
|
||||
$testcase->company = str_replace(" ", " ", $testcase->company);
|
||||
$testcase->company = str_replace('"', '""', $testcase->company);
|
||||
$case->steps = str_replace('<br />', "\n", $case->steps);
|
||||
$case->steps = str_replace('"', '""', $case->steps);
|
||||
}
|
||||
|
||||
/* drop some field that is not needed. */
|
||||
unset($testcase->path);
|
||||
|
||||
/* fill some field with useful value. */
|
||||
$testcase->module = isset($relatedModules[$testcase->module]) ? $relatedModules[$testcase->module] : '';
|
||||
$testcase->story = isset($relatedStories[$testcase->story]) ? $relatedStories[$testcase->story] : '';
|
||||
$testcase->linkCase = isset($relatedCases[$testcase->linkCase]) ? $relatedCases[$testcase->linkCase] : '';
|
||||
if(isset($products[$case->product])) $case->product = $products[$case->product];
|
||||
if(isset($relatedModules[$case->module])) $case->module = $relatedModules[$case->module];
|
||||
if(isset($relatedStories[$case->story])) $case->story = $relatedStories[$case->story];
|
||||
|
||||
$testcase->product = $products[$testcase->product];
|
||||
$testcase->pri = $this->lang->testcase->priList[$testcase->pri];
|
||||
$testcase->type = $this->lang->testcase->typeList[$testcase->type];
|
||||
$testcase->stage = $this->lang->testcase->stageList[$testcase->stage];
|
||||
$testcase->scriptedBy = $users[$testcase->scriptedBy] ;
|
||||
$testcase->status = $this->lang->testcase->statusList[$testcase->status];
|
||||
$testcase->openedBy = $users[$testcase->openedBy];
|
||||
$testcase->openedDate = substr($testcase->openedDate, 0, 10);
|
||||
$testcase->lastEditedBy = $users[$testcase->lastEditedBy];
|
||||
$testcase->lastEditedDate = substr($testcase->lastEditedDate, 0, 10);
|
||||
if(isset($caseLang->priList[$case->pri])) $case->pri = $caseLang->priList[$case->pri];
|
||||
if(isset($caseLang->typeList[$case->type])) $case->type = $caseLang->typeList[$case->type];
|
||||
if(isset($caseLang->stageList[$case->stage])) $case->stage = $caseLang->stageList[$case->stage];
|
||||
if(isset($caseLang->statusList[$case->status])) $case->status = $caseLang->statusList[$case->status];
|
||||
if(isset($users[$case->openedBy])) $case->openedBy = $users[$case->openedBy];
|
||||
if(isset($users[$case->lastEditedBy])) $case->lastEditedBy = $users[$case->lastEditedBy];
|
||||
|
||||
$case->openedDate = substr($case->openedDate, 0, 10);
|
||||
$case->lastEditedDate = substr($case->lastEditedDate, 0, 10);
|
||||
|
||||
if($case->linkCase)
|
||||
{
|
||||
$tmpLinkCases = array();
|
||||
$linkCaseIdList = explode(',', $case->linkCase);
|
||||
foreach($linkCaseIdList as $linkCaseID)
|
||||
{
|
||||
$linkCaseID = trim($linkCaseID);
|
||||
$tmpLinkCases[] = isset($relatedCases[$linkCaseID]) ? $relatedCases[$linkCaseID] : $linkCaseID;
|
||||
}
|
||||
$case->linkCase = join("; \n", $tmpLinkCases);
|
||||
}
|
||||
}
|
||||
|
||||
$this->post->set('fields', $fields);
|
||||
$this->post->set('rows', $testcases);
|
||||
if($this->post->fileType == 'csv') $this->fetch('file', 'export2CSV', $_POST);
|
||||
if($this->post->fileType == 'xml') $this->fetch('file', 'export2XML', $_POST);
|
||||
if($this->post->fileType == 'html') $this->fetch('file', 'export2HTML', $_POST);
|
||||
$this->post->set('rows', $cases);
|
||||
$this->fetch('file', 'export2' . $this->post->fileType, $_POST);
|
||||
}
|
||||
|
||||
$this->display();
|
||||
|
||||
@@ -115,25 +115,6 @@ class testcaseModel extends model
|
||||
return $case;
|
||||
}
|
||||
|
||||
/**
|
||||
* getByQuery
|
||||
*
|
||||
* @param string $productID
|
||||
* @param string $query
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getByQuery($productID, $query, $orderBy)
|
||||
{
|
||||
$tmpTestcases = $this->dao->select('*')->from(TABLE_CASE)->alias('t1')->where($query)
|
||||
->andWhere('product')->eq((int)$productID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)
|
||||
->fetchAll();
|
||||
return $tmpTestcases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a case.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user