* Fix bug of task #89139.
This commit is contained in:
@@ -79,7 +79,7 @@ class api extends control
|
||||
|
||||
if($browseType == 'bySearch')
|
||||
{
|
||||
$this->view->apiList = $this->api->getApiListBySearch($libID, $queryID);
|
||||
$this->view->apiList = $this->api->getApiListBySearch($libID, $queryID, '', array_keys($libs));
|
||||
$this->view->typeList = $this->api->getTypeList($libID);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class api extends control
|
||||
$this->view->objectType = $objectType;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->libTree = $this->api->getLibTree($libID, $libs, $moduleID);
|
||||
$this->view->libTree = $this->api->getLibTree($libID, $libs, $moduleID, $objectID, $browseType);
|
||||
$this->view->users = $this->user->getPairs('noclosed,noletter');
|
||||
$this->view->objectDropdown = isset($libs[$libID]) ? $this->generateLibsDropMenu($libs[$libID], $release) : '';
|
||||
|
||||
|
||||
+10
-8
@@ -965,15 +965,14 @@ class apiModel extends model
|
||||
}
|
||||
|
||||
$apiQuery = $this->session->$queryName;
|
||||
if(strpos($apiQuery, "`lib` = 'all'") === false and !$objectType) $apiQuery = "$apiQuery and lib = $libID";
|
||||
if(strpos($apiQuery, "`lib` = 'all'") !== false) $apiQuery = str_replace("`lib` = 'all'", '1', $apiQuery);
|
||||
|
||||
$list = $this->dao->select('*')
|
||||
->from(TABLE_API)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere($apiQuery)
|
||||
->beginIF(!empty($libs))->andWhere('`lib`')->in($libs)->fi()
|
||||
->fetchAll();
|
||||
->from(TABLE_API)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere($apiQuery)
|
||||
->beginIF(!empty($libs))->andWhere('`lib`')->in($libs)->fi()
|
||||
->fetchAll();
|
||||
|
||||
return $list;
|
||||
}
|
||||
@@ -1041,13 +1040,16 @@ class apiModel extends model
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $libs
|
||||
* @param int $moduleID
|
||||
* @param int $objectID
|
||||
* @param string $browseType bySearch
|
||||
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getLibTree($libID, $libs, $objectID = 0)
|
||||
public function getLibTree($libID, $libs, $moduleID, $objectID = 0, $browseType = '')
|
||||
{
|
||||
$libTree = $this->loadModel('doc')->getLibTree($libID, $libs, 'api', $objectID);
|
||||
$libTree = $this->loadModel('doc')->getLibTree($libID, $libs, 'api', $moduleID, $objectID, $browseType);
|
||||
$releases = $this->getReleaseByQuery(array_keys($libs), null, 'lib_asc, id_desc');
|
||||
|
||||
foreach($libTree as &$tree)
|
||||
|
||||
@@ -301,8 +301,7 @@ class docModel extends model
|
||||
if($libType == 'product') $this->config->api->createlib->requiredFields .= ',product';
|
||||
if($libType == 'project') $this->config->api->createlib->requiredFields .= ',project';
|
||||
|
||||
$data->id = $id;
|
||||
$this->checkApiLibName($data, $libType);
|
||||
$this->checkApiLibName($data, $libType, $id);
|
||||
|
||||
if(dao::isError()) return false;
|
||||
|
||||
@@ -356,10 +355,9 @@ class docModel extends model
|
||||
$type = 'nolink';
|
||||
if(!empty($oldLib->product)) $type = 'product';
|
||||
if(!empty($oldLib->project)) $type = 'project';
|
||||
$lib->id = $libID;
|
||||
$lib->product = $oldLib->product;
|
||||
$lib->project = $oldLib->project;
|
||||
$this->checkApiLibName($lib, $type);
|
||||
$this->checkApiLibName($lib, $type, $libID);
|
||||
}
|
||||
|
||||
$lib->name = trim($lib->name); //Temporary treatment: Code for bug #15528.
|
||||
@@ -3019,7 +3017,7 @@ class docModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function checkApiLibName($lib, $libType)
|
||||
public function checkApiLibName($lib, $libType, $libID = 0)
|
||||
{
|
||||
$sameNames = $this->dao->select('*')
|
||||
->from(TABLE_DOCLIB)
|
||||
@@ -3027,9 +3025,7 @@ class docModel extends model
|
||||
->andWhere('`project`')->eq($lib->project)
|
||||
->andWhere('`name`')->eq($lib->name)
|
||||
->andWhere('`type`')->eq('api')
|
||||
->beginIF(isset($lib->id))
|
||||
->andWhere('`id`')->ne($lib->id)
|
||||
->fi()
|
||||
->beginIF(!empty($libID))->andWhere('`id`')->ne($libID)->fi()
|
||||
->fetchAll();
|
||||
if(count($sameNames) > 0 and $libType == 'product') dao::$errors['name'] = $this->lang->doclib->apiNameUnique[$libType] . sprintf($this->lang->error->unique, $this->lang->doclib->name, $lib->name);
|
||||
if(count($sameNames) > 0 and $libType == 'project') dao::$errors['name'] = $this->lang->doclib->apiNameUnique[$libType] . sprintf($this->lang->error->unique, $this->lang->doclib->name, $lib->name);
|
||||
|
||||
Reference in New Issue
Block a user