mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-11 16:35:38 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
6fd868c5a7
|
@ -974,10 +974,11 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* @param array $states remove user only from reviews/approvals in one of the states
|
||||
* e.g. if passing array('review'=>array(0)), the method will operate on
|
||||
* reviews which has not been touched yet.
|
||||
* @param object user who takes over the processes
|
||||
* @param object $newuser user who takes over the processes
|
||||
* @param array $docs remove only processes from docs with the given document ids
|
||||
* @return boolean true on success or false in case of an error
|
||||
*/
|
||||
private function __removeFromProcesses($user, $states = array(), $newuser=null) { /* {{{ */
|
||||
private function __removeFromProcesses($user, $states = array(), $newuser=null, $docs=null) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
/* Get a list of all reviews, even those of older document versions */
|
||||
|
@ -986,6 +987,12 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
foreach ($reviewStatus["indstatus"] as $ri) {
|
||||
if(!($doc = $this->_dms->getDocument($ri['documentID'])))
|
||||
continue;
|
||||
if($docs) {
|
||||
if(!in_array($doc->getID(), $docs))
|
||||
continue;
|
||||
if(!$doc->isLatestContent($ri['version']))
|
||||
continue;
|
||||
}
|
||||
if($newuser && $doc->getAccessMode($newuser) < M_READ)
|
||||
continue;
|
||||
if($ri['status'] != -2 && (!isset($states['review']) || in_array($ri['status'], $states['review']))) {
|
||||
|
@ -998,14 +1005,12 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
}
|
||||
/* Only reviews not done already can be transferred to a new user */
|
||||
if($newuser && $ri['status'] == 0) {
|
||||
if($doc = $this->_dms->getDocument($ri['documentID'])) {
|
||||
if($version = $doc->getContentByVersion($ri['version'])) {
|
||||
$ret = $version->addIndReviewer($newuser, $user);
|
||||
/* returns -3 if the user is already a reviewer */
|
||||
if($ret === false || ($ret < 0 && $ret != -3)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
if($version = $doc->getContentByVersion($ri['version'])) {
|
||||
$ret = $version->addIndReviewer($newuser, $user);
|
||||
/* returns -3 if the user is already a reviewer */
|
||||
if($ret === false || ($ret < 0 && $ret != -3)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1019,6 +1024,12 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
foreach ($approvalStatus["indstatus"] as $ai) {
|
||||
if(!($doc = $this->_dms->getDocument($ai['documentID'])))
|
||||
continue;
|
||||
if($docs) {
|
||||
if(!in_array($doc->getID(), $docs))
|
||||
continue;
|
||||
if(!$doc->isLatestContent($ai['version']))
|
||||
continue;
|
||||
}
|
||||
if($newuser && $doc->getAccessMode($newuser) < M_READ)
|
||||
continue;
|
||||
if($ai['status'] != -2 && (!isset($states['approval']) || in_array($ai['status'], $states['approval']))) {
|
||||
|
@ -1031,14 +1042,12 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
}
|
||||
/* Only approvals not done already can be transferred to a new user */
|
||||
if($newuser && $ai['status'] == 0) {
|
||||
if($doc = $this->_dms->getDocument($ai['documentID'])) {
|
||||
if($version = $doc->getContentByVersion($ai['version'])) {
|
||||
$ret = $version->addIndReviewer($newuser, $user);
|
||||
/* returns -3 if the user is already a reviewer */
|
||||
if($ret === false || ($ret < 0 && $ret != -3)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
if($version = $doc->getContentByVersion($ai['version'])) {
|
||||
$ret = $version->addIndReviewer($newuser, $user);
|
||||
/* returns -3 if the user is already a reviewer */
|
||||
if($ret === false || ($ret < 0 && $ret != -3)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1052,6 +1061,12 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
foreach ($receiptStatus["indstatus"] as $ri) {
|
||||
if(!($doc = $this->_dms->getDocument($ri['documentID'])))
|
||||
continue;
|
||||
if($docs) {
|
||||
if(!in_array($doc->getID(), $docs))
|
||||
continue;
|
||||
if(!$doc->isLatestContent($ri['version']))
|
||||
continue;
|
||||
}
|
||||
if($newuser && $doc->getAccessMode($newuser) < M_READ)
|
||||
continue;
|
||||
if($ri['status'] != -2 && (!isset($states['receipt']) || in_array($ri['status'], $states['receipt']))) {
|
||||
|
@ -1085,6 +1100,12 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
foreach ($revisionStatus["indstatus"] as $ri) {
|
||||
if(!($doc = $this->_dms->getDocument($ri['documentID'])))
|
||||
continue;
|
||||
if($docs) {
|
||||
if(!in_array($doc->getID(), $docs))
|
||||
continue;
|
||||
if(!$doc->isLatestContent($ri['version']))
|
||||
continue;
|
||||
}
|
||||
if($newuser && $doc->getAccessMode($newuser) < M_READ)
|
||||
continue;
|
||||
if($ri['status'] != -2 && (!isset($states['revision']) || in_array($ri['status'], $states['revision']))) {
|
||||
|
@ -1123,14 +1144,14 @@ class SeedDMS_Core_User { /* {{{ */
|
|||
* @param object $user the user doing the removal (needed for entry in
|
||||
* review and approve log).
|
||||
* @param array $states remove user only from reviews/approvals in one of the states
|
||||
* @param object user who takes over the processes
|
||||
* @param object $newuser user who takes over the processes
|
||||
* @return boolean true on success or false in case of an error
|
||||
*/
|
||||
public function removeFromProcesses($user, $states=array(), $newuser=null) { /* {{{ */
|
||||
public function removeFromProcesses($user, $states=array(), $newuser=null, $docs=null) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$db->startTransaction();
|
||||
if(!$this->__removeFromProcesses($user, $states, $newuser)) {
|
||||
if(!$this->__removeFromProcesses($user, $states, $newuser, $docs)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -240,13 +240,15 @@ else if ($action == "removefromprocesses") {
|
|||
$_POST["status"]["receipt"] = array();
|
||||
if(!isset($_POST["status"]["revision"]))
|
||||
$_POST["status"]["revision"] = array();
|
||||
if (!$userToRemove->removeFromProcesses($user, $_POST['status'], $userToAssign)) {
|
||||
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
||||
if(!empty($_POST['needsdocs']) && empty($_POST['docs'])) {
|
||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_rm_user_processes_no_docs')));
|
||||
} else {
|
||||
if (!$userToRemove->removeFromProcesses($user, $_POST['status'], $userToAssign, $_POST['docs'])) {
|
||||
UI::exitError(getMLText("admin_tools"),getMLText("error_rm_user_processes"));
|
||||
}
|
||||
add_log_line(".php&action=removefromprocesses&userid=".$userid);
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_rm_user_processes')));
|
||||
}
|
||||
|
||||
add_log_line(".php&action=removefromprocesses&userid=".$userid);
|
||||
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_rm_user_processes')));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,11 @@ if (isset($_GET["task"])) {
|
|||
$task = $_GET['task'];
|
||||
}
|
||||
|
||||
$type = null;
|
||||
if (isset($_GET["type"])) {
|
||||
$type = $_GET['type'];
|
||||
}
|
||||
|
||||
$allusers = $dms->getAllUsers($settings->_sortUsersInList);
|
||||
|
||||
if($view) {
|
||||
|
@ -60,6 +65,7 @@ if($view) {
|
|||
$view->setParam('rmuser', $rmuser);
|
||||
$view->setParam('allusers', $allusers);
|
||||
$view->setParam('task', $task);
|
||||
$view->setParam('type', $type);
|
||||
$view->setParam('cachedir', $settings->_cacheDir);
|
||||
$view->setParam('rootfolder', $dms->getFolder($settings->_rootFolderID));
|
||||
$view->setParam('conversionmgr', $conversionmgr);
|
||||
|
|
|
@ -43,8 +43,12 @@ $(document).ready( function() {
|
|||
$('body').on('click', 'label.checkbox, td span', function(ev){
|
||||
ev.preventDefault();
|
||||
$('#kkkk.ajax').data('action', $(this).data('action'));
|
||||
$('#kkkk.ajax').trigger('update', {userid: $(this).data('userid'), task: $(this).data('task')});
|
||||
$('#kkkk.ajax').trigger('update', {userid: $(this).data('userid'), task: $(this).data('task'), type: $(this).data('type')});
|
||||
});
|
||||
$('body').on('click', '#selectall', function(ev){
|
||||
$("input.markforprocess").each(function () { this.checked = !this.checked; });
|
||||
ev.preventDefault();
|
||||
});
|
||||
});
|
||||
<?php
|
||||
} /* }}} */
|
||||
|
@ -60,7 +64,9 @@ $(document).ready( function() {
|
|||
$previewconverters = $this->params['previewconverters'];
|
||||
$timeout = $this->params['timeout'];
|
||||
$rmuser = $this->params['rmuser'];
|
||||
$allusers = $this->params['allusers'];
|
||||
$task = $this->params['task'];
|
||||
$type = $this->params['type'];
|
||||
|
||||
if(!$task)
|
||||
return;
|
||||
|
@ -239,12 +245,23 @@ $(document).ready( function() {
|
|||
break;
|
||||
}
|
||||
if($docs) {
|
||||
echo '<form id="processform" action="../op/op.UsrMgr.php" method="post">';
|
||||
echo '<input type="hidden" name="userid" value="'.$rmuser->getID().'">';
|
||||
if($type) {
|
||||
$kk = explode('_', $type, 2);
|
||||
echo '<input type="hidden" name="status['.$kk[0].'][]" value="'.$kk[1].'">';
|
||||
}
|
||||
echo '<input type="hidden" name="task" value="'.$task.'">';
|
||||
echo '<input type="hidden" name="action" value="removefromprocesses">';
|
||||
echo '<input type="hidden" name="needsdocs" value="1">';
|
||||
echo createHiddenFieldWithKey('removefromprocesses');
|
||||
print "<table class=\"table table-condensed table-sm\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
print "<th></th>\n";
|
||||
print "<th>".getMLText("name")."</th>\n";
|
||||
print "<th>".getMLText("status")."</th>\n";
|
||||
print "<th>".getMLText("action")."</th>\n";
|
||||
print "<th><span id=\"selectall\"><i class=\"fa fa-arrows-h\" title=\"".getMLText('object_cleaner_toggle_checkboxes')."\"></i></span></th>\n";
|
||||
print "</tr>\n</thead>\n<tbody>\n";
|
||||
foreach($docs as $document) {
|
||||
$document->verifyLastestContentExpriry();
|
||||
|
@ -258,11 +275,33 @@ $(document).ready( function() {
|
|||
$extracontent['below_title'] = $this->getListRowPath($document);
|
||||
echo $this->documentListRowStart($document);
|
||||
echo $this->documentListRow($document, $previewer, true, 0, $extracontent);
|
||||
echo '<td>';
|
||||
echo '<input type="checkbox" class="markforprocess" value="'.$document->getId().'" name="docs['.$document->getId().']">';
|
||||
echo '</td>';
|
||||
echo $this->documentListRowEnd($document);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</tbody>\n</table>";
|
||||
$options = array(array(0, getMLText('do_no_transfer_to_user')));
|
||||
foreach ($allusers as $currUser) {
|
||||
if ($currUser->isGuest() || ($currUser->getID() == $rmuser->getID()) )
|
||||
continue;
|
||||
|
||||
if ($rmuser && $currUser->getID()==$rmuser->getID()) $selected=$count;
|
||||
$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()." - ".$currUser->getFullName()));
|
||||
}
|
||||
$this->formField(
|
||||
getMLText("transfer_process_to_user"),
|
||||
array(
|
||||
'element'=>'select',
|
||||
'name'=>'assignTo',
|
||||
'class'=>'chzn-select',
|
||||
'options'=>$options
|
||||
)
|
||||
);
|
||||
echo '<p><button type="submit" class="btn btn-primary"><i class="fa fa-remove"></i> '.getMLText('transfer').'</button>';
|
||||
echo '</form>';
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
|
@ -467,7 +506,7 @@ $(document).ready( function() {
|
|||
<?php
|
||||
echo "<table class=\"table table-condensed table-sm\">";
|
||||
foreach($out as $o) {
|
||||
echo "<tr><td>".$o[3]."</td><td>".$o[4]."</td><td><input style=\"margin-top: 0px;\" type=\"checkbox\" name=\"status[".$o[1]."][]\" value=\"".$o[0]."\"></td><td><span data-action=\"printList\" data-userid=\"".$rmuser->getId()."\" data-task=\"".$o[1]."s_".$o[2]."\"><i class=\"fa fa-list\"></i></span></td></tr>";
|
||||
echo "<tr><td>".$o[3]."</td><td>".$o[4]."</td><td><input style=\"margin-top: 0px;\" type=\"checkbox\" name=\"status[".$o[1]."][]\" value=\"".$o[0]."\"></td><td><span data-action=\"printList\" data-userid=\"".$rmuser->getId()."\" data-task=\"".$o[1]."s_".$o[2]."\" data-type=\"".$o[1]."_".$o[0]."\"><i class=\"fa fa-list\"></i></span></td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user