allow to upload a file with each review/approval

This commit is contained in:
Uwe Steinmann 2015-06-11 21:30:56 +02:00
parent d55346ba0f
commit d36ba8d906
4 changed files with 56 additions and 9 deletions

View File

@ -80,10 +80,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 {
@ -128,7 +139,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 {

View File

@ -76,10 +76,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"));
}
@ -131,7 +141,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"));
}

View File

@ -118,12 +118,21 @@ function checkGrpForm()
print "</tr></tbody></table><br>\n";
}
?>
<form method="post" action="../op/op.ApproveDocument.php" name="form1" onsubmit="return checkIndForm();">
<form method="post" action="../op/op.ApproveDocument.php" name="form1" enctype="multipart/form-data" onsubmit="return checkIndForm();">
<?php echo createHiddenFieldWithKey('approvedocument'); ?>
<table>
<tr><td><?php printMLText("comment")?>:</td>
<td><textarea name="comment" cols="80" rows="4"></textarea>
</td></tr>
<tr>
<td><?php printMLText("comment")?>:</td>
<td><textarea name="comment" cols="80" rows="4"></textarea></td>
</tr>
<tr>
<td><?php printMLText("approval_file")?>:</td>
<td>
<?php
$this->printFileChooser('approvalfile', false);
?>
</td>
</tr>
<tr><td><?php printMLText("approval_status")?>:</td>
<td><select name="approvalStatus">
<?php if($approvalStatus['status'] != 1) { ?>

View File

@ -109,13 +109,21 @@ function checkGrpForm()
print "</tr></tbody></table><br>";
}
?>
<form method="post" action="../op/op.ReviewDocument.php" name="form1" onsubmit="return checkIndForm();">
<form method="post" action="../op/op.ReviewDocument.php" name="form1" enctype="multipart/form-data" onsubmit="return checkIndForm();">
<?php echo createHiddenFieldWithKey('reviewdocument'); ?>
<table class="table-condensed">
<tr>
<td><?php printMLText("comment")?>:</td>
<td><textarea name="comment" cols="80" rows="4"></textarea></td>
</tr>
<tr>
<td><?php printMLText("review_file")?>:</td>
<td>
<?php
$this->printFileChooser('reviewfile', false);
?>
</td>
</tr>
<tr>
<td><?php printMLText("review_status")?></td>
<td>