Merge branch '15.0.beta3' of https://gitlab.zcorp.cc/easycorp/zentaopms into 15.0.beta3
This commit is contained in:
@@ -1178,6 +1178,10 @@ class executionModel extends model
|
||||
{
|
||||
$link = helper::createLink($module, $method, "productID=0&branch=0&extra=executionID=%s");
|
||||
}
|
||||
elseif($module == 'bug' and $method == 'view')
|
||||
{
|
||||
$link = helper::createLink('execution', 'bug', "executionID=%s");
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = helper::createLink($module, $method, "executionID=%s");
|
||||
|
||||
@@ -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);
|
||||
|
||||
+28
-3
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1601,7 +1601,8 @@ class productModel extends model
|
||||
}
|
||||
elseif($module == 'testtask')
|
||||
{
|
||||
$link = helper::createLink($module, 'browse', "productID=%s" . ($branch ? "&branch=%s" : '&branch=0') . "&extra=$extra");
|
||||
$extra = $method != 'browse' ? '' : "&extra=$extra";
|
||||
$link = helper::createLink($module, 'browse', "productID=%s" . ($branch ? "&branch=%s" : '&branch=0') . $extra);
|
||||
}
|
||||
elseif($module == 'bug' && $method == 'view')
|
||||
{
|
||||
|
||||
@@ -815,6 +815,8 @@ class projectModel extends model
|
||||
$this->dao->replace(TABLE_USERGROUP)->data($groupPriv)->exec();
|
||||
}
|
||||
|
||||
if($project->acl != 'open') $this->loadModel('user')->updateUserView($projectID, 'project');
|
||||
|
||||
return $projectID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user