trim name passed to addDocumentCategory() and check if != ''

This commit is contained in:
Uwe Steinmann 2021-09-17 18:59:06 +02:00
parent 3ed0854e13
commit 59c16b3ce4

View File

@ -2431,10 +2431,12 @@ class SeedDMS_Core_DMS {
} /* }}} */
function addDocumentCategory($name) { /* {{{ */
if (is_object($this->getDocumentCategoryByName($name))) {
if(!trim($name))
return false;
if (is_object($this->getDocumentCategoryByName(trim($name)))) {
return false;
}
$queryStr = "INSERT INTO `tblCategory` (`name`) VALUES (".$this->db->qstr($name).")";
$queryStr = "INSERT INTO `tblCategory` (`name`) VALUES (".$this->db->qstr(trim($name)).")";
if (!$this->db->getResult($queryStr))
return false;