diff --git a/extension/lite/story/ext/view/edit.html.php b/extension/lite/story/ext/view/edit.html.php
index c45fa148a4..eef7e20595 100644
--- a/extension/lite/story/ext/view/edit.html.php
+++ b/extension/lite/story/ext/view/edit.html.php
@@ -80,6 +80,8 @@
status) !== false ? html::textarea('spec', htmlSpecialString($story->spec), "rows='5' class='form-control'") : $story->spec;?>
+ status) === false and empty($files) ? false : true;?>
+
story->comment;?>
diff --git a/module/bug/config.php b/module/bug/config.php
index 0ba621fbc7..a797500f5a 100644
--- a/module/bug/config.php
+++ b/module/bug/config.php
@@ -56,6 +56,8 @@ $config->bug->custom->createFields = $config->bug->list->customCreateFields
$config->bug->custom->batchCreateFields = 'project,execution,deadline,steps,type,severity,os,browser,%s';
$config->bug->custom->batchEditFields = 'type,severity,pri,assignedTo,deadline,status,resolvedBy,resolution';
+$config->bug->excludeCheckFileds = ',severities,';
+
$config->bug->editor = new stdclass();
$config->bug->editor->create = array('id' => 'steps', 'tools' => 'bugTools');
$config->bug->editor->edit = array('id' => 'steps,comment', 'tools' => 'bugTools');
diff --git a/module/bug/model.php b/module/bug/model.php
index 20aa199c03..374d7b4e3e 100644
--- a/module/bug/model.php
+++ b/module/bug/model.php
@@ -192,7 +192,16 @@ class bugModel extends model
foreach($data->title as $i => $title)
{
$title = trim($title);
- if(empty($title)) continue;
+ if(empty($title))
+ {
+ if($this->common->checkValidRow('bug', $data, $i))
+ {
+ dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->bug->title);
+ return false;
+ }
+
+ continue;
+ }
$bug = new stdClass();
$bug->openedBy = $this->app->user->account;
@@ -202,7 +211,7 @@ class bugModel extends model
$bug->module = (int)$data->modules[$i];
$bug->project = (int)$data->projects[$i];
$bug->execution = (int)$data->executions[$i];
- $bug->openedBuild = implode(',', $data->openedBuilds[$i]);
+ $bug->openedBuild = isset($data->openedBuilds) ? implode(',', $data->openedBuilds[$i]) : '';
$bug->color = $data->color[$i];
$bug->title = $title;
$bug->deadline = $data->deadlines[$i];
diff --git a/module/common/model.php b/module/common/model.php
index 9b29e6d4ba..9d4c484348 100644
--- a/module/common/model.php
+++ b/module/common/model.php
@@ -3481,6 +3481,28 @@ EOD;
return true;
}
+
+ /**
+ * Check valid row.
+ *
+ * @param string $objectType
+ * @param array $postData
+ * @param int $index
+ * @access public
+ * @return bool
+ */
+ public function checkValidRow($objectType, $postData = array(), $index = 0)
+ {
+ if(empty($postData)) return false;
+
+ foreach($postData as $key => $value)
+ {
+ if(!is_array($value) or strpos($this->config->$objectType->excludeCheckFileds, ",$key,") !== false) continue;
+ if(isset($value[$index]) and !empty($value[$index]) and $value[$index] != 'ditto') return true;
+ }
+
+ return false;
+ }
}
class common extends commonModel
diff --git a/module/file/model.php b/module/file/model.php
index 22b98a85d7..d664584737 100755
--- a/module/file/model.php
+++ b/module/file/model.php
@@ -46,8 +46,8 @@ class fileModel extends model
->where('objectType')->eq($objectType)
->andWhere('objectID')->eq((int)$objectID)
->andWhere('extra')->ne('editor')
- ->beginIF($objectType == 'story' and $extra)->andWhere('extra')->like("%,$extra,%")->fi()
- ->beginIF($objectType != 'story' and $extra)->andWhere('extra')->eq($extra)->fi()
+ ->beginIF(strpos('story,requirement', $objectType) !== false and $extra)->andWhere('extra')->like("%,$extra,%")->fi()
+ ->beginIF(strpos('story,requirement', $objectType) === false and $extra)->andWhere('extra')->eq($extra)->fi()
->andWhere('deleted')->eq('0')
->orderBy('id')
->fetchAll('id');
@@ -1132,8 +1132,8 @@ class fileModel extends model
public function updateStoryFileVersion($storyID, $storyVersion, $deleteFiles = array())
{
$oldStoryVersion = $storyVersion - 1;
- $this->dao->dbh($this->dbh)->update(TABLE_FILE)->set("extra = CONCAT(extra, '$storyVersion,')")
- ->where('objectType')->eq('story')
+ $this->dao->update(TABLE_FILE)->set("extra = CONCAT(extra, '$storyVersion,')")
+ ->where('objectType')->in('story,requirement')
->andWhere('objectID')->eq($storyID)
->andWhere('extra')->like("%,$oldStoryVersion,%")
->beginIF(!empty($deleteFiles))->andWhere('id')->notin($deleteFiles)->fi()
@@ -1152,7 +1152,7 @@ class fileModel extends model
public function deleteStoryFile($storyID, $storyVersion, $deleteFiles = array())
{
$deleteFileList = $this->dao->select('*')->from(TABLE_FILE)
- ->where('objectType')->eq('story')
+ ->where('objectType')->in('story,requirement')
->andWhere('objectID')->eq($storyID)
->andWhere('extra')->eq(",$storyVersion,")
->beginIF(!empty($deleteFiles))->andWhere('id')->in($deleteFiles)->fi()
@@ -1171,7 +1171,7 @@ class fileModel extends model
/* When the file is in multiple story versions, 'extra' need delete the version to be deleted. */
$this->dao->update(TABLE_FILE)->set("extra = REPLACE(extra, '$storyVersion,', '')")
- ->where('objectType')->eq('story')
+ ->where('objectType')->in('story,requirement')
->andWhere('objectID')->eq($storyID)
->andWhere('extra')->like("%,$storyVersion,%")
->beginIF(!empty($deleteFiles))->andWhere('id')->in($deleteFiles)->fi()
diff --git a/module/story/config.php b/module/story/config.php
index c3f2cf57cc..8dafb8abba 100644
--- a/module/story/config.php
+++ b/module/story/config.php
@@ -50,6 +50,8 @@ $config->story->custom->createFields = $config->story->list->customCreateFi
$config->story->custom->batchCreateFields = 'module,plan,spec,pri,estimate,review,%s';
$config->story->custom->batchEditFields = 'branch,module,plan,estimate,pri,source,stage,closedBy,closedReason';
+$config->story->excludeCheckFileds = ',uploadImage,category,reviewer,reviewDitto,';
+
global $lang, $app;
$config->story->datatable = new stdclass();
if($app->tab == 'execution')
diff --git a/module/story/model.php b/module/story/model.php
index 7608bd56d3..3f0060323c 100644
--- a/module/story/model.php
+++ b/module/story/model.php
@@ -501,7 +501,16 @@ class storyModel extends model
$data = array();
foreach($stories->title as $i => $title)
{
- if(empty($title)) continue;
+ if(empty($title))
+ {
+ if($this->common->checkValidRow('story', $stories, $i))
+ {
+ dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->story->title);
+ return false;
+ }
+
+ continue;
+ }
if(empty($stories->reviewer[$i]) and empty($stories->reviewerDitto[$i])) $stories->reviewer[$i] = array();
diff --git a/module/story/view/edit.html.php b/module/story/view/edit.html.php
index 4c523b8c79..d6c1cf8cc3 100644
--- a/module/story/view/edit.html.php
+++ b/module/story/view/edit.html.php
@@ -85,6 +85,8 @@
status) !== false ? html::textarea('verify', htmlSpecialString($story->verify), "rows='5' class='form-control'") : $story->verify;?>
+ status) === false and empty($files) ? false : true;?>
+
story->comment;?>
diff --git a/module/task/config.php b/module/task/config.php
index 96ca1d4d79..2cc5b81f4c 100644
--- a/module/task/config.php
+++ b/module/task/config.php
@@ -48,6 +48,8 @@ $config->task->custom->createFields = $config->task->customCreateFields;
$config->task->custom->batchCreateFields = 'module,story,assignedTo,estimate,desc,pri';
$config->task->custom->batchEditFields = 'module,assignedTo,status,pri,estimate,record,left';
+$config->task->excludeCheckFileds = ',pri,estStartedDitto,deadlineDitto,';
+
$config->task->datatable = new stdclass();
$config->task->datatable->defaultField = array('id', 'pri', 'name', 'status', 'assignedTo', 'finishedBy', 'estimate', 'consumed', 'left', 'progress', 'deadline', 'actions');
diff --git a/module/task/model.php b/module/task/model.php
index a34b5e12ff..54cb9ada59 100644
--- a/module/task/model.php
+++ b/module/task/model.php
@@ -353,7 +353,15 @@ class taskModel extends model
$estStarted = (!isset($tasks->estStarted[$i]) or isset($tasks->estStartedDitto[$i])) ? $estStarted : $tasks->estStarted[$i];
$deadline = (!isset($tasks->deadline[$i]) or isset($tasks->deadlineDitto[$i])) ? $deadline : $tasks->deadline[$i];
- if(empty($tasks->name[$i])) continue;
+ if(empty($tasks->name[$i]))
+ {
+ if($this->common->checkValidRow('task', $tasks, $i))
+ {
+ dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->task->name);
+ return false;
+ }
+ continue;
+ }
$data[$i] = new stdclass();
$data[$i]->story = (int)$story;
diff --git a/module/testcase/config.php b/module/testcase/config.php
index fb2bd8aa6d..46afbf4e76 100644
--- a/module/testcase/config.php
+++ b/module/testcase/config.php
@@ -32,6 +32,8 @@ $config->testcase->custom->createFields = $config->testcase->customCreateFi
$config->testcase->custom->batchCreateFields = 'module,story,%s';
$config->testcase->custom->batchEditFields = 'branch,module,stage,status,pri,story';
+$config->testcase->excludeCheckFileds = ',pri,type,stage,';
+
global $lang;
$config->testcase->search['module'] = 'testcase';
$config->testcase->search['fields']['title'] = $lang->testcase->title;
diff --git a/module/testcase/model.php b/module/testcase/model.php
index b626241bc0..76b1739229 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -155,7 +155,16 @@ class testcaseModel extends model
$data = array();
foreach($cases->title as $i => $title)
{
- if(empty($title)) continue;
+ if(empty($title))
+ {
+ if($this->common->checkValidRow('testcase', $cases, $i))
+ {
+ dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->testcase->title);
+ return false;
+ }
+
+ continue;
+ }
$data[$i] = new stdclass();
$data[$i]->product = $productID;
diff --git a/module/upgrade/model.php b/module/upgrade/model.php
index 8194c63ac3..375693aa78 100644
--- a/module/upgrade/model.php
+++ b/module/upgrade/model.php
@@ -7216,7 +7216,7 @@ class upgradeModel extends model
*/
public function updateStoryFile()
{
- $storyFileList = $this->dao->select('*')->from(TABLE_FILE)->where('objectType')->eq('story')->andWhere('extra')->ne('editor')->fetchAll('id');
+ $storyFileList = $this->dao->select('*')->from(TABLE_FILE)->where('objectType')->in('story,requirement')->andWhere('extra')->ne('editor')->fetchAll('id');
/* Get story version. */
$storyIDList = array();