From 2fdf26bc2155e410d4ed6abeb6ae3050864f559e Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Fri, 27 Nov 2020 10:27:08 +0800 Subject: [PATCH] * Finisht task #8497. --- module/bug/control.php | 8 +-- module/build/control.php | 12 ++-- module/build/model.php | 68 +++++++++++++++++++--- module/common/lang/zh-cn.php | 2 +- module/project/control.php | 4 +- module/projectrelease/config.php | 16 ++--- module/projectrelease/control.php | 35 ++++++----- module/projectrelease/js/common.js | 52 +++++++++++++++++ module/projectrelease/js/view.js | 2 +- module/projectrelease/model.php | 35 +++++------ module/projectrelease/view/browse.html.php | 18 +++--- module/projectrelease/view/create.html.php | 15 +++++ 12 files changed, 195 insertions(+), 72 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index afc4be2439..0eaee874a0 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -408,7 +408,7 @@ class bug extends control /* If projectID is setted, get builds and stories of this project. */ if($projectID) { - $builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,noterminate,nodone'); + $builds = $this->loadModel('build')->getExecutionBuildPairs($projectID, $productID, $branch, 'noempty,noterminate,nodone'); $stories = $this->story->getProjectStoryPairs($projectID); } else @@ -509,7 +509,7 @@ class bug extends control /* If projectID is setted, get builds and stories of this project. */ if($projectID) { - $builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $branch, 'noempty'); + $builds = $this->loadModel('build')->getExecutionBuildPairs($projectID, $productID, $branch, 'noempty'); $stories = $this->story->getProjectStoryPairs($projectID); } else @@ -701,7 +701,7 @@ class bug extends control $allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, 'noempty'); if($projectID) { - $openedBuilds = $this->build->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone'); + $openedBuilds = $this->build->getExecutionBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone'); } else { @@ -1715,7 +1715,7 @@ class bug extends control public function ajaxGetBugFieldOptions($productID, $projectID = 0) { $modules = $this->loadModel('tree')->getOptionMenu($productID, 'bug'); - $builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID); + $builds = $this->loadModel('build')->getExecutionBuildPairs($projectID, $productID); $type = $this->lang->bug->typeList; $pri = $this->lang->bug->priList; $severity = $this->lang->bug->severityList; diff --git a/module/build/control.php b/module/build/control.php index 61c5ccfd4f..05027294d2 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -212,7 +212,7 @@ class build extends control $this->view->canBeChanged = common::canBeChanged('build', $build); // Determines whether an object is editable. $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->build = $build; - $this->view->buildPairs = $this->build->getProjectBuildPairs($build->project, 0, 0, 'noempty,notrunk'); + $this->view->buildPairs = $this->build->getExecutionBuildPairs($build->project, 0, 0, 'noempty,notrunk'); $this->view->actions = $this->loadModel('action')->getList('build', $buildID); $this->view->link = $link; $this->view->param = $param; @@ -323,26 +323,26 @@ class build extends control if($varName == 'openedBuild') { $params = ($type == 'all') ? 'noempty' : 'noempty, noterminate, nodone'; - $builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, $params, $build); + $builds = $this->build->getExecutionBuildPairs($projectID, $productID, $branch, $params, $build); if($isJsonView) die(json_encode($builds)); else die(html::select($varName . '[]', $builds , '', 'size=4 class=form-control multiple')); } if($varName == 'openedBuilds') { - $builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty'); + $builds = $this->build->getExecutionBuildPairs($projectID, $productID, $branch, 'noempty'); if($isJsonView) die(json_encode($builds)); else die(html::select($varName . "[$index][]", $builds , $build, 'size=4 class=form-control multiple')); } if($varName == 'resolvedBuild') { $params = ($type == 'all') ? '' : 'noterminate, nodone'; - $builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, $params, $build); + $builds = $this->build->getExecutionBuildPairs($projectID, $productID, $branch, $params, $build); if($isJsonView) die(json_encode($builds)); else die(html::select($varName, $builds, $build, "class='form-control'")); } if($varName == 'testTaskBuild') { - $builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,notrunk'); + $builds = $this->build->getExecutionBuildPairs($projectID, $productID, $branch, 'noempty,notrunk'); if($isJsonView) die(json_encode($builds)); else { @@ -357,7 +357,7 @@ class build extends control } if($varName == 'dropdownList') { - $builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,notrunk'); + $builds = $this->build->getExecutionBuildPairs($projectID, $productID, $branch, 'noempty,notrunk'); if($isJsonView) die(json_encode($builds)); $list = "
"; diff --git a/module/build/model.php b/module/build/model.php index 8d6c232add..227ab36c64 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -50,22 +50,22 @@ class buildModel extends model } /** - * Get builds of a project. + * Get builds of a execution. * - * @param int $projectID + * @param int $executionID * @param string $type all|product|bysearch * @param int|string $param productID|buildQuery * @access public * @return array */ - public function getProjectBuilds($projectID, $type = '', $param = '') + public function getExecutionBuilds($executionID, $type = '', $param = '') { return $this->dao->select('t1.*, t2.name as projectName, t3.name as productName, t4.name as branchName') ->from(TABLE_BUILD)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') ->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id') ->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id') - ->where('t1.project')->eq((int)$projectID) + ->where('t1.project')->eq((int)$executionID) ->andWhere('t1.deleted')->eq(0) ->beginIF($type == 'product' and $param)->andWhere('t1.product')->eq($param)->fi() ->beginIF($type == 'bysearch')->andWhere($param)->fi() @@ -74,14 +74,14 @@ class buildModel extends model } /** - * Get builds of a project by search. + * Get builds of a execution by search. * - * @param int $projectID + * @param int $executionID * @param int $queryID * @access public * @return array */ - public function getProjectBuildsBySearch($projectID, $queryID) + public function getExecutionBuildsBySearch($executionID, $queryID) { /* If there are saved query conditions, reset the session. */ if($queryID) @@ -104,7 +104,7 @@ class buildModel extends model } } - return $this->getProjectBuilds($projectID, 'bysearch', $buildQuery); + return $this->getExecutionBuilds($executionID, 'bysearch', $buildQuery); } /** @@ -112,7 +112,9 @@ class buildModel extends model * * @param int $projectID * @param int $productID + * @param int $branch * @param string $params noempty|notrunk, can be a set of them + * @param int $buildID * @access public * @return array */ @@ -128,7 +130,55 @@ class buildModel extends model ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') ->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build') ->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id') - ->where('t1.project')->eq((int)$projectID) + ->where('t1.PRJ')->eq((int)$projectID) + ->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi() + ->beginIF($branch)->andWhere('t1.branch')->in("0,$branch")->fi() + ->andWhere('t1.deleted')->eq(0) + ->orderBy('t1.date desc, t1.id desc')->fetchAll('id'); + + /* Set builds and filter terminate releases. */ + $builds = array(); + foreach($projectBuilds as $buildID => $build) + { + if(empty($build->releaseID) and (strpos($params, 'nodone') !== false) and ($build->projectStatus === 'done')) continue; + if((strpos($params, 'noterminate') !== false) and ($build->releaseStatus === 'terminate')) continue; + $builds[$buildID] = $build->name; + } + if(!$builds) return $sysBuilds + $selectedBuilds; + + /* if the build has been released, replace build name with release name. */ + $releases = $this->dao->select('build, name')->from(TABLE_RELEASE) + ->where('build')->in(array_keys($builds)) + ->beginIF($branch)->andWhere('branch')->in("0,$branch")->fi() + ->andWhere('deleted')->eq(0) + ->fetchPairs(); + foreach($releases as $buildID => $releaseName) $builds[$buildID] = $releaseName; + + return $sysBuilds + $builds + $selectedBuilds; + } + + /** + * Get builds of a execution in pairs. + * + * @param int $executionID + * @param int $productID + * @param string $params noempty|notrunk, can be a set of them + * @access public + * @return array + */ + public function getExecutionBuildPairs($executionID, $productID, $branch = 0, $params = '', $buildID = 0) + { + $sysBuilds = array(); + $selectedBuilds = array(); + if(strpos($params, 'noempty') === false) $sysBuilds = array('' => ''); + if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => $this->lang->trunk); + if($buildID != 0) $selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($buildID)->fetchPairs(); + + $projectBuilds = $this->dao->select('t1.id, t1.name, t1.project, t2.status as projectStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName')->from(TABLE_BUILD)->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') + ->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build') + ->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id') + ->where('t1.project')->eq((int)$executionID) ->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi() ->beginIF($branch)->andWhere('t1.branch')->in("0,$branch")->fi() ->andWhere('t1.deleted')->eq(0) diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index da74cf5d37..a9a0656673 100755 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -882,7 +882,7 @@ $lang->menu->waterfall->projectstory = array('link' => '需求|projectstory|requ $lang->menu->waterfall->design = '设计|design|browse|product={PRODUCT}'; $lang->menu->waterfall->ci = '代码|repo|browse|'; $lang->menu->waterfall->qa = array('link' => '测试|bug|browse|product={PRODUCT}', 'subModule' => ',testcase,testtask,testsuite,testreport,caselib,'); -$lang->menu->waterfall->projectrelease = array('link' => '发布|projectrelease|browse|product={PRODUCT}'); +$lang->menu->waterfall->projectrelease = array('link' => '发布|projectrelease|browse'); //$lang->menu->waterfall->release = array('link' => '发布|release|browse|product={PRODUCT}', 'subModule' => 'release'); $lang->menu->waterfall->issue = '问题|issue|browse|'; $lang->menu->waterfall->risk = '风险|risk|browse|'; diff --git a/module/project/control.php b/module/project/control.php index 3792d11fab..5fbcbc2310 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -890,11 +890,11 @@ class project extends control /* Get builds. */ if($type == 'bysearch') { - $builds = $this->loadModel('build')->getProjectBuildsBySearch((int)$projectID, $param); + $builds = $this->loadModel('build')->getExecutionBuildsBySearch((int)$projectID, $param); } else { - $builds = $this->loadModel('build')->getProjectBuilds((int)$projectID, $type, $param); + $builds = $this->loadModel('build')->getExecutionBuilds((int)$projectID, $type, $param); } /* Set project builds. */ diff --git a/module/projectrelease/config.php b/module/projectrelease/config.php index 464702d309..3c5ce3dcee 100644 --- a/module/projectrelease/config.php +++ b/module/projectrelease/config.php @@ -1,10 +1,10 @@ release = new stdclass(); -$config->release->create = new stdclass(); -$config->release->edit = new stdclass(); -$config->release->create->requiredFields = 'name,date'; -$config->release->edit->requiredFields = 'name,date,build'; +$config->projectrelease = new stdclass(); +$config->projectrelease->create = new stdclass(); +$config->projectrelease->edit = new stdclass(); +$config->projectrelease->create->requiredFields = 'name,date'; +$config->projectrelease->edit->requiredFields = 'name,date,build'; -$config->release->editor = new stdclass(); -$config->release->editor->create = array('id' => 'desc', 'tools' => 'simpleTools'); -$config->release->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools'); +$config->projectrelease->editor = new stdclass(); +$config->projectrelease->editor->create = array('id' => 'desc', 'tools' => 'simpleTools'); +$config->projectrelease->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools'); diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php index 69e076f360..595dce4869 100644 --- a/module/projectrelease/control.php +++ b/module/projectrelease/control.php @@ -44,13 +44,17 @@ class projectrelease extends control $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID); $this->loadModel('product'); + $this->loadModel('project'); + $products = $this->product->getProductPairsByProject($this->session->PRJ); + if(empty($products)) $this->locate($this->createLink('product', 'create')); + $product = $this->product->getById($productID); - if(empty($product)) $this->locate($this->createLink('product', 'create')); $this->view->product = $product; + $this->view->branches = (isset($product->type) and $product->type) == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID); $this->view->branch = $branch; - $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id); - $this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$this->view->product->id}&branch=$branch"), $this->view->product->name); - $this->product->setMenu($this->product->getPairs(), $productID, $branch); + $this->view->project = $this->loadModel('project')->getById($this->session->PRJ); + $this->view->products = $products; + $this->product->setMenu($this->product->getPairs(), $productID ? $productID : key($products), $branch); } /** @@ -62,14 +66,15 @@ class projectrelease extends control * @access public * @return void */ - public function browse($productID, $branch = 0, $type = 'all') + public function browse($productID = 0, $branch = 0, $type = 'all') { $this->commonAction($productID, $branch); $this->session->set('releaseList', $this->app->getURI(true)); - $this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->browse; + $this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->release->browse; $this->view->position[] = $this->lang->release->browse; - $this->view->releases = $this->projectrelease->getList($productID, $branch, $type); + $this->view->releases = $this->projectrelease->getList($productID, $branch, $type, $this->session->PRJ); + $this->view->productID = $productID; $this->view->type = $type; $this->display(); } @@ -86,7 +91,7 @@ class projectrelease extends control { if(!empty($_POST)) { - $releaseID = $this->projectrelease->create($productID, $branch); + $releaseID = $this->projectrelease->create(); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->loadModel('action')->create('release', $releaseID, 'opened'); @@ -96,16 +101,20 @@ class projectrelease extends control $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID"))); } - $builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'notrunk|withbranch', false); + $builds = $this->loadModel('build')->getProjectBuildPairs($this->session->PRJ, $productID, $branch, 'notrunk|withbranch'); $releaseBuilds = $this->projectrelease->getReleaseBuilds($productID, $branch); foreach($releaseBuilds as $build) unset($builds[$build]); unset($builds['trunk']); $this->commonAction($productID, $branch); - $this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->create; + $productID = !empty($productID) ? $productID : key($this->view->products); + + $this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->release->create; $this->view->position[] = $this->lang->release->create; $this->view->builds = $builds; $this->view->productID = $productID; + $this->view->product = $this->product->getById($productID); + $this->view->branches = $this->loadModel('branch')->getPairs($productID); $this->view->lastRelease = $this->projectrelease->getLast($productID, $branch); $this->display(); } @@ -147,7 +156,7 @@ class projectrelease extends control $this->view->position[] = $this->lang->release->edit; $this->view->release = $release; $this->view->build = $build; - $this->view->builds = $this->loadModel('build')->getProductBuildPairs($release->product, $release->branch, 'notrunk|withbranch', false); + $this->view->builds = $this->loadModel('build')->getProjectBuildPairs($this->session->PRJ, $release->product, $release->branch, 'notrunk|withbranch'); $this->display(); } @@ -418,7 +427,7 @@ class projectrelease extends control $queryID = ($browseType == 'bySearch') ? (int)$param : 0; unset($this->config->product->search['fields']['product']); unset($this->config->product->search['fields']['project']); - $this->config->product->search['actionURL'] = $this->createLink('release', 'view', "releaseID=$releaseID&type=story&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID')); + $this->config->product->search['actionURL'] = $this->createLink('projectrelease', 'view', "releaseID=$releaseID&type=story&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID')); $this->config->product->search['queryID'] = $queryID; $this->config->product->search['style'] = 'simple'; $this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product)); @@ -535,7 +544,7 @@ class projectrelease extends control $this->loadModel('bug'); $queryID = ($browseType == 'bysearch') ? (int)$param : 0; unset($this->config->bug->search['fields']['product']); - $this->config->bug->search['actionURL'] = $this->createLink('release', 'view', "releaseID=$releaseID&type=$type&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID')); + $this->config->bug->search['actionURL'] = $this->createLink('projectrelease', 'view', "releaseID=$releaseID&type=$type&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID')); $this->config->bug->search['queryID'] = $queryID; $this->config->bug->search['style'] = 'simple'; $this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product)); diff --git a/module/projectrelease/js/common.js b/module/projectrelease/js/common.js index 1f3ddf85b3..b00a04a658 100644 --- a/module/projectrelease/js/common.js +++ b/module/projectrelease/js/common.js @@ -2,3 +2,55 @@ $(document).ready(function() { $("a.preview").modalTrigger({width:1000, type:'iframe'}); }) + +function loadProduct(productID) +{ + if(typeof parentStory != 'undefined' && parentStory) + { + confirmLoadProduct = confirm(moveChildrenTips); + if(!confirmLoadProduct) + { + $('#product').val(oldProductID); + $('#product').trigger("chosen:updated"); + return false; + } + } + + if(typeof hasSR != 'undefined' && hasSR) + { + confirmLoadProduct = confirm(moveSRTips);//Set hasSR variable in pro and biz. + if(!confirmLoadProduct) + { + $('#product').val(oldProductID); + $('#product').trigger("chosen:updated"); + return false; + } + } + + oldProductID = $('#product').val(); + loadProductBranches(productID) +} + +function loadBranch() +{ + var branch = $('#branch').val(); + if(typeof(branch) == 'undefined') branch = 0; +} + +function loadProductBranches(productID) +{ + $('#branch').remove(); + $('#branch_chosen').remove(); + $.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID), function(data) + { + var $product = $('#product'); + var $inputGroup = $product.closest('.input-group'); + $inputGroup.find('.input-group-addon').toggleClass('hidden', !data); + if(data) + { + $inputGroup.append(data); + $('#branch').css('width', config.currentMethod == 'create' ? '120px' : '65px').chosen(); + } + $inputGroup.fixInputGroup(); + }) +} diff --git a/module/projectrelease/js/view.js b/module/projectrelease/js/view.js index 3fe9cdb5b1..88bbba7202 100644 --- a/module/projectrelease/js/view.js +++ b/module/projectrelease/js/view.js @@ -3,7 +3,7 @@ function showLink(releaseID, type, param) var method = type == 'story' ? 'linkStory' : 'linkBug'; if(typeof(param) == 'undefined') param = '&browseType=' + type + '¶m=0'; if(type == 'leftBug') param += '&type=leftBug'; - loadURL(createLink('release', method, 'releaseID=' + releaseID + param), type); + loadURL(createLink('projectrelease', method, 'releaseID=' + releaseID + param), type); $('.actions').find("a[href*='" + type + "']").addClass('hidden'); } diff --git a/module/projectrelease/model.php b/module/projectrelease/model.php index d20fc2b729..33912523cc 100644 --- a/module/projectrelease/model.php +++ b/module/projectrelease/model.php @@ -42,23 +42,25 @@ class projectreleaseModel extends model /** * Get list of releases. - * - * @param int $productID - * @param int $branch - * @param string $type + * + * @param int $productID + * @param int $branch + * @param string $type + * @param int $projectID * @access public * @return array */ - public function getList($productID, $branch = 0, $type = 'all') + public function getList($productID, $branch = 0, $type = 'all', $projectID = 0) { return $this->dao->select('t1.*, t2.name as productName, t3.id as buildID, t3.name as buildName, t3.project') ->from(TABLE_RELEASE)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build = t3.id') - ->where('t1.product')->eq((int)$productID) + ->where('t1.deleted')->eq(0) + ->beginIF($projectID)->andWhere('t1.PRJ')->eq((int)$projectID)->fi() + ->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi() ->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi() ->beginIF($type != 'all')->andWhere('t1.status')->eq($type)->fi() - ->andWhere('t1.deleted')->eq(0) ->orderBy('t1.date DESC') ->fetchAll(); } @@ -102,15 +104,11 @@ class projectreleaseModel extends model /** * Create a release. * - * @param int $productID - * @param int $branch * @access public * @return int */ - public function create($productID, $branch = 0) + public function create() { - $productID = (int)$productID; - $branch = (int)$branch; $buildID = 0; /* Check build if build is required. */ @@ -121,8 +119,6 @@ class projectreleaseModel extends model $release = fixer::input('post') ->add('PRJ', $this->session->PRJ) - ->add('product', (int)$productID) - ->add('branch', (int)$branch) ->setDefault('stories', '') ->join('stories', ',') ->join('bugs', ',') @@ -134,10 +130,11 @@ class projectreleaseModel extends model /* Auto create build when release is not link build. */ if(empty($release->build) and $release->name) { - $build = $this->dao->select('*')->from(TABLE_BUILD) + $branch = isset($release->branch) ? $release->branch : 0; + $build = $this->dao->select('*')->from(TABLE_BUILD) ->where('deleted')->eq('0') ->andWhere('name')->eq($release->name) - ->andWhere('product')->eq($productID) + ->andWhere('product')->eq($release->product) ->andWhere('branch')->eq($branch) ->fetch(); if($build) @@ -148,8 +145,8 @@ class projectreleaseModel extends model { $build = new stdclass(); $build->PRJ = $this->session->PRJ; - $build->product = (int)$productID; - $build->branch = (int)$branch; + $build->product = $release->product; + $build->branch = $branch; $build->name = $release->name; $build->date = $release->date; $build->builder = $this->app->user->account; @@ -159,7 +156,7 @@ class projectreleaseModel extends model $build = $this->loadModel('file')->processImgURL($build, $this->config->release->editor->create['id']); $this->dao->insert(TABLE_BUILD)->data($build) ->autoCheck() - ->check('name', 'unique', "product = {$productID} AND branch = {$branch} AND deleted = '0'") + ->check('name', 'unique', "product = {$release->product} AND branch = {$branch} AND deleted = '0'") ->batchCheck($this->config->release->create->requiredFields, 'notempty') ->exec(); if(dao::isError()) return false; diff --git a/module/projectrelease/view/browse.html.php b/module/projectrelease/view/browse.html.php index 3b9181b9bd..6ac1742ad2 100644 --- a/module/projectrelease/view/browse.html.php +++ b/module/projectrelease/view/browse.html.php @@ -16,14 +16,14 @@ @@ -32,8 +32,8 @@

release->noRelease;?> - - createLink('projectrelease', 'create', "productID=$product->id&branch=$branch"), " " . $lang->release->create, '', "class='btn btn-info'");?> + + createLink('projectrelease', 'create', "productID=$productID&branch=$branch"), " " . $lang->release->create, '', "class='btn btn-info'");?>

@@ -44,7 +44,7 @@ release->id;?> release->name;?> release->build;?> - type != 'normal'):?> + type) and $product->type != 'normal'):?> product->branch;?> release->date;?> @@ -68,7 +68,7 @@ ?> project) ? $release->buildName : html::a($this->createLink('build', 'view', "buildID=$release->buildID"), $release->buildName);?> - type != 'normal'):?> + type) and $product->type != 'normal'):?> '>branch];?> date;?> diff --git a/module/projectrelease/view/create.html.php b/module/projectrelease/view/create.html.php index 8fddb38e36..0b21d031e1 100644 --- a/module/projectrelease/view/create.html.php +++ b/module/projectrelease/view/create.html.php @@ -20,6 +20,21 @@
+ + + + +
release->product;?> + type != 'normal'):?> +
+ + + type != 'normal'):?> + + +
+ +
release->name;?>