mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 07:22:11 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
9300d92311
|
@ -7,7 +7,17 @@ http://petstore.swagger.io/ or http://editor.swagger.io/
|
|||
You may as well set up your own swagger-ui installation as described at
|
||||
https://medium.com/@tatianaensslin/how-to-add-swagger-ui-to-php-server-code-f1610c01dc03
|
||||
|
||||
Your apache needs to have the module 'header' enabled, because some HTTP headers
|
||||
are set when the file swagger.yaml is accessed by the editor.
|
||||
Your apache needs to have the module `header` enabled, because some HTTP headers
|
||||
are set when the file `swagger.yaml` is accessed by the editor.
|
||||
|
||||
Currently, the swagger.yaml shipped with SeedDMS uses still swagger 2.0
|
||||
|
||||
If you are using php-fpm you will have to ensure that files with
|
||||
extension .yaml are allowed to be parsed. Extend the
|
||||
`security.limit_extensions` in the pool configuration by `.yaml`. Also
|
||||
check the contents of the file `.htaccess` in directory `restapi`. It
|
||||
by default sets the handler for php to `application/x-httpd-php` which
|
||||
uses the apache module of php. If you would like to use php-fpm
|
||||
instead, then set it to
|
||||
|
||||
SetHandler "proxy:unix:/var/run/php/php8.2-fpm.sock|fcgi://localhost/"
|
||||
|
|
|
@ -188,7 +188,7 @@ class Settings { /* {{{ */
|
|||
var $_enableHiddenRevApp = true;
|
||||
// enable/disable update of a review/approval by the reviewer/approver
|
||||
var $_enableUpdateRevApp = false;
|
||||
// enable/disable removal of a review/approval by the admiistrator
|
||||
// enable/disable removal of a review/approval by the administrator
|
||||
var $_enableRemoveRevApp = false;
|
||||
// enable/disable listing logged in user as recipient
|
||||
var $_enableSelfReceipt = false;
|
||||
|
@ -202,6 +202,14 @@ class Settings { /* {{{ */
|
|||
var $_enableOwnerReceipt = false;
|
||||
// enable/disable filter for receipt by the recipient
|
||||
var $_enableFilterReceipt = false;
|
||||
// group manager is mandatory reviewer
|
||||
var $_addManagerAsReviewer = false;
|
||||
// group manager is mandatory approver
|
||||
var $_addManagerAsApprover = false;
|
||||
// global reviewer
|
||||
var $_globalReviewer = array();
|
||||
// global approver
|
||||
var $_globalApprover = array();
|
||||
// enable/disable default notification for owner
|
||||
var $_enableOwnerNotification = false;
|
||||
// enable/disable deleting of versions for regular users
|
||||
|
@ -805,6 +813,12 @@ class Settings { /* {{{ */
|
|||
$this->_enableOwnerReceipt = Settings::boolval($tab["enableOwnerReceipt"]);
|
||||
$this->_enableUpdateReceipt = Settings::boolval($tab["enableUpdateReceipt"]);
|
||||
$this->_enableFilterReceipt = Settings::boolval($tab["enableFilterReceipt"]);
|
||||
$this->_addManagerAsReviewer = Settings::boolval($tab["addManagerAsReviewer"]);
|
||||
$this->_addManagerAsApprover = Settings::boolval($tab["addManagerAsApprover"]);
|
||||
if(trim(strval($tab["globalReviewer"])))
|
||||
$this->_globalReviewer = explode(',',strval($tab["globalReviewer"]));
|
||||
if(trim(strval($tab["globalApprover"])))
|
||||
$this->_globalApprover = explode(',',strval($tab["globalApprover"]));
|
||||
$this->_presetExpirationDate = strval($tab["presetExpirationDate"]);
|
||||
$this->_initialDocumentStatus = intval($tab["initialDocumentStatus"]);
|
||||
$this->_versioningFileName = strval($tab["versioningFileName"]);
|
||||
|
@ -1177,6 +1191,12 @@ class Settings { /* {{{ */
|
|||
$this->setXMLAttributValue($node, "enableFilterReceipt", $this->_enableFilterReceipt);
|
||||
$this->setXMLAttributValue($node, "presetExpirationDate", $this->_presetExpirationDate);
|
||||
$this->setXMLAttributValue($node, "initialDocumentStatus", $this->_initialDocumentStatus);
|
||||
$this->setXMLAttributValue($node, "addManagerAsReviewer", $this->_addManagerAsReviewer);
|
||||
$this->setXMLAttributValue($node, "addManagerAsApprover", $this->_addManagerAsApprover);
|
||||
$this->setXMLAttributValue($node, "globalReviewer", implode(',', $this->_globalReviewer));
|
||||
$this->setXMLAttributValue($node, "globalApprover", implode(',', $this->_globalApprover));
|
||||
$this->setXMLAttributValue($node, "presetExpirationDate", $this->_presetExpirationDate);
|
||||
$this->setXMLAttributValue($node, "apiOrigin", $this->_apiOrigin);
|
||||
$this->setXMLAttributValue($node, "versioningFileName", $this->_versioningFileName);
|
||||
$this->setXMLAttributValue($node, "workflowMode", $this->_workflowMode);
|
||||
$this->setXMLAttributValue($node, "enableReceiptWorkflow", $this->_enableReceiptWorkflow);
|
||||
|
|
|
@ -959,7 +959,7 @@ function isAjax() { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Hash a password
|
||||
* Hash a password
|
||||
*
|
||||
* @param string $password
|
||||
* @return string hashed password
|
||||
|
@ -969,7 +969,7 @@ function seed_pass_hash($password) { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Verify a password
|
||||
* Verify a password
|
||||
*
|
||||
* @param string $password
|
||||
* @return string hashed password
|
||||
|
@ -1044,7 +1044,7 @@ function cmp_user_login($a, $b) { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Compare function for sorting users by name
|
||||
* Compare function for sorting users by name
|
||||
*
|
||||
* Use this for usort()
|
||||
*
|
||||
|
@ -1066,36 +1066,80 @@ function cmp_user_fullname($a, $b) { /* {{{ */
|
|||
* Returns the mandatory reviewers
|
||||
*
|
||||
* This function checks if the reviewers have at least read access
|
||||
* on the folder containing the document.
|
||||
* on the folder containing the document. It also checks if the
|
||||
* mandatory reviewer is an admin or the uploading user and if
|
||||
* those are allowed to review/approve a document.
|
||||
*
|
||||
* @param $folder folder where document is located
|
||||
* @param $document document which is updated, null when adding a new document
|
||||
* @param $user user creating the new version or document
|
||||
* @return array
|
||||
* @return array containing the elements 'i' and 'g'. Each is a list of user/group ids
|
||||
*/
|
||||
function getMandatoryReviewers($folder, $user) { /* {{{ */
|
||||
function getMandatoryReviewers($folder, $document, $user) { /* {{{ */
|
||||
global $settings;
|
||||
|
||||
/* Get a list of all users and groups with read access on the folder.
|
||||
* Only those users and groups will be added as reviewers
|
||||
*/
|
||||
$docAccess = $folder->getReadAccessList($settings->_enableAdminRevApp, $settings->_enableOwnerRevApp);
|
||||
$res=$user->getMandatoryReviewers();
|
||||
$reviewers = array('i'=>[], 'g'=>[]);
|
||||
/* Get mandatory reviewers of user */
|
||||
$res = $user->getMandatoryReviewers();
|
||||
$revi = $revg = [];
|
||||
foreach ($res as $r){
|
||||
if ($r['reviewerUserID']!=0){
|
||||
foreach ($docAccess["users"] as $usr)
|
||||
if ($usr->getID()==$r['reviewerUserID']){
|
||||
$reviewers["i"][] = $r['reviewerUserID'];
|
||||
break;
|
||||
}
|
||||
$revi[] = $r['reviewerUserID'];
|
||||
} elseif ($r['reviewerGroupID']!=0){
|
||||
foreach ($docAccess["groups"] as $grp)
|
||||
if ($grp->getID()==$r['reviewerGroupID']){
|
||||
$reviewers["g"][] = $r['reviewerGroupID'];
|
||||
break;
|
||||
}
|
||||
$revg[] = $r['reviewerGroupID'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Add managers of groups as mandatory reviewers */
|
||||
if(!empty($settings->_addManagerAsReviewer)) {
|
||||
$groups = $user->getGroups();
|
||||
foreach($groups as $group) {
|
||||
$managers = $group->getManagers();
|
||||
foreach($managers as $manager) {
|
||||
$revi[] = $manager->getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Add global reviewers as mandatory reviewers */
|
||||
if(!empty($settings->_globalReviewer)) {
|
||||
$revi = array_merge($revi, $settings->_globalReviewer);
|
||||
}
|
||||
|
||||
/* Check if reviewers are allowed to review */
|
||||
$revi = array_unique($revi);
|
||||
$revg = array_unique($revg);
|
||||
$reviewers["i"] = []; // users
|
||||
$reviewers["g"] = []; // groups
|
||||
$reviewers["ni"] = []; // users being filtered out
|
||||
$reviewers["ng"] = []; // groups being filtered out
|
||||
$dms = $user->getDMS();
|
||||
foreach($revi as $uid) {
|
||||
if($u = $dms->getUser($uid)) {
|
||||
/* need at least read access on parent folder */
|
||||
if($folder->getAccessMode($u) < M_READ)
|
||||
$reviewers["ni"][] = $u->getId();
|
||||
/* admins as reviewers must be enabled */
|
||||
elseif(!$settings->_enableAdminRevApp && $u->isAdmin())
|
||||
$reviewers["ni"][] = $u->getId();
|
||||
/* the owner of the document as a reviewer must be enabled */
|
||||
elseif(!$settings->_enableOwnerRevApp && $document && $document->getOwner()->getId() == $u->getId())
|
||||
$reviewers["ni"][] = $u->getId();
|
||||
/* the updloader as a reviewer must be enabled */
|
||||
elseif(!$settings->_enableSelfRevApp && $u->getId() == $user->getId())
|
||||
$reviewers["ni"][] = $u->getId();
|
||||
else
|
||||
$reviewers["i"][] = $u->getId();
|
||||
}
|
||||
}
|
||||
foreach($revg as $gid) {
|
||||
if($g = $dms->getGroup($gid)) {
|
||||
if($folder->getGroupAccessMode($g) < M_READ)
|
||||
$reviewers["ng"][] = $g->getId();
|
||||
else
|
||||
$reviewers["g"][] = $g->getId();
|
||||
}
|
||||
}
|
||||
|
||||
return $reviewers;
|
||||
} /* }}} */
|
||||
|
||||
|
@ -1103,38 +1147,80 @@ function getMandatoryReviewers($folder, $user) { /* {{{ */
|
|||
* Returns the mandatory approvers
|
||||
*
|
||||
* This function checks if the approvers have at least read access
|
||||
* on the folder containing the document.
|
||||
* on the folder containing the document. It also checks if the
|
||||
* mandatory approver is an admin or the uploading user and if
|
||||
* those are allowed to review/approve a document.
|
||||
*
|
||||
* @param $folder folder where document is located
|
||||
* @param $document document which is updated, null when adding a new document
|
||||
* @param $user user creating the new version or document
|
||||
* @return array
|
||||
* @return array containing the elements 'i' and 'g'. Each is a list of user/group ids
|
||||
*/
|
||||
function getMandatoryApprovers($folder, $user) { /* {{{ */
|
||||
function getMandatoryApprovers($folder, $document, $user) { /* {{{ */
|
||||
global $settings;
|
||||
|
||||
/* Get a list of all users and groups with read access on the folder.
|
||||
* Only those users and groups will be added as approvers
|
||||
*/
|
||||
$docAccess = $folder->getReadAccessList($settings->_enableAdminRevApp, $settings->_enableOwnerRevApp);
|
||||
$res=$user->getMandatoryApprovers();
|
||||
$approvers = array('i'=>[], 'g'=>[]);
|
||||
/* Get mandatory approvers of user */
|
||||
$res = $user->getMandatoryApprovers();
|
||||
$appi = $appg = [];
|
||||
foreach ($res as $r){
|
||||
|
||||
if ($r['approverUserID']!=0){
|
||||
foreach ($docAccess["users"] as $usr)
|
||||
if ($usr->getID()==$r['approverUserID']){
|
||||
$approvers["i"][] = $r['approverUserID'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ($r['approverGroupID']!=0){
|
||||
foreach ($docAccess["groups"] as $grp)
|
||||
if ($grp->getID()==$r['approverGroupID']){
|
||||
$approvers["g"][] = $r['approverGroupID'];
|
||||
break;
|
||||
}
|
||||
$appi[] = $r['approverUserID'];
|
||||
} elseif ($r['approverGroupID']!=0){
|
||||
$appg[] = $r['approverGroupID'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Add managers of groups as mandatory approvers */
|
||||
if(!empty($settings->_addManagerAsApprover)) {
|
||||
$groups = $user->getGroups();
|
||||
foreach($groups as $group) {
|
||||
$managers = $group->getManagers();
|
||||
foreach($managers as $manager) {
|
||||
$appi[] = $manager->getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Add global approvers as mandatory approvers */
|
||||
if(!empty($settings->_globalApprover)) {
|
||||
$appi = array_merge($appi, $settings->_globalApprover);
|
||||
}
|
||||
|
||||
/* Check if approvers are allowed to approve */
|
||||
$appi = array_unique($appi);
|
||||
$appg = array_unique($appg);
|
||||
$approvers["i"] = []; // users
|
||||
$approvers["g"] = []; // groups
|
||||
$approvers["ni"] = []; // users being filtered out
|
||||
$approvers["ng"] = []; // groups being filtered out
|
||||
$dms = $user->getDMS();
|
||||
foreach($appi as $uid) {
|
||||
if($u = $dms->getUser($uid)) {
|
||||
/* need at least read access on parent folder */
|
||||
if($folder->getAccessMode($u) < M_READ)
|
||||
$approvers["ni"][] = $u->getId();
|
||||
/* admins as approvers must be enabled */
|
||||
elseif(!$settings->_enableAdminRevApp && $u->isAdmin())
|
||||
$approvers["ni"][] = $u->getId();
|
||||
/* the owner of the document as a approver must be enabled */
|
||||
elseif(!$settings->_enableOwnerRevApp && $document && $document->getOwner()->getId() == $u->getId())
|
||||
$approvers["ni"][] = $u->getId();
|
||||
/* the updloader as a approver must be enabled */
|
||||
elseif(!$settings->_enableSelfRevApp && $u->getId() == $user->getId())
|
||||
$approvers["ni"][] = $u->getId();
|
||||
else
|
||||
$approvers["i"][] = $u->getId();
|
||||
}
|
||||
}
|
||||
foreach($appg as $gid) {
|
||||
if($g = $dms->getGroup($gid)) {
|
||||
if($folder->getGroupAccessMode($g) < M_READ)
|
||||
$approvers["ng"][] = $g->getId();
|
||||
else
|
||||
$approvers["g"][] = $g->getId();
|
||||
}
|
||||
}
|
||||
|
||||
return $approvers;
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
@ -234,13 +234,13 @@ if($settings->_workflowMode == 'traditional' || $settings->_workflowMode == 'tra
|
|||
|
||||
// add mandatory reviewers/approvers
|
||||
if($settings->_workflowMode == 'traditional') {
|
||||
$mreviewers = getMandatoryReviewers($folder, $user);
|
||||
$mreviewers = getMandatoryReviewers($folder, null, $user);
|
||||
if($mreviewers['i'])
|
||||
$reviewers['i'] = array_merge($reviewers['i'], $mreviewers['i']);
|
||||
if($mreviewers['g'])
|
||||
$reviewers['g'] = array_merge($reviewers['g'], $mreviewers['g']);
|
||||
}
|
||||
$mapprovers = getMandatoryApprovers($folder, $user);
|
||||
$mapprovers = getMandatoryApprovers($folder, null, $user);
|
||||
if($mapprovers['i'])
|
||||
$approvers['i'] = array_merge($approvers['i'], $mapprovers['i']);
|
||||
if($mapprovers['g'])
|
||||
|
|
|
@ -794,13 +794,13 @@ switch($command) {
|
|||
if($settings->_workflowMode == 'traditional' || $settings->_workflowMode == 'traditional_only_approval') {
|
||||
// add mandatory reviewers/approvers
|
||||
if($settings->_workflowMode == 'traditional') {
|
||||
$mreviewers = getMandatoryReviewers($folder, $user);
|
||||
$mreviewers = getMandatoryReviewers($folder, null, $user);
|
||||
if($mreviewers['i'])
|
||||
$reviewers['i'] = array_merge($reviewers['i'], $mreviewers['i']);
|
||||
if($mreviewers['g'])
|
||||
$reviewers['g'] = array_merge($reviewers['g'], $mreviewers['g']);
|
||||
}
|
||||
$mapprovers = getMandatoryApprovers($folder, $user);
|
||||
$mapprovers = getMandatoryApprovers($folder, null, $user);
|
||||
if($mapprovers['i'])
|
||||
$approvers['i'] = array_merge($approvers['i'], $mapprovers['i']);
|
||||
if($mapprovers['g'])
|
||||
|
|
|
@ -259,6 +259,10 @@ if ($action == "saveSettings")
|
|||
setBoolValue("enableOwnerRevApp");
|
||||
setBoolValue("enableSelfRevApp");
|
||||
setBoolValue("enableSelfReceipt");
|
||||
setBoolValue("addManagerAsReviewer");
|
||||
setBoolValue("addManagerAsApprover");
|
||||
setArrayValue("globalReviewer");
|
||||
setArrayValue("globalApprover");
|
||||
setBoolValue("enableUpdateRevApp");
|
||||
setBoolValue("enableRemoveRevApp");
|
||||
setBoolValue("enableAdminReceipt");
|
||||
|
|
|
@ -278,13 +278,13 @@ default:
|
|||
|
||||
// add mandatory reviewers/approvers
|
||||
if($settings->_workflowMode == 'traditional') {
|
||||
$mreviewers = getMandatoryReviewers($folder, $user);
|
||||
$mreviewers = getMandatoryReviewers($folder, $document, $user);
|
||||
if($mreviewers['i'])
|
||||
$reviewers['i'] = array_merge($reviewers['i'], $mreviewers['i']);
|
||||
if($mreviewers['g'])
|
||||
$reviewers['g'] = array_merge($reviewers['g'], $mreviewers['g']);
|
||||
}
|
||||
$mapprovers = getMandatoryApprovers($folder, $user);
|
||||
$mapprovers = getMandatoryApprovers($folder, $document, $user);
|
||||
if($mapprovers['i'])
|
||||
$approvers['i'] = array_merge($approvers['i'], $mapprovers['i']);
|
||||
if($mapprovers['g'])
|
||||
|
|
|
@ -514,33 +514,30 @@ console.log(params);
|
|||
}
|
||||
if($settings->_initialDocumentStatus == S_RELEASED)
|
||||
$this->warningMsg(getMLText("add_doc_workflow_warning"));
|
||||
$this->contentContainerEnd();
|
||||
} elseif($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
|
||||
$this->contentContainerEnd();
|
||||
if($workflowmode == 'traditional') {
|
||||
$this->contentSubHeading(getMLText("assign_reviewers"));
|
||||
$this->contentContainerStart();
|
||||
|
||||
$mreviewers = getMandatoryReviewers($folder, null, $user);
|
||||
|
||||
/* List all mandatory reviewers */
|
||||
$res=$user->getMandatoryReviewers();
|
||||
$tmp = array();
|
||||
if($res) {
|
||||
foreach ($res as $r) {
|
||||
if($r['reviewerUserID'] > 0) {
|
||||
$u = $dms->getUser($r['reviewerUserID']);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
}
|
||||
foreach ($mreviewers['i'] as $r) {
|
||||
$u = $dms->getUser($r);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
|
||||
$options = array();
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if(!$enablehiddenrevapp && $usr->isHidden()) continue;
|
||||
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['reviewerUserID']==$usr->getID()) $mandatory=true;
|
||||
if(!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
|
||||
$option = array($usr->getID(), htmlspecialchars($usr->getLogin()." - ".$usr->getFullName()), null);
|
||||
if ($mandatory) $option[] = array(array('disabled', 'disabled'));
|
||||
if(in_array($usr->getId(), $mreviewers['i']))
|
||||
$option[] = array(array('disabled', 'disabled'), array('data-subtitle', getMLText('user_is_mandatory_reviewer')));
|
||||
$options[] = $option;
|
||||
}
|
||||
$this->formField(
|
||||
|
@ -557,17 +554,15 @@ console.log(params);
|
|||
);
|
||||
|
||||
/* Check for mandatory reviewer without access */
|
||||
foreach($res as $r) {
|
||||
if($r['reviewerUserID']) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if ($r['reviewerUserID']==$usr->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessUser = $dms->getUser($r['reviewerUserID']);
|
||||
$this->warningMsg(getMLText("mandatory_reviewer_no_access", array('user'=>htmlspecialchars($noAccessUser->getFullName()." (".$noAccessUser->getLogin().")"))));
|
||||
}
|
||||
foreach($mreviewers['ni'] as $r) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if ($r == $usr->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessUser = $dms->getUser($r);
|
||||
$this->warningMsg(getMLText("mandatory_reviewer_no_access", array('user'=>htmlspecialchars($noAccessUser->getFullName()." (".$noAccessUser->getLogin().")"))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -590,22 +585,15 @@ console.log(params);
|
|||
|
||||
/* List all mandatory groups of reviewers */
|
||||
$tmp = array();
|
||||
if($res) {
|
||||
foreach ($res as $r) {
|
||||
if($r['reviewerGroupID'] > 0) {
|
||||
$u = $dms->getGroup($r['reviewerGroupID']);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
}
|
||||
foreach ($mreviewers['g'] as $r) {
|
||||
$u = $dms->getGroup($r);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
$options = array();
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['reviewerGroupID']==$grp->getID()) $mandatory=true;
|
||||
|
||||
$option = array($grp->getID(), htmlspecialchars($grp->getName()), null);
|
||||
if ($mandatory || !$grp->getUsers()) $option[] = array(array('disabled', 'disabled'));
|
||||
if(in_array($grp->getId(), $mreviewers['g']))
|
||||
$option[] = array(array('disabled', 'disabled'), array('data-subtitle', getMLText('group_is_mandatory_reviewer')));
|
||||
$options[] = $option;
|
||||
}
|
||||
$this->formField(
|
||||
|
@ -621,17 +609,15 @@ console.log(params);
|
|||
array('field_wrap'=>array('', ($tmp ? '<div class="mandatories"><span>'.getMLText('mandatory_reviewergroups').':</span> '.implode(', ', $tmp).'</div>' : '')))
|
||||
);
|
||||
/* Check for mandatory reviewer group without access */
|
||||
foreach($res as $r) {
|
||||
if ($r['reviewerGroupID']) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
if ($r['reviewerGroupID']==$grp->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessGroup = $dms->getGroup($r['reviewerGroupID']);
|
||||
$this->warningMsg(getMLText("mandatory_reviewergroup_no_access", array('group'=>htmlspecialchars($noAccessGroup->getName()))));
|
||||
}
|
||||
foreach($mreviewers['ng'] as $r) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
if ($r == $grp->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessGroup = $dms->getGroup($r['reviewerGroupID']);
|
||||
$this->warningMsg(getMLText("mandatory_reviewergroup_no_access", array('group'=>htmlspecialchars($noAccessGroup->getName()))));
|
||||
}
|
||||
}
|
||||
$this->contentContainerEnd();
|
||||
|
@ -639,28 +625,24 @@ console.log(params);
|
|||
|
||||
$this->contentSubHeading(getMLText("assign_approvers"));
|
||||
$this->contentContainerStart();
|
||||
$res=$user->getMandatoryApprovers();
|
||||
|
||||
$mapprovers = getMandatoryApprovers($folder, null, $user);
|
||||
|
||||
/* List all mandatory approvers */
|
||||
$tmp = array();
|
||||
if($res) {
|
||||
foreach ($res as $r) {
|
||||
if($r['approverUserID'] > 0) {
|
||||
$u = $dms->getUser($r['approverUserID']);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
}
|
||||
foreach ($mapprovers['i'] as $r) {
|
||||
$u = $dms->getUser($r);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
|
||||
$options = array();
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if(!$enablehiddenrevapp && $usr->isHidden()) continue;
|
||||
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
if(!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['approverUserID']==$usr->getID()) $mandatory=true;
|
||||
|
||||
$option = array($usr->getID(), htmlspecialchars($usr->getLogin()." - ".$usr->getFullName()), null);
|
||||
if ($mandatory) $option[] = array(array('disabled', 'disabled'));
|
||||
if(in_array($usr->getId(), $mapprovers['i']))
|
||||
$option[] = array(array('disabled', 'disabled'), array('data-subtitle', getMLText('user_is_mandatory_approver')));
|
||||
$options[] = $option;
|
||||
}
|
||||
$this->formField(
|
||||
|
@ -677,17 +659,15 @@ console.log(params);
|
|||
);
|
||||
|
||||
/* Check for mandatory approvers without access */
|
||||
foreach($res as $r) {
|
||||
if($r['approverUserID']) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if ($r['approverUserID']==$usr->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessUser = $dms->getUser($r['approverUserID']);
|
||||
$this->warningMsg(getMLText("mandatory_approver_no_access", array('user'=>htmlspecialchars($noAccessUser->getFullName()." (".$noAccessUser->getLogin().")"))));
|
||||
}
|
||||
foreach($mapprovers['ni'] as $r) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if ($r == $usr->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessUser = $dms->getUser($r);
|
||||
$this->warningMsg(getMLText("mandatory_approver_no_access", array('user'=>htmlspecialchars($noAccessUser->getFullName()." (".$noAccessUser->getLogin().")"))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -710,24 +690,16 @@ console.log(params);
|
|||
|
||||
/* List all mandatory groups of approvers */
|
||||
$tmp = array();
|
||||
if($res) {
|
||||
foreach ($res as $r) {
|
||||
if($r['approverGroupID'] > 0) {
|
||||
$u = $dms->getGroup($r['approverGroupID']);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
}
|
||||
foreach ($mapprovers['g'] as $r) {
|
||||
$u = $dms->getGroup($r);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
|
||||
$options = array();
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['approverGroupID']==$grp->getID()) $mandatory=true;
|
||||
|
||||
$option = array($grp->getID(), htmlspecialchars($grp->getName()), null);
|
||||
if ($mandatory || !$grp->getUsers()) $option[] = array(array('disabled', 'disabled'));
|
||||
|
||||
if(in_array($usr->getId(), $mapprovers['g']))
|
||||
$option[] = array(array('disabled', 'disabled'), array('data-subtitle', getMLText('group_is_mandatory_approver')));
|
||||
$options[] = $option;
|
||||
}
|
||||
$this->formField(
|
||||
|
@ -744,19 +716,18 @@ console.log(params);
|
|||
);
|
||||
|
||||
/* Check for mandatory approver groups without access */
|
||||
foreach($res as $r) {
|
||||
if ($r['approverGroupID']) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
if ($r['approverGroupID']==$grp->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessGroup = $dms->getGroup($r['approverGroupID']);
|
||||
$this->warningMsg(getMLText("mandatory_approvergroup_no_access", array('group'=>htmlspecialchars($noAccessGroup->getName()))));
|
||||
}
|
||||
foreach($mapprovers['ng'] as $r) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
if ($r == $grp->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessGroup = $dms->getGroup($r);
|
||||
$this->warningMsg(getMLText("mandatory_approvergroup_no_access", array('group'=>htmlspecialchars($noAccessGroup->getName()))));
|
||||
}
|
||||
}
|
||||
$this->contentContainerEnd();
|
||||
$this->warningMsg(getMLText("add_doc_reviewer_approver_warning"));
|
||||
} else {
|
||||
}
|
||||
|
|
|
@ -89,51 +89,48 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
|
|||
$this->contentSubHeading(getMLText("update_reviewers"));
|
||||
$this->contentContainerStart();
|
||||
|
||||
if($user->getID() != $owner->getID()) {
|
||||
$res=$owner->getMandatoryReviewers();
|
||||
if($user->isAdmin())
|
||||
$res = array();
|
||||
} else
|
||||
$res=$user->getMandatoryReviewers();
|
||||
/*
|
||||
if($user->getID() != $owner->getID()) {
|
||||
$res=$owner->getMandatoryReviewers();
|
||||
if($user->isAdmin())
|
||||
$res = array();
|
||||
} else
|
||||
$res=$user->getMandatoryReviewers();
|
||||
*/
|
||||
$mreviewers = getMandatoryReviewers($folder, $document, $user);
|
||||
|
||||
$options = [];
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['reviewerUserID']==$usr->getID()) $mandatory=true;
|
||||
|
||||
if ($mandatory){
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('disabled', 'disabled'), array('data-subtitle', getMLText('user_is_mandatory_reviewer'))));
|
||||
} elseif (isset($reviewIndex["i"][$usr->getID()])) {
|
||||
switch ($reviewIndex["i"][$usr->getID()]["status"]) {
|
||||
case S_LOG_WAITING:
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), true);
|
||||
break;
|
||||
case S_LOG_USER_REMOVED:
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('data-subtitle', getMLText('user_previously_removed_from_reviewers'))));
|
||||
break;
|
||||
default:
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('disabled', 'disabled')));
|
||||
break;
|
||||
$options = [];
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if(in_array($usr->getId(), $mreviewers['i'])) {
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('disabled', 'disabled'), array('data-subtitle', getMLText('user_is_mandatory_reviewer'))));
|
||||
} elseif (isset($reviewIndex["i"][$usr->getID()])) {
|
||||
switch ($reviewIndex["i"][$usr->getID()]["status"]) {
|
||||
case S_LOG_WAITING:
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), true);
|
||||
break;
|
||||
case S_LOG_USER_REMOVED:
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('data-subtitle', getMLText('user_previously_removed_from_reviewers'))));
|
||||
break;
|
||||
default:
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('disabled', 'disabled')));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if(!$enablehiddenrevapp && $usr->isHidden()) continue;
|
||||
if(!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()));
|
||||
}
|
||||
} else {
|
||||
if(!$enablehiddenrevapp && $usr->isHidden()) continue;
|
||||
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()));
|
||||
}
|
||||
}
|
||||
|
||||
/* List all mandatory reviewers */
|
||||
$extraparams = [];
|
||||
if($res) {
|
||||
$tmp = array();
|
||||
foreach ($res as $r) {
|
||||
if($r['reviewerUserID'] > 0) {
|
||||
$u = $dms->getUser($r['reviewerUserID']);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
}
|
||||
if($tmp) {
|
||||
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_reviewers').':</span> '.implode(', ', $tmp)."</div>\n"];
|
||||
}
|
||||
$tmp = array();
|
||||
foreach ($mreviewers['i'] as $r) {
|
||||
$u = $dms->getUser($r);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
if($tmp) {
|
||||
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_reviewers').':</span> '.implode(', ', $tmp)."</div>\n"];
|
||||
}
|
||||
$this->formField(
|
||||
getMLText("individuals"),
|
||||
|
@ -173,10 +170,7 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
|
|||
$options = [];
|
||||
foreach ($docAccess["groups"] as $group) {
|
||||
$grpusers = $group->getUsers();
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['reviewerGroupID']==$group->getID()) $mandatory=true;
|
||||
|
||||
if ($mandatory) {
|
||||
if(in_array($group->getId(), $mreviewers['g'])) {
|
||||
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, array(array('disabled', 'disabled'), array('data-subtitle', getMLText('group_is_mandatory_reviewer'))));
|
||||
} elseif (isset($reviewIndex["g"][$group->getID()])) {
|
||||
switch ($reviewIndex["g"][$group->getID()]["status"]) {
|
||||
|
@ -197,17 +191,13 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
|
|||
|
||||
/* List all mandatory groups of reviewers */
|
||||
$extraparams = [];
|
||||
if($res) {
|
||||
$tmp = array();
|
||||
foreach ($res as $r) {
|
||||
if($r['reviewerGroupID'] > 0) {
|
||||
$u = $dms->getGroup($r['reviewerGroupID']);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
}
|
||||
if($tmp) {
|
||||
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_reviewergroups').':</span> '.implode(', ', $tmp)."</div>\n"];
|
||||
}
|
||||
$tmp = array();
|
||||
foreach ($mreviewers['g'] as $r) {
|
||||
$u = $dms->getGroup($r);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
if($tmp) {
|
||||
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_reviewergroups').':</span> '.implode(', ', $tmp)."</div>\n"];
|
||||
}
|
||||
$this->formField(
|
||||
getMLText("groups"),
|
||||
|
@ -228,20 +218,21 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
|
|||
$this->contentSubHeading(getMLText("update_approvers"));
|
||||
$this->contentContainerStart();
|
||||
|
||||
/*
|
||||
if($user->getID() != $owner->getID()) {
|
||||
$res=$owner->getMandatoryApprovers();
|
||||
if($user->isAdmin())
|
||||
$res = array();
|
||||
} else
|
||||
$res=$user->getMandatoryApprovers();
|
||||
*/
|
||||
|
||||
$mapprovers = getMandatoryApprovers($folder, $document, $user);
|
||||
|
||||
$options = [];
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['approverUserID']==$usr->getID()) $mandatory=true;
|
||||
|
||||
if ($mandatory){
|
||||
if(in_array($usr->getId(), $mapprovers['i'])) {
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('disabled', 'disabled'), array('data-subtitle', getMLText('user_is_mandatory_approver'))));
|
||||
} elseif (isset($approvalIndex["i"][$usr->getID()])) {
|
||||
|
||||
|
@ -259,24 +250,20 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
|
|||
}
|
||||
else {
|
||||
if(!$enablehiddenrevapp && $usr->isHidden()) continue;
|
||||
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
if(!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()));
|
||||
}
|
||||
}
|
||||
|
||||
/* List all mandatory approvers */
|
||||
$extraparams = [];
|
||||
if($res) {
|
||||
$tmp = array();
|
||||
foreach ($res as $r) {
|
||||
if($r['approverUserID'] > 0) {
|
||||
$u = $dms->getUser($r['approverUserID']);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
}
|
||||
if($tmp) {
|
||||
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_approvers').':</span> '.implode(', ', $tmp)."</div>\n"];
|
||||
}
|
||||
$tmp = array();
|
||||
foreach ($mapprovers['i'] as $r) {
|
||||
$u = $dms->getUser($r);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
if($tmp) {
|
||||
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_approvers').':</span> '.implode(', ', $tmp)."</div>\n"];
|
||||
}
|
||||
$this->formField(
|
||||
getMLText("individuals"),
|
||||
|
@ -316,10 +303,7 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
|
|||
$options = [];
|
||||
foreach ($docAccess["groups"] as $group) {
|
||||
$grpusers = $group->getUsers();
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['approverGroupID']==$group->getID()) $mandatory=true;
|
||||
|
||||
if ($mandatory) {
|
||||
if(in_array($group->getId(), $mapprovers['g'])) {
|
||||
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, array(array('disabled', 'disabled'), array('data-subtitle', getMLText('group_is_mandatory_approver'))));
|
||||
} elseif (isset($approvalIndex["g"][$group->getID()])) {
|
||||
|
||||
|
@ -342,17 +326,13 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
|
|||
|
||||
/* List all mandatory groups of approvers */
|
||||
$extraparams = [];
|
||||
if($res) {
|
||||
$tmp = array();
|
||||
foreach ($res as $r) {
|
||||
if($r['approverGroupID'] > 0) {
|
||||
$u = $dms->getGroup($r['approverGroupID']);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
}
|
||||
if($tmp) {
|
||||
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_reviewergroups').':</span> '.implode(', ', $tmp)."</div>\n"];
|
||||
}
|
||||
$tmp = array();
|
||||
foreach ($mapprovers['g'] as $r) {
|
||||
$u = $dms->getGroup($r);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
if($tmp) {
|
||||
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_approvergroups').':</span> '.implode(', ', $tmp)."</div>\n"];
|
||||
}
|
||||
$this->formField(
|
||||
getMLText("groups"),
|
||||
|
|
|
@ -544,6 +544,10 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
|
|||
<?php $this->showConfigCheckbox('settings_enableOwnerReceipt', 'enableOwnerReceipt'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableUpdateReceipt', 'enableUpdateReceipt'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableFilterReceipt', 'enableFilterReceipt'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_addManagerAsReviewer', 'addManagerAsReviewer'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_addManagerAsApprover', 'addManagerAsApprover'); ?>
|
||||
<?php $this->showConfigUser('settings_globalReviewer', 'globalReviewer', true, true); ?>
|
||||
<?php $this->showConfigUser('settings_globalApprover', 'globalApprover', true, true); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableVersionDeletion', 'enableVersionDeletion'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableVersionModification', 'enableVersionModification'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableDuplicateDocNames', 'enableDuplicateDocNames'); ?>
|
||||
|
|
|
@ -348,28 +348,24 @@ console.log(element);
|
|||
$this->contentContainerEnd();
|
||||
$this->contentSubHeading(getMLText("assign_reviewers"));
|
||||
$this->contentContainerStart();
|
||||
$res=$user->getMandatoryReviewers();
|
||||
|
||||
$mreviewers = getMandatoryReviewers($folder, $document, $user);
|
||||
|
||||
$options = array();
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if(!$enablehiddenrevapp && $usr->isHidden()) continue;
|
||||
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['reviewerUserID']==$usr->getID()) $mandatory=true;
|
||||
if(!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
|
||||
$option = array($usr->getID(), htmlspecialchars($usr->getLogin()." - ".$usr->getFullName()), null);
|
||||
if ($mandatory) $option[] = array(array('disabled', 'disabled'));
|
||||
if(in_array($usr->getId(), $mreviewers['i']))
|
||||
$option[] = array(array('disabled', 'disabled'), array('data-subtitle', getMLText('user_is_mandatory_reviewer')));
|
||||
$options[] = $option;
|
||||
}
|
||||
$tmp = array();
|
||||
foreach($reviewStatus as $r) {
|
||||
if($r['type'] == 0) {
|
||||
if($res) {
|
||||
$mandatory=false;
|
||||
foreach ($res as $rr)
|
||||
if ($rr['reviewerUserID']==$r['required']) {
|
||||
$mandatory=true;
|
||||
}
|
||||
if(!$mandatory)
|
||||
if($mreviewers) {
|
||||
if(!in_array($r['required'], $mreviewers['i']))
|
||||
$tmp[] = $r['required'];
|
||||
} else {
|
||||
$tmp[] = $r['required'];
|
||||
|
@ -381,20 +377,17 @@ console.log(element);
|
|||
$fieldwrap = array('', $this->getSelectPresetButtonHtml("IndReviewers", $tmp));
|
||||
}
|
||||
/* List all mandatory reviewers */
|
||||
if($res) {
|
||||
$tmp = array();
|
||||
foreach ($res as $r) {
|
||||
if($r['reviewerUserID'] > 0) {
|
||||
$u = $dms->getUser($r['reviewerUserID']);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
}
|
||||
if($tmp) {
|
||||
if(isset($fieldwrap[1]))
|
||||
$fieldwrap[1] .= '<div class="mandatories"><span>'.getMLText('mandatory_reviewers').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
else
|
||||
$fieldwrap[1] = '<div class="mandatories"><span>'.getMLText('mandatory_reviewers').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
}
|
||||
$tmp = array();
|
||||
foreach ($mreviewers['i'] as $r) {
|
||||
$u = $dms->getUser($r);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
|
||||
if($tmp) {
|
||||
if(isset($fieldwrap[1]))
|
||||
$fieldwrap[1] .= '<div class="mandatories"><span>'.getMLText('mandatory_reviewers').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
else
|
||||
$fieldwrap[1] = '<div class="mandatories"><span>'.getMLText('mandatory_reviewers').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
}
|
||||
|
||||
$this->formField(
|
||||
|
@ -412,17 +405,15 @@ console.log(element);
|
|||
);
|
||||
|
||||
/* Check for mandatory reviewer without access */
|
||||
foreach($res as $r) {
|
||||
if($r['reviewerUserID']) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if ($r['reviewerUserID']==$usr->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessUser = $dms->getUser($r['reviewerUserID']);
|
||||
$this->warningMsg(getMLText("mandatory_reviewer_no_access", array('user'=>htmlspecialchars($noAccessUser->getFullName()." (".$noAccessUser->getLogin().")"))));
|
||||
}
|
||||
foreach($mreviewers['ni'] as $r) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if ($r == $usr->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessUser = $dms->getUser($r);
|
||||
$this->warningMsg(getMLText("mandatory_reviewer_no_access", array('user'=>htmlspecialchars($noAccessUser->getFullName()." (".$noAccessUser->getLogin().")"))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,24 +436,17 @@ console.log(element);
|
|||
|
||||
$options = array();
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['reviewerGroupID']==$grp->getID()) $mandatory=true;
|
||||
|
||||
$option = array($grp->getID(), htmlspecialchars($grp->getName()), null);
|
||||
if ($mandatory || !$grp->getUsers()) $option[] = array(array('disabled', 'disabled'));
|
||||
if(in_array($grp->getId(), $mreviewers['g']) || !$grp->getUsers())
|
||||
$option[] = array(array('disabled', 'disabled'), array('data-subtitle', getMLText('group_is_mandatory_reviewer')));
|
||||
$options[] = $option;
|
||||
}
|
||||
|
||||
$tmp = array();
|
||||
foreach($reviewStatus as $r) {
|
||||
if($r['type'] == 1) {
|
||||
if($res) {
|
||||
$mandatory=false;
|
||||
foreach ($res as $rr)
|
||||
if ($rr['reviewerGroupID']==$r['required']) {
|
||||
$mandatory=true;
|
||||
}
|
||||
if(!$mandatory)
|
||||
if($mreviewers) {
|
||||
if(!in_array($r['required'], $mreviewers['g']))
|
||||
$tmp[] = $r['required'];
|
||||
} else {
|
||||
$tmp[] = $r['required'];
|
||||
|
@ -474,18 +458,18 @@ console.log(element);
|
|||
$fieldwrap = array('', $this->getSelectPresetButtonHtml("GrpReviewers", $tmp));
|
||||
}
|
||||
/* List all mandatory groups of reviewers */
|
||||
if($res) {
|
||||
$tmp = array();
|
||||
foreach ($res as $r) {
|
||||
if($r['reviewerGroupID'] > 0) {
|
||||
$u = $dms->getGroup($r['reviewerGroupID']);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
}
|
||||
if($tmp) {
|
||||
$fieldwrap[1] .= '<div class="mandatories"><span>'.getMLText('mandatory_reviewergroups').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
}
|
||||
$tmp = array();
|
||||
foreach ($mreviewers['g'] as $r) {
|
||||
$u = $dms->getGroup($r);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
if($tmp) {
|
||||
if(isset($fieldwrap[1]))
|
||||
$fieldwrap[1] .= '<div class="mandatories"><span>'.getMLText('mandatory_reviewergroups').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
else
|
||||
$fieldwrap[1] = '<div class="mandatories"><span>'.getMLText('mandatory_reviewergroups').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
}
|
||||
|
||||
$this->formField(
|
||||
getMLText("groups"),
|
||||
array(
|
||||
|
@ -501,17 +485,15 @@ console.log(element);
|
|||
);
|
||||
|
||||
/* Check for mandatory reviewer group without access */
|
||||
foreach($res as $r) {
|
||||
if ($r['reviewerGroupID']) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
if ($r['reviewerGroupID']==$grp->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessGroup = $dms->getGroup($r['reviewerGroupID']);
|
||||
$this->warningMsg(getMLText("mandatory_reviewergroup_no_access", array('group'=>htmlspecialchars($noAccessGroup->getName()))));
|
||||
}
|
||||
foreach($mreviewers['ng'] as $r) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
if ($r == $grp->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessGroup = $dms->getGroup($r['reviewerGroupID']);
|
||||
$this->warningMsg(getMLText("mandatory_reviewergroup_no_access", array('group'=>htmlspecialchars($noAccessGroup->getName()))));
|
||||
}
|
||||
}
|
||||
$this->contentContainerEnd();
|
||||
|
@ -519,29 +501,25 @@ console.log(element);
|
|||
|
||||
$this->contentSubHeading(getMLText("assign_approvers"));
|
||||
$this->contentContainerStart();
|
||||
|
||||
$mapprovers = getMandatoryApprovers($folder, $document, $user);
|
||||
|
||||
$options = array();
|
||||
$res=$user->getMandatoryApprovers();
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if(!$enablehiddenrevapp && $usr->isHidden()) continue;
|
||||
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
if(!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
||||
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['approverUserID']==$usr->getID()) $mandatory=true;
|
||||
|
||||
$option = array($usr->getID(), htmlspecialchars($usr->getLogin()." - ".$usr->getFullName()), null);
|
||||
if ($mandatory) $option[] = array(array('disabled', 'disabled'));
|
||||
if(in_array($usr->getId(), $mapprovers['i']))
|
||||
$option[] = array(array('disabled', 'disabled'), array('data-subtitle', getMLText('user_is_mandatory_approver')));
|
||||
$options[] = $option;
|
||||
}
|
||||
|
||||
$tmp = array();
|
||||
foreach($approvalStatus as $r) {
|
||||
if($r['type'] == 0) {
|
||||
if($res) {
|
||||
$mandatory=false;
|
||||
foreach ($res as $rr)
|
||||
if ($rr['approverUserID']==$r['required']) {
|
||||
$mandatory=true;
|
||||
}
|
||||
if(!$mandatory)
|
||||
if($mapprovers) {
|
||||
if(!in_array($r['required'], $mapprovers['i']))
|
||||
$tmp[] = $r['required'];
|
||||
} else {
|
||||
$tmp[] = $r['required'];
|
||||
|
@ -552,18 +530,18 @@ console.log(element);
|
|||
if($tmp) {
|
||||
$fieldwrap = array('', $this->getSelectPresetButtonHtml("IndApprovers", $tmp));
|
||||
}
|
||||
|
||||
/* List all mandatory approvers */
|
||||
if($res) {
|
||||
$tmp = array();
|
||||
foreach ($res as $r) {
|
||||
if($r['approverUserID'] > 0) {
|
||||
$u = $dms->getUser($r['approverUserID']);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
}
|
||||
if($tmp) {
|
||||
$tmp = array();
|
||||
foreach ($mapprovers['i'] as $r) {
|
||||
$u = $dms->getUser($r);
|
||||
$tmp[] = htmlspecialchars($u->getFullName().' ('.$u->getLogin().')');
|
||||
}
|
||||
if($tmp) {
|
||||
if(isset($fieldwrap[1]))
|
||||
$fieldwrap[1] .= '<div class="mandatories"><span>'.getMLText('mandatory_approvers').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
}
|
||||
else
|
||||
$fieldwrap[1] = '<div class="mandatories"><span>'.getMLText('mandatory_approvers').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
}
|
||||
|
||||
$this->formField(
|
||||
|
@ -581,18 +559,16 @@ console.log(element);
|
|||
);
|
||||
|
||||
/* Check for mandatory approvers without access */
|
||||
foreach($res as $r) {
|
||||
if($r['approverUserID']) {
|
||||
foreach($mapprovers['ni'] as $r) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if ($r['approverUserID']==$usr->getID())
|
||||
if ($r == $usr->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessUser = $dms->getUser($r['approverUserID']);
|
||||
$noAccessUser = $dms->getUser($r);
|
||||
$this->warningMsg(getMLText("mandatory_approver_no_access", array('user'=>htmlspecialchars($noAccessUser->getFullName()." (".$noAccessUser->getLogin().")"))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$options = array();
|
||||
|
@ -615,28 +591,18 @@ console.log(element);
|
|||
$options = array();
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
|
||||
$mandatory=false;
|
||||
foreach ($res as $r) if ($r['approverGroupID']==$grp->getID()) $mandatory=true;
|
||||
|
||||
$option = array($grp->getID(), htmlspecialchars($grp->getName()), null);
|
||||
if ($mandatory || !$grp->getUsers()) $option[] = array(array('disabled', 'disabled'));
|
||||
|
||||
if(in_array($grp->getId(), $mapprovers['g']))
|
||||
$option[] = array(array('disabled', 'disabled'), array('data-subtitle', getMLText('group_is_mandatory_approver')));
|
||||
$options[] = $option;
|
||||
}
|
||||
$tmp = array();
|
||||
foreach($approvalStatus as $r) {
|
||||
if($r['type'] == 1) {
|
||||
if($res) {
|
||||
$mandatory=false;
|
||||
foreach ($res as $rr)
|
||||
if ($rr['approverGroupID']==$r['required']) {
|
||||
$mandatory=true;
|
||||
}
|
||||
if(!$mandatory)
|
||||
$tmp[] = $r['required'];
|
||||
} else {
|
||||
if(!in_array($r['required'], $mapprovers['g']))
|
||||
$tmp[] = $r['required'];
|
||||
}
|
||||
} else {
|
||||
$tmp[] = $r['required'];
|
||||
}
|
||||
}
|
||||
$fieldwrap = array('', '');
|
||||
|
@ -644,17 +610,13 @@ console.log(element);
|
|||
$fieldwrap = array('', $this->getSelectPresetButtonHtml("GrpApprovers", $tmp));
|
||||
}
|
||||
/* List all mandatory groups of approvers */
|
||||
if($res) {
|
||||
$tmp = array();
|
||||
foreach ($res as $r) {
|
||||
if($r['approverGroupID'] > 0) {
|
||||
$u = $dms->getGroup($r['approverGroupID']);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
}
|
||||
if($tmp) {
|
||||
$fieldwrap[1] .= '<div class="mandatories"><span>'.getMLText('mandatory_approvergroups').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
}
|
||||
$tmp = array();
|
||||
foreach ($mapprovers['g'] as $r) {
|
||||
$u = $dms->getGroup($r);
|
||||
$tmp[] = htmlspecialchars($u->getName());
|
||||
}
|
||||
if($tmp) {
|
||||
$fieldwrap[1] .= '<div class="mandatories"><span>'.getMLText('mandatory_approvergroups').':</span> '.implode(', ', $tmp)."</div>\n";
|
||||
}
|
||||
|
||||
$this->formField(
|
||||
|
@ -672,17 +634,15 @@ console.log(element);
|
|||
);
|
||||
|
||||
/* Check for mandatory approver groups without access */
|
||||
foreach($res as $r) {
|
||||
if ($r['approverGroupID']) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
if ($r['approverGroupID']==$grp->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessGroup = $dms->getGroup($r['approverGroupID']);
|
||||
$this->warningMsg(getMLText("mandatory_approvergroup_no_access", array('group'=>htmlspecialchars($noAccessGroup->getName()))));
|
||||
}
|
||||
foreach($mapprovers['ng'] as $r) {
|
||||
$hasAccess = false;
|
||||
foreach ($docAccess["groups"] as $grp) {
|
||||
if ($r == $grp->getID())
|
||||
$hasAccess = true;
|
||||
}
|
||||
if(!$hasAccess) {
|
||||
$noAccessGroup = $dms->getGroup($r);
|
||||
$this->warningMsg(getMLText("mandatory_approvergroup_no_access", array('group'=>htmlspecialchars($noAccessGroup->getName()))));
|
||||
}
|
||||
}
|
||||
$this->contentContainerEnd();
|
||||
|
|
Loading…
Reference in New Issue
Block a user