Merge branch release/21.7.5 of zentao/zentaopms (#10919)
This commit is contained in:
@@ -1220,10 +1220,24 @@ const actionsMap =
|
||||
const lang = getLang();
|
||||
const canEdit = !isReadonly && privs.edit && (!doc.privs || doc.privs.edit !== false) && privs.editFile;
|
||||
const canDelete = !isReadonly && privs.edit && (!doc.privs || doc.privs.edit !== false) && privs.deleteFile;
|
||||
const hasExtension = file.title.lastIndexOf('.' + file.extension) == (file.title.length - file.extension.length - 1);
|
||||
const canPreview = hasExtension && canPreviewExtensions.split('|').includes(file.extension);
|
||||
|
||||
let previewAction = null;
|
||||
let isOfficeFile = 'doc|docx|xls|xlsx|ppt|pptx|pdf'.includes(file.extension);
|
||||
let canPreview = 'txt|jpg|jpeg|gif|png|bmp|mp4'.includes(file.extension);
|
||||
if(libreOfficeTurnon && isOfficeFile) canPreview = true;
|
||||
if(canPreview)
|
||||
{
|
||||
previewAction = {url: $.createLink('file', 'download', `fileID=${file.id}&mouse=left`), hint: lang.filePreview, icon: 'eye', target: '_blank'};
|
||||
if(!isOfficeFile)
|
||||
{
|
||||
previewAction['data-toggle'] = 'modal';
|
||||
previewAction['data-size'] = 'lg';
|
||||
delete previewAction.target;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
canPreview ? {'data-toggle': 'modal', 'data-size': 'lg', url: $.createLink('file', 'download', `fileID=${file.id}&mouse=left`), hint: lang.filePreview, icon: 'eye'} : null,
|
||||
previewAction,
|
||||
{target: '_blank', url: zui.formatString(docApp.props.fileUrl, file), hint: lang.fileDownload, icon: 'download'},
|
||||
canEdit ? {hint: lang.fileRename, icon: 'pencil-alt', onClick: renameDocFile.bind(this, file, doc)} : null,
|
||||
canDelete ? {hint: lang.fileDelete, icon: 'trash', onClick: deleteDocFile.bind(this, file, doc)} : null,
|
||||
|
||||
@@ -320,10 +320,6 @@ class docApp extends wg
|
||||
$historyPanelProps = array('fileListProps' => $fileListProps);
|
||||
$canPreviewOffice = $canDownload && isset($config->file->libreOfficeTurnon) and $config->file->libreOfficeTurnon == 1;
|
||||
|
||||
$canPreviewExtensions = 'txt|jpg|jpeg|gif|png|bmp|mp4';
|
||||
if($canPreviewOffice) $canPreviewExtensions .= '|doc|docx|xls|xlsx|ppt|pptx|pdf';
|
||||
jsVar('canPreviewExtensions', $canPreviewExtensions);
|
||||
|
||||
// 不可用场景:文档模板、API 文档、开源版
|
||||
$diffEnabled = ($config->edition != 'open')
|
||||
&& !($rawModule == 'doc' && $rawMethod == 'view')
|
||||
|
||||
+1
-1
@@ -272,7 +272,7 @@ class docTao extends docModel
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
public function doUpdateDoc(int $docID, object $doc, $basicInfoChanged = false)
|
||||
public function doUpdateDoc(int $docID, object $doc, bool $basicInfoChanged = false)
|
||||
{
|
||||
$this->dao->update(TABLE_DOC)->data($doc)->autoCheck()->where('id')->eq($docID)->exec();
|
||||
|
||||
|
||||
@@ -684,7 +684,7 @@ class personnelModel extends model
|
||||
$this->dao->update(TABLE_PRODUCT)->set('whitelist')->eq($newWhitelist)->where('id')->eq($productID)->exec();
|
||||
|
||||
$viewProducts = $this->dao->select('products')->from(TABLE_USERVIEW)->where('account')->eq($account)->fetch('products');
|
||||
$newViewProducts = trim(str_replace(",{$productID},", '', ",{$viewProducts},"), ',');
|
||||
$newViewProducts = trim(str_replace(",{$productID},", ',', ",{$viewProducts},"), ',');
|
||||
$this->dao->update(TABLE_USERVIEW)->set('products')->eq($newViewProducts)->where('account')->eq($account)->exec();
|
||||
}
|
||||
|
||||
@@ -771,7 +771,7 @@ class personnelModel extends model
|
||||
$this->dao->update(TABLE_PROJECT)->set('whitelist')->eq($newWhitelist)->where('id')->eq($projectID)->exec();
|
||||
|
||||
$viewProjects = $this->dao->select('projects')->from(TABLE_USERVIEW)->where('account')->eq($account)->fetch('projects');
|
||||
$newViewProjects = trim(str_replace(",{$projectID},", '', ",{$viewProjects},"), ',');
|
||||
$newViewProjects = trim(str_replace(",{$projectID},", ',', ",{$viewProjects},"), ',');
|
||||
$this->dao->update(TABLE_USERVIEW)->set('projects')->eq($newViewProjects)->where('account')->eq($account)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,19 @@ zenData('user')->gen(20);
|
||||
|
||||
title=测试 personnelModel->deleteProductWhitelist();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
- 把 test6 从 产品 8 的白名单内删除 test6不在产品8的白名单内,所以不会删 @,6
|
||||
- 把 test6 从 产品 6 的白名单内删除 @,6
|
||||
- 把 test6 从 产品 2 的白名单内删除 产品2不是同步过来的,所以不会删 @,6
|
||||
- 把 test6 从 产品 111 的白名单内删除 产品111不存在,所以不会删 @,6
|
||||
- 把 test33 从 产品 6 的白名单内删除 test33不在产品6的白名单内,所以不会删 @,33
|
||||
- 把 test33 从 产品 8 的白名单内删除 @,33
|
||||
- 把 test33 从 产品 2 的白名单内删除 产品2不是同步过来的,所以不会删 @,33
|
||||
- 把 test33 从 产品 111 的白名单内删除 产品111不存在,所以不会删 @,33
|
||||
- 把 user6 从 产品 6 的白名单内删除 user6在 userview 中不存在,所以不会删 @0
|
||||
- 把 user6 从 产品 8 的白名单内删除 user6在 userview 中不存在,所以不会删 @0
|
||||
- 把 user6 从 产品 2 的白名单内删除 user6在 userview 中不存在,所以不会删 @0
|
||||
- 把 user6 从 产品 111 的白名单内删除 user6在 userview 中不存在,所以不会删 @0
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -13,6 +13,22 @@ title=测试 projectModel::getWorkhour;
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 获取不存在项目工时信息
|
||||
- 属性totalHours @0
|
||||
- 属性totalEstimate @0
|
||||
- 属性totalConsumed @0
|
||||
- 属性totalLeft @0
|
||||
- 获取项目ID为11的总预计工时
|
||||
- 属性totalHours @112.5
|
||||
- 属性totalEstimate @61
|
||||
- 属性totalConsumed @18
|
||||
- 属性totalLeft @61
|
||||
- 获取项目ID为60的总消耗工时
|
||||
- 属性totalHours @225
|
||||
- 属性totalEstimate @35
|
||||
- 属性totalConsumed @11
|
||||
- 属性totalLeft @35
|
||||
|
||||
*/
|
||||
|
||||
$projectIdList = array(1, 11, 60);
|
||||
@@ -20,6 +36,6 @@ $projectIdList = array(1, 11, 60);
|
||||
global $tester;
|
||||
$tester->loadModel('project');
|
||||
|
||||
r($tester->project->getWorkHour($projectIdList[0])) && p('totalHours') && e('0'); // 获取不存在项目工时信息
|
||||
r($tester->project->getWorkHour($projectIdList[1])) && p('totalEstimate') && e('61'); // 获取项目ID为11的总预计工时
|
||||
r($tester->project->getWorkHour($projectIdList[2])) && p('totalConsumed') && e('11'); // 获取项目ID为60的总消耗工时
|
||||
r($tester->project->getWorkHour($projectIdList[0])) && p('totalHours,totalEstimate,totalConsumed,totalLeft') && e('0,0,0,0'); // 获取不存在项目工时信息
|
||||
r($tester->project->getWorkHour($projectIdList[1])) && p('totalHours,totalEstimate,totalConsumed,totalLeft') && e('112.5,61,18,61'); // 获取项目ID为11的总预计工时
|
||||
r($tester->project->getWorkHour($projectIdList[2])) && p('totalHours,totalEstimate,totalConsumed,totalLeft') && e('225,35,11,35'); // 获取项目ID为60的总消耗工时
|
||||
|
||||
@@ -21,6 +21,15 @@ title=测试 projectModel::suspend();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 暂停 projectID=2 后,检查$changes[0]
|
||||
- 属性field @status
|
||||
- 属性new @suspended
|
||||
- 暂停 projectID=2 后,检查$changes[1]
|
||||
- 属性field @suspendedDate
|
||||
- 属性new @2023-05-03
|
||||
- 暂停 projectID=4第0条的new属性 @suspended
|
||||
- 执行已经暂停的项目 @0
|
||||
|
||||
*/
|
||||
|
||||
global $tester;
|
||||
@@ -35,5 +44,8 @@ $project->lastEditedBy = 'admin';
|
||||
$project->lastEditedDate = '2023-04-27';
|
||||
$project->suspendedDate = '2023-05-03';
|
||||
|
||||
r($tester->project->suspend(2, $project)) && p('0:new') && e('suspended');
|
||||
r($tester->project->suspend(4, $project)) && p('0:new') && e('suspended');
|
||||
$changes = $tester->project->suspend(2, $project);
|
||||
r($changes[0]) && p('field,new') && e('status,suspended'); // 暂停 projectID=2 后,检查$changes[0]
|
||||
r($changes[1]) && p('field,new') && e('suspendedDate,2023-05-03'); // 暂停 projectID=2 后,检查$changes[1]
|
||||
r($tester->project->suspend(4, $project)) && p('0:new') && e('suspended'); // 暂停 projectID=4
|
||||
r($tester->project->suspend(4, $project)) && p() && e('0'); // 执行已经暂停的项目
|
||||
|
||||
Reference in New Issue
Block a user