* Fix bug: return error.

This commit is contained in:
zhujinyong
2022-02-22 09:26:31 +08:00
parent 002e215a3d
commit 5a334ccb86
4 changed files with 33 additions and 32 deletions
+2 -1
View File
@@ -1671,7 +1671,8 @@ class execution extends control
$this->view->project = $this->project->getById($this->session->project);
}
$executionIDList = $this->post->executionIDList ? $this->post->executionIDList : return print(js::locate($this->session->executionList, 'parent'));
if(!$this->post->executionIDList) return print(js::locate($this->session->executionList, 'parent'));
$executionIDList = $this->post->executionIDList;
$executions = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->in($executionIDList)->fetchAll('id');
$appendPoUsers = $appendPmUsers = $appendQdUsers = $appendRdUsers = array();
+3 -3
View File
@@ -230,12 +230,12 @@ class personnel extends control
{
if($confirm == 'no')
{
die(js::confirm($this->lang->personnel->confirmDelete, inLink('unbindWhitelist',"id=$id&confirm=yes")));
return print(js::confirm($this->lang->personnel->confirmDelete, inLink('unbindWhitelist',"id=$id&confirm=yes")));
}
else
{
$acl = $this->dao->select('*')->from(TABLE_ACL)->where('id')->eq($id)->fetch();
if(empty($acl)) die(js::reload('parent'));
if(empty($acl)) return print(js::reload('parent'));
$objectTable = $acl->objectType == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
$whitelist = $this->dao->select('whitelist')->from($objectTable)->where('id')->eq($acl->objectID)->fetch('whitelist');
@@ -254,7 +254,7 @@ class personnel extends control
$this->loadModel('action')->create('whitelist', $acl->objectID, 'managedWhitelist', '', $acl->objectType);
die(js::reload('parent'));
return print(js::reload('parent'));
}
}
}
+21 -21
View File
@@ -596,11 +596,11 @@ class product extends control
}
$locate = $this->app->tab == 'product' ? $this->createLink('product', 'all') : $this->createLink('program', 'product', "programID=$programID");
die(js::locate($locate, 'parent'));
return print(js::locate($locate, 'parent'));
}
$productIDList = $this->post->productIDList;
if(empty($productIDList)) die(js::locate($this->session->productList, 'parent'));
if(empty($productIDList)) return print(js::locate($this->session->productList, 'parent'));
/* Set menu when page come from program. */
if($this->app->tab == 'program') $this->loadModel('program')->setMenu(0);
@@ -689,7 +689,7 @@ class product extends control
if(!empty($_POST))
{
$changes = $this->product->close($productID);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
@@ -699,7 +699,7 @@ class product extends control
$this->executeHooks($productID);
die(js::reload('parent.parent'));
return print(js::reload('parent.parent'));
}
$this->product->setMenu($productID);
@@ -727,7 +727,7 @@ class product extends control
if(!$product)
{
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'code' => 404, 'message' => '404 Not found'));
die(js::error($this->lang->notFound) . js::locate($this->createLink('product', 'index')));
return print(js::error($this->lang->notFound) . js::locate($this->createLink('product', 'index')));
}
$product->desc = $this->loadModel('file')->setImgSize($product->desc);
@@ -765,7 +765,7 @@ class product extends control
{
if($confirm == 'no')
{
die(js::confirm($this->lang->product->confirmDelete, $this->createLink('product', 'delete', "productID=$productID&confirm=yes")));
return print(js::confirm($this->lang->product->confirmDelete, $this->createLink('product', 'delete', "productID=$productID&confirm=yes")));
}
else
{
@@ -775,7 +775,7 @@ class product extends control
$this->executeHooks($productID);
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));
die(js::locate($this->createLink('product', 'all'), 'parent'));
return print(js::locate($this->createLink('product', 'all'), 'parent'));
}
}
@@ -898,7 +898,7 @@ class product extends control
$productID = $this->product->saveState($productID, $this->products);
$product = $this->product->getStatByID($productID);
if(!$product) die(js::locate('product', 'all'));
if(!$product) return print(js::locate('product', 'all'));
$product->desc = $this->loadModel('file')->setImgSize($product->desc);
$this->product->setMenu($productID);
@@ -934,11 +934,11 @@ class product extends control
$products = $this->product->getProductPairsByProject($executionID);
if(empty($products))
{
die(printf($this->lang->build->noProduct, $this->createLink('execution', 'manageproducts', "executionID=$executionID&from=buildCreate", '', 'true'), 'project'));
return print(printf($this->lang->build->noProduct, $this->createLink('execution', 'manageproducts', "executionID=$executionID&from=buildCreate", '', 'true'), 'project'));
}
else
{
die(html::select('product', $products, empty($product) ? '' : $product->id, "onchange='loadBranches(this.value);' class='form-control chosen' required data-toggle='modal' data-type='iframe'"));
return print(html::select('product', $products, empty($product) ? '' : $product->id, "onchange='loadBranches(this.value);' class='form-control chosen' required data-toggle='modal' data-type='iframe'"));
}
}
@@ -955,9 +955,9 @@ class product extends control
{
$projects = array('' => '');
$projects += $this->product->getProjectPairsByProduct($productID, $branch);
if($this->app->getViewType() == 'json') die(json_encode($projects));
if($this->app->getViewType() == 'json') return print(json_encode($projects));
die(html::select('project', $projects, $projectID, "class='form-control' onchange='loadProductExecutions({$productID}, this.value)'"));
return print(html::select('project', $projects, $projectID, "class='form-control' onchange='loadProductExecutions({$productID}, this.value)'"));
}
/**
@@ -974,17 +974,17 @@ class product extends control
public function ajaxGetExecutions($productID, $projectID = 0, $branch = 0, $number = '', $executionID = 0)
{
$executions = $this->product->getExecutionPairsByProduct($productID, $branch, 'id_desc', $projectID);
if($this->app->getViewType() == 'json') die(json_encode($executions));
if($this->app->getViewType() == 'json') return print(json_encode($executions));
if($number === '')
{
die(html::select('execution', array('' => '') + $executions, $executionID, "class='form-control' onchange='loadExecutionRelated(this.value)'"));
return print(html::select('execution', array('' => '') + $executions, $executionID, "class='form-control' onchange='loadExecutionRelated(this.value)'"));
}
else
{
$executionsName = "executions[$number]";
$executions = empty($executions) ? array('' => '') : $executions;
die(html::select($executionsName, $executions, '', "class='form-control' onchange='loadExecutionBuilds($executionID, this.value, $number)'"));
return print(html::select($executionsName, $executions, '', "class='form-control' onchange='loadExecutionBuilds($executionID, this.value, $number)'"));
}
}
@@ -1015,7 +1015,7 @@ class product extends control
$output .= html::a("javascript:void(0)", "<i class='icon icon-refresh'></i>", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'");
$output .= '</div>';
}
die($output);
echo $output;
}
/**
@@ -1031,8 +1031,8 @@ class product extends control
$lines = array();
if(empty($productID) or $programID) $lines = $this->product->getLinePairs($programID);
if($productID) die(html::select("lines[$productID]", array('' => '') + $lines, '', "class='form-control picker-select'"));
if(!$productID) die(html::select('line', array('' => '') + $lines, '', "class='form-control chosen'"));
if($productID) return print(html::select("lines[$productID]", array('' => '') + $lines, '', "class='form-control picker-select'"));
if(!$productID) return print(html::select('line', array('' => '') + $lines, '', "class='form-control chosen'"));
}
/**
@@ -1060,7 +1060,7 @@ class product extends control
$reviewers = $this->loadModel('user')->getPairs('noclosed|nodeleted', $storyReviewers, 0, $productReviewers);
die(html::select("reviewer[]", $reviewers, $storyReviewers, "class='form-control chosen' multiple"));
echo html::select("reviewer[]", $reviewers, $storyReviewers, "class='form-control chosen' multiple");
}
/**
@@ -1279,8 +1279,8 @@ class product extends control
if($_POST)
{
$this->product->manageLine();
if(dao::isError()) die(js::error(dao::getError()));
die(js::reload('parent'));
if(dao::isError()) return print(js::error(dao::getError()));
return print(js::reload('parent'));
}
$this->view->title = $this->lang->product->line;
+7 -7
View File
@@ -198,12 +198,12 @@ class productModel extends model
echo(js::alert($this->lang->product->accessDenied));
if(!$this->server->http_referer) die(js::locate(helper::createLink('product', 'index')));
if(!$this->server->http_referer) return print(js::locate(helper::createLink('product', 'index')));
$loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login";
if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(helper::createLink('product', 'index')));
if(strpos($this->server->http_referer, $loginLink) !== false) return print(js::locate(helper::createLink('product', 'index')));
die(js::locate('back'));
echo js::locate('back');
}
/**
@@ -739,10 +739,10 @@ class productModel extends model
$products[$productID]->{$extendField->field} = htmlSpecialString($products[$productID]->{$extendField->field});
$message = $this->checkFlowRule($extendField, $products[$productID]->{$extendField->field});
if($message) die(js::alert($message));
if($message) return print(js::alert($message));
}
}
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
$unlinkProducts = array();
foreach($products as $productID => $product)
@@ -757,7 +757,7 @@ class productModel extends model
->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $productID and `program` = $programID")
->where('id')->eq($productID)
->exec();
if(dao::isError()) die(js::error('product#' . $productID . dao::getError(true)));
if(dao::isError()) return print(js::error('product#' . $productID . dao::getError(true)));
/* When acl is open, white list set empty. When acl is private,update user view. */
if($product->acl == 'open') $this->loadModel('personnel')->updateWhitelist('', 'product', $productID);
@@ -2175,7 +2175,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')) die(js::error($this->lang->product->accessDenied) . js::locate('back'));
if(!$this->app->user->admin and strpos(",{$this->app->user->view->products},", ",$productID,") === false and $productID != 0 and !defined('TUTORIAL')) return print(js::error($this->lang->product->accessDenied) . js::locate('back'));
$product = $this->getByID($productID);
$params = array('branch' => $branch);