use configured classname, remove old code

This commit is contained in:
Uwe Steinmann 2015-07-15 22:28:31 +02:00
parent 245bcc6a1e
commit ecbdb4ea4a

View File

@ -190,7 +190,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$lock = $lockArr[0]["userID"]; $lock = $lockArr[0]["userID"];
} }
$document = new self($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $lock, $resArr["keywords"], $resArr["sequence"]); $classname = $dms->getClassname('document');
$document = new $classname($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $lock, $resArr["keywords"], $resArr["sequence"]);
$document->setDMS($dms); $document->setDMS($dms);
return $document; return $document;
} /* }}} */ } /* }}} */
@ -1204,6 +1205,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if($workflow) if($workflow)
$content->setWorkflow($workflow, $user); $content->setWorkflow($workflow, $user);
$docResultSet = new SeedDMS_Core_AddContentResultSet($content); $docResultSet = new SeedDMS_Core_AddContentResultSet($content);
$docResultSet->setDMS($this->_dms);
if($attributes) { if($attributes) {
foreach($attributes as $attrdefid=>$attribute) { foreach($attributes as $attrdefid=>$attribute) {
@ -1449,9 +1451,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
function removeContent($version) { /* {{{ */ function removeContent($version) { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$emailList = array();
$emailList[] = $version->_userID;
if (file_exists( $this->_dms->contentDir.$version->getPath() )) if (file_exists( $this->_dms->contentDir.$version->getPath() ))
if (!SeedDMS_Core_File::removeFile( $this->_dms->contentDir.$version->getPath() )) if (!SeedDMS_Core_File::removeFile( $this->_dms->contentDir.$version->getPath() ))
return false; return false;
@ -1500,9 +1499,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if(file_exists($file)) if(file_exists($file))
SeedDMS_Core_File::removeFile($file); SeedDMS_Core_File::removeFile($file);
} }
if ($st["status"]==0 && !in_array($st["required"], $emailList)) {
$emailList[] = $st["required"];
}
} }
if (strlen($stList)>0) { if (strlen($stList)>0) {
@ -1532,9 +1528,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if(file_exists($file)) if(file_exists($file))
SeedDMS_Core_File::removeFile($file); SeedDMS_Core_File::removeFile($file);
} }
if ($st["status"]==0 && !in_array($st["required"], $emailList)) {
$emailList[] = $st["required"];
}
} }
if (strlen($stList)>0) { if (strlen($stList)>0) {
@ -4101,6 +4094,11 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
protected $_content; protected $_content;
protected $_status; protected $_status;
/**
* @var object back reference to document management system
*/
protected $_dms;
function SeedDMS_Core_AddContentResultSet($content) { /* {{{ */ function SeedDMS_Core_AddContentResultSet($content) { /* {{{ */
$this->_content = $content; $this->_content = $content;
$this->_indReviewers = null; $this->_indReviewers = null;
@ -4108,15 +4106,31 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
$this->_indApprovers = null; $this->_indApprovers = null;
$this->_grpApprovers = null; $this->_grpApprovers = null;
$this->_status = null; $this->_status = null;
$this->_dms = null;
} /* }}} */
/*
* Set dms this object belongs to.
*
* Each object needs a reference to the dms it belongs to. It will be
* set when the object is created.
* The dms has a references to the currently logged in user
* and the database connection.
*
* @param object $dms reference to dms
*/
function setDMS($dms) { /* {{{ */
$this->_dms = $dms;
} /* }}} */ } /* }}} */
function addReviewer($reviewer, $type, $status) { /* {{{ */ function addReviewer($reviewer, $type, $status) { /* {{{ */
$dms = $this->_dms;
if (!is_object($reviewer) || (strcasecmp($type, "i") && strcasecmp($type, "g")) && !is_integer($status)){ if (!is_object($reviewer) || (strcasecmp($type, "i") && strcasecmp($type, "g")) && !is_integer($status)){
return false; return false;
} }
if (!strcasecmp($type, "i")) { if (!strcasecmp($type, "i")) {
if (strcasecmp(get_class($reviewer), "SeedDMS_Core_User")) { if (strcasecmp(get_class($reviewer), $dms->getClassname("user"))) {
return false; return false;
} }
if ($this->_indReviewers == null) { if ($this->_indReviewers == null) {
@ -4125,7 +4139,7 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
$this->_indReviewers[$status][] = $reviewer; $this->_indReviewers[$status][] = $reviewer;
} }
if (!strcasecmp($type, "g")) { if (!strcasecmp($type, "g")) {
if (strcasecmp(get_class($reviewer), "SeedDMS_Core_Group")) { if (strcasecmp(get_class($reviewer), $dms->getClassname("group"))) {
return false; return false;
} }
if ($this->_grpReviewers == null) { if ($this->_grpReviewers == null) {
@ -4137,6 +4151,7 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */
} /* }}} */ } /* }}} */
function addApprover($approver, $type, $status) { /* {{{ */ function addApprover($approver, $type, $status) { /* {{{ */
$dms = $this->_dms;
if (!is_object($approver) || (strcasecmp($type, "i") && strcasecmp($type, "g")) && !is_integer($status)){ if (!is_object($approver) || (strcasecmp($type, "i") && strcasecmp($type, "g")) && !is_integer($status)){
return false; return false;