diff --git a/extension/lite/custom/ext/config/lite.php b/extension/lite/custom/ext/config/lite.php
index 6ca05649d1..a7dc31e411 100644
--- a/extension/lite/custom/ext/config/lite.php
+++ b/extension/lite/custom/ext/config/lite.php
@@ -2,7 +2,6 @@
$config->custom->requiredModules = array();
$config->custom->requiredModules[10] = 'project';
$config->custom->requiredModules[20] = 'story';
-$config->custom->requiredModules[35] = 'execution';
$config->custom->requiredModules[40] = 'task';
$config->custom->requiredModules[80] = 'doc';
$config->custom->requiredModules[85] = 'user';
diff --git a/extension/lite/execution/ext/control/create.php b/extension/lite/execution/ext/control/create.php
new file mode 100644
index 0000000000..cd8f6aed3a
--- /dev/null
+++ b/extension/lite/execution/ext/control/create.php
@@ -0,0 +1,10 @@
+config->execution->create->requiredFields = 'name,code,begin,end';
+ parent::create($projectID, $executionID, $copyExecutionID, $planID, $confirm, $productID, $extra);
+ }
+}
\ No newline at end of file
diff --git a/extension/lite/execution/ext/control/edit.php b/extension/lite/execution/ext/control/edit.php
new file mode 100644
index 0000000000..c7796cbc34
--- /dev/null
+++ b/extension/lite/execution/ext/control/edit.php
@@ -0,0 +1,10 @@
+config->execution->edit->requiredFields = 'name,code,begin,end';
+ parent::edit($executionID, $action, $extra);
+ }
+}
\ No newline at end of file
diff --git a/extension/lite/kanban/ext/view/view.lite.html.hook.php b/extension/lite/kanban/ext/view/view.lite.html.hook.php
index 77f9eb2951..a3351704a6 100644
--- a/extension/lite/kanban/ext/view/view.lite.html.hook.php
+++ b/extension/lite/kanban/ext/view/view.lite.html.hook.php
@@ -1,3 +1,7 @@
\ No newline at end of file
diff --git a/extension/lite/user/ext/lang/zh-cn/lite.php b/extension/lite/user/ext/lang/zh-cn/lite.php
index d2f5818794..1617abafa0 100644
--- a/extension/lite/user/ext/lang/zh-cn/lite.php
+++ b/extension/lite/user/ext/lang/zh-cn/lite.php
@@ -1,2 +1,3 @@
user->task = '任务';
+$lang->user->noticeFeedbackUserLimit = "迅捷企业版用户数已经达到授权的上限,不能继续添加用户!";
diff --git a/extension/lite/user/ext/view/batchcreate.lite.html.hook.php b/extension/lite/user/ext/view/batchcreate.lite.html.hook.php
new file mode 100644
index 0000000000..59dcd3daa2
--- /dev/null
+++ b/extension/lite/user/ext/view/batchcreate.lite.html.hook.php
@@ -0,0 +1,70 @@
+
+dao->select("COUNT('*') as count")->from(TABLE_USER)
+ ->where('deleted')->eq(0)
+ ->beginIF($this->config->edition != 'open')->andWhere("visions")->ne('lite')->fi()
+ ->fetch('count');
+js::set('userCount', $userCount);
+js::set('userMaxCount', $userMaxCount);
+js::set('noticeUserCreate', str_replace('%maxcount%', $userMaxCount, $lang->user->noticeUserCreate));
+
+if($this->config->edition != 'open')
+{
+ $liteCount = $this->dao->select("COUNT('*') as count")->from(TABLE_USER)->where('deleted')->eq(0)->andWhere("visions")->eq('lite')->fetch('count');
+ $liteMaxCount = $properties['lite']['value'];
+ js::set('liteCount', $liteCount);
+ js::set('liteMaxCount', $liteMaxCount);
+ js::set('noticeFeedbackCreate', str_replace('%maxcount%', $liteMaxCount, $lang->user->noticeFeedbackCreate));
+}
+?>
+
+
diff --git a/framework/api/entry.class.php b/framework/api/entry.class.php
index 6ae1237f45..2d93b300d9 100644
--- a/framework/api/entry.class.php
+++ b/framework/api/entry.class.php
@@ -524,7 +524,7 @@ class baseEntry
/* Format value. */
if(!$isArray)
{
- $object->$key = $this->cast($object->$key, $type);
+ $object->$key = $this->cast(trim($object->$key, ','), $type);
continue;
}
diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php
index 1d702b267b..a94bfdc9e8 100644
--- a/lib/scm/gitlab.class.php
+++ b/lib/scm/gitlab.class.php
@@ -66,7 +66,7 @@ class gitlab
}
else
{
- $commits = $this->getCommitsByPath($file->path);
+ $commits = $this->getCommitsByPath($file->path, '', '', 1);
if(empty($commits)) continue;
$commit = $commits[0];
@@ -108,7 +108,7 @@ class gitlab
$file = $this->fetch($api, $param);
if(!isset($file->file_name)) return false;
- $commits = $this->getCommitsByPath($path);
+ $commits = $this->getCommitsByPath($path, '', '', 1);
$file->revision = $file->commit_id;
$file->size = $this->formatBytes($file->size);
@@ -636,10 +636,13 @@ class gitlab
* Get commits by path.
*
* @param string $path
+ * @param string $fromRevision
+ * @param string $toRevision
+ * @param int $perPage
* @access public
* @return array
*/
- public function getCommitsByPath($path, $fromRevision = '', $toRevision = '')
+ public function getCommitsByPath($path, $fromRevision = '', $toRevision = '', $perPage = 0)
{
$path = ltrim($path, DIRECTORY_SEPARATOR);
$api = "commits";
@@ -662,10 +665,11 @@ class gitlab
{
$since = $fromDate;
}
-
if($since) $param->since = $since;
if($until) $param->until = $until;
+ if($perPage) $param->per_page = $perPage;
+
return $this->fetch($api, $param);
}
@@ -742,7 +746,7 @@ class gitlab
{
$params = (array) $params;
$params['private_token'] = $this->token;
- $params['per_page'] = 100;
+ $params['per_page'] = isset($params['per_page']) ? $params['per_page'] : 100;
$api = ltrim($api, '/');
$api = $this->root . $api . '?' . http_build_query($params);
diff --git a/module/build/model.php b/module/build/model.php
index 5470d7266f..323ae85c58 100644
--- a/module/build/model.php
+++ b/module/build/model.php
@@ -202,6 +202,7 @@ class buildModel extends model
$selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)
->where('id')->in($buildIdList)
->beginIF($objectType === 'execution')->andWhere('execution')->eq($objectID)->fi()
+ ->beginIF($objectType === 'project')->andWhere('project')->eq($objectID)->fi()
->fetchPairs();
}
diff --git a/module/caselib/view/showimport.html.php b/module/caselib/view/showimport.html.php
index a2bb3dcff0..dad8d594e0 100644
--- a/module/caselib/view/showimport.html.php
+++ b/module/caselib/view/showimport.html.php
@@ -112,7 +112,7 @@ $(function()
}
echo html::hidden('isEndPage', $isEndPage ? 1 : 0);
echo html::hidden('pagerID', $pagerID);
- echo ' ' . html::backButton();
+ echo ' ' . html::a($this->createLink('caselib', 'browse', "libID=$libID"), $lang->goback, '', 'class="btn btn-wide"');
echo ' ' . sprintf($lang->file->importPager, $allCount, $pagerID, $allPager);
?>
diff --git a/module/design/control.php b/module/design/control.php
index 601a926bca..4607719e4f 100644
--- a/module/design/control.php
+++ b/module/design/control.php
@@ -230,6 +230,7 @@ class design extends control
$this->view->stories = $this->loadModel('story')->getProductStoryPairs($design->product);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->actions = $this->loadModel('action')->getList('design', $design->id);
+ $this->view->repos = $this->loadModel('repo')->getRepoPairs('project', $design->project);
$this->display();
}
diff --git a/module/design/js/view.js b/module/design/js/view.js
index 169bc7dcd8..07bfc10662 100644
--- a/module/design/js/view.js
+++ b/module/design/js/view.js
@@ -1,4 +1,19 @@
$(function()
{
$('#subNavbar .nav li[data-id=' + type.toLowerCase() + ']').addClass('active');
+ $('#linkCommit').click(function()
+ {
+ if(repos.length == 0)
+ {
+ var onlybody = config.onlybody;
+ config.onlybody = 'no';
+
+ var link = createLink('repo', 'create', 'objectID=' + projectID);
+
+ config.onlybody = onlybody;
+ window.parent.$.apps.open(link, 'project');
+
+ return false;
+ }
+ });
})
diff --git a/module/design/js/viewcommit.js b/module/design/js/viewcommit.js
index 56db3f864e..6d486b3137 100644
--- a/module/design/js/viewcommit.js
+++ b/module/design/js/viewcommit.js
@@ -10,9 +10,7 @@ $(function()
var link = createLink('repo', 'create', 'objectID=' + projectID);
config.onlybody = onlybody;
- window.parent.$.apps.open(link, 'devops');
-
- parent.$('#triggerModal').modal('hide');
+ window.parent.$.apps.open(link, 'project');
return false;
}
diff --git a/module/design/view/view.html.php b/module/design/view/view.html.php
index 0f723b76e8..a00c782294 100644
--- a/module/design/view/view.html.php
+++ b/module/design/view/view.html.php
@@ -12,6 +12,8 @@
?>
type);?>
+
+project);?>
session->designList != false ? $app->session->designList : $this->createLink('design', 'browse', "productID=$design->product");?>
@@ -45,7 +47,7 @@
deleted):?>
id", $design, 'button', '', '', 'iframe showinonlybody', true);
- common::printIcon('design', 'linkCommit', "designID=$design->id", $design, 'button', 'link', '', 'iframe showinonlybody', true);
+ common::printIcon('design', 'linkCommit', "designID=$design->id", $design, 'button', 'link', '', 'iframe showinonlybody', true, "id='linkCommit'");
common::printIcon('design', 'edit', "designID=$design->id", $design, 'button', 'alter');
common::printIcon('design', 'delete', "designID=$design->id", $design, 'button', 'trash', 'hiddenwin');
?>
diff --git a/module/file/view/export2csv.html.php b/module/file/view/export2csv.html.php
index 09323e1fc5..e5e6b61aad 100644
--- a/module/file/view/export2csv.html.php
+++ b/module/file/view/export2csv.html.php
@@ -22,4 +22,4 @@ foreach($rows as $row)
}
echo '"' . "\n";
}
-if($this->post->kind == 'task') echo $this->lang->file->childTaskTips;
+if($this->post->kind == 'task' && $config->vision != 'lite') echo $this->lang->file->childTaskTips;
diff --git a/module/gitlab/model.php b/module/gitlab/model.php
index ae76ba33bb..54ed60e29a 100644
--- a/module/gitlab/model.php
+++ b/module/gitlab/model.php
@@ -492,6 +492,7 @@ class gitlabModel extends model
{
/* GitLab API '/users' can only return 20 users per page in default, so we use a loop to fetch all users. */
$page = 1;
+ $perPage = 100;
$response = array();
$apiRoot = $this->getApiRoot($gitlabID);
@@ -503,12 +504,14 @@ class gitlabModel extends model
while(true)
{
/* Also use `per_page=20` to fetch users in API. Fetch active users only. */
- $url = sprintf($apiRoot, "/users") . "&order_by={$order}&sort={$sort}&page={$page}&per_page=20&active=true";
- $result = json_decode(commonModel::http($url));
+ $url = sprintf($apiRoot, "/users") . "&order_by={$order}&sort={$sort}&page={$page}&per_page={$perPage}&active=true";
+ $httpData = commonModel::httpWithHeader($url);
+ $result = json_decode($httpData['body']);
if(!empty($result))
{
$response = array_merge($response, $result);
$page += 1;
+ if($httpData['header']['X-Page'] == $httpData['header']['X-Total-Pages']) break;
}
else
{
diff --git a/module/message/model.php b/module/message/model.php
index 3704dcdc99..83a55e3ebb 100644
--- a/module/message/model.php
+++ b/module/message/model.php
@@ -183,7 +183,7 @@ class messageModel extends model
{
/* Get notifiy persons. */
$notifyPersons = array();
- if(!empty($object->notify)) $notifyPersons = $this->loadModel('release')->getNotifyPersons($object->notify, $object->product, $object->build, $object->id);
+ if(!empty($object->notify)) $notifyPersons = $this->loadModel('release')->getNotifyPersons($object);
if(!empty($notifyPersons)) $toList = implode(',', $notifyPersons);
}
diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php
index cf9fcd9c3f..61b03db2a5 100644
--- a/module/product/view/browse.html.php
+++ b/module/product/view/browse.html.php
@@ -227,8 +227,8 @@ $projectIDParam = $isProjectStory ? "projectID=$projectID&" : '';
}
}
?>
-
+
diff --git a/module/release/lang/en.php b/module/release/lang/en.php
index 0e4c7114b0..5ebeea5f34 100644
--- a/module/release/lang/en.php
+++ b/module/release/lang/en.php
@@ -89,3 +89,4 @@ $lang->release->notifyList['QD'] = 'QA Manager';
$lang->release->notifyList['SC'] = 'Story Creator';
$lang->release->notifyList['ET'] = "{$lang->execution->common} Team Members";
$lang->release->notifyList['PT'] = "Project Team Members";
+$lang->release->notifyList['CT'] = "Copy To";
diff --git a/module/release/lang/zh-cn.php b/module/release/lang/zh-cn.php
index d0f59ad659..149a5921c2 100644
--- a/module/release/lang/zh-cn.php
+++ b/module/release/lang/zh-cn.php
@@ -89,3 +89,4 @@ $lang->release->notifyList['QD'] = '测试负责人';
$lang->release->notifyList['SC'] = '需求提交人';
$lang->release->notifyList['ET'] = "所在{$lang->execution->common}团队成员";
$lang->release->notifyList['PT'] = "所在项目团队成员";
+$lang->release->notifyList['CT'] = "抄送给";
diff --git a/module/release/model.php b/module/release/model.php
index a1360ff42a..128917fcf9 100644
--- a/module/release/model.php
+++ b/module/release/model.php
@@ -281,21 +281,18 @@ class releaseModel extends model
/**
* Get notify persons.
*
- * @param string $notfiyList
- * @param int $productID
- * @param int $buildID
- * @param int $releaseID
+ * @param object $release
* @access public
* @return array
*/
- public function getNotifyPersons($notifyList = '', $productID = 0, $buildID = 0, $releaseID = 0)
+ public function getNotifyPersons($release)
{
- if(empty($notifyList)) return array();
+ if(empty($release->notify)) return array();
/* Init vars. */
$notifyPersons = array();
$managerFields = '';
- $notifyList = explode(',', $notifyList);
+ $notifyList = explode(',', $release->notify);
foreach($notifyList as $notify)
{
@@ -303,10 +300,10 @@ class releaseModel extends model
{
$managerFields .= $notify . ',';
}
- elseif($notify == 'SC' and !empty($buildID))
+ elseif($notify == 'SC' and !empty($release->build))
{
- $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($buildID)->fetch('stories');
- $stories .= $this->dao->select('stories')->from(TABLE_RELEASE)->where('id')->eq($releaseID)->fetch('stories');
+ $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($release->build)->fetch('stories');
+ $stories .= $this->dao->select('stories')->from(TABLE_RELEASE)->where('id')->eq($release->id)->fetch('stories');
$stories = trim($stories, ',');
if(empty($stories)) continue;
@@ -314,7 +311,7 @@ class releaseModel extends model
$openedByList = $this->dao->select('openedBy')->from(TABLE_STORY)->where('id')->in($stories)->fetchPairs();
$notifyPersons += $openedByList;
}
- elseif(($notify == 'ET' or $notify == 'PT') and !empty($buildID))
+ elseif(($notify == 'ET' or $notify == 'PT') and !empty($release->build))
{
$type = $notify == 'ET' ? 'execution' : 'project';
$members = $this->dao->select('t2.account')->from(TABLE_BUILD)->alias('t1')
@@ -326,12 +323,16 @@ class releaseModel extends model
$notifyPersons += $members;
}
+ elseif($notify == 'CT' and !empty($release->mailto))
+ {
+ $notifyPersons += explode(',', trim($release->mailto, ','));
+ }
}
if(!empty($managerFields))
{
$managerFields = trim($managerFields, ',');
- $managerUsers = $this->dao->select($managerFields)->from(TABLE_PRODUCT)->where('id')->eq($productID)->fetch();
+ $managerUsers = $this->dao->select($managerFields)->from(TABLE_PRODUCT)->where('id')->eq($release->product)->fetch();
foreach($managerUsers as $account)
{
if(!isset($notifyPersons[$account])) $notifyPersons[$account] = $account;
@@ -577,7 +578,7 @@ class releaseModel extends model
/* Get notifiy persons. */
$notifyPersons = array();
- if(!empty($release->notify)) $notifyPersons = $this->getNotifyPersons($release->notify, $release->product, $release->build, $release->id);
+ if(!empty($release->notify)) $notifyPersons = $this->getNotifyPersons($release);
foreach($notifyPersons as $account)
{
diff --git a/module/story/control.php b/module/story/control.php
index 5d86256837..056edfe336 100644
--- a/module/story/control.php
+++ b/module/story/control.php
@@ -1018,21 +1018,7 @@ class story extends control
$module = $this->app->tab == 'project' ? 'projectstory' : 'story';
- if(isonlybody())
- {
- $execution = $this->execution->getByID($this->session->execution);
- if($this->app->tab == 'execution' and $execution->type == 'kanban' and $this->app->tab == 'execution')
- {
- $kanbanData = $this->loadModel('kanban')->getRDKanban($this->session->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all');
- $kanbanData = json_encode($kanbanData);
-
- return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)"));
- }
- else
- {
- return print(js::reload('parent.parent'));
- }
- }
+ if(isonlybody()) return print(js::reload('parent.parent'));
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success'));
return print(js::locate($this->createLink($module, 'view', "storyID=$storyID"), 'parent'));
@@ -1130,7 +1116,8 @@ class story extends control
$storyID = (int)$storyID;
$story = $this->story->getById($storyID, $version, true);
- if(!$story) return print(js::error($this->lang->notFound) . js::locate($this->createLink('product', 'index')));
+ $linkModuleName = $this->config->vision == 'lite' ? 'project' : 'product';
+ if(!$story) return print(js::error($this->lang->notFound) . js::locate($this->createLink($linkModuleName, 'index')));
$story = $this->story->mergeReviewer($story, true);
diff --git a/module/story/lang/en.php b/module/story/lang/en.php
index 78ff05105a..a1230ac20a 100644
--- a/module/story/lang/en.php
+++ b/module/story/lang/en.php
@@ -284,6 +284,7 @@ $lang->story->estimateMustBeNumber = 'Estimate value must be number.';
$lang->story->estimateMustBePlus = 'Estimated value cannot be negative';
$lang->story->confirmChangeBranch = $lang->SRCommon . ' %s is linked to the plan of its linked branch. If the branch is edited, ' . $lang->SRCommon . ' will be removed from the plan of its linked branch. Do you want to continue edit ' . $lang->SRCommon . '?';
$lang->story->confirmChangePlan = $lang->SRCommon . ' %s is linked to the branch of its plan. If the branch is edited, ' . $lang->SRCommon . ' will be removed from the plan. Do you want to continue edit branch ?';
+$lang->story->errorDuplicateStory = $lang->SRCommon . '%s not exist';
$lang->story->form = new stdclass();
$lang->story->form->area = 'Scope';
diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php
index ff0751f10c..e0303c441a 100644
--- a/module/story/lang/zh-cn.php
+++ b/module/story/lang/zh-cn.php
@@ -284,6 +284,7 @@ $lang->story->estimateMustBeNumber = '估算值必须是数字';
$lang->story->estimateMustBePlus = '估算值不能是负数';
$lang->story->confirmChangeBranch = $lang->SRCommon . '%s已关联在之前所属分支的计划中,调整分支后,' . $lang->SRCommon . '将从之前所属分支的计划中移除,请确认是否继续修改上述' . $lang->SRCommon . '的分支。';
$lang->story->confirmChangePlan = $lang->SRCommon . '%s已关联在之前计划的所属分支中,调整分支后,' . $lang->SRCommon . '将会从计划中移除,请确认是否继续修改计划的所属分支。';
+$lang->story->errorDuplicateStory = $lang->SRCommon . '%s不存在';
$lang->story->form = new stdclass();
$lang->story->form->area = "该{$lang->SRCommon}所属范围";
diff --git a/module/story/model.php b/module/story/model.php
index d5eedc2706..0663530312 100644
--- a/module/story/model.php
+++ b/module/story/model.php
@@ -1553,6 +1553,16 @@ class storyModel extends model
->removeIF($this->post->closedReason != 'subdivided', 'childStories')
->get();
+ if(!empty($story->duplicateStory))
+ {
+ $duplicateStoryID = $this->dao->select('id')->from(TABLE_STORY)->where('id')->eq($story->duplicateStory)->fetch();
+ if(empty($duplicateStoryID))
+ {
+ dao::$errors[] = sprintf($this->lang->story->errorDuplicateStory, $story->duplicateStory);
+ return false;
+ }
+ }
+
$this->lang->story->comment = $this->lang->comment;
$this->dao->update(TABLE_STORY)->data($story, 'comment')
->autoCheck()
diff --git a/module/story/view/tasks.html.php b/module/story/view/tasks.html.php
index 3c9f772564..a1f9e2e247 100644
--- a/module/story/view/tasks.html.php
+++ b/module/story/view/tasks.html.php
@@ -55,7 +55,11 @@ include '../../common/view/chart.html.php';
estimate;?> |
consumed;?> |
left;?> |
- |
+
+
+ |
diff --git a/module/testcase/control.php b/module/testcase/control.php
index 5896cf1b99..69ae38ebc1 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -964,6 +964,10 @@ class testcase extends control
$libID = $productID;
$libraries = $this->loadModel('caselib')->getLibraries();
+ /* Remove story custom fields from caselib */
+ $this->config->testcase->customBatchEditFields = str_replace(',story', '', $this->config->testcase->customBatchEditFields);
+ $this->config->testcase->custom->batchEditFields = str_replace(',story', '', $this->config->testcase->custom->batchEditFields);
+
/* Set caselib menu. */
$this->caselib->setLibMenu($libraries, $libID);
@@ -1029,11 +1033,11 @@ class testcase extends control
$productIdList = array();
foreach($cases as $case) $productIdList[$case->product] = $case->product;
- $branches = 0;
$branchTagOption = array();
$products = $this->product->getByIdList($productIdList);
foreach($products as $product)
{
+ $branches = 0;
if($product->type != 'normal')
{
$branches = $this->loadModel('branch')->getList($product->id, 0, 'all');
@@ -1055,6 +1059,9 @@ class testcase extends control
$showSuhosinInfo = common::judgeSuhosinSetting($countInputVars);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
+ $stories = $this->loadModel('story')->getProductStoryPairs($productID, $branch);
+ $this->view->stories = array('' => '', 'ditto' => $this->lang->testcase->ditto) + $stories;
+
/* Set custom. */
foreach(explode(',', $this->config->testcase->customBatchEditFields) as $field) $customFields[$field] = $this->lang->testcase->$field;
$this->view->customFields = $customFields;
diff --git a/module/testcase/js/batchedit.js b/module/testcase/js/batchedit.js
index 9df9b0827a..2b56dfa9a5 100644
--- a/module/testcase/js/batchedit.js
+++ b/module/testcase/js/batchedit.js
@@ -57,7 +57,7 @@ $(function()
var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num);
$.get(storyLink, function(stories)
{
- if(!stories) modules = '';
+ if(!stories) stories = '';
$('#story' + num).replaceWith(stories);
$('#story' + num + "_chosen").remove();
$('#story' + num).next('.picker').remove();
diff --git a/module/testcase/js/common.js b/module/testcase/js/common.js
index f70847fd18..d29efaf6cd 100644
--- a/module/testcase/js/common.js
+++ b/module/testcase/js/common.js
@@ -361,21 +361,32 @@ function updateStepID()
*/
function loadStories(productID, moduleID, num)
{
- var branchIDName = config.currentMethod == 'batchcreate' ? '#branch' : '#branches';
+ var branchIDName = (config.currentMethod == 'batchcreate' || config.currentMethod == 'showimport') ? '#branch' : '#branches';
var branchID = $(branchIDName + num).val();
var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num);
$.get(storyLink, function(stories)
{
- if(!stories) modules = '';
- for(var i = num; i < 10 ; i ++)
+ if(!stories) stories = '';
+ if(config.currentMethod == 'batchcreate')
{
- if(i != num && $('#module' + i).val() != 'ditto') break;
- var nowStories = stories.replaceAll('story' + num, 'story' + i);
- $('#story' + i).replaceWith(nowStories);
- $('#story' + i + "_chosen").remove();
- $('#story' + i).next('.picker').remove();
- $('#story' + i).attr('name', 'story[' + i + ']');
- $('#story' + i).chosen();
+ for(var i = num; i < 10 ; i ++)
+ {
+ if(i != num && $('#module' + i).val() != 'ditto') break;
+ var nowStories = stories.replaceAll('story' + num, 'story' + i);
+ $('#story' + i).replaceWith(nowStories);
+ $('#story' + i + "_chosen").remove();
+ $('#story' + i).next('.picker').remove();
+ $('#story' + i).attr('name', 'story[' + i + ']');
+ $('#story' + i).chosen();
+ }
+ }
+ else
+ {
+ $('#story' + num).replaceWith(stories);
+ $('#story' + num + "_chosen").remove();
+ $('#story' + num).next('.picker').remove();
+ $('#story' + num).attr('name', 'story[' + num + ']');
+ $('#story' + num).chosen();
}
});
}
diff --git a/module/testcase/js/showimport.js b/module/testcase/js/showimport.js
index aede447892..b6490a25c1 100644
--- a/module/testcase/js/showimport.js
+++ b/module/testcase/js/showimport.js
@@ -1,25 +1,31 @@
-$(document).on('mouseup', '[id^=story].chosen-with-drop', function()
+$("[name^='product']").each(function()
{
- var select = $(this).prev('select');
- var id = $(select).attr('id');
- var index = id.substring(5);
- var moduleID = $('#module' + index).val();
- var branch = $('#branch' + index).length > 0 ? $('#branch' + index).val() : 0;
- if(moduleID == 'ditto')
+ var id = $(this).attr('id');
+ $(this).attr('id', 'product' + id.match(/\d+/));
+});
+
+$("[name^='branch']").each(function()
+{
+ var id = $(this).attr('id');
+ $(this).attr('id', 'branch' + id.match(/\d+/));
+});
+
+$("[name^='story']").each(function()
+{
+ var id = $(this).attr('id');
+ var num = id.substring(5);
+ var productID = $('#product' + num).val();
+ var branchID = $('#branch' + num).val();
+ var moduleID = $('#module' + num).val();
+ var storyID = $("#story" + num).val();
+ var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num);
+ $.get(storyLink, function(stories)
{
- for(var i = index - 1; i >=0; i--)
- {
- if($('#module' + i).val() != 'ditto')
- {
- moduleID = $('#module' + i).val();
- break;
- }
- }
- }
- var link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID='+ ($(select).val() || '0') + '&onlyOption=true&status=noclosed&limit=0&type=null');
- var $story = $('#story' + index);
- if($story.data('loadLink') !== link)
- {
- $story.load(link, function(){$story.data('loadLink', link).trigger("chosen:updated");});
- }
+ if(!stories) stories = '';
+ $('#story' + num).replaceWith(stories);
+ $('#story' + num + "_chosen").remove();
+ $('#story' + num).next('.picker').remove();
+ $('#story' + num).attr('name', 'story[' + num + ']').chosen();
+ $('#story' + num).val(storyID).trigger('chosen:updated');
+ });
});
diff --git a/module/testcase/model.php b/module/testcase/model.php
index 0fea861510..4948202db4 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -894,12 +894,12 @@ class testcaseModel extends model
/* Process data if the value is 'ditto'. */
foreach($caseIDList as $caseID)
{
- if($data->pris[$caseID] == 'ditto') $data->pris[$caseID] = isset($prev['pri']) ? $prev['pri'] : 3;
- if($data->branches[$caseID] == 'ditto') $data->branches[$caseID] = isset($prev['branch']) ? $prev['branch'] : 0;
- if($data->modules[$caseID] == 'ditto') $data->modules[$caseID] = isset($prev['module']) ? $prev['module'] : 0;
- if($data->story[$caseID] == 'ditto') $data->story[$caseID] = isset($prev['story']) ? $prev['story'] : 0;
- if($data->types[$caseID] == 'ditto') $data->types[$caseID] = isset($prev['type']) ? $prev['type'] : '';
- if($data->story[$caseID] == '') $data->story[$caseID] = 0;
+ if($data->pris[$caseID] == 'ditto') $data->pris[$caseID] = isset($prev['pri']) ? $prev['pri'] : 3;
+ if($data->modules[$caseID] == 'ditto') $data->modules[$caseID] = isset($prev['module']) ? $prev['module'] : 0;
+ if($data->types[$caseID] == 'ditto') $data->types[$caseID] = isset($prev['type']) ? $prev['type'] : '';
+ if($data->story[$caseID] == '') $data->story[$caseID] = 0;
+ if(isset($data->branches[$caseID]) and $data->branches[$caseID] == 'ditto') $data->branches[$caseID] = isset($prev['branch']) ? $prev['branch'] : 0;
+ if($data->story[$caseID] == 'ditto') $data->story[$caseID] = isset($prev['story']) ? $prev['story'] : 0;
$prev['pri'] = $data->pris[$caseID];
$prev['type'] = $data->types[$caseID];
@@ -953,8 +953,9 @@ class testcaseModel extends model
if(!dao::isError())
{
- $isLibCase = ($oldCase->lib and empty($oldCase->product));
- $titleChanged = ($case->title != $oldCase->title);
+ $isLibCase = ($oldCase->lib and empty($oldCase->product));
+ $titleChanged = ($case->title != $oldCase->title);
+ $case->product = $oldCase->product;
if($isLibCase and $titleChanged) $this->dao->update(TABLE_CASE)->set('`title`')->eq($case->title)->where('`fromCaseID`')->eq($caseID)->exec();
$this->updateCase2Project($oldCase, $case, $caseID);
@@ -1247,9 +1248,9 @@ class testcaseModel extends model
else
{
/* Compare every step. */
- foreach($oldStep as $id => $oldStep)
+ foreach($oldStep as $id => $step)
{
- if(trim($oldStep->desc) != trim($steps[$id]->desc) or trim($oldStep->expect) != $steps[$id]->expect)
+ if(trim($step->desc) != trim($steps[$id]->desc) or trim($step->expect) != $steps[$id]->expect)
{
$stepChanged = true;
break;
@@ -1388,10 +1389,14 @@ class testcaseModel extends model
if($module != 'ditto') $prevModule = $module;
if($module == 'ditto') $data->module[$i] = $prevModule;
}
- foreach($data->branch as $i => $branch)
+
+ if(isset($data->branch))
{
- if($branch != 'ditto') $prevBranch = $branch;
- if($branch == 'ditto') $data->branch[$i] = $prevBranch;
+ foreach($data->branch as $i => $branch)
+ {
+ if($branch != 'ditto') $prevBranch = $branch;
+ if($branch == 'ditto') $data->branch[$i] = $prevBranch;
+ }
}
$libCases = $this->dao->select('*')->from(TABLE_CASE)->where('deleted')->eq(0)->andWhere('id')->in($data->caseIdList)->fetchAll('id');
@@ -1889,7 +1894,7 @@ class testcaseModel extends model
if($methodName == 'review')
{
- $status = zget($case, 'status', $status);
+ $status = zget($case, 'status', '');
if($this->post->result == 'pass') return 'normal';
diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php
index 2bbe8ce596..d58a558d58 100644
--- a/module/testcase/view/batchedit.html.php
+++ b/module/testcase/view/batchedit.html.php
@@ -52,6 +52,7 @@
testcase->branch;?> |
'>testcase->module;?> |
+ '>testcase->story;?> |
testcase->title;?> |
testcase->type;?> |
'>testcase->precondition;?> |
@@ -91,6 +92,7 @@
' style='overflow:visible'> '/')), $cases[$caseID]->module, "class='form-control chosen' onchange='loadStories($productID, this.value, $caseID)'");?> |
+ ' style='overflow:visible'>story, "class='form-control chosen'");?> |
|