* adjust code.

This commit is contained in:
z
2020-07-01 17:47:54 +08:00
parent ceecc58272
commit 36dfb8eb36
22 changed files with 41 additions and 22 deletions
+7 -1
View File
@@ -1106,7 +1106,13 @@ class baseDAO
{
${"arg$i"} = isset($funcArgs[$i + 2]) ? $funcArgs[$i + 2] : null;
}
if(strtolower($funcName) == 'notempty' and !empty($selectFields) and strpos(",{$selectFields},", ",{$fieldName},") !== false) $arg0 = $fieldName;
/* When check not empty and field is select, then use empty function to check. */
if(strtolower($funcName) == 'notempty')
{
$arg0 = false;
if(!empty($selectFields) and strpos(",{$selectFields},", ",{$fieldName},") !== false) $arg0 = true;
}
$checkFunc = 'check' . $funcName;
if(validater::$checkFunc($value, $arg0, $arg1, $arg2) === false)
+4 -3
View File
@@ -324,15 +324,16 @@ class baseValidater
* Not empty checking.
*
* @param mixed $var
* @param string $fieldName
* @param bool $useEmpty
* @static
* @access public
* @return bool
*/
public static function checkNotEmpty($var, $fieldName = '')
public static function checkNotEmpty($var, $useEmpty = false)
{
$var = trim($var);
if($fieldName) return !empty($var);
if($useEmpty) return !empty($var);
return strlen($var) != 0;
}
+4
View File
@@ -50,6 +50,7 @@ class dingapi
/**
* Get all users.
*
* @param string $whiteListDept
* @access public
* @return array
*/
@@ -79,6 +80,7 @@ class dingapi
/**
* Get all depts.
*
* @param string $whiteList
* @access public
* @return array
*/
@@ -87,6 +89,7 @@ class dingapi
$response = $this->queryAPI($this->apiUrl . "department/list?access_token={$this->token}");
if($this->isError()) return false;
/* Get parent and white list parent dept id list. */
if($whiteList)
{
$parentIdList = array();
@@ -110,6 +113,7 @@ class dingapi
continue;
}
/* Check this dept belong to white list. */
$isWhiteList = false;
$parentID = $dept->parentid;
while(isset($parentIdList[$parentID]))
+1 -1
View File
@@ -844,7 +844,7 @@ class actionModel extends model
}
/* If action type is login or logout, needn't link. */
if($actionType == 'svncommited')
if($actionType == 'svncommited' or $actionType == 'gitcommited')
{
$action->actor = isset($commiters[$action->actor]) ? $commiters[$action->actor] : $action->actor;
}
+1 -1
View File
@@ -2,7 +2,7 @@
$config->bug = new stdClass();
$config->bug->batchCreate = 10;
$config->bug->longlife = 7;
$config->bug->selectFields = 'module,project,pri,severity,type,story,task,os,browser,plan,assignedTo,resolvedBuild';
$config->bug->selectFields = 'module,project,openedBuild,resolution,pri,severity,type,story,task,os,browser,plan,assignedTo,resolvedBuild';
$config->bug->create = new stdclass();
$config->bug->edit = new stdclass();
+1
View File
@@ -1605,6 +1605,7 @@ class bug extends control
}
/* Set related files. */
$bug->files = '';
if(isset($relatedFiles[$bug->id]))
{
foreach($relatedFiles[$bug->id] as $file)
+2
View File
@@ -8,3 +8,5 @@ $config->build->edit->requiredFields = 'product,project,name,builder,date';
$config->build->editor = new stdclass();
$config->build->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
$config->build->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
$config->build->selectFields = 'product,project,builder';
-2
View File
@@ -446,7 +446,6 @@ class build extends control
/* Load pager. */
$this->app->loadClass('pager', $static = true);
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
$pager = new pager($recTotal, $recPerPage, $pageID);
/* Build search form. */
@@ -563,7 +562,6 @@ class build extends control
/* Load pager. */
$this->app->loadClass('pager', $static = true);
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
$pager = new pager($recTotal, $recPerPage, $pageID);
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
-1
View File
@@ -208,7 +208,6 @@ class buildModel extends model
->get();
if($this->config->global->flow == 'onlyTest') $build->project = 0;
if(empty($build->product)) return dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->build->product);
$build = $this->loadModel('file')->processImgURL($build, $this->config->build->editor->create['id'], $this->post->uid);
$this->dao->insert(TABLE_BUILD)->data($build)
+2 -1
View File
@@ -205,7 +205,8 @@ class fileModel extends model
$file['title'] = $purifier->purify($file['title']);
$file['size'] = $_POST['size'];
$file['tmpname'] = $tmp_name;
$file['uuid'] = str_replace(array('.', DS), '', $_POST['uuid']);
/* Fix for build uuid like '../../'. */
$file['uuid'] = str_replace(array('.', '/', '\\'), '', $_POST['uuid']);
$file['pathname'] = $this->setPathName(0, $file['extension']);
$file['chunkpath'] = 'chunks' . DS .'f_' . $file['uuid'] . '.' . $file['extension'] . '.part';
$file['chunks'] = isset($_POST['chunks']) ? intval($_POST['chunks']) : 0;
+2 -2
View File
@@ -28,11 +28,11 @@
<button type="button" class="btn btn-link file-input-delete"><?php echo $lang->delete;?></button>
</div>
</div>
<input type="file" name="<?php echo $filesName;?>[]" onchange="checkExtension(this)" />
<input type="file" name="<?php echo $filesName;?>[]" onchange="checkDangerExtension(this)" />
</div>
</div>
<script>
function checkExtension(obj)
function checkDangerExtension(obj)
{
var fileName = $(obj).val();
var index = fileName.lastIndexOf(".");
+2
View File
@@ -4,3 +4,5 @@ $config->job->create = new stdclass();
$config->job->edit = new stdclass();
$config->job->create->requiredFields = 'name,repo,jkHost,jkJob,triggerType';
$config->job->edit->requiredFields = 'name,repo,jkHost,jkJob,triggerType';
$config->job->selectFields = 'repo,jkHost,jkJob,triggerType';
+2
View File
@@ -8,3 +8,5 @@ $config->release->edit->requiredFields = 'name,date,build';
$config->release->editor = new stdclass();
$config->release->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
$config->release->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
$config->release->selectFields = 'build';
-2
View File
@@ -389,7 +389,6 @@ class release extends control
/* Load pager. */
$this->app->loadClass('pager', $static = true);
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
$pager = new pager($recTotal, $recPerPage, $pageID);
/* Build search form. */
@@ -507,7 +506,6 @@ class release extends control
/* Load pager. */
$this->app->loadClass('pager', $static = true);
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
$pager = new pager($recTotal, $recPerPage, $pageID);
/* Build the search form. */
+1 -1
View File
@@ -4,7 +4,7 @@ $config->story = new stdclass();
$config->story->batchCreate = 10;
$config->story->affectedFixedNum = 7;
$config->story->needReview = 1;
$config->story->selectFields = 'module,plan,source,pri';
$config->story->selectFields = 'module,plan,source,pri,closedReason,assignedTo,reviewedBy';
$config->story->batchClose = new stdclass();
$config->story->batchClose->columns = 10;
+2 -1
View File
@@ -914,10 +914,10 @@ class storyModel extends model
$now = helper::now();
$date = helper::today();
$story = fixer::input('post')
->remove('result,preVersion,comment')
->setDefault('reviewedDate', $date)
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->setDefault('reviewedBy', '')
->setIF($this->post->result == 'pass' and $oldStory->status == 'draft', 'status', 'active')
->setIF($this->post->result == 'pass' and $oldStory->status == 'changed', 'status', 'active')
->setIF($this->post->result == 'reject', 'closedBy', $this->app->user->account)
@@ -932,6 +932,7 @@ class storyModel extends model
->removeIF($this->post->result == 'reject' and $this->post->closedReason != 'duplicate', 'duplicateStory')
->removeIF($this->post->result == 'reject' and $this->post->closedReason != 'subdivided', 'childStories')
->join('reviewedBy', ',')
->remove('result,preVersion,comment')
->get();
/* fix bug #671. */
+2 -2
View File
@@ -1,7 +1,7 @@
<?php
$config->task = new stdclass();
$config->task->batchCreate = 10;
$config->task->selectFields = 'story,pri,assignedTo';
$config->task->selectFields = 'project,type,story,module,pri,assignedTo';
$config->task->create = new stdclass();
$config->task->edit = new stdclass();
@@ -9,7 +9,7 @@ $config->task->start = new stdclass();
$config->task->finish = new stdclass();
$config->task->activate = new stdclass();
$config->task->create->requiredFields = 'name,type';
$config->task->create->requiredFields = 'project,name,type';
$config->task->edit->requiredFields = $config->task->create->requiredFields;
$config->task->finish->requiredFields = 'currentConsumed';
$config->task->activate->requiredFields = 'left';
+1 -1
View File
@@ -1502,9 +1502,9 @@ class task extends control
$task->lastEditedDate = substr($task->lastEditedDate, 0, 10);
/* Set related files. */
$task->files = '';
if(isset($relatedFiles[$task->id]))
{
$task->files = '';
foreach($relatedFiles[$task->id] as $file)
{
$fileURL = common::getSysURL() . $this->createLink('file', 'download', "fileID={$file->id}");
+2 -2
View File
@@ -49,13 +49,12 @@ class taskModel extends model
->setIF(is_numeric($this->post->left), 'left', (float)$this->post->left)
->setDefault('openedBy', $this->app->user->account)
->setDefault('openedDate', helper::now())
->cleanINT('project,story')
->cleanINT('project,story,module')
->stripTags($this->config->task->editor->create['id'], $this->config->allowedTags)
->join('mailto', ',')
->remove('after,files,labels,assignedTo,uid,storyEstimate,storyDesc,storyPri,team,teamEstimate,teamMember,multiple,teams,contactListMenu,selectTestStory,testStory,testPri,testEstStarted,testDeadline,testAssignedTo,testEstimate')
->get();
if($task->type != 'test') $this->post->set('selectTestStory', 0);
if($task->project == 0) $task->project = '';
foreach($this->post->assignedTo as $assignedTo)
{
@@ -755,6 +754,7 @@ class taskModel extends model
->setDefault('lastEditedBy', $this->app->user->account)
->add('lastEditedDate', $now)
->stripTags($this->config->task->editor->edit['id'], $this->config->allowedTags)
->cleanINT('project,story,module')
->join('mailto', ',')
->remove('comment,files,labels,uid,multiple,team,teamEstimate,teamConsumed,teamLeft,contactListMenu')
->get();
+1 -1
View File
@@ -3,7 +3,7 @@ $config->testcase = new stdclass();
$config->testcase->defaultSteps = 3;
$config->testcase->batchCreate = 10;
$config->testcase->needReview = 0;
$config->testcase->selectFields = 'lib,stage,story,pri,status';
$config->testcase->selectFields = 'lib,stage,type,story,pri,status';
$config->testcase->create = new stdclass();
$config->testcase->edit = new stdclass();
+2
View File
@@ -8,3 +8,5 @@ $config->testreport->edit->requiredFields = 'title,owner';
$config->testreport->editor = new stdclass();
$config->testreport->editor->create = array('id' => 'report', 'tools' => 'simpleTools');
$config->testreport->editor->edit = array('id' => 'report', 'tools' => 'simpleTools');
$config->testreport->selectFields = 'owner';
+2
View File
@@ -5,6 +5,8 @@ $config->testtask->edit = new stdclass();
$config->testtask->create->requiredFields = 'project,build,begin,end,name';
$config->testtask->edit->requiredFields = 'project,build,begin,end,name';
$config->testtask->selectFields = 'project,build,owner';
$config->testtask->importunitresult = new stdclass();
$config->testtask->importunitresult->requiredFields = 'project,build,begin,end,name,resultFile';