diff --git a/module/bug/js/create.js b/module/bug/js/create.js
index 6b7e64477e..b602586a0a 100644
--- a/module/bug/js/create.js
+++ b/module/bug/js/create.js
@@ -14,7 +14,9 @@ function loadAllUsers()
var moduleID = $('#module').val();
var productID = $('#product').val();
setAssignedTo(moduleID, productID);
- $('#assignedTo').empty().append($(data).find('option')).trigger('chosen:updated').trigger('chosen:activate');
+ $('#assignedTo').replaceWith(data);
+ $('#assignedTo_chosen').remove();
+ $('#assignedTo').chosen();
}
});
}
diff --git a/module/execution/model.php b/module/execution/model.php
index ee2c4fb8ce..6f2eab0f95 100644
--- a/module/execution/model.php
+++ b/module/execution/model.php
@@ -1178,6 +1178,10 @@ class executionModel extends model
{
$link = helper::createLink($module, $method, "productID=0&branch=0&extra=executionID=%s");
}
+ elseif(in_array($module, array('bug', 'case', 'testtask', 'testreport')) and $method == 'view')
+ {
+ $link = helper::createLink('execution', $module, "executionID=%s");
+ }
else
{
$link = helper::createLink($module, $method, "executionID=%s");
diff --git a/module/file/control.php b/module/file/control.php
index e9c08f9a49..ff5e46caa4 100644
--- a/module/file/control.php
+++ b/module/file/control.php
@@ -63,7 +63,7 @@ class file extends control
die(json_encode(array('error' => 1, 'message' => $this->lang->file->errorFileUpload)));
}
}
- if(@helper::saveFile($file['tmpname'], $this->file->savePath . $this->file->getSaveName($file['pathname'])))
+ if(@move_uploaded_file($file['tmpname'], $this->file->savePath . $this->file->getSaveName($file['pathname'])))
{
/* Compress image for jpg and bmp. */
$file = $this->file->compressImage($file);
diff --git a/module/file/model.php b/module/file/model.php
index c798587d83..1a2252c579 100644
--- a/module/file/model.php
+++ b/module/file/model.php
@@ -262,7 +262,7 @@ class fileModel extends model
}
else
{
- if(!helper::saveFile($file['tmpname'], $tmpFileChunkPath)) return false;
+ if(!move_uploaded_file($file['tmpname'], $tmpFileChunkPath)) return false;
}
if($file['chunk'] == ($file['chunks'] - 1))
@@ -278,7 +278,7 @@ class fileModel extends model
}
else
{
- if(!helper::saveFile($file['tmpname'], $file['realpath'])) return false;
+ if(!move_uploaded_file($file['tmpname'], $file['realpath'])) return false;
$uploadFile['extension'] = $file['extension'];
$uploadFile['pathname'] = $file['pathname'];
@@ -471,7 +471,7 @@ class fileModel extends model
$pathName = $filePath->pathname;
$realPathName = $this->savePath . $this->getRealPathName($pathName);
if(!is_dir(dirname($realPathName))) mkdir(dirname($realPathName));
- helper::saveFile($file['tmpname'], $realPathName);
+ move_uploaded_file($file['tmpname'], $realPathName);
$file['pathname'] = $pathName;
$file = $this->compressImage($file);
@@ -966,4 +966,29 @@ class fileModel extends model
die();
}
}
+
+ /**
+ * Get image size.
+ *
+ * @access public
+ * @param object $file
+ * @return array
+ */
+ public function getImageSize($file)
+ {
+ if($this->config->file->storageType == 'fs')
+ {
+ return getimagesize($file->realPath);
+ }
+ else if($this->config->file->storageType == 's3')
+ {
+ $this->app->loadClass('ossclient', true);
+
+ $config = $this->config->file;
+ $ossClient = new ossclient($config->accessKeyId, $config->accessKeySecret, $config->endpoint, $config->bucket);
+ $info = $ossClient->getImageInfo($file->pathname);
+
+ return array($info->ImageWidth->value, $info->ImageHeight->value, 'img');
+ }
+ }
}
diff --git a/module/file/view/printfiles.html.php b/module/file/view/printfiles.html.php
index b7de5a98cf..e4c7c2a783 100644
--- a/module/file/view/printfiles.html.php
+++ b/module/file/view/printfiles.html.php
@@ -53,7 +53,7 @@ $sessionString .= session_name() . '=' . session_id();
$imageWidth = 0;
if(stripos('jpg|jpeg|gif|png|bmp', $file->extension) !== false)
{
- $imageSize = getimagesize($file->realPath);
+ $imageSize = $this->file->getImageSize($file);
$imageWidth = $imageSize ? $imageSize[0] : 0;
}
diff --git a/module/group/control.php b/module/group/control.php
index e8090b0030..588e4ea9b2 100644
--- a/module/group/control.php
+++ b/module/group/control.php
@@ -252,22 +252,23 @@ class group extends control
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('group', 'browse'), 'parent'));
}
- $group = $this->group->getById($groupID);
- $groupUsers = $this->group->getUserPairs($groupID);
- $allUsers = $this->loadModel('dept')->getDeptUserPairs($deptID);
- $otherUsers = array_diff_assoc($allUsers, $groupUsers);
+ $group = $this->group->getById($groupID);
+ $groupUsers = $this->group->getUserPairs($groupID);
+ $allUsers = $this->loadModel('dept')->getDeptUserPairs($deptID);
+ $otherUsers = array_diff_assoc($allUsers, $groupUsers);
+ $outsideUsers = $this->user->getPairs('outside|noclosed|noletter|noempty');
$title = $this->lang->company->common . $this->lang->colon . $group->name . $this->lang->colon . $this->lang->group->manageMember;
$position[] = $group->name;
$position[] = $this->lang->group->manageMember;
- $this->view->title = $title;
- $this->view->position = $position;
- $this->view->group = $group;
- $this->view->deptTree = $this->loadModel('dept')->getTreeMenu($rooteDeptID = 0, array('deptModel', 'createGroupManageMemberLink'), $groupID);
- $this->view->groupUsers = $groupUsers;
- $this->view->otherUsers = $otherUsers;
-
+ $this->view->title = $title;
+ $this->view->position = $position;
+ $this->view->group = $group;
+ $this->view->deptTree = $this->loadModel('dept')->getTreeMenu($rooteDeptID = 0, array('deptModel', 'createGroupManageMemberLink'), $groupID);
+ $this->view->groupUsers = $groupUsers;
+ $this->view->otherUsers = $otherUsers;
+ $this->view->outsideUsers = array_diff_assoc($outsideUsers, $groupUsers);
$this->display();
}
diff --git a/module/group/view/managemember.html.php b/module/group/view/managemember.html.php
index 5c0aefa6db..5a1cc302e0 100644
--- a/module/group/view/managemember.html.php
+++ b/module/group/view/managemember.html.php
@@ -48,8 +48,8 @@
|
-
-
+
+
|
@@ -58,6 +58,19 @@
|
+
+ |
+
+
+
+
+ |
+
+ $realname):?>
+ $realname), '');?>
+
+ |
+
|
dao->replace(TABLE_USERGROUP)->data($groupPriv)->exec();
}
+ if($project->acl != 'open') $this->loadModel('user')->updateUserView($projectID, 'project');
+
return $projectID;
}
}
diff --git a/module/repo/model.php b/module/repo/model.php
index 03ec69715a..acb8566700 100644
--- a/module/repo/model.php
+++ b/module/repo/model.php
@@ -1769,20 +1769,27 @@ class repoModel extends model
return $buildedURL;
}
- /**
- * Get gitlab projects.
- *
- * @param string $host
- * @param string $token
- * @access public
- * @return array
- */
- public function getGitlabProjects($host, $token)
- {
+ /**
+ * Get gitlab projects.
+ *
+ * @param string $host
+ * @param string $token
+ * @access public
+ * @return array
+ */
+ public function getGitlabProjects($host, $token)
+ {
$host = rtrim($host, '/');
$host .= '/api/v4/projects';
- $projects = file_get_contents($host . "?private_token=$token");
- return json_decode($projects);
- }
+ $allResults = array();
+ for($page = 1; true; $page ++)
+ {
+ $results = json_decode(file_get_contents($host . "?private_token=$token&page={$page}&per_page=100"));
+ if(empty($results)) break;
+ $allResults = $allResults + $results;
+ }
+
+ return $allResults;
+ }
}
diff --git a/module/upgrade/control.php b/module/upgrade/control.php
index 403469e06c..f51da2b2be 100644
--- a/module/upgrade/control.php
+++ b/module/upgrade/control.php
@@ -134,7 +134,7 @@ class upgrade extends control
if(!$this->upgrade->isError())
{
- if(!$this->config->systemMode && !isset($this->config->qcVersion)) $this->locate(inlink('to15Guide', "fromVersion=$fromVersion"));
+ if(!$this->config->systemMode && !isset($this->config->qcVersion) && strpos($fromVersion, 'max') === false) $this->locate(inlink('to15Guide', "fromVersion=$fromVersion"));
$this->locate(inlink('afterExec', "fromVersion=$fromVersion"));
}
diff --git a/module/upgrade/model.php b/module/upgrade/model.php
index cefc175566..5c8a6dbf4f 100644
--- a/module/upgrade/model.php
+++ b/module/upgrade/model.php
@@ -4199,6 +4199,7 @@ class upgradeModel extends model
$program->openedDate = helper::now();
$program->openedVersion = $this->config->version;
$program->acl = 'open';
+ $program->days = $this->computeDaysDelta($program->begin, $program->end);
$this->app->loadLang('program');
$this->app->loadLang('project');
@@ -4274,6 +4275,7 @@ class upgradeModel extends model
$project->status = $data->projectStatus;
$project->begin = $data->begin;
$project->end = isset($data->end) ? $data->end : LONG_TIME;
+ $project->days = $this->computeDaysDelta($project->begin, $project->end);
$project->PM = $data->PM;
$project->auth = 'extend';
$project->openedBy = $account;
@@ -4324,6 +4326,32 @@ class upgradeModel extends model
return array($programID, $projectID, $lineID);
}
+ /**
+ * Compute delta of two days.
+ *
+ * @param string begin
+ * @param string end
+ * @access public
+ * @return int
+ */
+ public function computeDaysDelta($begin, $end)
+ {
+ if($end == LONG_TIME) return 0;
+
+ $delta = helper::diffDate($end, $begin);
+ $week = date('w', strtotime($begin));
+ $weekend = 0;
+ for($i = 0; $i < $delta; $i++)
+ {
+ $week = $week % 7;
+ if($week == 0 or $week == 6) $weekend ++;
+
+ $week++;
+ }
+
+ return $delta - $weekend;
+ }
+
/**
* Replace program or project id for product and project linked objects.
*
@@ -4397,8 +4425,11 @@ class upgradeModel extends model
$this->dao->replace(TABLE_PROJECTCASE)->data($projectCase)->exec();
}
- /* Compute sprint path and grade. */
- $sprints = $this->dao->select('id, type, acl')->from(TABLE_PROJECT)->where('id')->in($sprintIdList)->fetchAll();
+ /* Compute sprint path, grade and the minimum start date and end date of the project. */
+ $project = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
+ $sprints = $this->dao->select('id, type, acl, begin, end')->from(TABLE_PROJECT)->where('id')->in($sprintIdList)->fetchAll();
+ $minBeginDate = $project->begin;
+ $maxEndData = $project->end;
foreach($sprints as $sprint)
{
$data = new stdclass();
@@ -4411,6 +4442,9 @@ class upgradeModel extends model
$data->lifetime = empty($sprint->lifetime) ? $sprint->type : $sprint->lifetime;
$this->dao->update(TABLE_PROJECT)->data($data)->where('id')->eq($sprint->id)->exec();
+
+ $minBeginDate = ($sprint->begin < $minBeginDate) ? $sprint->begin : $minBeginDate;
+ $maxEndData = $sprint->end > $maxEndData ? $sprint->end : $maxEndData;
}
/* Compute project date and status. */
@@ -4429,6 +4463,13 @@ class upgradeModel extends model
$data->closedDate = $maxRealEnd;
}
+ if($minBeginDate != $project->begin or $maxEndData != $project->end)
+ {
+ $data->begin = $minBeginDate;
+ $data->end = $maxEndData;
+ $data->days = $this->computeDaysDelta($data->begin, $data->end);
+ }
+
$this->dao->update(TABLE_PROJECT)->data($data)->where('id')->eq($projectID)->exec();
/* Set product and project relation. */
@@ -4481,8 +4522,10 @@ class upgradeModel extends model
$users = $this->dao->select('account')->from(TABLE_USER)->where('deleted')->eq('0')->fetchPairs('account', 'account');
/* Insert product and sprint team into project team. */
- $today = helper::today();
- foreach($teams as $account)
+ $today = helper::today();
+ $project = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
+ $projectMember = $this->dao->select('*')->from(TABLE_TEAM)->where('account')->in($teams)->fetchAll('account');
+ foreach($projectMember as $account => $user)
{
if(empty($account)) continue;
if(!isset($users[$account])) continue;
@@ -4491,7 +4534,10 @@ class upgradeModel extends model
$team->root = $projectID;
$team->type = 'project';
$team->account = $account;
+ $team->role = $user->role;
$team->join = $today;
+ $team->days = $project->days;
+ $team->hours = '7.0';
$this->dao->replace(TABLE_TEAM)->data($team)->exec();
}
diff --git a/module/user/model.php b/module/user/model.php
index 3b68f42bee..b21d70430b 100644
--- a/module/user/model.php
+++ b/module/user/model.php
@@ -192,6 +192,7 @@ class userModel extends model
* Get user info by ID.
*
* @param mix $userID
+ * @param string $field id|account
* @access public
* @return object|bool
*/
diff --git a/test/init.php b/test/init.php
index 93c3aa8626..5b362be7c9 100644
--- a/test/init.php
+++ b/test/init.php
@@ -46,8 +46,8 @@ function run($result)
/**
* Print expect data.
*
- * @param int $key
- * @param string $delimiter
+ * @param string $key
+ * @param string $delimiter
* @access public
* @return void
*/
@@ -96,6 +96,6 @@ function zdImport($table, $yaml, $count = 10)
global $app, $config;
$dns = "mysql://{$config->db->user}:{$config->db->password}@{$config->db->host}:{$config->db->port}/{$config->db->name}#utf8";
$table = trim($table, '`');
- $commad = "$config->zdPath -c $yaml -t $table -T -dns $dns --clear -n $count";
- system($commad);
+ $command = "$config->zdPath -c $yaml -t $table -T -dns $dns --clear -n $count";
+ system($command);
}
|