Documentation

SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object
in package

Class to represent content of a document

Each document has content attached to it, often called a 'version' of the document. The document content represents a file on the disk with some meta data stored in the database. A document content has a version number which is incremented with each replacement of the old content. Old versions are kept unless they are explicitly deleted by SeedDMS_Core_Document::removeContent().

Tags
category

DMS

author

Markus Westphal, Malcolm Cowe, Matteo Lucarelli, Uwe Steinmann uwe@steinmann.cx

copyright

Copyright (C) 2002-2005 Markus Westphal, 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, 2010-2024 Uwe Steinmann

version

Release: @package_version@

Table of Contents

Properties

$_dms  : object
$_approvalStatus  : int
$_attributes  : array<string|int, mixed>
$_checksum  : string
$_comment  : string
$_date  : string
$_dir  : string
$_document  : object
$_fileSize  : int
$_fileType  : string
$_id  : int
$_mimeType  : string
$_orgFileName  : string
$_readAccessList  : array<string|int, mixed>
$_reviewStatus  : int
$_status  : int
$_user  : object
$_userID  : int
$_version  : int
$_workflow  : object
$_workflowState  : object

Methods

__construct()  : mixed
SeedDMS_Core_Object constructor.
addGrpApprover()  : int|false
Add group as new approver
addGrpReviewer()  : int|false
Add group as new reviewer
addIndApprover()  : int|false
Add user as new approver
addIndReviewer()  : int|false
Add user as new reviewer
content()  : mixed
delGrpApprover()  : mixed
delGrpReviewer()  : mixed
delIndApprover()  : mixed
delIndReviewer()  : mixed
enterNextState()  : bool
Enter next state of workflow if possible
executeWorkflowTransitionIsAllowed()  : bool
Check if all conditions are met to change the workflow state of a document content (run the transition).
exists()  : mixed
getAccessMode()  : int
Returns the access mode similar to a document
getApprovalStatus()  : array<string|int, mixed>
Get the current approval status of the document content The approval status is a list of approvers and its current status
getApproveLog()  : array<string|int, mixed>
Get the latest entries from the approval log of the document content
getApprovers()  : array<string|int, mixed>|bool|null
Return a list of all approvers separated by individuals and groups This list will not take the approval log into account. Therefore it can contain approvers which has actually been deleted as an approver.
getAttribute()  : array<string|int, mixed>|string
Returns an attribute of the object for the given attribute definition
getAttributes()  : array<string|int, mixed>|bool
Returns all attributes set for the object
getAttributeValue()  : mixed
Returns an attribute value of the object for the given attribute definition This is a short cut for $object->getAttribute($attrdef)->getValue()
getAttributeValueAsArray()  : mixed
Returns an attribute value of the object for the given attribute definition
getAttributeValueAsString()  : string
Returns an attribute value of the object for the given attribute definition
getChecksum()  : mixed
getComment()  : mixed
getDate()  : mixed
getDMS()  : SeedDMS_Core_DMS
Returns instance of dms
getDocument()  : mixed
getFileName()  : mixed
getFileSize()  : mixed
getFileType()  : mixed
getID()  : int
Returns the internal id of the object
getLastWorkflowLog()  : object
Get the latest workflow log entry for the document content within the workflow. Even after finishing the workflow (when the document content does not have workflow set anymore) this function returns the last log entry.
getMimeType()  : mixed
getOriginalFileName()  : mixed
getParentWorkflow()  : mixed
Run a sub workflow
getPath()  : string
Return path of file on disk relative to the content directory
getRealChecksum()  : mixed
getRealMimeType()  : mixed
getReviewers()  : array<string|int, mixed>|bool|null
Return a list of all reviewers separated by individuals and groups This list will not take the review log into account. Therefore it can contain reviewers which has actually been deleted as a reviewer.
getReviewLog()  : array<string|int, mixed>
Get the latest entries from the review log of the document content
getReviewStatus()  : array<string|int, mixed>
Get the current review status of the document content The review status is a list of reviewers and its current status
getStatus()  : array<string|int, mixed>
Get the latest status of the content
getStatusLog()  : array<string|int, mixed>
Get current and former states of the document content
getUser()  : mixed
getVersion()  : mixed
getWorkflow()  : object
Get workflow assigned to the document content
getWorkflowLog()  : array<string|int, mixed>
Get the so far logged operations on the document content within the workflow. Even after finishing the workflow (when the document content does not have workflow set anymore) this function returns the list of all log entries.
getWorkflowState()  : object
Get state of workflow assigned to the document content
isType()  : mixed
Check if this object is of type 'documentcontent'.
needsWorkflowAction()  : bool
Check if the document content needs an action by a user
removeApproval()  : int|bool
Add another entry to approval log which resets the status
removeAttribute()  : bool
Remove an attribute of the object for the given attribute definition
removeReview()  : int|bool
Add another entry to review log which resets the status
removeWorkflow()  : bool
Remove workflow
repair()  : bool
Checks the internal data of the document version and repairs it.
returnFromSubWorkflow()  : mixed
Return from sub workflow to parent workflow.
rewindWorkflow()  : bool
Restart workflow from its initial state
rewriteApprovalLog()  : bool
Rewrites the complete approval log
rewriteReviewLog()  : bool
Rewrites the complete review log
rewriteStatusLog()  : bool
Rewrites the complete status log
rewriteWorkflowLog()  : bool
Rewrites the complete workflow log
runSubWorkflow()  : mixed
Run a sub workflow
setApprovalByGrp()  : mixed
Sets approval status of a document content for a group
setApprovalByInd()  : int|bool
Sets approval status of a document content for a user
setAttributeValue()  : bool
Set an attribute of the object for the given attribute definition
setChecksum()  : mixed
Set checksum by reading the file
setComment()  : mixed
setDate()  : bool
Set upload date of document content
setDMS()  : mixed
Set dms this object belongs to.
setFileSize()  : mixed
Set file size by reading the file
setFileType()  : mixed
Set file type by evaluating the mime type
setMimeType()  : mixed
setReviewByGrp()  : int|bool
Add a review to the document content
setReviewByInd()  : int|bool
Add a review to the document content
setStatus()  : bool
Set the status of the content
setWorkflow()  : mixed
Assign a workflow to a document content
setWorkflowState()  : mixed
Set state of workflow assigned to the document content
size()  : mixed
triggerWorkflowTransition()  : bool
Trigger transition
triggerWorkflowTransitionIsAllowed()  : bool
Check if the user is allowed to trigger the transition A user is allowed if either the user itself or a group of which the user is a member of is registered for triggering a transition. This method does not change the workflow state of the document content.
verifyStatus()  : mixed
Recalculate the status of a document
__getDir()  : mixed
getDir and the corresponding database table field are deprecated

