mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 00:45:34 +00:00
- getDocumentCategoryByName() returns just one category
This commit is contained in:
parent
afb4774ada
commit
63bf8505a8
|
@ -923,6 +923,14 @@ class LetoDMS_Core_DMS {
|
|||
return $categories;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get a category by its name
|
||||
*
|
||||
* The name of a category is by default unique.
|
||||
*
|
||||
* @param string $name human readable name of category
|
||||
* @return object instance of LetoDMS_Core_DocumentCategory
|
||||
*/
|
||||
function getDocumentCategoryByName($name) { /* {{{ */
|
||||
$queryStr = "SELECT * FROM tblCategory where name='".$name."'";
|
||||
|
||||
|
@ -930,14 +938,11 @@ class LetoDMS_Core_DMS {
|
|||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
||||
$categories = array();
|
||||
foreach ($resArr as $row) {
|
||||
$cat = new LetoDMS_Core_DocumentCategory($row["id"], $row["name"]);
|
||||
$cat->setDMS($this);
|
||||
array_push($categories, $cat);
|
||||
}
|
||||
$row = $resArr[0];
|
||||
$cat = new LetoDMS_Core_DocumentCategory($row["id"], $row["name"]);
|
||||
$cat->setDMS($this);
|
||||
|
||||
return $categories;
|
||||
return $cat;
|
||||
} /* }}} */
|
||||
|
||||
function addDocumentCategory($name) { /* {{{ */
|
||||
|
|
Loading…
Reference in New Issue
Block a user