add method to set name, comment, version, public flag of document files

This commit is contained in:
Uwe Steinmann 2017-12-05 08:27:14 +01:00
parent 795b6c52e2
commit e3d1cc172b

View File

@ -4729,6 +4729,23 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
function getDocument() { return $this->_document; }
function getUserID() { return $this->_userID; }
function getComment() { return $this->_comment; }
/*
* Set the comment of the document file
*
* @param $newComment string new comment of document
*/
function setComment($newComment) { /* {{{ */
$db = $this->_document->_dms->getDB();
$queryStr = "UPDATE `tblDocumentFiles` SET `comment` = ".$db->qstr($newComment)." WHERE `document` = ".$this->_document->getId()." AND `id` = ". $this->_id;
if (!$db->getResult($queryStr))
return false;
$this->_comment = $newComment;
return true;
} /* }}} */
function getDate() { return $this->_date; }
function getDir() { return $this->_dir; }
function getFileType() { return $this->_fileType; }
@ -4736,6 +4753,22 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
function getOriginalFileName() { return $this->_orgFileName; }
function getName() { return $this->_name; }
/*
* Set the name of the document file
*
* @param $newComment string new name of document
*/
function setName($newName) { /* {{{ */
$db = $this->_document->_dms->getDB();
$queryStr = "UPDATE `tblDocumentFiles` SET `name` = ".$db->qstr($newName)." WHERE `document` = ".$this->_document->getId()." AND `id` = ". $this->_id;
if (!$db->getResult($queryStr))
return false;
$this->_name = $newName;
return true;
} /* }}} */
function getUser() {
if (!isset($this->_user))
$this->_user = $this->_document->_dms->getUser($this->_userID);
@ -4748,8 +4781,43 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
function getVersion() { return $this->_version; }
/*
* Set the version of the document file
*
* @param $newComment string new version of document
*/
function setVersion($newVersion) { /* {{{ */
$db = $this->_document->_dms->getDB();
if(!is_numeric($newVersion) && $newVersion != '')
return false;
$queryStr = "UPDATE `tblDocumentFiles` SET `version` = ".(int) $newVersion." WHERE `document` = ".$this->_document->getId()." AND `id` = ". $this->_id;
if (!$db->getResult($queryStr))
return false;
$this->_version = (int) $newVersion;
return true;
} /* }}} */
function isPublic() { return $this->_public; }
/*
* Set the public flag of the document file
*
* @param $newComment string new comment of document
*/
function setPublic($newPublic) { /* {{{ */
$db = $this->_document->_dms->getDB();
$queryStr = "UPDATE `tblDocumentFiles` SET `public` = ".($newPublic ? 1 : 0)." WHERE `document` = ".$this->_document->getId()." AND `id` = ". $this->_id;
if (!$db->getResult($queryStr))
return false;
$this->_public = $newPublic ? 1 : 0;
return true;
} /* }}} */
/**
* Returns the access mode similar to a document
*