diff --git a/config/zentaopms.php b/config/zentaopms.php index bc2ecfea74..f2567d0504 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -140,6 +140,7 @@ $config->openMethods[] = 'my.preference'; $config->openMethods[] = 'my.changepassword'; $config->openMethods[] = 'my.profile'; $config->openMethods[] = 'my.settutorialconfig'; +$config->openMethods[] = 'doc.selectlibtype'; /* Define the tables. */ define('TABLE_COMPANY', '`' . $config->db->prefix . 'company`'); diff --git a/module/common/model.php b/module/common/model.php index e4778ee2eb..a30d494697 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -374,7 +374,6 @@ class commonModel extends model $createMethod = 'create'; if($objectType == 'effort') $createMethod = 'batchCreate'; - if($objectType == 'doc') $createMethod = 'selectLibType'; if(strpos('bug|execution', $objectType) !== false) $needPrintDivider = true; if(common::hasPriv($objectType, $createMethod)) @@ -397,7 +396,11 @@ class commonModel extends model $params = ''; if(strpos('bug|testcase|story', $objectType) !== false) $params = "productID=$productID"; - if($objectType == 'doc') $params = "objectType=&objectID=0&libID=0"; + if($objectType == 'doc') + { + $params = "objectType=&objectID=0&libID=0"; + $createMethod = 'selectLibType'; + } $html .= '
  • ' . html::a(helper::createLink($objectType, $createMethod, $params, '', $isOnlyBody), " " . $lang->createObjects[$objectType], '', $isOnlyBody ? $attr : '') . '
  • '; } diff --git a/module/doc/control.php b/module/doc/control.php index f927d17664..3c10c9a467 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -332,10 +332,11 @@ class doc extends control $libs = $this->doc->getLibs($objectType, $extra = "withObject,$unclosed", $libID, $objectID); if(!$libID and !empty($libs)) $libID = key($libs); - $lib = $this->doc->getLibByID($libID); - $type = !empty($lib) ? $lib->type : 'product'; + $lib = $this->doc->getLibByID($libID); + $type = isset($lib->type) ? $lib->type : 'product'; + $libName = isset($lib->name) ? $lib->name : 'product'; - $this->view->title = $lib->name . $this->lang->colon . $this->lang->doc->create; + $this->view->title = $libName . $this->lang->doc->create; $this->view->libID = $libID; $this->view->libs = $libs;