Merge branch 'easycorp/zentaopms-sprint/hufangzhou_task_87019'

This commit is contained in:
wangyidong
2023-03-15 09:44:59 +08:00
6 changed files with 36 additions and 11 deletions
+1
View File
@@ -93,6 +93,7 @@ $lang->product->unfoldClosed = 'Unfold Closed';
$lang->product->confirmDelete = " Möchten Sie {$lang->productCommon} löschen?";
$lang->product->errorNoProduct = "Kein {$lang->productCommon} erstellt!";
$lang->product->accessDenied = "Sie haben keinen Zugriff auf {$lang->productCommon}.";
$lang->product->notExists = "{$lang->productCommon} is not exists!";
$lang->product->programChangeTip = "The {$lang->projectCommon}s linked with this {$lang->productCommon}: %s will be transferred to the modified program set together.";
$lang->product->notChangeProgramTip = "The {$lang->SRCommon} of {$lang->productCommon} has been linked to the following {$lang->projectCommon}s, please cancel the link before proceeding";
$lang->product->confirmChangeProgram = "The {$lang->projectCommon}s linked with this {$lang->productCommon}: %s is also linked with other {$lang->productCommon}s, whether to transfer {$lang->projectCommon}s to the modified program set.";
+1
View File
@@ -93,6 +93,7 @@ $lang->product->unfoldClosed = 'Unfold Closed';
$lang->product->confirmDelete = " Do you want to delete the {$lang->productCommon}?";
$lang->product->errorNoProduct = "No {$lang->productCommon} is created yet!";
$lang->product->accessDenied = "You have no access to the {$lang->productCommon}.";
$lang->product->notExists = "{$lang->productCommon} is not exists!";
$lang->product->programChangeTip = "The {$lang->projectCommon}s linked with this {$lang->productCommon}: %s will be transferred to the modified program set together.";
$lang->product->notChangeProgramTip = "The {$lang->SRCommon} of {$lang->productCommon} has been linked to the following {$lang->projectCommon}s, please cancel the link before proceeding";
$lang->product->confirmChangeProgram = "The {$lang->projectCommon}s linked with this {$lang->productCommon}: %s is also linked with other {$lang->productCommon}s, whether to transfer {$lang->projectCommon}s to the modified program set.";
+1
View File
@@ -93,6 +93,7 @@ $lang->product->unfoldClosed = 'Unfold Closed';
$lang->product->confirmDelete = "Voulez-vous vraiment supprimer le {$lang->productCommon} ?";
$lang->product->errorNoProduct = "Aucun {$lang->productCommon} n'est créé pour l'instant !";
$lang->product->accessDenied = "Vous n'avez pas accès au {$lang->productCommon}.";
$lang->product->notExists = "{$lang->productCommon} is not exists!";
$lang->product->programChangeTip = "The {$lang->projectCommon}s linked with this {$lang->productCommon}: %s will be transferred to the modified program set together.";
$lang->product->notChangeProgramTip = "The {$lang->SRCommon} of {$lang->productCommon} has been linked to the following {$lang->projectCommon}s, please cancel the link before proceeding";
$lang->product->confirmChangeProgram = "The {$lang->projectCommon}s linked with this {$lang->productCommon}: %s is also linked with other {$lang->productCommon}s, whether to transfer {$lang->projectCommon}s to the modified program set.";
+1
View File
@@ -93,6 +93,7 @@ $lang->product->unfoldClosed = '展开已关闭';
$lang->product->confirmDelete = " 您确定删除该{$lang->productCommon}吗?";
$lang->product->errorNoProduct = "还没有创建{$lang->productCommon}!";
$lang->product->accessDenied = "您无权访问该{$lang->productCommon}";
$lang->product->notExists = "该{$lang->productCommon}不存在!";
$lang->product->programChangeTip = "如下{$lang->projectCommon}只关联了该{$lang->productCommon}, 将直接转移至新项目集下。";
$lang->product->notChangeProgramTip = "该{$lang->productCommon}的{$lang->SRCommon}已经关联到如下{$lang->projectCommon},请点击{$lang->projectCommon}名称进入{$lang->SRCommon}列表取消关联后再操作";
$lang->product->confirmChangeProgram = "如下{$lang->projectCommon}既关联了该{$lang->productCommon}又关联了其他{$lang->productCommon},请确认是否继续关联该{$lang->productCommon},勾选后将取消与其他{$lang->productCommon}的关联关系,同时转移至新项目集下。";
+8 -5
View File
@@ -170,20 +170,22 @@ class productModel extends model
{
if(defined('TUTORIAL')) return $productID;
$product = $this->getById($productID);
if(!empty($product) and $product->shadow) $this->accessDenied($this->lang->product->notExists);
if($productID == 0 and $this->cookie->preProductID and isset($products[$this->cookie->preProductID])) $productID = $this->cookie->preProductID;
if($productID == 0 and $this->session->product == '') $productID = key($products);
$this->session->set('product', (int)$productID, $this->app->tab);
if(!isset($products[$this->session->product]))
{
$product = $this->getById($productID);
if(empty($product) or $product->deleted == 1) $productID = key($products);
$this->session->set('product', (int)$productID, $this->app->tab);
if($productID && strpos(",{$this->app->user->view->products},", ",{$productID},") === false)
{
$productID = key($products);
$this->session->set('product', (int)$productID, $this->app->tab);
$this->accessDenied();
$this->accessDenied($this->lang->product->accessDenied);
}
}
@@ -216,14 +218,15 @@ class productModel extends model
/**
* Show accessDenied response.
*
* @param string $tips
* @access private
* @return void
*/
public function accessDenied()
public function accessDenied($tips)
{
if(defined('TUTORIAL')) return true;
echo(js::alert($this->lang->product->accessDenied));
echo(js::alert($tips));
if(!$this->server->http_referer) return print(js::locate(helper::createLink('product', 'index')));
@@ -2580,7 +2583,7 @@ class productModel extends model
*/
public function setMenu($productID, $branch = '', $module = 0, $moduleType = '', $extra = '')
{
if(!$this->app->user->admin and strpos(",{$this->app->user->view->products},", ",$productID,") === false and $productID != 0 and !defined('TUTORIAL')) return $this->accessDenied();
if(!$this->app->user->admin and strpos(",{$this->app->user->view->products},", ",$productID,") === false and $productID != 0 and !defined('TUTORIAL')) return $this->accessDenied($this->lang->product->accessDenied);
$product = $this->getByID($productID);
$params = array('branch' => $branch);
+24 -6
View File
@@ -874,8 +874,8 @@ class programModel extends model
$this->loadModel('user');
if($program->acl != 'open') $this->user->updateUserView($programID, 'program');
/* If the program changes, the authorities of programs and projects under the program should be refreshed. */
$children = $this->dao->select('id, type')->from(TABLE_PROGRAM)->where('path')->like("%,{$programID},%")->andWhere('id')->ne($programID)->andWhere('acl')->eq('program')->fetchPairs('id', 'type');
/* If the program changes, the authorities of programs and projects under the program should be refreshed. */
$children = $this->dao->select('id, type')->from(TABLE_PROGRAM)->where('path')->like("%,{$programID},%")->andWhere('id')->ne($programID)->andWhere('acl')->eq('program')->fetchPairs('id', 'type');
foreach($children as $id => $type) $this->user->updateUserView($id, $type);
if(isset($program->PM) and $program->PM != $oldProgram->PM)
{
@@ -888,11 +888,29 @@ class programModel extends model
$this->processNode($programID, $program->parent, $oldProgram->path, $oldProgram->grade);
/* Move product to new top program. */
if($oldProgram->parent == 0)
$oldTopProgram = $this->getTopByPath($oldProgram->path);
$newTopProgram = $this->getTopByID($programID);
if($oldTopProgram != $newTopProgram)
{
$oldTopProgram = $this->getTopByPath($oldProgram->path);
$newTopProgram = $this->getTopByID($programID);
if($oldTopProgram != $newTopProgram) $this->dao->update(TABLE_PRODUCT)->set('program')->eq($newTopProgram)->where('program')->eq($oldTopProgram)->exec();
if($oldProgram->parent == 0)
{
$this->dao->update(TABLE_PRODUCT)->set('program')->eq($newTopProgram)->where('program')->eq($oldTopProgram)->exec();
}
else
{
/* Get the shadow products that produced by the program's no product projects. */
$shadowProducts = $this->dao->select('t1.id')->from(TABLE_PRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.product')
->leftJoin(TABLE_PROJECT)->alias('t3')->on('t2.project=t3.id')
->where('t3.path')->like("%,$programID,%")
->andWhere('t3.type')->eq('project')
->andWhere('t3.hasProduct')->eq('0')
->andWhere('t1.shadow')->eq('1')
->fetchPairs();
$this->dao->update(TABLE_PRODUCT)->set('program')->eq($newTopProgram)->where('id')->in($shadowProducts)->exec();
}
}
}