fix line indenting

This commit is contained in:
Uwe Steinmann 2021-10-02 07:23:23 +02:00
parent 0260b8dad9
commit bae7e939a1

View File

@ -227,27 +227,27 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$this->_notifyList = array();
$this->_latestContent = null;
$this->_content = null;
/* Cache */
$this->clearCache();
/* Cache */
$this->clearCache();
} /* }}} */
/**
* Clear cache of this instance.
*
* The result of some expensive database actions (e.g. get all subfolders
* or documents) will be saved in a class variable to speed up consecutive
* calls of the same method. If a second call of the same method shall not
* use the cache, then it must be cleared.
*
* Clear cache of this instance.
*
* The result of some expensive database actions (e.g. get all subfolders
* or documents) will be saved in a class variable to speed up consecutive
* calls of the same method. If a second call of the same method shall not
* use the cache, then it must be cleared.
*
*/
public function clearCache() { /* {{{ */
$this->_parent = null;
$this->_owner = null;
$this->_documentLinks = null;
$this->_documentFiles = null;
$this->_content = null;
$this->_accessList = null;
$this->_notifyList = null;
$this->_parent = null;
$this->_owner = null;
$this->_documentLinks = null;
$this->_documentFiles = null;
$this->_content = null;
$this->_accessList = null;
$this->_notifyList = null;
} /* }}} */
/**
@ -727,10 +727,14 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
* Set default access mode
*
* This method sets the default access mode and also removes all notifiers which
* will not have read access anymore.
* will not have read access anymore. Setting a default access mode will only
* have an immediate effect if the access rights are not inherited, otherwise
* it just updates the database record of the document and once the
* inheritance is turn off the default access mode will take effect.
*
* @param integer $mode access mode
* @param integer $mode access mode
* @param bool|string $noclean set to true if notifier list shall not be clean up
*
* @return bool
*/
function setDefaultAccess($mode, $noclean="false") { /* {{{ */
@ -1031,8 +1035,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
function addAccess($mode, $userOrGroupID, $isUser) { /* {{{ */
$db = $this->_dms->getDB();
if($mode < M_NONE || $mode > M_ALL)
return false;
if($mode < M_NONE || $mode > M_ALL)
return false;
$userOrGroup = ($isUser) ? "`userID`" : "`groupID`";
@ -1811,9 +1815,9 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
* currently logged in user.
*
* @param integer $version version number of content element
* @return SeedDMS_Core_DocumentContent|null|boolean object of class
* {@link SeedDMS_Core_DocumentContent}, null if not content was found,
* false in case of an error
* @return SeedDMS_Core_DocumentContent|null|boolean object of class
* {@link SeedDMS_Core_DocumentContent}, null if not content was found,
* false in case of an error
*/
function getContentByVersion($version) { /* {{{ */
if (!is_numeric($version)) return false;
@ -2108,7 +2112,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$queryStr = "SELECT * FROM `tblDocumentLinks` WHERE `document` = " . $this->_id ." AND `id` = " . (int) $linkID;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$resArr)
if (is_bool($resArr) && !$resArr)
return false;
if (count($resArr)==0)
return null;
@ -2230,13 +2234,13 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$public = ($public) ? 1 : 0;
if (!is_numeric($targetID) || $targetID < 1)
return false;
return false;
if ($targetID == $this->_id)
return false;
return false;
if (!is_numeric($userID) || $userID < 1)
return false;
return false;
if(!($target = $this->_dms->getDocument($targetID)))
return false;
@ -2259,7 +2263,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$db = $this->_dms->getDB();
if (!is_numeric($linkID) || $linkID < 1)
return false;
return false;
$queryStr = "DELETE FROM `tblDocumentLinks` WHERE `document` = " . $this->_id ." AND `id` = " . (int) $linkID;
if (!$db->getResult($queryStr)) return false;
@ -2374,7 +2378,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$db = $this->_dms->getDB();
if (!is_numeric($ID) || $ID < 1)
return false;
return false;
$file = $this->getDocumentFile($ID);
if (is_bool($file) && !$file) return false;
@ -3011,8 +3015,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
if ($hasworkflow) { $newstatus = S_IN_WORKFLOW; $ret = $this->setStatus(S_IN_WORKFLOW,$msg,$user); }
elseif ($pendingReview) { $newstatus = S_DRAFT_REV; $ret = $this->setStatus(S_DRAFT_REV,$msg,$user); }
elseif ($pendingApproval) { $newstatus = S_DRAFT_APP; $ret = $this->setStatus(S_DRAFT_APP,$msg,$user); }
else { $newstatus = S_RELEASED; $ret = $this->setStatus(S_RELEASED,$msg,$user); }
return $ret ? $newstatus : $ret;
else { $newstatus = S_RELEASED; $ret = $this->setStatus(S_RELEASED,$msg,$user); }
return $ret ? $newstatus : $ret;
} /* }}} */
function __construct($id, $document, $version, $comment, $date, $userID, $dir, $orgFileName, $fileType, $mimeType, $fileSize=0, $checksum='') { /* {{{ */
@ -3194,7 +3198,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false;
if (count($res)!=1)
return false;
$this->_status = $res[0];
$this->_status = $res[0];
}
return $this->_status;
} /* }}} */
@ -3292,7 +3296,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
}
$db->commitTransaction();
unset($this->_status);
unset($this->_status);
return true;
} /* }}} */
@ -3828,24 +3832,24 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return true;
} /* }}} */
/**
* Add user as new reviewer
*
* @param object $user user in charge for the review
* @param object $requestUser user requesting the operation (usually the
* currently logged in user)
*
* @return integer|false if > 0 the id of the review log, if < 0 the error
* code, false in case of an sql error
*/
/**
* Add user as new reviewer
*
* @param object $user user in charge for the review
* @param object $requestUser user requesting the operation (usually the
* currently logged in user)
*
* @return integer|false if > 0 the id of the review log, if < 0 the error
* code, false in case of an sql error
*/
function addIndReviewer($user, $requestUser) { /* {{{ */
if(!$user || !$requestUser)
return -1;
$db = $this->_document->getDMS()->getDB();
if(!$user->isType('user'))
return -1;
if(!$user->isType('user'))
return -1;
$userID = $user->getID();
@ -3890,28 +3894,28 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
}
$reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID');
$db->dropTemporaryTable('ttreviewid');
$db->dropTemporaryTable('ttreviewid');
return $reviewLogID;
} /* }}} */
/**
* Add group as new reviewer
*
* @param object $group group in charge for the review
* @param object $requestUser user requesting the operation (usually the
* currently logged in user)
*
* @return integer|false if > 0 the id of the review log, if < 0 the error
* code, false in case of an sql error
*/
/**
* Add group as new reviewer
*
* @param object $group group in charge for the review
* @param object $requestUser user requesting the operation (usually the
* currently logged in user)
*
* @return integer|false if > 0 the id of the review log, if < 0 the error
* code, false in case of an sql error
*/
function addGrpReviewer($group, $requestUser) { /* {{{ */
if(!$group || !$requestUser)
return -1;
return -1;
$db = $this->_document->getDMS()->getDB();
if(!$group->isType('group'))
return -1;
if(!$group->isType('group'))
return -1;
$groupID = $group->getID();
@ -3933,7 +3937,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
// Check to see if the group has already been added to the review list.
$reviewStatus = $group->getReviewStatus($this->_document->getID(), $this->_version);
if (is_bool($reviewStatus) && !$reviewStatus) {
if (is_bool($reviewStatus) && !$reviewStatus) {
return false;
}
if (count($reviewStatus) > 0 && $reviewStatus[0]["status"]!=-2) {
@ -3963,7 +3967,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
}
$reviewLogID = $db->getInsertID('tblDocumentReviewLog', 'reviewLogID');
$db->dropTemporaryTable('ttreviewid');
$db->dropTemporaryTable('ttreviewid');
return $reviewLogID;
} /* }}} */
@ -3979,16 +3983,16 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* be set again and 0 will be returned. Іf the review could be succesfully
* added, the review log id will be returned.
*
* @see SeedDMS_Core_DocumentContent::setApprovalByInd()
*
* @see SeedDMS_Core_DocumentContent::setApprovalByInd()
*
* @param object $user user doing the review
* @param object $requestUser user asking for the review, this is mostly
* the user currently logged in.
* @param integer $status status of review
* @param string $comment comment for review
*
* @return integer|bool new review log id, error code 0 till -4,
* false in case of an sql error
* @param string $comment comment for review
*
* @return integer|bool new review log id, error code 0 till -4,
* false in case of an sql error
*/
function setReviewByInd($user, $requestUser, $status, $comment, $file='') { /* {{{ */
if(!$user || !$requestUser)
@ -3996,8 +4000,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$db = $this->_document->getDMS()->getDB();
if(!$user->isType('user'))
return -1;
if(!$user->isType('user'))
return -1;
// Check if the user is on the review list at all.
$reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version);
@ -4032,7 +4036,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'r' . $reviewLogID);
}
return $reviewLogID;
} /* }}} */
} /* }}} */
/**
* Add another entry to review log which resets the status
@ -4044,12 +4048,12 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* After calling this method SeedDMS_Core_DocumentCategory::verifyStatus()
* should be called to recalculate the document status.
*
* @param integer $reviewid id of review
* @param SeedDMS_Core_User $requestUser user requesting the removal
* @param string $comment comment
*
* @return integer|bool true if successful, error code < 0,
* false in case of an sql error
* @param integer $reviewid id of review
* @param SeedDMS_Core_User $requestUser user requesting the removal
* @param string $comment comment
*
* @return integer|bool true if successful, error code < 0,
* false in case of an sql error
*/
public function removeReview($reviewid, $requestUser, $comment='') { /* {{{ */
$db = $this->_document->getDMS()->getDB();
@ -4082,7 +4086,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false;
return true;
} /* }}} */
} /* }}} */
/**
* Add a review to the document content
@ -4097,8 +4101,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* @param integer $status status of review
* @param string $comment comment for review
*
* @return integer|bool new review log id, error code 0 till -4,
* false in case of an sql error
* @return integer|bool new review log id, error code 0 till -4,
* false in case of an sql error
*/
function setReviewByGrp($group, $requestUser, $status, $comment, $file='') { /* {{{ */
if(!$group || !$requestUser)
@ -4144,24 +4148,24 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return $reviewLogID;
} /* }}} */
/**
* Add user as new approver
*
* @param object $user user in charge for the approval
* @param object $requestUser user requesting the operation (usually the
* currently logged in user)
*
* @return integer|false if > 0 the id of the approval log, if < 0 the error
* code, false in case of an sql error
*/
/**
* Add user as new approver
*
* @param object $user user in charge for the approval
* @param object $requestUser user requesting the operation (usually the
* currently logged in user)
*
* @return integer|false if > 0 the id of the approval log, if < 0 the error
* code, false in case of an sql error
*/
function addIndApprover($user, $requestUser) { /* {{{ */
if(!$user || !$requestUser)
return -1;
$db = $this->_document->getDMS()->getDB();
if(!$user->isType('user'))
return -1;
if(!$user->isType('user'))
return -1;
$userID = $user->getID();
@ -4206,28 +4210,28 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
}
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
$db->dropTemporaryTable('ttapproveid');
$db->dropTemporaryTable('ttapproveid');
return $approveLogID;
} /* }}} */
/**
* Add group as new approver
*
* @param object $group group in charge for the approval
* @param object $requestUser user requesting the operation (usually the
* currently logged in user)
*
* @return integer|false if > 0 the id of the approval log, if < 0 the error
* code, false in case of an sql error
*/
/**
* Add group as new approver
*
* @param object $group group in charge for the approval
* @param object $requestUser user requesting the operation (usually the
* currently logged in user)
*
* @return integer|false if > 0 the id of the approval log, if < 0 the error
* code, false in case of an sql error
*/
function addGrpApprover($group, $requestUser) { /* {{{ */
if(!$group || !$requestUser)
return -1;
return -1;
$db = $this->_document->getDMS()->getDB();
if(!$group->isType('group'))
return -1;
if(!$group->isType('group'))
return -1;
$groupID = $group->getID();
@ -4278,8 +4282,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false;
}
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
$db->dropTemporaryTable('ttapproveid');
$approveLogID = $db->getInsertID('tblDocumentApproveLog', 'approveLogID');
$db->dropTemporaryTable('ttapproveid');
return $approveLogID;
} /* }}} */
@ -4294,8 +4298,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* Then it is check if the approval status is already -2. In both cases
* the function returns with an error.
*
* @see SeedDMS_Core_DocumentContent::setReviewByInd()
*
* @see SeedDMS_Core_DocumentContent::setReviewByInd()
*
* @param object $user user in charge for doing the approval
* @param object $requestUser user actually calling this function
* @param integer $status the status of the approval, possible values are
@ -4304,10 +4308,10 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* -1=rejected,
* -2=user is deleted (use {link
* SeedDMS_Core_DocumentContent::delIndApprover} instead)
* @param string $comment approval comment
*
* @return integer|bool new review log id, error code 0 till -4,
* false in case of an sql error
* @param string $comment approval comment
*
* @return integer|bool new review log id, error code 0 till -4,
* false in case of an sql error
*/
function setApprovalByInd($user, $requestUser, $status, $comment, $file='') { /* {{{ */
if(!$user || !$requestUser)
@ -4315,8 +4319,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$db = $this->_document->getDMS()->getDB();
if(!$user->isType('user'))
return -1;
if(!$user->isType('user'))
return -1;
// Check if the user is on the approval list at all.
$approvalStatus = $user->getApprovalStatus($this->_document->getID(), $this->_version);
@ -4351,7 +4355,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID);
}
return $approveLogID;
} /* }}} */
} /* }}} */
/**
* Add another entry to approval log which resets the status
@ -4363,12 +4367,12 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* After calling this method SeedDMS_Core_DocumentCategory::verifyStatus()
* should be called to recalculate the document status.
*
* @param integer $approveid id of approval
* @param SeedDMS_Core_User $requestUser user requesting the removal
* @param string $comment comment
*
* @return integer|bool true if successful, error code < 0,
* false in case of an sql error
* @param integer $approveid id of approval
* @param SeedDMS_Core_User $requestUser user requesting the removal
* @param string $comment comment
*
* @return integer|bool true if successful, error code < 0,
* false in case of an sql error
*/
public function removeApproval($approveid, $requestUser, $comment='') { /* {{{ */
$db = $this->_document->getDMS()->getDB();
@ -4401,11 +4405,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false;
return true;
} /* }}} */
} /* }}} */
/**
* Sets approval status of a document content for a group
*
* Sets approval status of a document content for a group
*
* The functions behaves like
* {link SeedDMS_Core_DocumentContent::setApprovalByInd} but does it for
* a group instead of a user
@ -4416,8 +4420,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$db = $this->_document->getDMS()->getDB();
if(!$group->isType('group'))
return -1;
if(!$group->isType('group'))
return -1;
// Check if the group is on the approval list at all.
$approvalStatus = $group->getApprovalStatus($this->_document->getID(), $this->_version);
@ -4452,13 +4456,13 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
SeedDMS_Core_File::copyFile($file, $this->_dms->contentDir . $this->_document->getDir() . 'a' . $approveLogID);
}
return $approveLogID;
} /* }}} */
} /* }}} */
function delIndReviewer($user, $requestUser, $msg='') { /* {{{ */
$db = $this->_document->getDMS()->getDB();
if(!$user->isType('user'))
return -1;
if(!$user->isType('user'))
return -1;
// Check to see if the user can be removed from the review list.
$reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version);
@ -4490,8 +4494,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
function delGrpReviewer($group, $requestUser, $msg='') { /* {{{ */
$db = $this->_document->getDMS()->getDB();
if(!$group->isType('group'))
return -1;
if(!$group->isType('group'))
return -1;
$groupID = $group->getID();
@ -4524,8 +4528,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
function delIndApprover($user, $requestUser, $msg='') { /* {{{ */
$db = $this->_document->getDMS()->getDB();
if(!$user->isType('user'))
return -1;
if(!$user->isType('user'))
return -1;
$userID = $user->getID();
@ -4559,8 +4563,8 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
function delGrpApprover($group, $requestUser, $msg='') { /* {{{ */
$db = $this->_document->getDMS()->getDB();
if(!$group->isType('group'))
return -1;
if(!$group->isType('group'))
return -1;
$groupID = $group->getID();