Properties

$_attributes

protected array<string|int, mixed> $_attributes

list of attributes

$_fileType

protected string $_fileType

file type (actually the extension without the leading dot)

Methods

__construct()

SeedDMS_Core_Object constructor.

public __construct(mixed $id, mixed $document, mixed $version, mixed $comment, mixed $date, mixed $userID, mixed $dir, mixed $orgFileName, mixed $fileType, mixed $mimeType[, mixed $fileSize = 0 ][, mixed $checksum = '' ]) : mixed
Parameters
$id : mixed
$document : mixed
$version : mixed
$comment : mixed
$date : mixed
$userID : mixed
$dir : mixed
$orgFileName : mixed
$fileType : mixed
$mimeType : mixed
$fileSize : mixed = 0
$checksum : mixed = ''

addGrpApprover()

Add group as new approver

public addGrpApprover(object $group, object $requestUser) : int|false
Parameters
$group : object

group in charge for the approval

$requestUser : object

user requesting the operation (usually the currently logged in user)

Return values
int|false

if > 0 the id of the approval log, if < 0 the error code, false in case of an sql error

addGrpReviewer()

Add group as new reviewer

public addGrpReviewer(object $group, object $requestUser) : int|false
Parameters
$group : object

group in charge for the review

$requestUser : object

user requesting the operation (usually the currently logged in user)

Return values
int|false

