Fixed wrong return object in getDocumentLink()

This commit is contained in:
Sebastian Bartus-Kunz 2017-12-20 15:40:20 +01:00 committed by Uwe Steinmann
parent efe9ff0e42
commit f3daa6d0e2

View File

@ -284,7 +284,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
*/
function getDir() { /* {{{ */
if($this->_dms->maxDirID) {
$dirid = (int) (($this->_id-1) / $this->_dms->maxDirID) + 1;
$dirid = (int) (($this->_id-1) / $this->_dms->maxDirID) + 1;
return $dirid."/".$this->_id."/";
} else {
return $this->_id."/";
@ -760,7 +760,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
* has no access list the returned array contains the two elements
* 'users' and 'groups' which are than empty. The methode returns false
* if the function fails.
*
*
* @param integer $mode access mode (defaults to M_ANY)
* @param integer $op operation (defaults to O_EQ)
* @return array multi dimensional array or false in case of an error
@ -1825,7 +1825,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$link = new SeedDMS_Core_DocumentLink($resArr["id"], $document, $target, $resArr["userID"], $resArr["public"]);
$user = $this->_dms->getLoggedInUser();
if($link->getAccessMode($user, $document, $target) >= M_READ)
return $file;
return $link;
return null;
} /* }}} */
@ -1977,7 +1977,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$queryStr = "SELECT * FROM `tblDocumentFiles` WHERE `document` = " . $this->_id;
if($version) {
$queryStr .= " AND (`version`=0 OR `version`=".(int) $version.")";
}
}
$queryStr .= " ORDER BY ";
if($version) {
$queryStr .= "`version` DESC,";
@ -2352,7 +2352,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
/**
* Calculate the disk space including all versions of the document
*
*
* This is done by using the internal database field storing the
* filesize of a document version.
*
@ -2371,7 +2371,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
/**
* Returns a list of events happend during the life of the document
*
*
* This includes the creation of new versions, approval and reviews, etc.
*
* @return array list of events
@ -2865,7 +2865,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
/**
* Rewrites the complete status log
*
*
* Attention: this function is highly dangerous.
* It removes an existing status log and rewrites it.
* This method was added for importing an xml dump.
@ -2916,7 +2916,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* Returns the access mode similar to a document
*
* There is no real access mode for document content, so this is more
* like a virtual access mode, derived from the status of the document
* like a virtual access mode, derived from the status of the document
* content. The function checks if {@link SeedDMS_Core_DMS::noReadForStatus}
* contains the status of the version and returns M_NONE if it exists and
* the user is not involved in a workflow or review/approval/revision.
@ -2926,7 +2926,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* prevent access on the whole document if there is no accessible version.
*
* FIXME: This function only works propperly if $u is the currently logged in
* user, because noReadForStatus will be set for this user.
* user, because noReadForStatus will be set for this user.
* FIXED: instead of using $dms->noReadForStatus it is take from the user's role
*
* @param object $u user
@ -3094,7 +3094,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
/**
* Rewrites the complete review log
*
*
* Attention: this function is highly dangerous.
* It removes an existing review log and rewrites it.
* This method was added for importing an xml dump.
@ -3222,7 +3222,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
/**
* Rewrites the complete approval log
*
*
* Attention: this function is highly dangerous.
* It removes an existing review log and rewrites it.
* This method was added for importing an xml dump.
@ -3890,7 +3890,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$recs = $db->getResultArray($queryStr);
if (is_bool($recs) && !$recs)
return false;
$this->_workflowState = new SeedDMS_Core_Workflow_State($recs[0]['id'], $recs[0]['name'], $recs[0]['maxtime'], $recs[0]['precondfunc'], $recs[0]['documentstatus']);
$this->_workflowState = new SeedDMS_Core_Workflow_State($recs[0]['id'], $recs[0]['name'], $recs[0]['maxtime'], $recs[0]['precondfunc'], $recs[0]['documentstatus']);
$this->_workflowState->setDMS($this->_document->_dms);
}
return $this->_workflowState;
@ -3913,7 +3913,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$db->rollbackTransaction();
return false;
}
$this->_workflow = $workflow;
$this->_workflow = $workflow;
if(!$this->setStatus(S_IN_WORKFLOW, "Added workflow '".$workflow->getName()."'", $user)) {
$db->rollbackTransaction();
return false;
@ -3947,7 +3947,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false;
if(!$recs)
return false;
$this->_workflow = new SeedDMS_Core_Workflow($recs[0]['id'], $recs[0]['name'], $this->_document->_dms->getWorkflowState($recs[0]['initstate']));
$this->_workflow = new SeedDMS_Core_Workflow($recs[0]['id'], $recs[0]['name'], $this->_document->_dms->getWorkflowState($recs[0]['initstate']));
$this->_workflow->setDMS($this->_document->_dms);
}
return $this->_workflow;
@ -3955,7 +3955,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
/**
* Rewrites the complete workflow log
*
*
* Attention: this function is highly dangerous.
* It removes an existing workflow log and rewrites it.
* This method was added for importing an xml dump.
@ -4107,7 +4107,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
if($recs[0]['parentworkflow'])
return $this->_document->_dms->getWorkflow($recs[0]['parentworkflow']);
return false;
} /* }}} */
@ -4134,7 +4134,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
if (!$db->getResult($queryStr)) {
return false;
}
$this->_workflow = $subworkflow;
$this->_workflow = $subworkflow;
return true;
}
return true;
@ -4181,7 +4181,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false;
}
$this->_workflow = $this->_document->_dms->getWorkflow($recs[0]['parentworkflow']);
$this->_workflow = $this->_document->_dms->getWorkflow($recs[0]['parentworkflow']);
$this->_workflow->setDMS($this->_document->_dms);
if($transition) {
@ -4390,7 +4390,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return $nextstate;
}
return true;
} /* }}} */
/**