diff --git a/op/op.ApproveDocument.php b/op/op.ApproveDocument.php index 3de3bc945..6c0990762 100644 --- a/op/op.ApproveDocument.php +++ b/op/op.ApproveDocument.php @@ -77,10 +77,21 @@ if (!isset($_POST["approvalStatus"]) || !is_numeric($_POST["approvalStatus"]) || UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_approval_status")); } +if($_FILES["approvalfile"]["tmp_name"]) { + if (is_uploaded_file($_FILES["approvalfile"]["tmp_name"]) && $_FILES['approvalfile']['error']!=0){ + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_failed")); + } +} + if ($_POST["approvalType"] == "ind") { $comment = $_POST["comment"]; - if(0 > $latestContent->setApprovalByInd($user, $user, $_POST["approvalStatus"], $comment)) { + if($_FILES["approvalfile"]["tmp_name"]) + $file = $_FILES["approvalfile"]["tmp_name"]; + else + $file = ''; + $approvalLogID = $latestContent->setApprovalByInd($user, $user, $_POST["approvalStatus"], $comment, $file); + if(0 > $approvalLogID) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("approval_update_failed")); } else { @@ -125,7 +136,12 @@ if ($_POST["approvalType"] == "ind") { else if ($_POST["approvalType"] == "grp") { $comment = $_POST["comment"]; $group = $dms->getGroup($_POST['approvalGroup']); - if(0 > $latestContent->setApprovalByGrp($group, $user, $_POST["approvalStatus"], $comment)) { + if($_FILES["approvalfile"]["tmp_name"]) + $file = $_FILES["approvalfile"]["tmp_name"]; + else + $file = ''; + $approvalLogID = $latestContent->setApprovalByGrp($group, $user, $_POST["approvalStatus"], $comment, $file); + if(0 > $approvalLogID) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("approval_update_failed")); } else { diff --git a/op/op.ReviewDocument.php b/op/op.ReviewDocument.php index 633794cf0..66db124f3 100644 --- a/op/op.ReviewDocument.php +++ b/op/op.ReviewDocument.php @@ -73,10 +73,20 @@ if (!isset($_POST["reviewStatus"]) || !is_numeric($_POST["reviewStatus"]) || UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_review_status")); } +if($_FILES["reviewfile"]["tmp_name"]) { + if (is_uploaded_file($_FILES["reviewfile"]["tmp_name"]) && $_FILES['reviewfile']['error']!=0){ + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_failed")); + } +} + if ($_POST["reviewType"] == "ind") { $comment = $_POST["comment"]; - $reviewLogID = $latestContent->setReviewByInd($user, $user, $_POST["reviewStatus"], $comment); + if($_FILES["reviewfile"]["tmp_name"]) + $file = $_FILES["reviewfile"]["tmp_name"]; + else + $file = ''; + $reviewLogID = $latestContent->setReviewByInd($user, $user, $_POST["reviewStatus"], $comment, $file); if(0 > $reviewLogID) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("review_update_failed")); } @@ -128,7 +138,11 @@ if ($_POST["reviewType"] == "ind") { else if ($_POST["reviewType"] == "grp") { $comment = $_POST["comment"]; $group = $dms->getGroup($_POST['reviewGroup']); - $reviewLogID = $latestContent->setReviewByGrp($group, $user, $_POST["reviewStatus"], $comment); + if($_FILES["reviewfile"]["tmp_name"]) + $file = $_FILES["reviewfile"]["tmp_name"]; + else + $file = ''; + $reviewLogID = $latestContent->setReviewByGrp($group, $user, $_POST["reviewStatus"], $comment, $file); if(0 > $reviewLogID) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("review_update_failed")); } diff --git a/views/bootstrap/class.ApproveDocument.php b/views/bootstrap/class.ApproveDocument.php index 4d3eb7934..16e6d3523 100644 --- a/views/bootstrap/class.ApproveDocument.php +++ b/views/bootstrap/class.ApproveDocument.php @@ -118,12 +118,21 @@ function checkGrpForm() print "
\n"; } ?> -
+ - - + + + + + + + +
: -
:
: +printFileChooser('approvalfile', false); +?> +
:

"; } ?> - + + + + +
:
: +printFileChooser('reviewfile', false); +?> +