mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
getting category or attributedef. returns null not false if none was found
This commit is contained in:
parent
84ffa71d24
commit
79bcdb6086
|
@ -2404,8 +2404,10 @@ class SeedDMS_Core_DMS {
|
||||||
|
|
||||||
$queryStr = "SELECT * FROM `tblCategory` WHERE `id` = " . (int) $id;
|
$queryStr = "SELECT * FROM `tblCategory` WHERE `id` = " . (int) $id;
|
||||||
$resArr = $this->db->getResultArray($queryStr);
|
$resArr = $this->db->getResultArray($queryStr);
|
||||||
if ((is_bool($resArr) && !$resArr) || (count($resArr) != 1))
|
if (is_bool($resArr) && !$resArr)
|
||||||
return false;
|
return false;
|
||||||
|
if (count($resArr) != 1)
|
||||||
|
return null;
|
||||||
|
|
||||||
$resArr = $resArr[0];
|
$resArr = $resArr[0];
|
||||||
$cat = new SeedDMS_Core_DocumentCategory($resArr["id"], $resArr["name"]);
|
$cat = new SeedDMS_Core_DocumentCategory($resArr["id"], $resArr["name"]);
|
||||||
|
@ -2569,14 +2571,16 @@ class SeedDMS_Core_DMS {
|
||||||
* @return bool|SeedDMS_Core_AttributeDefinition or false
|
* @return bool|SeedDMS_Core_AttributeDefinition or false
|
||||||
*/
|
*/
|
||||||
function getAttributeDefinition($id) { /* {{{ */
|
function getAttributeDefinition($id) { /* {{{ */
|
||||||
if (!is_numeric($id))
|
if (!is_numeric($id) || $id < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$queryStr = "SELECT * FROM `tblAttributeDefinitions` WHERE `id` = " . (int) $id;
|
$queryStr = "SELECT * FROM `tblAttributeDefinitions` WHERE `id` = " . (int) $id;
|
||||||
$resArr = $this->db->getResultArray($queryStr);
|
$resArr = $this->db->getResultArray($queryStr);
|
||||||
|
|
||||||
if (is_bool($resArr) && $resArr == false) return false;
|
if (is_bool($resArr) && $resArr == false)
|
||||||
if (count($resArr) != 1) return false;
|
return false;
|
||||||
|
if (count($resArr) != 1)
|
||||||
|
return null;
|
||||||
|
|
||||||
$resArr = $resArr[0];
|
$resArr = $resArr[0];
|
||||||
|
|
||||||
|
@ -2600,8 +2604,10 @@ class SeedDMS_Core_DMS {
|
||||||
$queryStr = "SELECT * FROM `tblAttributeDefinitions` WHERE `name` = " . $this->db->qstr($name);
|
$queryStr = "SELECT * FROM `tblAttributeDefinitions` WHERE `name` = " . $this->db->qstr($name);
|
||||||
$resArr = $this->db->getResultArray($queryStr);
|
$resArr = $this->db->getResultArray($queryStr);
|
||||||
|
|
||||||
if (is_bool($resArr) && $resArr == false) return false;
|
if (is_bool($resArr) && $resArr == false)
|
||||||
if (count($resArr) != 1) return false;
|
return false;
|
||||||
|
if (count($resArr) != 1)
|
||||||
|
return null;
|
||||||
|
|
||||||
$resArr = $resArr[0];
|
$resArr = $resArr[0];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user