Merge branch 'release/21.7.5' of https://gitfox.zcorp.cc/git/zentao/zentaopms into release/21.7.5

This commit is contained in:
sunguangming
2025-08-22 05:33:55 +00:00
4 changed files with 11 additions and 62 deletions
-34
View File
@@ -1308,40 +1308,6 @@ class productModel extends model
return true;
}
/**
* 为产品列表页和详情页构建操作按钮。
* Build operate menu.
*
* @param object $product
* @access public
* @return array
*/
public function buildOperateMenu(object $product): array
{
/* Declare menu list. */
$menuList = array
(
'main' => array(),
'suffix' => array()
);
$params = "product=$product->id";
if($product->status != 'closed' && common::hasPriv('product', 'close')) $menuList['main'][] = $this->config->product->actionList['close'];
if($product->status == 'closed' && common::hasPriv('product', 'activate')) $menuList['main'][] = $this->config->product->actionList['activate'];
if(common::hasPriv('product', 'edit'))
{
unset($this->config->product->actionList['edit']['text']);
$this->config->product->actionList['edit']['url'] = helper::createLink('product', 'edit', $params);
$menuList['suffix'][] = $this->config->product->actionList['edit'];
}
if(common::hasPriv('product', 'delete')) $menuList['suffix'][] = $this->config->product->actionList['delete'];
return $menuList;
}
/**
* Setting parameters for link.
*
+10 -1
View File
@@ -4,8 +4,13 @@
/**
title=测试 productModel::accessDenied();
timeout=0
cid=0
- 权限不足跳转 @fail
- 权限不足跳转 @fail
- 权限不足跳转 @fail
- 权限不足跳转 @fail
- 权限不足跳转 @fail
*/
@@ -20,7 +25,7 @@ $tester->loadModel('product');
try
{
$tester->product->accessDenied();
$tester->product->accessDenied('noPriv');
}
catch (Throwable $e)
{
@@ -28,3 +33,7 @@ catch (Throwable $e)
}
r($result) && p() && e('fail'); // 权限不足跳转
r($result) && p() && e('fail'); // 权限不足跳转
r($result) && p() && e('fail'); // 权限不足跳转
r($result) && p() && e('fail'); // 权限不足跳转
r($result) && p() && e('fail'); // 权限不足跳转
@@ -1,27 +0,0 @@
#!/usr/bin/env php
<?php
/**
title=productModel->buildOperateMenu();
cid=0
- 检查是否有关闭链接。第0条的text属性 @关闭
- 检查是否有编辑和删除链接。 @2
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/product.unittest.class.php';
zenData('product')->gen(10);
global $tester;
$productModel = $tester->loadModel('product');
$productModel->app->user->admin = true;
$productModel->app->moduleName = 'product';
$productModel->app->methodName = 'view';
$product = $productModel->getByID(1);
$menu = $productModel->buildOperateMenu($product);
r($menu['main']) && p('0:text') && e('关闭'); // 检查是否有关闭链接。
r(count($menu['suffix'])) && p() && e('2'); // 检查是否有编辑和删除链接。
+1
View File
@@ -1757,6 +1757,7 @@ class testcase extends control
if($_POST)
{
$this->lang->testcase->title = $this->lang->testcase->sceneTitle;
$scene = form::data($this->config->testcase->form->editScene)->get();
$this->testcase->updateScene($scene, $oldScene);