From 857519033dc712c5b8bb11c707a08556b83cbf0a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 6 Aug 2013 14:21:40 +0200 Subject: [PATCH] do not allow to change workflow if it is mandatory --- op/op.AddDocument.php | 13 +++++++---- op/op.UpdateDocument.php | 4 +++- views/bootstrap/class.AddDocument.php | 29 ++++++++++++++++-------- views/bootstrap/class.UpdateDocument.php | 29 ++++++++++++++++-------- 4 files changed, 51 insertions(+), 24 deletions(-) diff --git a/op/op.AddDocument.php b/op/op.AddDocument.php index 65d301c12..4c32f5dd1 100644 --- a/op/op.AddDocument.php +++ b/op/op.AddDocument.php @@ -87,11 +87,6 @@ foreach($attributes_version as $attrdefid=>$attribute) { } -if(isset($_POST["workflow"])) - $workflow = $dms->getWorkflow($_POST["workflow"]); -else - $workflow = null; - $reqversion = (int)$_POST["reqversion"]; if ($reqversion<1) $reqversion=1; @@ -183,6 +178,14 @@ foreach ($res as $r){ } } +if(!$workflow = $user->getMandatoryWorkflow()) { + if(isset($_POST["workflow"])) + $workflow = $dms->getWorkflow($_POST["workflow"]); + else + $workflow = null; +} + + if($settings->_dropFolderDir) { if(isset($_POST["dropfolderfileform1"]) && $_POST["dropfolderfileform1"]) { $fullfile = $settings->_dropFolderDir.'/'.$user->getLogin().'/'.$_POST["dropfolderfileform1"]; diff --git a/op/op.UpdateDocument.php b/op/op.UpdateDocument.php index 277ee883a..6d749c39d 100644 --- a/op/op.UpdateDocument.php +++ b/op/op.UpdateDocument.php @@ -168,6 +168,8 @@ if ($_FILES['userfile']['error'] == 0) { } } + $workflow = $user->getMandatoryWorkflow(); + if(isset($_POST["attributes"]) && $_POST["attributes"]) { $attributes = $_POST["attributes"]; foreach($attributes as $attrdefid=>$attribute) { @@ -184,7 +186,7 @@ if ($_FILES['userfile']['error'] == 0) { $attributes = array(); } - $contentResult=$document->addContent($comment, $user, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $reviewers, $approvers, $version=0, $attributes); + $contentResult=$document->addContent($comment, $user, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $reviewers, $approvers, $version=0, $attributes, $workflow); if (is_bool($contentResult) && !$contentResult) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); } diff --git a/views/bootstrap/class.AddDocument.php b/views/bootstrap/class.AddDocument.php index 7bb6aa4a3..3cefbbb67 100644 --- a/views/bootstrap/class.AddDocument.php +++ b/views/bootstrap/class.AddDocument.php @@ -215,19 +215,30 @@ function addFiles()
:
- + + + diff --git a/views/bootstrap/class.UpdateDocument.php b/views/bootstrap/class.UpdateDocument.php index 537e44a07..913d87102 100644 --- a/views/bootstrap/class.UpdateDocument.php +++ b/views/bootstrap/class.UpdateDocument.php @@ -274,19 +274,30 @@ function checkForm()
:
- + + +