* code for batchcreate and batchedit with flow.
This commit is contained in:
@@ -235,9 +235,8 @@ class control extends baseControl
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return false;
|
||||
|
||||
$flow = $this->loadModel('workflow')->getByModule($this->moduleName);
|
||||
$action = $this->loadModel('workflowaction')->getByModuleAndAction($this->moduleName, $this->methodName);
|
||||
if($flow && $action) $this->loadModel('workflowhook')->execute($flow, $action, $objectID);
|
||||
$moduleName = $this->moduleName;
|
||||
return $this->$moduleName->executeHooks($objectID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,4 +65,53 @@ class model extends baseModel
|
||||
|
||||
return $this->loadModel('workflowfield')->processSubStatus($module, $record);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get flow extend fields.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getFlowExtendFields()
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return array();
|
||||
|
||||
return $this->loadModel('flow')->getExtendFields($this->app->getModuleName(), $this->app->getMethodName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check flow rule.
|
||||
*
|
||||
* @param object $field
|
||||
* @param string $value
|
||||
* @access public
|
||||
* @return bool|string
|
||||
*/
|
||||
public function checkFlowRule($field, $value)
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return false;
|
||||
|
||||
return $this->loadModel('flow')->checkRule($field, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute Hooks
|
||||
*
|
||||
* @param int $objectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function executeHooks($objectID)
|
||||
{
|
||||
if(!isset($this->config->bizVersion)) return false;
|
||||
|
||||
$moduleName = $this->app->getModuleName();
|
||||
$methodName = $this->app->getMethodName();
|
||||
|
||||
$action = $this->loadModel('workflowaction')->getByModuleAndAction($moduleName, $methodName);
|
||||
if($action and $action->extensionType == 'none') return false;
|
||||
|
||||
$flow = $this->loadModel('workflow')->getByModule($moduleName);
|
||||
if($flow && $action) $this->loadModel('workflowhook')->execute($flow, $action, $objectID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,6 +221,7 @@ class bugModel extends model
|
||||
}
|
||||
|
||||
if(isset($data->uploadImage)) $this->loadModel('file');
|
||||
$extendFields = $this->getFlowExtendFields();
|
||||
$bugs = array();
|
||||
foreach($data->title as $i => $title)
|
||||
{
|
||||
@@ -251,6 +252,13 @@ class bugModel extends model
|
||||
$bug->assignedDate = $now;
|
||||
}
|
||||
|
||||
foreach($extendFields as $extendField)
|
||||
{
|
||||
$bug->{$extendField->field} = htmlspecialchars($this->post->{$extendField->field}[$i]);
|
||||
$message = $this->checkFlowRule($extendField, $bug->{$extendField->field});
|
||||
if($message) die(js::alert($message));
|
||||
}
|
||||
|
||||
foreach(explode(',', $this->config->bug->create->requiredFields) as $field)
|
||||
{
|
||||
$field = trim($field);
|
||||
@@ -294,6 +302,9 @@ class bugModel extends model
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
$bugID = $this->dao->lastInsertID();
|
||||
|
||||
$this->executeHooks($bugID);
|
||||
|
||||
$this->loadModel('score')->create('bug', 'create', $bugID);
|
||||
if(!empty($data->uploadImage[$i]) and !empty($file))
|
||||
{
|
||||
@@ -719,6 +730,7 @@ class bugModel extends model
|
||||
}
|
||||
|
||||
/* Initialize bugs from the post data.*/
|
||||
$extendFields = $this->getFlowExtendFields();
|
||||
$oldBugs = $bugIDList ? $this->getByList($bugIDList) : array();
|
||||
foreach($bugIDList as $bugID)
|
||||
{
|
||||
@@ -758,6 +770,13 @@ class bugModel extends model
|
||||
$bug->assignedDate = $now;
|
||||
}
|
||||
|
||||
foreach($extendFields as $extendField)
|
||||
{
|
||||
$bug->{$extendField->field} = htmlspecialchars($this->post->{$extendField->field}[$i]);
|
||||
$message = $this->checkFlowRule($extendField, $bug->{$extendField->field});
|
||||
if($message) die(js::alert($message));
|
||||
}
|
||||
|
||||
$bugs[$bugID] = $bug;
|
||||
unset($bug);
|
||||
}
|
||||
@@ -778,6 +797,9 @@ class bugModel extends model
|
||||
if(!dao::isError())
|
||||
{
|
||||
if(!empty($bug->resolvedBy)) $this->loadModel('score')->create('bug', 'resolve', $bugID);
|
||||
|
||||
$this->executeHooks($bugID);
|
||||
|
||||
$allChanges[$bugID] = common::createChanges($oldBug, $bug);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
<th class='w-120px<?php echo zget($visibleFields, 'os', ' hidden') . zget($requiredFields, 'os', '', ' required');?>'><?php echo $lang->bug->os;?></th>
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'browser', ' hidden') . zget($requiredFields, 'browser', '', ' required');?>'><?php echo $lang->bug->browser;?></th>
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'keywords', ' hidden') . zget($requiredFields, 'keywords', '', ' required');?>'><?php echo $lang->bug->keywords;?></th>
|
||||
<?php
|
||||
$extendFields = $this->bug->getFlowExtendFields();
|
||||
foreach($extendFields as $extendField) echo "<th class='w-100px'>{$extendField->name}</th>";
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -110,6 +114,7 @@
|
||||
<td class='<?php echo zget($visibleFields, 'os', 'hidden')?>' style='overflow:visible'> <?php echo html::select("oses[$i]", $lang->bug->osList, $os, "class='form-control chosen'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'browser', 'hidden')?>' style='overflow:visible'> <?php echo html::select("browsers[$i]", $lang->bug->browserList, $browser, "class='form-control chosen'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'keywords', 'hidden')?>'><?php echo html::input("keywords[$i]", '', "class='form-control'");?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, '', $extendField->field . "[$i]") . "</td>";?>
|
||||
</tr>
|
||||
<?php $i++;?>
|
||||
<?php endforeach;?>
|
||||
@@ -152,6 +157,7 @@
|
||||
<td class='<?php echo zget($visibleFields, 'os', 'hidden')?>' style='overflow:visible'> <?php echo html::select("oses[$i]", $lang->bug->osList, $os, "class='form-control chosen'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'browser', 'hidden')?>' style='overflow:visible'> <?php echo html::select("browsers[$i]", $lang->bug->browserList, $browser, "class='form-control chosen'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'keywords', 'hidden')?>'><?php echo html::input("keywords[$i]", '', "class='form-control'");?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, '', $extendField->field . "[$i]") . "</td>";?>
|
||||
</tr>
|
||||
<?php endfor;?>
|
||||
</tbody>
|
||||
@@ -197,6 +203,7 @@
|
||||
<td class='<?php echo zget($visibleFields, 'os', 'hidden')?>' style='overflow:visible'> <?php echo html::select("oses[%s]", $lang->bug->osList, $os, "class='form-control chosen'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'browser', 'hidden')?>' style='overflow:visible'> <?php echo html::select("browsers[%s]", $lang->bug->browserList, $browser, "class='form-control chosen'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'keywords', 'hidden')?>'><?php echo html::input("keywords[%s]", '', "class='form-control'");?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, '', $extendField->field . "[%s]") . "</td>";?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -64,6 +64,10 @@
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'keywords', ' hidden') . zget($requiredFields, 'keywords', '', ' required');?>'><?php echo $lang->bug->keywords;?></th>
|
||||
<th class='w-120px<?php echo zget($visibleFields, 'resolvedBy', ' hidden')?>'><?php echo $lang->bug->resolvedByAB;?></th>
|
||||
<th class='w-150px<?php echo zget($visibleFields, 'resolution', ' hidden')?>'><?php echo $lang->bug->resolutionAB;?></th>
|
||||
<?php
|
||||
$extendFields = $this->bug->getFlowExtendFields();
|
||||
foreach($extendFields as $extendField) echo "<th class='w-100px'>{$extendField->name}</th>";
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -128,6 +132,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $bug, $extendField->field . "[{$bugID}]") . "</td>";?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
+23
-3
@@ -301,8 +301,9 @@ class storyModel extends model
|
||||
|
||||
if(isset($stories->uploadImage)) $this->loadModel('file');
|
||||
|
||||
$forceReview = $this->checkForceReview();
|
||||
$data = array();
|
||||
$extendFields = $this->getFlowExtendFields();
|
||||
$forceReview = $this->checkForceReview();
|
||||
$data = array();
|
||||
foreach($stories->title as $i => $title)
|
||||
{
|
||||
if(empty($title)) continue;
|
||||
@@ -323,6 +324,13 @@ class storyModel extends model
|
||||
$story->openedDate = $now;
|
||||
$story->version = 1;
|
||||
|
||||
foreach($extendFields as $extendField)
|
||||
{
|
||||
$story->{$extendField->field} = htmlspecialchars($this->post->{$extendField->field}[$i]);
|
||||
$message = $this->checkFlowRule($extendField, $story->{$extendField->field});
|
||||
if($message) die(js::alert($message));
|
||||
}
|
||||
|
||||
foreach(explode(',', $this->config->story->create->requiredFields) as $field)
|
||||
{
|
||||
$field = trim($field);
|
||||
@@ -364,7 +372,7 @@ class storyModel extends model
|
||||
unset($file['realpath']);
|
||||
|
||||
if(!is_dir($this->file->savePath)) mkdir($this->file->savePath, 0777, true);
|
||||
if(rename($realPath, $this->file->savePath . $this->file->getSaveName($file['pathname'])))
|
||||
if($realPath and rename($realPath, $this->file->savePath . $this->file->getSaveName($file['pathname'])))
|
||||
{
|
||||
$file['addedBy'] = $this->app->user->account;
|
||||
$file['addedDate'] = $now;
|
||||
@@ -387,6 +395,8 @@ class storyModel extends model
|
||||
|
||||
$this->dao->insert(TABLE_STORYSPEC)->data($specData)->exec();
|
||||
|
||||
$this->executeHooks($storyID);
|
||||
|
||||
$actionID = $this->action->create('story', $storyID, 'Opened', '');
|
||||
if(!dao::isError()) $this->loadModel('score')->create('story', 'create',$storyID);
|
||||
$mails[$i] = new stdclass();
|
||||
@@ -796,6 +806,7 @@ class storyModel extends model
|
||||
if(isset($data->closedReasons[$storyID])) $prev['closedReason'] = $data->closedReasons[$storyID];
|
||||
}
|
||||
|
||||
$extendFields = $this->getFlowExtendFields();
|
||||
foreach($storyIdList as $storyID)
|
||||
{
|
||||
$oldStory = $oldStories[$storyID];
|
||||
@@ -830,6 +841,13 @@ class storyModel extends model
|
||||
if($story->closedBy != false or $story->closedReason != false) $story->status = 'closed';
|
||||
if($story->closedReason != false and $story->closedBy == false) $story->closedBy = $this->app->user->account;
|
||||
|
||||
foreach($extendFields as $extendField)
|
||||
{
|
||||
$story->{$extendField->field} = htmlspecialchars($this->post->{$extendField->field}[$i]);
|
||||
$message = $this->checkFlowRule($extendField, $story->{$extendField->field});
|
||||
if($message) die(js::alert($message));
|
||||
}
|
||||
|
||||
$stories[$storyID] = $story;
|
||||
}
|
||||
|
||||
@@ -857,6 +875,8 @@ class storyModel extends model
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
$this->executeHooks($storyID);
|
||||
|
||||
$this->setStage($storyID);
|
||||
if($story->closedReason == 'done') $this->loadModel('score')->create('story', 'close');
|
||||
$allChanges[$storyID] = common::createChanges($oldStory, $story);
|
||||
|
||||
@@ -56,6 +56,10 @@
|
||||
<th class='col-estimate<?php echo zget($visibleFields, 'estimate', ' hidden') . zget($requiredFields, 'estimate', '', ' required');?>'><?php echo $lang->story->estimate;?></th>
|
||||
<th class='col-review<?php echo zget($visibleFields, 'review', ' hidden') . zget($requiredFields, 'review', '', ' required');?>'><?php echo $lang->story->needReview;?></th>
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'keywords', ' hidden') . zget($requiredFields, 'keywords', '', ' required');?>'><?php echo $lang->story->keywords;?></th>
|
||||
<?php
|
||||
$extendFields = $this->story->getFlowExtendFields();
|
||||
foreach($extendFields as $extendField) echo "<th class='w-100px'>{$extendField->name}</th>";
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -88,6 +92,7 @@
|
||||
<td class='<?php echo zget($visibleFields, 'estimate', 'hidden')?>'><?php echo html::input('estimate[$id]', $estimate, "class='form-control'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'review', 'hidden')?>'><?php echo html::select('needReview[$id]', $lang->story->reviewList, $needReview, "class='form-control'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'keywords', 'hidden')?>'><?php echo html::input('keywords[$id]', '', "class='form-control'");?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, '', $extendField->field . '[$id]') . "</td>";?>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
||||
@@ -53,6 +53,10 @@ foreach(explode(',', $showFields) as $field)
|
||||
<th class='w-130px<?php echo zget($visibleFields, 'closedBy', ' hidden')?>'><?php echo $lang->story->closedBy;?></th>
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'closedReason', ' hidden')?>'> <?php echo $lang->story->closedReason;?></th>
|
||||
<th class='w-80px<?php echo zget($visibleFields, 'keywords', ' hidden')?>'><?php echo $lang->story->keywords;?></th>
|
||||
<?php
|
||||
$extendFields = $this->story->getFlowExtendFields();
|
||||
foreach($extendFields as $extendField) echo "<th class='w-100px'>{$extendField->name}</th>";
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -143,6 +147,7 @@ foreach(explode(',', $showFields) as $field)
|
||||
<td <?php echo zget($visibleFields, 'closedReason', "class='hidden'")?>><?php echo html::select("closedReasons[$storyID]", $reasonList, $story->closedReason, 'class="form-control" disabled="disabled"');?></td>
|
||||
<?php endif;?>
|
||||
<td <?php echo zget($visibleFields, 'keywords', "class='hidden'")?>><?php echo html::input("keywords[$storyID]", $story->keywords, 'class="form-control"');?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $story, $extendField->field . "[{$storyID}]") . "</td>";?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
+25
-3
@@ -246,7 +246,8 @@ class taskModel extends model
|
||||
$assignedTo = '';
|
||||
|
||||
/* Get task data. */
|
||||
$data = array();
|
||||
$extendFields = $this->getFlowExtendFields();
|
||||
$data = array();
|
||||
foreach($tasks->name as $i => $name)
|
||||
{
|
||||
$story = !isset($tasks->story[$i]) || $tasks->story[$i] == 'ditto' ? $story : $tasks->story[$i];
|
||||
@@ -278,6 +279,17 @@ class taskModel extends model
|
||||
if($assignedTo) $data[$i]->assignedDate = $now;
|
||||
if(strpos($this->config->task->create->requiredFields, 'estStarted') !== false and empty($tasks->estStarted[$i])) $data[$i]->estStarted = '';
|
||||
if(strpos($this->config->task->create->requiredFields, 'deadline') !== false and empty($tasks->deadline[$i])) $data[$i]->deadline = '';
|
||||
|
||||
foreach($extendFields as $extendField)
|
||||
{
|
||||
$data[$i]->{$extendField->field} = htmlspecialchars($this->post->{$extendField->field}[$i]);
|
||||
$message = $this->checkFlowRule($extendField, $data[$i]->{$extendField->field});
|
||||
if($message)
|
||||
{
|
||||
dao::$errors['message'][] = sprintf($message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix bug #1525*/
|
||||
@@ -289,7 +301,6 @@ class taskModel extends model
|
||||
/* check data. */
|
||||
foreach($data as $i => $task)
|
||||
{
|
||||
|
||||
if($task->deadline != '0000-00-00' and $task->deadline < $task->estStarted)
|
||||
{
|
||||
dao::$errors['message'][] = $this->lang->task->error->deadlineSmall;
|
||||
@@ -327,6 +338,9 @@ class taskModel extends model
|
||||
$taskID = $this->dao->lastInsertID();
|
||||
$childTasks .= $taskID . ',';
|
||||
if($story) $this->story->setStage($task->story);
|
||||
|
||||
$this->executeHooks($taskID);
|
||||
|
||||
$actionID = $this->action->create('task', $taskID, 'Opened', '');
|
||||
if(!dao::isError()) $this->loadModel('score')->create('task', 'create', $taskID);
|
||||
|
||||
@@ -905,7 +919,8 @@ class taskModel extends model
|
||||
}
|
||||
|
||||
/* Initialize tasks from the post data.*/
|
||||
$oldTasks = $taskIDList ? $this->getByList($taskIDList) : array();
|
||||
$extendFields = $this->getFlowExtendFields();
|
||||
$oldTasks = $taskIDList ? $this->getByList($taskIDList) : array();
|
||||
foreach($taskIDList as $taskID)
|
||||
{
|
||||
$oldTask = $oldTasks[$taskID];
|
||||
@@ -934,6 +949,13 @@ class taskModel extends model
|
||||
$task->lastEditedDate = $now;
|
||||
$task->consumed = $oldTask->consumed;
|
||||
|
||||
foreach($extendFields as $extendField)
|
||||
{
|
||||
$task->{$extendField->field} = htmlspecialchars($this->post->{$extendField->field}[$i]);
|
||||
$message = $this->checkFlowRule($extendField, $task->{$extendField->field});
|
||||
if($message) die(js::alert($message));
|
||||
}
|
||||
|
||||
if($data->consumeds[$taskID])
|
||||
{
|
||||
if($data->consumeds[$taskID] < 0)
|
||||
|
||||
@@ -70,6 +70,10 @@
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'deadline', ' hidden') . zget($requiredFields, 'deadline', '', ' required');?>'><?php echo $lang->task->deadline;?></th>
|
||||
<th class='w-150px<?php echo zget($visibleFields, 'desc', ' hidden') . zget($requiredFields, 'desc', '', ' required');?>'><?php echo $lang->task->desc;?></th>
|
||||
<th class='w-80px<?php echo zget($visibleFields, 'pri', ' hidden') . zget($requiredFields, 'pri', '', ' required');?>'><?php echo $lang->task->pri;?></th>
|
||||
<?php
|
||||
$extendFields = $this->task->getFlowExtendFields();
|
||||
foreach($extendFields as $extendField) echo "<th class='w-100px'>{$extendField->name}</th>";
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -132,6 +136,7 @@
|
||||
<td <?php echo zget($visibleFields, 'deadline', "class='hidden'")?>><?php echo html::input("deadline[$i]", '', "class='form-control text-center form-date'");?></td>
|
||||
<td <?php echo zget($visibleFields, 'desc', "class='hidden'")?>><?php echo html::textarea("desc[$i]", '', "rows='1' class='form-control autosize'");?></td>
|
||||
<td <?php echo zget($visibleFields, 'pri', "class='hidden'")?>><?php echo html::select("pri[$i]", (array)$lang->task->priList, $pri, 'class=form-control');?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, '', $extendField->field . "[$i]") . "</td>";?>
|
||||
</tr>
|
||||
<?php endfor;?>
|
||||
</tbody>
|
||||
@@ -184,6 +189,7 @@
|
||||
<td <?php echo zget($visibleFields, 'deadline', "class='hidden'")?>><?php echo html::input("deadline[%s]", '', "class='form-control text-center form-date'");?></td>
|
||||
<td <?php echo zget($visibleFields, 'desc', "class='hidden'")?>><?php echo html::textarea("desc[%s]", '', "rows='1' class='form-control autosize'");?></td>
|
||||
<td <?php echo zget($visibleFields, 'pri', "class='hidden'")?>><?php echo html::select("pri[%s]", (array)$lang->task->priList, $pri, 'class=form-control');?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, '', $extendField->field . "[%s]") . "</td>";?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -66,6 +66,10 @@
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'canceledBy', ' hidden') . zget($requiredFields, 'canceledBy', '', ' required');?>'><?php echo $lang->task->canceledBy;?></th>
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'closedBy', ' hidden') . zget($requiredFields, 'closedBy', '', ' required');?>'><?php echo $lang->task->closedBy;?></th>
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'closedReason', ' hidden') . zget($requiredFields, 'closedReason', '', ' required');?>'><?php echo $lang->task->closedReason;?></th>
|
||||
<?php
|
||||
$extendFields = $this->task->getFlowExtendFields();
|
||||
foreach($extendFields as $extendField) echo "<th class='w-100px'>{$extendField->name}</th>";
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -111,6 +115,7 @@
|
||||
<td class='text-left<?php echo zget($visibleFields, 'canceledBy', ' hidden')?>' style='overflow:visible'><?php echo html::select("canceledBys[$taskID]", $members, $tasks[$taskID]->canceledBy, "class='form-control chosen'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'closedBy', ' hidden')?>' style='overflow:visible'><?php echo html::select("closedBys[$taskID]", $members, $tasks[$taskID]->closedBy, "class='form-control chosen'");?></td>
|
||||
<td <?php echo zget($visibleFields, 'closedReason', "class='hidden'")?>><?php echo html::select("closedReasons[$taskID]", $lang->task->reasonList, $tasks[$taskID]->closedReason, 'class=form-control');?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $tasks[$taskID], $extendField->field . "[{$taskID}]") . "</td>";?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
@@ -272,6 +272,7 @@ class testcaseModel extends model
|
||||
}
|
||||
|
||||
$this->loadModel('story');
|
||||
$extendFields = $this->getFlowExtendFields();
|
||||
$storyVersions = array();
|
||||
$forceNotReview = $this->forceNotReview();
|
||||
$data = array();
|
||||
@@ -304,6 +305,13 @@ class testcaseModel extends model
|
||||
$storyVersions[$caseStory] = $data[$i]->storyVersion;
|
||||
}
|
||||
|
||||
foreach($extendFields as $extendField)
|
||||
{
|
||||
$data[$i]->{$extendField->field} = htmlspecialchars($this->post->{$extendField->field}[$i]);
|
||||
$message = $this->checkFlowRule($extendField, $data[$i]->{$extendField->field});
|
||||
if($message) die(js::alert($message));
|
||||
}
|
||||
|
||||
foreach(explode(',', $this->config->testcase->create->requiredFields) as $field)
|
||||
{
|
||||
$field = trim($field);
|
||||
@@ -324,7 +332,10 @@ class testcaseModel extends model
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
$caseID = $this->dao->lastInsertID();
|
||||
$caseID = $this->dao->lastInsertID();
|
||||
|
||||
$this->executeHooks($caseID);
|
||||
|
||||
$this->loadModel('score')->create('testcase', 'create', $caseID);
|
||||
$actionID = $this->loadModel('action')->create('case', $caseID, 'Opened');
|
||||
}
|
||||
@@ -840,6 +851,7 @@ class testcaseModel extends model
|
||||
}
|
||||
|
||||
/* Initialize cases from the post data.*/
|
||||
$extendFields = $this->getFlowExtendFields();
|
||||
foreach($caseIDList as $caseID)
|
||||
{
|
||||
$case = new stdclass();
|
||||
@@ -857,6 +869,13 @@ class testcaseModel extends model
|
||||
$case->type = $data->types[$caseID];
|
||||
$case->stage = empty($data->stages[$caseID]) ? '' : implode(',', $data->stages[$caseID]);
|
||||
|
||||
foreach($extendFields as $extendField)
|
||||
{
|
||||
$case->{$extendField->field} = htmlspecialchars($this->post->{$extendField->field}[$i]);
|
||||
$message = $this->checkFlowRule($extendField, $case->{$extendField->field});
|
||||
if($message) die(js::alert($message));
|
||||
}
|
||||
|
||||
$cases[$caseID] = $case;
|
||||
unset($case);
|
||||
}
|
||||
@@ -873,6 +892,8 @@ class testcaseModel extends model
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
$this->executeHooks($caseID);
|
||||
|
||||
unset($oldCase->steps);
|
||||
$allChanges[$caseID] = common::createChanges($oldCase, $case);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,10 @@
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'keywords', ' hidden') . zget($requiredFields, 'keywords', '', ' required')?>'><?php echo $lang->testcase->keywords;?></th>
|
||||
<th class='w-140px<?php echo zget($visibleFields, 'stage', ' hidden') . zget($requiredFields, 'stage', '', ' required')?>'><?php echo $lang->testcase->stage;?></th>
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'review', ' hidden') . zget($requiredFields, 'review', '', ' required')?>'><?php echo $lang->testcase->review;?></th>
|
||||
<?php
|
||||
$extendFields = $this->testcase->getFlowExtendFields();
|
||||
foreach($extendFields as $extendField) echo "<th class='w-100px'>{$extendField->name}</th>";
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -99,6 +103,7 @@
|
||||
<td class='<?php echo zget($visibleFields, 'keywords', 'hidden')?>'> <?php echo html::input("keywords[$i]", '', "class='form-control'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'stage', ' hidden')?>' style='overflow:visible'><?php echo html::select("stage[$i][]", $lang->testcase->stageList, '', "class='form-control chosen' multiple");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'review', 'hidden')?>'><?php echo html::select("needReview[$i]", $lang->testcase->reviewList, $needReview, "class='form-control'");?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, '', $extendField->field . "[$i]") . "</td>";?>
|
||||
</tr>
|
||||
<?php endfor;?>
|
||||
</tbody>
|
||||
@@ -139,6 +144,7 @@
|
||||
<td class='<?php echo zget($visibleFields, 'keywords', 'hidden')?>'> <?php echo html::input("keywords[%s]", '', "class='form-control'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'stage', ' hidden')?>' style='overflow:visible'><?php echo html::select("stage[%s][]", $lang->testcase->stageList, '', "class='form-control chosen' multiple");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'review', 'hidden')?>'><?php echo html::select("needReview[%s]", $lang->testcase->reviewList, $needReview, "class='form-control chosen'");?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, '', $extendField->field . "[%s]") . "</td>";?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -57,6 +57,10 @@
|
||||
<th class='<?php echo zget($visibleFields, 'precondition', 'hidden') . zget($requiredFields, 'precondition', '', ' required');?>'><?php echo $lang->testcase->precondition;?></th>
|
||||
<th class='w-100px<?php echo zget($visibleFields, 'keywords', ' hidden') . zget($requiredFields, 'keywords', '', ' required');?>'><?php echo $lang->testcase->keywords;?></th>
|
||||
<th class='w-250px<?php echo zget($visibleFields, 'stage', ' hidden') . zget($requiredFields, 'stage', '', ' required');?>'><?php echo $lang->testcase->stage;?></th>
|
||||
<?php
|
||||
$extendFields = $this->testcase->getFlowExtendFields();
|
||||
foreach($extendFields as $extendField) echo "<th class='w-100px'>{$extendField->name}</th>";
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -109,6 +113,7 @@
|
||||
<td class='<?php echo zget($visibleFields, 'precondition', 'hidden')?>'><?php echo html::textarea("precondition[$caseID]", $cases[$caseID]->precondition, "rows='1' class='form-control autosize'")?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'keywords', 'hidden')?>'> <?php echo html::input("keywords[$caseID]", $cases[$caseID]->keywords, "class='form-control'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'stage', ' hidden')?>' style='overflow:visible'><?php echo html::select("stages[$caseID][]", $lang->testcase->stageList, $cases[$caseID]->stage, "class='form-control chosen' multiple data-placeholder='{$lang->testcase->stage}'");?></td>
|
||||
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $cases[$caseID], $extendField->field . "[{$caseID}]") . "</td>";?>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user