mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
7c818d0913
|
@ -5901,9 +5901,9 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
if (!$this->_workflowState) {
|
||||
$queryStr=
|
||||
"SELECT b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflowStates` b ON a.`state` = b.id WHERE `a`.`id`=". $this->_workflow['id'];
|
||||
"SELECT b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflowStates` b ON a.`state` = b.id WHERE a.`state` IS NOT NULL AND `a`.`id`=". $this->_workflow['id'];
|
||||
$recs = $db->getResultArray($queryStr);
|
||||
if (is_bool($recs) && !$recs)
|
||||
if (!$recs)
|
||||
return false;
|
||||
$this->_workflowState = new SeedDMS_Core_Workflow_State($recs[0]['id'], $recs[0]['name'], $recs[0]['maxtime'], $recs[0]['precondfunc'], $recs[0]['documentstatus']);
|
||||
$this->_workflowState->setDMS($this->_document->getDMS());
|
||||
|
@ -6089,7 +6089,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
$workflow = $this->_workflow['workflow'];
|
||||
|
||||
if(SeedDMS_Core_DMS::checkIfEqual($workflow->getInitState(), $this->getWorkflowState()) || $unlink == true) {
|
||||
/* A workflow should always be in a state, but in case it isn't, the
|
||||
* at least allow to remove the workflow.
|
||||
*/
|
||||
$currentstate = $this->getWorkflowState();
|
||||
if(!$currentstate || SeedDMS_Core_DMS::checkIfEqual($workflow->getInitState(), $currentstate) || $unlink == true) {
|
||||
$db->startTransaction();
|
||||
if($unlink) {
|
||||
$queryStr=
|
||||
|
|
|
@ -228,6 +228,9 @@ class SeedDMS_Core_Workflow { /* {{{ */
|
|||
function getNextTransitions($state) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if(!$state)
|
||||
return false;
|
||||
|
||||
$queryStr = "SELECT * FROM `tblWorkflowTransitions` WHERE `workflow`=".$this->_id." AND `state`=".$state->getID();
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && $resArr == false)
|
||||
|
|
|
@ -1904,6 +1904,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
|
|||
- SeedDMS_Core_DMS::getTimeline() uses status log instead of document content
|
||||
- add methods SeedDMS_Core_DocumentContent::getReviewers() and SeedDMS_Core_DocumentContent::getApprovers()
|
||||
- add methods SeedDMS_Core_DocumentContent::getApproveLog() and SeedDMS_Core_DocumentContent::getReviewLog()
|
||||
- better handling of document with an empty workflow state
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
|
|
|
@ -208,7 +208,8 @@ class SeedDMS_AccessOperation {
|
|||
if($document->isType('document')) {
|
||||
if($latestContent = $document->getLatestContent()) {
|
||||
$workflow = $latestContent->getWorkflow();
|
||||
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (!$workflow || ($workflow->getInitState()->getID() == $latestContent->getWorkflowState()->getID()))) {
|
||||
$workflowstate = $latestContent->getWorkflowState();
|
||||
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (!$workflow || ($workflowstate && ($workflow->getInitState()->getID() == $workflowstate->getID())))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +276,8 @@ class SeedDMS_AccessOperation {
|
|||
if($latestContent = $document->getLatestContent()) {
|
||||
$status = $latestContent->getStatus();
|
||||
$workflow = $latestContent->getWorkflow();
|
||||
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) >= M_READWRITE)) || $this->user->isAdmin()) && (in_array($status["status"], array(S_DRAFT_REV, S_DRAFT_APP, S_IN_REVISION)) || ($workflow && $workflow->getInitState()->getID() == $latestContent->getWorkflowState()->getID()))) {
|
||||
$workflowstate = $latestContent->getWorkflowState();
|
||||
if ((($this->settings->_enableVersionModification && ($document->getAccessMode($this->user) >= M_READWRITE)) || $this->user->isAdmin()) && (in_array($status["status"], array(S_DRAFT_REV, S_DRAFT_APP, S_IN_REVISION)) || ($workflow && $workflowstate && $workflow->getInitState()->getID() == $workflowstate->getID()))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class SeedDMS_View_ApprovalSummary extends SeedDMS_Theme_Style {
|
|||
if ($document && $version) {
|
||||
|
||||
if ($printheader){
|
||||
print "<table class=\"table table-condensed\">";
|
||||
print "<table class=\"table table-condensed table-sm\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
print "<th></th>\n";
|
||||
print "<th>".getMLText("name")."</th>\n";
|
||||
|
@ -129,7 +129,7 @@ class SeedDMS_View_ApprovalSummary extends SeedDMS_Theme_Style {
|
|||
if (!in_array($st["documentID"], $iRev) && $document && $version) {
|
||||
|
||||
if ($printheader){
|
||||
print "<table class=\"table table-condensed\">";
|
||||
print "<table class=\"table table-condensed table-sm\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
print "<th></th>\n";
|
||||
print "<th>".getMLText("name")."</th>\n";
|
||||
|
|
|
@ -45,7 +45,6 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Theme_Style {
|
|||
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
|
||||
|
||||
$this->contentHeading(getMLText("edit_attributes"));
|
||||
$this->contentContainerStart();
|
||||
?>
|
||||
<form class="form-horizontal" action="../op/op.EditAttributes.php" name="form1" method="POST">
|
||||
<?php echo createHiddenFieldWithKey('editattributes'); ?>
|
||||
|
@ -53,6 +52,7 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Theme_Style {
|
|||
<input type="hidden" name="version" value="<?php print $version->getVersion();?>">
|
||||
|
||||
<?php
|
||||
$this->contentContainerStart();
|
||||
if($attrdefs) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$arr = $this->callHook('editDocumentContentAttribute', $version, $attrdef);
|
||||
|
@ -75,11 +75,11 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Theme_Style {
|
|||
} elseif(is_string($arrs)) {
|
||||
echo $arrs;
|
||||
}
|
||||
$this->contentContainerEnd();
|
||||
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText('save'));
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
$this->contentContainerEnd();
|
||||
$this->contentEnd();
|
||||
$this->htmlEndPage();
|
||||
} /* }}} */
|
||||
|
|
|
@ -49,6 +49,7 @@ class SeedDMS_View_RemoveWorkflowFromDocument extends SeedDMS_Theme_Style {
|
|||
$wkflog = $latestContent->getWorkflowLog();
|
||||
$workflow = $latestContent->getWorkflow();
|
||||
|
||||
if($currentstate) {
|
||||
$msg = "The document is currently in state: ".$currentstate->getName()."<br />";
|
||||
if($wkflog) {
|
||||
foreach($wkflog as $entry) {
|
||||
|
@ -61,6 +62,9 @@ class SeedDMS_View_RemoveWorkflowFromDocument extends SeedDMS_Theme_Style {
|
|||
$msg .= getReadableDuration((time()-$enterts))." ago.<br />";
|
||||
}
|
||||
$msg .= "The document may stay in this state for ".$currentstate->getMaxTime()." sec.";
|
||||
} else {
|
||||
$msg = getMLText('workflow_in_unknown_state');
|
||||
}
|
||||
$this->infoMsg($msg);
|
||||
|
||||
$this->contentContainerStart();
|
||||
|
|
|
@ -85,7 +85,7 @@ class SeedDMS_View_ReviewSummary extends SeedDMS_Theme_Style {
|
|||
if ($document && $version) {
|
||||
|
||||
if ($printheader){
|
||||
print "<table class=\"table table-condensed\">";
|
||||
print "<table class=\"table table-condensed table-sm\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
print "<th></th>\n";
|
||||
print "<th>".getMLText("name")."</th>\n";
|
||||
|
@ -131,7 +131,7 @@ class SeedDMS_View_ReviewSummary extends SeedDMS_Theme_Style {
|
|||
if (!in_array($st["documentID"], $iRev) && $document && $version) {
|
||||
|
||||
if ($printheader){
|
||||
print "<table class=\"table table-condensed\">";
|
||||
print "<table class=\"table table-condensed table-sm\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
print "<th></th>\n";
|
||||
print "<th>".getMLText("name")."</th>\n";
|
||||
|
@ -147,7 +147,6 @@ class SeedDMS_View_ReviewSummary extends SeedDMS_Theme_Style {
|
|||
echo $txt;
|
||||
else {
|
||||
$class = $st['status'] == 1 ? ' success' : ($st['status'] == -1 ? ' error' : ( $st['status'] == -2 ? ' info' : ''));
|
||||
// print "<tr id=\"table-row-document-".$st['documentID']."\" class=\"table-row-document".$class."\" rel=\"document_".$st['documentID']."\" formtoken=\"".createFormKey('movedocument')."\" draggable=\"true\">";
|
||||
echo $this->documentListRowStart($document, $class);
|
||||
echo $this->documentListRow($document, $previewer, true, $st['version']);
|
||||
print "<td><small>".getReviewStatusText($st['status'])."<br />".$st["date"]."<br />". htmlspecialchars($modgroup->getName()) ."</small></td>";
|
||||
|
|
|
@ -49,6 +49,7 @@ class SeedDMS_View_RewindWorkflow extends SeedDMS_Theme_Style {
|
|||
$wkflog = array_pop($latestContent->getWorkflowLog());
|
||||
$workflow = $latestContent->getWorkflow();
|
||||
|
||||
if($currentstate) {
|
||||
$msg = "The document is currently in state: ".$currentstate->getName()."<br />";
|
||||
if($wkflog) {
|
||||
foreach($wkflog as $entry) {
|
||||
|
@ -61,14 +62,16 @@ class SeedDMS_View_RewindWorkflow extends SeedDMS_Theme_Style {
|
|||
$msg .= getReadableDuration((time()-$enterts))." ago.<br />";
|
||||
}
|
||||
$msg .= "The document may stay in this state for ".$currentstate->getMaxTime()." sec.";
|
||||
} else {
|
||||
$msg = getMLText('workflow_in_unknown_state');
|
||||
}
|
||||
$this->infoMsg($msg);
|
||||
|
||||
$this->contentContainerStart();
|
||||
// Display the Workflow form.
|
||||
$this->rowStart();
|
||||
$this->columnStart(4);
|
||||
?>
|
||||
<p><?php printMLText("rewind_workflow_warning"); ?></p>
|
||||
<?php $this->warningMsg(getMLText("rewind_workflow_warning")); ?>
|
||||
<form method="post" action="../op/op.RewindWorkflow.php" name="form1">
|
||||
<?php echo createHiddenFieldWithKey('rewindworkflow'); ?>
|
||||
<input type='hidden' name='documentid' value='<?php echo $document->getId(); ?>'/>
|
||||
|
@ -85,7 +88,6 @@ class SeedDMS_View_RewindWorkflow extends SeedDMS_Theme_Style {
|
|||
<?php
|
||||
$this->columnEnd();
|
||||
$this->rowEnd();
|
||||
$this->contentContainerEnd();
|
||||
|
||||
if($wkflog) {
|
||||
echo "<table class=\"table table-condensed table-sm\">";
|
||||
|
|
|
@ -750,13 +750,17 @@ $(document).ready( function() {
|
|||
$reverselinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $reverselinks, 'source');
|
||||
|
||||
$needwkflaction = false;
|
||||
$transitions = array();
|
||||
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
|
||||
} elseif($workflowmode == 'advanced') {
|
||||
$workflow = $latestContent->getWorkflow();
|
||||
if($workflow) {
|
||||
$workflowstate = $latestContent->getWorkflowState();
|
||||
if($workflowstate = $latestContent->getWorkflowState()) {
|
||||
$transitions = $workflow->getNextTransitions($workflowstate);
|
||||
$needwkflaction = $latestContent->needsWorkflowAction($user);
|
||||
} else {
|
||||
$this->warningMsg(getMLText('workflow_in_unknown_state'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1166,7 @@ $(document).ready( function() {
|
|||
$this->columnStart(12);
|
||||
$this->contentContainerStart();
|
||||
if($user->isAdmin()) {
|
||||
if(SeedDMS_Core_DMS::checkIfEqual($workflow->getInitState(), $latestContent->getWorkflowState())) {
|
||||
if(!$workflowstate || SeedDMS_Core_DMS::checkIfEqual($workflow->getInitState(), $workflowstate)) {
|
||||
print "<form action=\"../out/out.RemoveWorkflowFromDocument.php\" method=\"get\"><input type=\"hidden\" name=\"documentid\" value=\"".$latestContent->getDocument()->getId()."\" /><input type=\"hidden\" name=\"version\" value=\"".$latestContent->getVersion()."\" /><button type=\"submit\" class=\"btn btn-danger\"><i class=\"fa fa-remove\"></i> ".getMLText('rm_workflow')."</button></form>";
|
||||
} else {
|
||||
print "<form action=\"../out/out.RewindWorkflow.php\" method=\"get\"><input type=\"hidden\" name=\"documentid\" value=\"".$latestContent->getDocument()->getId()."\" /><input type=\"hidden\" name=\"version\" value=\"".$latestContent->getVersion()."\" /><button type=\"submit\" class=\"btn btn-danger\"><i class=\"fa fa-refresh\"></i> ".getMLText('rewind_workflow')."</button></form>";
|
||||
|
@ -1173,7 +1177,7 @@ $(document).ready( function() {
|
|||
if($parentworkflow = $latestContent->getParentWorkflow()) {
|
||||
echo "<p>Sub workflow of '".htmlspecialchars($parentworkflow->getName())."'</p>";
|
||||
}
|
||||
echo "<h5>".getMLText('current_state').": ".htmlspecialchars($workflowstate->getName())."</h5>";
|
||||
echo "<h5>".getMLText('current_state').": ".($workflowstate ? htmlspecialchars($workflowstate->getName()) : htmlspecialchars(getMLText('workflow_in_unknown_state')))."</h5>";
|
||||
echo "<table class=\"table table-condensed table-sm\">\n";
|
||||
echo "<tr>";
|
||||
echo "<td>".getMLText('next_state').":</td>";
|
||||
|
@ -1277,7 +1281,7 @@ $(document).ready( function() {
|
|||
if($workflows) {
|
||||
$subworkflows = array();
|
||||
foreach($workflows as $wkf) {
|
||||
if($wkf->getInitState()->getID() == $workflowstate->getID()) {
|
||||
if($workflowstate && ($wkf->getInitState()->getID() == $workflowstate->getID())) {
|
||||
if($workflow->getID() != $wkf->getID()) {
|
||||
$subworkflows[] = $wkf;
|
||||
}
|
||||
|
|
|
@ -72,46 +72,27 @@ class SeedDMS_View_WorkflowSummary extends SeedDMS_Theme_Style {
|
|||
$document = $dms->getDocument($st['document']);
|
||||
if($document)
|
||||
$version = $document->getContentByVersion($st['version']);
|
||||
$workflow = $dms->getWorkflow($st['workflow']);
|
||||
$state = $dms->getWorkflowState($st['state']);
|
||||
$owner = $document->getOwner();
|
||||
$moduser = $dms->getUser($st['userid']);
|
||||
|
||||
if ($document && $version) {
|
||||
|
||||
if ($printheader){
|
||||
print "<table class=\"table table-condensed\">";
|
||||
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("version")."</th>\n";
|
||||
print "<th>".getMLText("owner")."</th>\n";
|
||||
print "<th>".getMLText("workflow")."</th>\n";
|
||||
print "<th>".getMLText("workflow_state")."</th>\n";
|
||||
print "<th>".getMLText("status")."</th>\n";
|
||||
print "<th>".getMLText("action")."</th>\n";
|
||||
print "<th>".getMLText("last_update")."</th>\n";
|
||||
print "<th>".getMLText("expires")."</th>\n";
|
||||
print "</tr>\n</thead>\n<tbody>\n";
|
||||
$printheader=false;
|
||||
}
|
||||
|
||||
$previewer->createPreview($version);
|
||||
print "<tr>\n";
|
||||
print "<td><a href=\"../op/op.Download.php?documentid=".$document->getID()."&version=".$st['version']."\">";
|
||||
if($previewer->hasPreview($version)) {
|
||||
print "<img class=\"mimeicon\" width=\"".$previewwidth."\" src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$version->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($version->getMimeType())."\">";
|
||||
} else {
|
||||
print "<img class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($version->getFileType())."\" title=\"".htmlspecialchars($version->getMimeType())."\">";
|
||||
}
|
||||
print "</a></td>";
|
||||
print "<td><a href=\"out.DocumentVersionDetail.php?documentid=".$st["document"]."&version=".$st["version"]."\">".htmlspecialchars($document->getName());
|
||||
print "</a></td>";
|
||||
print "<td>".$st["version"]."</td>";
|
||||
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
|
||||
print "<td>".$workflow->getName()."</td>";
|
||||
print "<td>".$state->getName()."</td>";
|
||||
print "<td>".$st["date"]." ". htmlspecialchars($moduser->getFullName()) ."</td>";
|
||||
print "<td>".(!$document->expires() ? "-":getReadableDate($document->getExpires()))."</td>";
|
||||
print "</tr>\n";
|
||||
echo $this->documentListRowStart($document, $class);
|
||||
echo $this->documentListRow($document, $previewer, true, $st['version']);
|
||||
print "<td><small>".getLongReadableDate($st["date"])."<br />". htmlspecialchars($moduser->getFullName()) ."</small></td>";
|
||||
echo $this->documentListRowEnd($document);
|
||||
$iRev[] = $document->getId();
|
||||
}
|
||||
}
|
||||
if (!$printheader) {
|
||||
|
@ -127,45 +108,27 @@ class SeedDMS_View_WorkflowSummary extends SeedDMS_Theme_Style {
|
|||
$document = $dms->getDocument($st['document']);
|
||||
if($document)
|
||||
$version = $document->getContentByVersion($st['version']);
|
||||
$workflow = $dms->getWorkflow($st['workflow']);
|
||||
$state = $dms->getWorkflowState($st['state']);
|
||||
$owner = $document->getOwner();
|
||||
$modgroup = $dms->getGroup($st['groupid']);
|
||||
|
||||
if (!in_array($st["document"], $iRev) && $document && $version) {
|
||||
|
||||
if ($printheader){
|
||||
print "<table class=\"table table-condensed\">";
|
||||
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("version")."</th>\n";
|
||||
print "<th>".getMLText("owner")."</th>\n";
|
||||
print "<th>".getMLText("workflow")."</th>\n";
|
||||
print "<th>".getMLText("workflow_state")."</th>\n";
|
||||
print "<th>".getMLText("status")."</th>\n";
|
||||
print "<th>".getMLText("action")."</th>\n";
|
||||
print "<th>".getMLText("last_update")."</th>\n";
|
||||
print "<th>".getMLText("expires")."</th>\n";
|
||||
print "</tr>\n</thead>\n<tbody>\n";
|
||||
$printheader=false;
|
||||
}
|
||||
|
||||
$previewer->createPreview($version);
|
||||
print "<tr>\n";
|
||||
print "<td><a href=\"../op/op.Download.php?documentid=".$document->getID()."&version=".$st['version']."\">";
|
||||
if($previewer->hasPreview($version)) {
|
||||
print "<img class=\"mimeicon\" width=\"".$previewwidth."\" src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$version->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($version->getMimeType())."\">";
|
||||
} else {
|
||||
print "<img class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($version->getFileType())."\" title=\"".htmlspecialchars($version->getMimeType())."\">";
|
||||
}
|
||||
print "</a></td>";
|
||||
print "<td><a href=\"out.DocumentVersionDetail.php?documentid=".$st["document"]."&version=".$st["version"]."\">".htmlspecialchars($document->getName())."</a></td>";
|
||||
print "<td>".$st["version"]."</td>";
|
||||
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
|
||||
print "<td>".$workflow->getName()."</td>";
|
||||
print "<td>".$state->getName()."</td>";
|
||||
print "<td>".$st["date"]." ". htmlspecialchars($modgroup->getName()) ."</td>";
|
||||
print "<td>".(!$document->expires() ? "-":getReadableDate($document->getExpires()))."</td>";
|
||||
print "</tr>\n";
|
||||
echo $this->documentListRowStart($document, $class);
|
||||
echo $this->documentListRow($document, $previewer, true, $st['version']);
|
||||
print "<td><small>".getLongReadableDate($st["date"])."<br />". htmlspecialchars($moduser->getFullName()) ."</small></td>";
|
||||
echo $this->documentListRowEnd($document);
|
||||
$iRev[] = $document->getId();
|
||||
}
|
||||
}
|
||||
if (!$printheader) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user