if > 0 the id of the review log, if < 0 the error code, false in case of an sql error

addIndApprover()

Add user as new approver

public addIndApprover(object $user, object $requestUser) : int|false
Parameters
$user : object

user in charge for the approval

$requestUser : object

user requesting the operation (usually the currently logged in user)

Return values
int|false

if > 0 the id of the approval log, if < 0 the error code, false in case of an sql error

addIndReviewer()

Add user as new reviewer

public addIndReviewer(object $user, object $requestUser) : int|false
Parameters
$user : object

user in charge for the review

$requestUser : object

user requesting the operation (usually the currently logged in user)

Return values
int|false

if > 0 the id of the review log, if < 0 the error code, false in case of an sql error

delGrpApprover()

public delGrpApprover(mixed $group, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
$group : mixed
$requestUser : mixed
$msg : mixed = ''

delGrpReviewer()

public delGrpReviewer(mixed $group, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
$group : mixed
$requestUser : mixed
$msg : mixed = ''

delIndApprover()

public delIndApprover(mixed $user, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
$user : mixed
$requestUser : mixed
$msg : mixed = ''

delIndReviewer()

public delIndReviewer(mixed $user, mixed $requestUser[, mixed $msg = '' ]) : mixed
Parameters
$user : mixed
$requestUser : mixed
$msg : mixed = ''

enterNextState()

Enter next state of workflow if possible

public enterNextState(object $user, object $nextstate) : bool

The method will check if one of the following states in the workflow can be reached. It does it by running the precondition function of that state. The precondition function gets a list of all transitions leading to the state. It will determine, whether the transitions has been triggered and if that is sufficient to enter the next state. If no pre condition function is set, then 1 of n transtions are enough to enter the next state.

If moving in the next state is possible and this state has a corresponding document state, then the document state will be updated and the workflow will be detached from the document.

Parameters
$user : object
$nextstate : object
Return values
bool

true if the state could be reached false if not

executeWorkflowTransitionIsAllowed()

Check if all conditions are met to change the workflow state of a document content (run the transition).

public executeWorkflowTransitionIsAllowed(mixed $transition) : bool

The conditions are met if all explicitly set users and a sufficient number of users of the groups have acknowledged the content.

Parameters
$transition : mixed
Return values
bool

true if transaction maybe executed

getAccessMode()

Returns the access mode similar to a document

public getAccessMode(object $u) : int

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 content. The function checks if 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. This method is called by all functions that returns the content e.g. SeedDMS_Core_Document::getLatestContent() It is also used by SeedDMS_Core_Document::getAccessMode() to prevent access on the whole document if there is no accessible version.

FIXME: This method only works propperly if $u is the currently logged in user, because noReadForStatus will be set for this user. FIXED: instead of using $dms->noReadForStatus it is take from the user's role

Parameters
$u : object

user

Return values
int

either M_NONE or M_READ

getApprovalStatus()

Get the current approval status of the document content The approval status is a list of approvers and its current status

public getApprovalStatus([int $limit = 1 ]) : array<string|int, mixed>
Parameters
$limit : int = 1

the number of recent status changes per approver

Return values
array<string|int, mixed>

list of approval status

getApproveLog()

Get the latest entries from the approval log of the document content

public getApproveLog([int $limit = 1 ]) : array<string|int, mixed>
Parameters
$limit : int = 1

the number of log entries returned, defaults to 1

Return values
array<string|int, mixed>

list of approval log entries

getApprovers()

Return a list of all approvers separated by individuals and groups This list will not take the approval log into account. Therefore it can contain approvers which has actually been deleted as an approver.

public getApprovers() : array<string|int, mixed>|bool|null
Return values
array<string|int, mixed>|bool|null

getAttributes()

Returns all attributes set for the object

public getAttributes() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool

getAttributeValue()

Returns an attribute value of the object for the given attribute definition This is a short cut for $object->getAttribute($attrdef)->getValue()

public getAttributeValue(SeedDMS_Core_AttributeDefinition $attrdef) : mixed
Parameters
$attrdef : SeedDMS_Core_AttributeDefinition
Return values
mixed

value of attritbute or null if the attribute is not set. The value is an array if the attribute is defined as multi value

getAttributeValueAsArray()

Returns an attribute value of the object for the given attribute definition

public getAttributeValueAsArray(SeedDMS_Core_AttributeDefinition $attrdef) : mixed

This is a short cut for getAttribute($attrdef)->getValueAsArray() but first checks if the object has an attribute for the given attribute definition.

Parameters
$attrdef : SeedDMS_Core_AttributeDefinition
Return values
mixed

value of attritbute or null if the attribute is not set. Even if the attribute is not defined as multi value

getAttributeValueAsString()

Returns an attribute value of the object for the given attribute definition

public getAttributeValueAsString(SeedDMS_Core_AttributeDefinition $attrdef) : string

This is a short cut for getAttribute($attrdef)->getValueAsString() but first checks if the object has an attribute for the given attribute definition.

Parameters
$attrdef : SeedDMS_Core_AttributeDefinition
Return values
string

value of attritbute or false. The value is always a string even if the attribute is defined as multi value

getID()

Returns the internal id of the object

public getID() : int
Return values
int

id of document/folder

getLastWorkflowLog()

Get the latest workflow log entry for the document content within the workflow. Even after finishing the workflow (when the document content does not have workflow set anymore) this function returns the last log entry.

public getLastWorkflowLog() : object
Return values
object

getPath()

Return path of file on disk relative to the content directory

public getPath() : string

Since version 5.1.13 a single '.' in the fileType will be skipped. On Windows a file named 'name.' will be saved as 'name' but the fileType will contain the a single '.'.

Return values
string

path of file on disc

getReviewers()

Return a list of all reviewers separated by individuals and groups This list will not take the review log into account. Therefore it can contain reviewers which has actually been deleted as a reviewer.

public getReviewers() : array<string|int, mixed>|bool|null
Return values
array<string|int, mixed>|bool|null

getReviewLog()

Get the latest entries from the review log of the document content

public getReviewLog([int $limit = 1 ]) : array<string|int, mixed>
Parameters
$limit : int = 1

the number of log entries returned, defaults to 1

Return values
array<string|int, mixed>

list of review log entries

getReviewStatus()

Get the current review status of the document content The review status is a list of reviewers and its current status

public getReviewStatus([int $limit = 1 ]) : array<string|int, mixed>
Parameters
$limit : int = 1

the number of recent status changes per reviewer

Return values
array<string|int, mixed>

list of review status

getStatus()

Get the latest status of the content

public getStatus([mixed $limit = 1 ]) : array<string|int, mixed>

The status of the content reflects its current review, approval or workflow state. A status can be a negative or positive number or 0. A negative numbers indicate a missing approval, review or an obsolete content. Positive numbers indicate some kind of approval or workflow being active, but not necessarily a release. S_DRAFT_REV, 0 S_DRAFT_APP, 1 S_RELEASED, 2 S_IN_WORKFLOW, 3 S_REJECTED, -1 S_OBSOLETE, -2 S_EXPIRED, -3 When a content is inserted and does not need approval nor review, then its status is set to S_RELEASED immediately. Any change of the status is monitored in the table tblDocumentStatusLog. This function will always return the latest entry for the content.

Parameters
$limit : mixed = 1
Return values
array<string|int, mixed>

latest record from tblDocumentStatusLog

getStatusLog()

Get current and former states of the document content

public getStatusLog([int $limit = 0 ]) : array<string|int, mixed>
Parameters
$limit : int = 0

if not set all log entries will be returned

Return values
array<string|int, mixed>

list of status changes

getWorkflow()

Get workflow assigned to the document content

public getWorkflow() : object

The method returns the last workflow if one was assigned. If the document version is in a sub workflow, it will have a never date and therefore will be found first.

Return values
object

an object of class SeedDMS_Core_Workflow or false in case of error, e.g. the version has not a workflow

getWorkflowLog()

Get the so far logged operations on the document content within the workflow. Even after finishing the workflow (when the document content does not have workflow set anymore) this function returns the list of all log entries.

public getWorkflowLog([mixed $transition = null ]) : array<string|int, mixed>
Parameters
$transition : mixed = null
Return values
array<string|int, mixed>

list of objects

getWorkflowState()

Get state of workflow assigned to the document content

public getWorkflowState() : object
Return values
object

an object of class SeedDMS_Core_Workflow_State or false in case of error, e.g. the version has not a workflow

isType()

Check if this object is of type 'documentcontent'.

public isType(string $type) : mixed
Parameters
$type : string

type of object

needsWorkflowAction()

Check if the document content needs an action by a user

public needsWorkflowAction(SeedDMS_Core_User $user) : bool

This method will return true if document content is in a transition which can be triggered by the given user.

Parameters
$user : SeedDMS_Core_User
Return values
bool

true is action is needed

removeApproval()

Add another entry to approval log which resets the status

public removeApproval(int $approveid, SeedDMS_Core_User $requestUser[, string $comment = '' ]) : int|bool

This method will not delete anything from the database, but will add a new approval log entry which sets the status to 0. This is only allowed if the current status is either 1 (approved) or -1 (rejected).

After calling this method SeedDMS_Core_DocumentContent::verifyStatus() should be called to recalculate the document status.

Parameters
$approveid : int

id of approval

$requestUser : SeedDMS_Core_User

user requesting the removal

$comment : string = ''

comment

Return values
int|bool

true if successful, error code < 0, false in case of an sql error

removeReview()

Add another entry to review log which resets the status

public removeReview(int $reviewid, SeedDMS_Core_User $requestUser[, string $comment = '' ]) : int|bool

This method will not delete anything from the database, but will add a new review log entry which sets the status to 0. This is only allowed if the current status is either 1 (reviewed) or -1 (rejected).

After calling this method SeedDMS_Core_DocumentContent::verifyStatus() should be called to recalculate the document status.

Parameters
$reviewid : int

id of review

$requestUser : SeedDMS_Core_User

user requesting the removal

$comment : string = ''

comment

Return values
int|bool

true if successful, error code < 0, false in case of an sql error

removeWorkflow()

Remove workflow

public removeWorkflow(object $user[, bool $unlink = false ]) : bool

Fully removing a workflow including entries in the workflow log is only allowed if the workflow is still its initial state. At a later point of time only unlinking the document from the workflow is allowed. It will keep any log entries. A workflow is unlinked from a document when enterNextState() succeeds.

Parameters
$user : object

user doing initiating the removal

$unlink : bool = false

if true, just unlink the workflow from the document but do not remove the workflow log. The $unlink flag has been added to detach the workflow from the document when it has reached a valid end state (see SeedDMS_Core_DocumentContent::enterNextState())

Return values
bool

true if workflow could be removed or false in case of error

repair()

Checks the internal data of the document version and repairs it.

public repair() : bool

Currently, this function only repairs a missing filetype

Return values
bool

true on success, otherwise false

returnFromSubWorkflow()

Return from sub workflow to parent workflow.

public returnFromSubWorkflow(object $user[, mixed $transition = null ][, mixed $comment = '' ]) : mixed

The method will trigger the given transition

FIXME: Needs much better checking if this is allowed

Parameters
$user : object

intiating the return

$transition : mixed = null
$comment : mixed = ''

rewindWorkflow()

Restart workflow from its initial state

public rewindWorkflow() : bool
Return values
bool

true if workflow could be restarted or false in case of error

rewriteApprovalLog()

Rewrites the complete approval log

public rewriteApprovalLog(mixed $reviewers) : bool

Attention: this function is highly dangerous. It removes an existing review log and rewrites it. This method was added for importing an xml dump.

Parameters
$reviewers : mixed
Return values
bool

true on success, otherwise false

rewriteReviewLog()

Rewrites the complete review log

public rewriteReviewLog(mixed $reviewers) : bool

Attention: this function is highly dangerous. It removes an existing review log and rewrites it. This method was added for importing an xml dump.

Parameters
$reviewers : mixed
Return values
bool

true on success, otherwise false

rewriteStatusLog()

Rewrites the complete status log

public rewriteStatusLog(array<string|int, mixed> $statuslog) : bool

Attention: this function is highly dangerous. It removes an existing status log and rewrites it. This method was added for importing an xml dump.

Parameters
$statuslog : array<string|int, mixed>

new status log with the newest log entry first.

Return values
bool

true on success, otherwise false

rewriteWorkflowLog()

Rewrites the complete workflow log

public rewriteWorkflowLog(array<string|int, mixed> $workflowlog) : bool

Attention: this function is highly dangerous. It removes an existing workflow log and rewrites it. This method was added for importing an xml dump.

Parameters
$workflowlog : array<string|int, mixed>

new workflow log with the newest log entry first.

Return values
bool

true on success, otherwise false

runSubWorkflow()

Run a sub workflow

public runSubWorkflow(object $subworkflow) : mixed
Parameters
$subworkflow : object

setApprovalByGrp()

Sets approval status of a document content for a group

public setApprovalByGrp(mixed $group, mixed $requestUser, mixed $status, mixed $comment[, mixed $file = '' ]) : mixed

The functions behaves like {link SeedDMS_Core_DocumentContent::setApprovalByInd} but does it for a group instead of a user

Parameters
$group : mixed
$requestUser : mixed
$status : mixed
$comment : mixed
$file : mixed = ''

setApprovalByInd()

Sets approval status of a document content for a user

public setApprovalByInd(object $user, object $requestUser, int $status, string $comment[, mixed $file = '' ]) : int|bool

This method can be used to approve or reject a document content, or to reset its approval state. In most cases this function will be called by an user, but an admin may set the approval for somebody else. It is first checked if the user is in the list of approvers at all. Then it is check if the approval status is already -2. In both cases the function returns with an error.

Parameters
$user : object

user in charge for doing the approval

$requestUser : object

user actually calling this function

$status : int

the status of the approval, possible values are 0=unprocessed (maybe used to reset a status) 1=approved, -1=rejected, -2=user is deleted (use {link SeedDMS_Core_DocumentContent::delIndApprover} instead)

$comment : string

approval comment

$file : mixed = ''
Tags
see
SeedDMS_Core_DocumentContent::setReviewByInd()
Return values
int|bool

new review log id, error code 0 till -4, false in case of an sql error

setAttributeValue()

Set an attribute of the object for the given attribute definition

public setAttributeValue(SeedDMS_Core_AttributeDefinition $attrdef, array<string|int, mixed>|string $value) : bool
Parameters
$attrdef : SeedDMS_Core_AttributeDefinition

definition of attribute

$value : array<string|int, mixed>|string

value of attribute, for multiple values this must be an array

Return values
bool

true if operation was successful, otherwise false

setChecksum()

Set checksum by reading the file

public setChecksum() : mixed

setComment()

public setComment(mixed $newComment) : mixed
Parameters
$newComment : mixed

setDate()

Set upload date of document content

public setDate([string $date = false ]) : bool
Parameters
$date : string = false

date must be a timestamp or in the format 'Y-m-d H:i:s'

Return values
bool

true on success, otherwise false

setDMS()

Set dms this object belongs to.

public setDMS(SeedDMS_Core_DMS $dms) : mixed

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.

Parameters
$dms : SeedDMS_Core_DMS

reference to dms

setFileSize()

Set file size by reading the file

public setFileSize() : mixed

setFileType()

Set file type by evaluating the mime type

public setFileType() : mixed

setMimeType()

public setMimeType(mixed $newMimetype) : mixed
Parameters
$newMimetype : mixed

setReviewByGrp()

Add a review to the document content

public setReviewByGrp(object $group, object $requestUser, int $status, string $comment[, mixed $file = '' ]) : int|bool

This method is similar to SeedDMS_Core_DocumentContent::setReviewByInd() but adds a review for a group instead of a user.

Parameters
$group : object

group doing the review

$requestUser : object

user asking for the review, this is mostly the user currently logged in.

$status : int

status of review

$comment : string

comment for review

$file : mixed = ''
Return values
int|bool

new review log id, error code 0 till -4, false in case of an sql error

setReviewByInd()

Add a review to the document content

public setReviewByInd(object $user, object $requestUser, int $status, string $comment[, mixed $file = '' ]) : int|bool

This method will add an entry to the table tblDocumentReviewLog. It will first check if the user is ment to review the document version. It not the return value is -3. Next it will check if the users has been removed from the list of reviewers. In that case -4 will be returned. If the given review status has been set by the user before, it cannot be set again and 0 will be returned. Іf the review could be succesfully added, the review log id will be returned.

Parameters
$user : object

user doing the review

$requestUser : object

user asking for the review, this is mostly the user currently logged in.

$status : int

status of review

$comment : string

comment for review

$file : mixed = ''
Tags
see
SeedDMS_Core_DocumentContent::setApprovalByInd()
Return values
int|bool

new review log id, error code 0 till -4, false in case of an sql error

setStatus()

Set the status of the content

public setStatus(int $status, string $comment, object $updateUser[, string $date = '' ]) : bool

Setting the status means to add another entry into the table tblDocumentStatusLog. The method returns also false if the status is already set on the value passed to the method.

Parameters
$status : int

new status of content

$comment : string

comment for this status change

$updateUser : object

user initiating the status change

$date : string = ''

date in the format 'Y-m-d H:i:s'

Return values
bool

true on success, otherwise false

setWorkflow()

Assign a workflow to a document content

public setWorkflow(object $workflow, mixed $user) : mixed
Parameters
$workflow : object
$user : mixed

setWorkflowState()

Set state of workflow assigned to the document content

public setWorkflowState(object $state) : mixed
Parameters
$state : object

triggerWorkflowTransition()

Trigger transition

public triggerWorkflowTransition(object $user, object $transition[, string $comment = '' ]) : bool

This method will be deprecated

The method will first check if the user is allowed to trigger the transition. If the user is allowed, an entry in the workflow log will be added, which is later used to check if the transition can actually be processed. The method will finally call executeWorkflowTransitionIsAllowed() which checks all log entries and does the transitions post function if all users and groups have triggered the transition. Finally enterNextState() is called which will try to enter the next state.

Parameters
$user : object
$transition : object
$comment : string = ''

user comment

Return values
bool

next state if transition could be triggered and then next state could be entered, true if the transition could just be triggered or false in case of an error

triggerWorkflowTransitionIsAllowed()

Check if the user is allowed to trigger the transition A user is allowed if either the user itself or a group of which the user is a member of is registered for triggering a transition. This method does not change the workflow state of the document content.

public triggerWorkflowTransitionIsAllowed(object $user, mixed $transition) : bool
Parameters
$user : object
$transition : mixed
Return values
bool

true if user may trigger transaction

verifyStatus()

Recalculate the status of a document

public verifyStatus([bool $ignorecurrentstatus = false ][, object $user = null ][, string $msg = '' ]) : mixed

The methods checks the review and approval status and sets the status of the document accordingly.

If status is S_RELEASED and the version has a workflow, then set the status to S_IN_WORKFLOW If status is S_RELEASED and there are reviewers => set status S_DRAFT_REV If status is S_RELEASED or S_DRAFT_REV and there are approvers => set status S_DRAFT_APP If status is draft and there are no approver and no reviewers => set status to S_RELEASED The status of a document with the current status S_OBSOLETE, S_REJECTED, or S_EXPIRED will not be changed unless the parameter $ignorecurrentstatus is set to true.

This method may not be called after a negative approval or review to recalculated the status, because it doesn't take a defeating approval or review into account. This method does not set the status to S_REJECTED! It will just check for a pending workflow, approval or review and set the status accordingly, e.g. after the list of reviewers or appovers has been modified. If there is no pending workflow, approval or review the status will be set to S_RELEASED.

This method will call SeedDMS_Core_DocumentContent::setStatus() which checks if the status has actually changed. This is, why this function can be called at any time without harm to the status log.

Parameters
$ignorecurrentstatus : bool = false

ignore the current status and recalculate a new status in any case

$user : object = null

the user initiating this method

$msg : string = ''

message stored in status log when status is set

__getDir()

getDir and the corresponding database table field are deprecated

private __getDir() : mixed

        
On this page

Search results