diff --git a/module/action/model.php b/module/action/model.php index 7fcb6c2359..8533290b3e 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -1027,7 +1027,7 @@ class actionModel extends model if($action->objectType == 'product') { $product = $this->dao->select('id,name,code,acl')->from(TABLE_PRODUCT)->where('id')->eq($action->objectID)->fetch(); - $count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PRODUCT)->where('deleted')->eq('0')->andWhere("(`name`='{$product->name}' OR `code`='{$product->code}')")->fetch('count'); + $count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PRODUCT)->where('deleted')->eq('0')->andWhere("(`name`='{$product->name}'" . ($product->code ? " OR `code`='{$product->code}'" : '') . ")")->fetch('count'); if($count > 0) { echo js::alert(sprintf($this->lang->action->needEdit, $this->lang->action->objectTypes['product'])); @@ -1038,7 +1038,7 @@ class actionModel extends model elseif($action->objectType == 'project') { $project = $this->dao->select('id,name,code,acl')->from(TABLE_PROJECT)->where('id')->eq($action->objectID)->fetch(); - $count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PROJECT)->where('deleted')->eq('0')->andWhere("(`name`='{$project->name}' OR `code`='{$project->code}')")->fetch('count'); + $count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PROJECT)->where('deleted')->eq('0')->andWhere("(`name`='{$project->name}'" . ($project->code ? " OR `code`='{$project->code}'" : '') . ")")->fetch('count'); if($count > 0) { echo js::alert(sprintf($this->lang->action->needEdit, $this->lang->action->objectTypes['project'])); diff --git a/module/build/control.php b/module/build/control.php index 5deb4f5750..1729efc776 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -22,10 +22,7 @@ class build extends control public function create($executionID, $productID = 0) { /* Create execution if no execution. */ - if($executionID == 0) - { - die(js::locate($this->createLink('project', 'create'), 'parent')); - } + if($executionID == 0) die(js::locate($this->createLink('project', 'create'), 'parent')); if(!empty($_POST)) { @@ -144,7 +141,7 @@ class build extends control $this->view->products = $products; $this->view->users = $this->loadModel('user')->getPairs('noletter', $build->builder); $this->view->build = $build; - $this->view->testtask = $this->dao->select('id')->from(TABLE_TESTTASK)->where('build')->eq($build->id)->andWhere('deleted')->eq(0)->fetch('id'); + $this->view->testtaskID = $this->dao->select('id')->from(TABLE_TESTTASK)->where('build')->eq($build->id)->andWhere('deleted')->eq(0)->fetch('id'); $this->display(); } diff --git a/module/build/model.php b/module/build/model.php index 7241339872..d337632ed5 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -147,6 +147,7 @@ class buildModel extends model } } + if($this->session->projectBuildQuery == false) $this->session->set('projectBuildQuery', ' 1 = 1'); $buildQuery = $this->session->projectBuildQuery; /* Distinguish between repeated fields. */ @@ -207,6 +208,7 @@ class buildModel extends model } } + if($this->session->executionBuildQuery == false) $this->session->set('executionBuildQuery', ' 1 = 1'); $buildQuery = $this->session->executionBuildQuery; /* Distinguish between repeated fields. */ diff --git a/module/build/view/edit.html.php b/module/build/view/edit.html.php index a816c0981e..5ba5dd1d40 100644 --- a/module/build/view/edit.html.php +++ b/module/build/view/edit.html.php @@ -28,7 +28,7 @@