use getDMS() instead of accessing _dms

This commit is contained in:
Uwe Steinmann 2020-01-10 14:48:14 +01:00
parent 9b6949a00a
commit 699152d95b

View File

@ -2896,7 +2896,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
function getUser() { /* {{{ */ function getUser() { /* {{{ */
if (!isset($this->_user)) if (!isset($this->_user))
$this->_user = $this->_document->_dms->getUser($this->_userID); $this->_user = $this->_document->getDMS()->getUser($this->_userID);
return $this->_user; return $this->_user;
} /* }}} */ } /* }}} */
@ -2912,7 +2912,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
function getPath() { return $this->_document->getDir() . $this->_version . ($this->_fileType != '.' ? $this->_fileType : ''); } function getPath() { return $this->_document->getDir() . $this->_version . ($this->_fileType != '.' ? $this->_fileType : ''); }
function setDate($date = false) { /* {{{ */ function setDate($date = false) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if(!$date) if(!$date)
$date = time(); $date = time();
@ -2942,7 +2942,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
if($filesize === false) if($filesize === false)
return false; return false;
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$queryStr = "UPDATE `tblDocumentContent` SET `fileSize` = ".$filesize." where `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version; $queryStr = "UPDATE `tblDocumentContent` SET `fileSize` = ".$filesize." where `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
if (!$db->getResult($queryStr)) if (!$db->getResult($queryStr))
return false; return false;
@ -2963,7 +2963,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
if($checksum === false) if($checksum === false)
return false; return false;
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$queryStr = "UPDATE `tblDocumentContent` SET `checksum` = ".$db->qstr($checksum)." where `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version; $queryStr = "UPDATE `tblDocumentContent` SET `checksum` = ".$db->qstr($checksum)." where `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
if (!$db->getResult($queryStr)) if (!$db->getResult($queryStr))
return false; return false;
@ -2973,7 +2973,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} /* }}} */ } /* }}} */
function setComment($newComment) { /* {{{ */ function setComment($newComment) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$queryStr = "UPDATE `tblDocumentContent` SET `comment` = ".$db->qstr($newComment)." WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version; $queryStr = "UPDATE `tblDocumentContent` SET `comment` = ".$db->qstr($newComment)." WHERE `document` = " . $this->_document->getID() . " AND `version` = " . $this->_version;
if (!$db->getResult($queryStr)) if (!$db->getResult($queryStr))
@ -3007,7 +3007,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return array latest record from tblDocumentStatusLog * @return array latest record from tblDocumentStatusLog
*/ */
function getStatus($limit=1) { /* {{{ */ function getStatus($limit=1) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if (!is_numeric($limit)) return false; if (!is_numeric($limit)) return false;
@ -3041,7 +3041,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return array list of status changes * @return array list of status changes
*/ */
function getStatusLog($limit=0) { /* {{{ */ function getStatusLog($limit=0) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if (!is_numeric($limit)) return false; if (!is_numeric($limit)) return false;
@ -3076,7 +3076,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return boolean true on success, otherwise false * @return boolean true on success, otherwise false
*/ */
function setStatus($status, $comment, $updateUser, $date='') { /* {{{ */ function setStatus($status, $comment, $updateUser, $date='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if (!is_numeric($status)) return false; if (!is_numeric($status)) return false;
@ -3123,7 +3123,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return boolean true on success, otherwise false * @return boolean true on success, otherwise false
*/ */
function rewriteStatusLog($statuslog) { /* {{{ */ function rewriteStatusLog($statuslog) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$queryStr= "SELECT `tblDocumentStatus`.* FROM `tblDocumentStatus` WHERE `tblDocumentStatus`.`documentID` = '". $this->_document->getID() ."' AND `tblDocumentStatus`.`version` = '". $this->_version ."' "; $queryStr= "SELECT `tblDocumentStatus`.* FROM `tblDocumentStatus` WHERE `tblDocumentStatus`.`documentID` = '". $this->_document->getID() ."' AND `tblDocumentStatus`.`version` = '". $this->_version ."' ";
$res = $db->getResultArray($queryStr); $res = $db->getResultArray($queryStr);
@ -3182,7 +3182,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return integer either M_NONE or M_READ * @return integer either M_NONE or M_READ
*/ */
function getAccessMode($u) { /* {{{ */ function getAccessMode($u) { /* {{{ */
$dms = $this->_document->_dms; $dms = $this->_document->getDMS();
/* Check if 'onCheckAccessDocumentContent' callback is set */ /* Check if 'onCheckAccessDocumentContent' callback is set */
if(isset($this->_dms->callbacks['onCheckAccessDocumentContent'])) { if(isset($this->_dms->callbacks['onCheckAccessDocumentContent'])) {
@ -3292,7 +3292,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return array list of review status * @return array list of review status
*/ */
function getReviewStatus($limit=1) { /* {{{ */ function getReviewStatus($limit=1) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if (!is_numeric($limit)) return false; if (!is_numeric($limit)) return false;
@ -3352,7 +3352,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return boolean true on success, otherwise false * @return boolean true on success, otherwise false
*/ */
function rewriteReviewLog($reviewers) { /* {{{ */ function rewriteReviewLog($reviewers) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$queryStr= "SELECT `tblDocumentReviewers`.* FROM `tblDocumentReviewers` WHERE `tblDocumentReviewers`.`documentID` = '". $this->_document->getID() ."' AND `tblDocumentReviewers`.`version` = '". $this->_version ."' "; $queryStr= "SELECT `tblDocumentReviewers`.* FROM `tblDocumentReviewers` WHERE `tblDocumentReviewers`.`documentID` = '". $this->_document->getID() ."' AND `tblDocumentReviewers`.`version` = '". $this->_version ."' ";
$res = $db->getResultArray($queryStr); $res = $db->getResultArray($queryStr);
@ -3420,7 +3420,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return array list of approval status * @return array list of approval status
*/ */
function getApprovalStatus($limit=1) { /* {{{ */ function getApprovalStatus($limit=1) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if (!is_numeric($limit)) return false; if (!is_numeric($limit)) return false;
@ -3480,7 +3480,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return boolean true on success, otherwise false * @return boolean true on success, otherwise false
*/ */
function rewriteApprovalLog($reviewers) { /* {{{ */ function rewriteApprovalLog($reviewers) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$queryStr= "SELECT `tblDocumentApprovers`.* FROM `tblDocumentApprovers` WHERE `tblDocumentApprovers`.`documentID` = '". $this->_document->getID() ."' AND `tblDocumentApprovers`.`version` = '". $this->_version ."' "; $queryStr= "SELECT `tblDocumentApprovers`.* FROM `tblDocumentApprovers` WHERE `tblDocumentApprovers`.`documentID` = '". $this->_document->getID() ."' AND `tblDocumentApprovers`.`version` = '". $this->_version ."' ";
$res = $db->getResultArray($queryStr); $res = $db->getResultArray($queryStr);
@ -3541,7 +3541,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} /* }}} */ } /* }}} */
function addIndReviewer($user, $requestUser) { /* {{{ */ function addIndReviewer($user, $requestUser) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$userID = $user->getID(); $userID = $user->getID();
@ -3592,7 +3592,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} /* }}} */ } /* }}} */
function addGrpReviewer($group, $requestUser) { /* {{{ */ function addGrpReviewer($group, $requestUser) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$groupID = $group->getID(); $groupID = $group->getID();
@ -3670,7 +3670,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return integer new review log id * @return integer new review log id
*/ */
function setReviewByInd($user, $requestUser, $status, $comment, $file='') { /* {{{ */ function setReviewByInd($user, $requestUser, $status, $comment, $file='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
// Check to see if the user can be removed from the review list. // Check to see if the user can be removed from the review list.
$reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version); $reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version);
@ -3722,7 +3722,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return integer new review log id * @return integer new review log id
*/ */
function setReviewByGrp($group, $requestUser, $status, $comment, $file='') { /* {{{ */ function setReviewByGrp($group, $requestUser, $status, $comment, $file='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
// Check to see if the user can be removed from the review list. // Check to see if the user can be removed from the review list.
$reviewStatus = $group->getReviewStatus($this->_document->getID(), $this->_version); $reviewStatus = $group->getReviewStatus($this->_document->getID(), $this->_version);
@ -3761,7 +3761,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} /* }}} */ } /* }}} */
function addIndApprover($user, $requestUser) { /* {{{ */ function addIndApprover($user, $requestUser) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$userID = $user->getID(); $userID = $user->getID();
@ -3810,7 +3810,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} /* }}} */ } /* }}} */
function addGrpApprover($group, $requestUser) { /* {{{ */ function addGrpApprover($group, $requestUser) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$groupID = $group->getID(); $groupID = $group->getID();
@ -3892,7 +3892,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return integer 0 on success, < 0 in case of an error * @return integer 0 on success, < 0 in case of an error
*/ */
function setApprovalByInd($user, $requestUser, $status, $comment, $file='') { /* {{{ */ function setApprovalByInd($user, $requestUser, $status, $comment, $file='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
// Check to see if the user can be removed from the approval list. // Check to see if the user can be removed from the approval list.
$approvalStatus = $user->getApprovalStatus($this->_document->getID(), $this->_version); $approvalStatus = $user->getApprovalStatus($this->_document->getID(), $this->_version);
@ -3936,7 +3936,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* group instead of a user * group instead of a user
*/ */
function setApprovalByGrp($group, $requestUser, $status, $comment, $file='') { /* {{{ */ function setApprovalByGrp($group, $requestUser, $status, $comment, $file='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
// Check to see if the user can be removed from the approval list. // Check to see if the user can be removed from the approval list.
$approvalStatus = $group->getApprovalStatus($this->_document->getID(), $this->_version); $approvalStatus = $group->getApprovalStatus($this->_document->getID(), $this->_version);
@ -3974,7 +3974,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} /* }}} */ } /* }}} */
function delIndReviewer($user, $requestUser, $msg='') { /* {{{ */ function delIndReviewer($user, $requestUser, $msg='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
// Check to see if the user can be removed from the review list. // Check to see if the user can be removed from the review list.
$reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version); $reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version);
@ -4004,7 +4004,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} /* }}} */ } /* }}} */
function delGrpReviewer($group, $requestUser, $msg='') { /* {{{ */ function delGrpReviewer($group, $requestUser, $msg='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$groupID = $group->getID(); $groupID = $group->getID();
@ -4035,7 +4035,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} /* }}} */ } /* }}} */
function delIndApprover($user, $requestUser, $msg='') { /* {{{ */ function delIndApprover($user, $requestUser, $msg='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$userID = $user->getID(); $userID = $user->getID();
@ -4067,7 +4067,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} /* }}} */ } /* }}} */
function delGrpApprover($group, $requestUser, $msg='') { /* {{{ */ function delGrpApprover($group, $requestUser, $msg='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$groupID = $group->getID(); $groupID = $group->getID();
@ -4103,7 +4103,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @param object $state * @param object $state
*/ */
function setWorkflowState($state) { /* {{{ */ function setWorkflowState($state) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if($this->_workflow) { if($this->_workflow) {
$queryStr = "UPDATE `tblWorkflowDocumentContent` set `state`=". $state->getID() ." WHERE `workflow`=". intval($this->_workflow->getID()). " AND `document`=". intval($this->_document->getID()) ." AND version=". intval($this->_version) .""; $queryStr = "UPDATE `tblWorkflowDocumentContent` set `state`=". $state->getID() ." WHERE `workflow`=". intval($this->_workflow->getID()). " AND `document`=". intval($this->_document->getID()) ." AND version=". intval($this->_version) ."";
@ -4123,7 +4123,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* or false in case of error, e.g. the version has not a workflow * or false in case of error, e.g. the version has not a workflow
*/ */
function getWorkflowState() { /* {{{ */ function getWorkflowState() { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if(!$this->_workflow) if(!$this->_workflow)
$this->getWorkflow(); $this->getWorkflow();
@ -4140,7 +4140,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
if (is_bool($recs) && !$recs) if (is_bool($recs) && !$recs)
return false; 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); $this->_workflowState->setDMS($this->_document->getDMS());
} }
return $this->_workflowState; return $this->_workflowState;
} /* }}} */ } /* }}} */
@ -4151,7 +4151,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @param object $workflow * @param object $workflow
*/ */
function setWorkflow($workflow, $user) { /* {{{ */ function setWorkflow($workflow, $user) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$this->getWorkflow(); $this->getWorkflow();
if($workflow && is_object($workflow)) { if($workflow && is_object($workflow)) {
@ -4184,7 +4184,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* or false in case of error, e.g. the version has not a workflow * or false in case of error, e.g. the version has not a workflow
*/ */
function getWorkflow() { /* {{{ */ function getWorkflow() { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if (!isset($this->_workflow)) { if (!isset($this->_workflow)) {
$queryStr= $queryStr=
@ -4196,8 +4196,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false; return false;
if(!$recs) if(!$recs)
return false; 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->getDMS()->getWorkflowState($recs[0]['initstate']));
$this->_workflow->setDMS($this->_document->_dms); $this->_workflow->setDMS($this->_document->getDMS());
} }
return $this->_workflow; return $this->_workflow;
} /* }}} */ } /* }}} */
@ -4213,7 +4213,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return boolean true on success, otherwise false * @return boolean true on success, otherwise false
*/ */
function rewriteWorkflowLog($workflowlog) { /* {{{ */ function rewriteWorkflowLog($workflowlog) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$db->startTransaction(); $db->startTransaction();
@ -4250,7 +4250,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* or false in case of error * or false in case of error
*/ */
function rewindWorkflow() { /* {{{ */ function rewindWorkflow() { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$this->getWorkflow(); $this->getWorkflow();
@ -4291,7 +4291,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* or false in case of error * or false in case of error
*/ */
function removeWorkflow($user, $unlink=false) { /* {{{ */ function removeWorkflow($user, $unlink=false) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$this->getWorkflow(); $this->getWorkflow();
@ -4336,7 +4336,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @param object $subworkflow * @param object $subworkflow
*/ */
function getParentWorkflow() { /* {{{ */ function getParentWorkflow() { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
/* document content must be in a workflow */ /* document content must be in a workflow */
$this->getWorkflow(); $this->getWorkflow();
@ -4355,7 +4355,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false; return false;
if($recs[0]['parentworkflow']) if($recs[0]['parentworkflow'])
return $this->_document->_dms->getWorkflow($recs[0]['parentworkflow']); return $this->_document->getDMS()->getWorkflow($recs[0]['parentworkflow']);
return false; return false;
} /* }}} */ } /* }}} */
@ -4366,7 +4366,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @param object $subworkflow * @param object $subworkflow
*/ */
function runSubWorkflow($subworkflow) { /* {{{ */ function runSubWorkflow($subworkflow) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
/* document content must be in a workflow */ /* document content must be in a workflow */
$this->getWorkflow(); $this->getWorkflow();
@ -4400,7 +4400,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @param string comment for the transition trigger * @param string comment for the transition trigger
*/ */
function returnFromSubWorkflow($user, $transition=null, $comment='') { /* {{{ */ function returnFromSubWorkflow($user, $transition=null, $comment='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
/* document content must be in a workflow */ /* document content must be in a workflow */
$this->getWorkflow(); $this->getWorkflow();
@ -4430,8 +4430,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false; return false;
} }
$this->_workflow = $this->_document->_dms->getWorkflow($recs[0]['parentworkflow']); $this->_workflow = $this->_document->getDMS()->getWorkflow($recs[0]['parentworkflow']);
$this->_workflow->setDMS($this->_document->_dms); $this->_workflow->setDMS($this->_document->getDMS());
if($transition) { if($transition) {
if(false === $this->triggerWorkflowTransition($user, $transition, $comment)) { if(false === $this->triggerWorkflowTransition($user, $transition, $comment)) {
@ -4456,7 +4456,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return boolean true if user may trigger transaction * @return boolean true if user may trigger transaction
*/ */
function triggerWorkflowTransitionIsAllowed($user, $transition) { /* {{{ */ function triggerWorkflowTransitionIsAllowed($user, $transition) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if(!$this->_workflow) if(!$this->_workflow)
$this->getWorkflow(); $this->getWorkflow();
@ -4598,7 +4598,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* false in case of an error * false in case of an error
*/ */
function triggerWorkflowTransition($user, $transition, $comment='') { /* {{{ */ function triggerWorkflowTransition($user, $transition, $comment='') { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if(!$this->_workflow) if(!$this->_workflow)
$this->getWorkflow(); $this->getWorkflow();
@ -4739,7 +4739,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return array list of operations * @return array list of operations
*/ */
function getWorkflowLog($transition = null) { /* {{{ */ function getWorkflowLog($transition = null) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
/* /*
if(!$this->_workflow) if(!$this->_workflow)
@ -4759,8 +4759,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$workflowlogs = array(); $workflowlogs = array();
for ($i = 0; $i < count($resArr); $i++) { for ($i = 0; $i < count($resArr); $i++) {
$workflow = $this->_document->_dms->getWorkflow($resArr[$i]["workflow"]); $workflow = $this->_document->getDMS()->getWorkflow($resArr[$i]["workflow"]);
$workflowlog = new SeedDMS_Core_Workflow_Log($resArr[$i]["id"], $this->_document->_dms->getDocument($resArr[$i]["document"]), $resArr[$i]["version"], $workflow, $this->_document->_dms->getUser($resArr[$i]["userid"]), $workflow->getTransition($resArr[$i]["transition"]), $resArr[$i]["date"], $resArr[$i]["comment"]); $workflowlog = new SeedDMS_Core_Workflow_Log($resArr[$i]["id"], $this->_document->getDMS()->getDocument($resArr[$i]["document"]), $resArr[$i]["version"], $workflow, $this->_document->getDMS()->getUser($resArr[$i]["userid"]), $workflow->getTransition($resArr[$i]["transition"]), $resArr[$i]["date"], $resArr[$i]["comment"]);
$workflowlog->setDMS($this); $workflowlog->setDMS($this);
$workflowlogs[$i] = $workflowlog; $workflowlogs[$i] = $workflowlog;
} }
@ -4775,7 +4775,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @return array list of operations * @return array list of operations
*/ */
function getLastWorkflowTransition() { /* {{{ */ function getLastWorkflowTransition() { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if(!$this->_workflow) if(!$this->_workflow)
$this->getWorkflow(); $this->getWorkflow();
@ -4792,7 +4792,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$workflowlogs = array(); $workflowlogs = array();
$i = 0; $i = 0;
$workflowlog = new SeedDMS_Core_Workflow_Log($resArr[$i]["id"], $this->_document->_dms->getDocument($resArr[$i]["document"]), $resArr[$i]["version"], $this->_workflow, $this->_document->_dms->getUser($resArr[$i]["userid"]), $this->_workflow->getTransition($resArr[$i]["transition"]), $resArr[$i]["date"], $resArr[$i]["comment"]); $workflowlog = new SeedDMS_Core_Workflow_Log($resArr[$i]["id"], $this->_document->getDMS()->getDocument($resArr[$i]["document"]), $resArr[$i]["version"], $this->_workflow, $this->_document->getDMS()->getUser($resArr[$i]["userid"]), $this->_workflow->getTransition($resArr[$i]["transition"]), $resArr[$i]["date"], $resArr[$i]["comment"]);
$workflowlog->setDMS($this); $workflowlog->setDMS($this);
return $workflowlog; return $workflowlog;
@ -4910,8 +4910,9 @@ class SeedDMS_Core_DocumentLink { /* {{{ */
* @return bool|SeedDMS_Core_User * @return bool|SeedDMS_Core_User
*/ */
function getUser() { function getUser() {
if (!isset($this->_user)) if (!isset($this->_user)) {
$this->_user = $this->_document->_dms->getUser($this->_userID); $this->_user = $this->_document->getDMS()->getUser($this->_userID);
}
return $this->_user; return $this->_user;
} }
@ -5087,7 +5088,7 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
* @param string $newComment string new comment of document * @param string $newComment string new comment of document
*/ */
function setComment($newComment) { /* {{{ */ function setComment($newComment) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$queryStr = "UPDATE `tblDocumentFiles` SET `comment` = ".$db->qstr($newComment)." WHERE `document` = ".$this->_document->getId()." AND `id` = ". $this->_id; $queryStr = "UPDATE `tblDocumentFiles` SET `comment` = ".$db->qstr($newComment)." WHERE `document` = ".$this->_document->getId()." AND `id` = ". $this->_id;
if (!$db->getResult($queryStr)) if (!$db->getResult($queryStr))
@ -5110,7 +5111,7 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
* @return boolean true on success * @return boolean true on success
*/ */
function setDate($date) { /* {{{ */ function setDate($date) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if(!$date) if(!$date)
$date = time(); $date = time();
@ -5157,7 +5158,7 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
* @param $newComment string new name of document * @param $newComment string new name of document
*/ */
function setName($newName) { /* {{{ */ function setName($newName) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$queryStr = "UPDATE `tblDocumentFiles` SET `name` = ".$db->qstr($newName)." WHERE `document` = ".$this->_document->getId()." AND `id` = ". $this->_id; $queryStr = "UPDATE `tblDocumentFiles` SET `name` = ".$db->qstr($newName)." WHERE `document` = ".$this->_document->getId()." AND `id` = ". $this->_id;
if (!$db->getResult($queryStr)) if (!$db->getResult($queryStr))
@ -5172,7 +5173,7 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
*/ */
function getUser() { function getUser() {
if (!isset($this->_user)) if (!isset($this->_user))
$this->_user = $this->_document->_dms->getUser($this->_userID); $this->_user = $this->_document->getDMS()->getUser($this->_userID);
return $this->_user; return $this->_user;
} }
@ -5194,7 +5195,7 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
* @param $newComment string new version of document * @param $newComment string new version of document
*/ */
function setVersion($newVersion) { /* {{{ */ function setVersion($newVersion) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
if(!is_numeric($newVersion) && $newVersion != '') if(!is_numeric($newVersion) && $newVersion != '')
return false; return false;
@ -5218,7 +5219,7 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
* @param $newComment string new comment of document * @param $newComment string new comment of document
*/ */
function setPublic($newPublic) { /* {{{ */ function setPublic($newPublic) { /* {{{ */
$db = $this->_document->_dms->getDB(); $db = $this->_document->getDMS()->getDB();
$queryStr = "UPDATE `tblDocumentFiles` SET `public` = ".($newPublic ? 1 : 0)." WHERE `document` = ".$this->_document->getId()." AND `id` = ". $this->_id; $queryStr = "UPDATE `tblDocumentFiles` SET `public` = ".($newPublic ? 1 : 0)." WHERE `document` = ".$this->_document->getId()." AND `id` = ". $this->_id;
if (!$db->getResult($queryStr)) if (!$db->getResult($queryStr))
@ -5240,7 +5241,7 @@ class SeedDMS_Core_DocumentFile { /* {{{ */
* @return integer either M_NONE or M_READ * @return integer either M_NONE or M_READ
*/ */
function getAccessMode($u) { /* {{{ */ function getAccessMode($u) { /* {{{ */
$dms = $this->_document->_dms; $dms = $this->_document->getDMS();
/* Check if 'onCheckAccessDocumentLink' callback is set */ /* Check if 'onCheckAccessDocumentLink' callback is set */
if(isset($this->_dms->callbacks['onCheckAccessDocumentFile'])) { if(isset($this->_dms->callbacks['onCheckAccessDocumentFile'])) {