mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-02-02 06:31:56 +00:00
reception of document can be deleted to enforce another reception
This commit is contained in:
parent
a48f9dbfe4
commit
a5bd41b397
|
|
@ -3,6 +3,7 @@
|
|||
--------------------------------------------------------------------------------
|
||||
- merge changes up to 5.1.45
|
||||
- fix error when creating a new document list with a name used by another user
|
||||
- reception of document can be deleted to enforce another reception
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 6.0.37
|
||||
|
|
|
|||
|
|
@ -1512,6 +1512,10 @@ class SeedDMS_NotificationService {
|
|||
$this->toGroup($user, $revisor, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* FIXME: Name of function should rather be sendReceiptRequestMail() in
|
||||
* accordance with sendReviewRequestMail().
|
||||
*/
|
||||
public function sendAddReceiptMail($content, $user, $recipient) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$folder = $document->getFolder();
|
||||
|
|
|
|||
|
|
@ -215,6 +215,8 @@ class Settings { /* {{{ */
|
|||
var $_enableHiddenReceipt = false;
|
||||
// enable/disable update of a receipt by the recipient
|
||||
var $_enableUpdateReceipt = false;
|
||||
// enable/disable removal of a receipt by the administrator
|
||||
var $_enableRemoveReceipt = false;
|
||||
// enable/disable listing administrator as recipient
|
||||
var $_enableAdminReceipt = false;
|
||||
// enable/disable listing owner as recipient
|
||||
|
|
@ -880,6 +882,7 @@ class Settings { /* {{{ */
|
|||
$this->_enableAdminReceipt = Settings::boolval($tab["enableAdminReceipt"]);
|
||||
$this->_enableOwnerReceipt = Settings::boolval($tab["enableOwnerReceipt"]);
|
||||
$this->_enableUpdateReceipt = Settings::boolval($tab["enableUpdateReceipt"]);
|
||||
$this->_enableRemoveReceipt = Settings::boolval($tab["enableRemoveReceipt"]);
|
||||
$this->_enableFilterReceipt = Settings::boolval($tab["enableFilterReceipt"]);
|
||||
$this->_addManagerAsReviewer = Settings::boolval($tab["addManagerAsReviewer"]);
|
||||
$this->_addManagerAsApprover = Settings::boolval($tab["addManagerAsApprover"]);
|
||||
|
|
@ -1279,6 +1282,7 @@ class Settings { /* {{{ */
|
|||
$this->setXMLAttributValue($node, "enableAdminReceipt", $this->_enableAdminReceipt);
|
||||
$this->setXMLAttributValue($node, "enableOwnerReceipt", $this->_enableOwnerReceipt);
|
||||
$this->setXMLAttributValue($node, "enableUpdateReceipt", $this->_enableUpdateReceipt);
|
||||
$this->setXMLAttributValue($node, "enableRemoveReceipt", $this->_enableRemoveReceipt);
|
||||
$this->setXMLAttributValue($node, "enableFilterReceipt", $this->_enableFilterReceipt);
|
||||
$this->setXMLAttributValue($node, "presetExpirationDate", $this->_presetExpirationDate);
|
||||
$this->setXMLAttributValue($node, "initialDocumentStatus", $this->_initialDocumentStatus);
|
||||
|
|
|
|||
101
op/op.RemoveReceiptLog.php
Normal file
101
op/op.RemoveReceiptLog.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
// Copyright (C) 2010-2021 Uwe Steinmann
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
include("../inc/inc.Settings.php");
|
||||
include("../inc/inc.Utils.php");
|
||||
include("../inc/inc.LogInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.Init.php");
|
||||
include("../inc/inc.Extension.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
|
||||
/* Check if the form data comes from a trusted request */
|
||||
if(!checkFormKey('removereceiptlog')) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_request_token"))),getMLText("invalid_request_token"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval($_POST["documentid"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
$documentid = $_POST["documentid"];
|
||||
$document = $dms->getDocument($documentid);
|
||||
|
||||
if (!is_object($document)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
if (!$user->isAdmin() || $document->getAccessMode($user) < M_ALL) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["version"]) || !is_numeric($_POST["version"]) || intval($_POST["version"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
$version = $_POST["version"];
|
||||
$content = $document->getContentByVersion($version);
|
||||
|
||||
if (!is_object($content)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
// operation is only allowed for the last document version
|
||||
$latestContent = $document->getLatestContent();
|
||||
if ($latestContent->getVersion()!=$version) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["receiptid"]) || !is_numeric($_POST["receiptid"]) || intval($_POST["receiptid"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_receiptid"));
|
||||
}
|
||||
$receiptid = $_POST['receiptid'];
|
||||
$receipts = $latestContent->getReceiptStatus();
|
||||
$receiptStatus = null;
|
||||
foreach($receipts as $receipt) {
|
||||
if($receipt['receiptID'] == $receiptid) {
|
||||
$receiptStatus = $receipt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$receiptStatus) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_receiptid"));
|
||||
}
|
||||
|
||||
if($receiptStatus['type'] == 0) {
|
||||
$ruser = $dms->getUser($receiptStatus['required']);
|
||||
$msg = getMLText('ind_receipt_removed', array('name'=>$ruser->getFullName()));
|
||||
} elseif($receiptStatus['type'] == 1) {
|
||||
$rgroup = $dms->getGroup($receiptStatus['required']);
|
||||
$msg = getMLText('group_receipt_removed', array('name'=>$rgroup->getName()));
|
||||
} else
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_receiptid"));
|
||||
|
||||
$comment = $_POST["comment"];
|
||||
$overallStatus = $latestContent->getStatus();
|
||||
if(true === $latestContent->removeReceipt($receiptid, $user, $comment)) {
|
||||
if($notifier) {
|
||||
$notifier->sendAddReceiptMail($latestContent, $user);
|
||||
}
|
||||
}
|
||||
header("Location:../out/out.ViewDocument.php?documentid=".$documentid."¤ttab=recipients");
|
||||
|
|
@ -280,6 +280,7 @@ if ($action == "saveSettings")
|
|||
setBoolValue("enableAdminReceipt");
|
||||
setBoolValue("enableOwnerReceipt");
|
||||
setBoolValue("enableUpdateReceipt");
|
||||
setBoolValue("enableRemoveReceipt");
|
||||
setBoolValue("enableFilterReceipt");
|
||||
setBoolValue("enableVersionDeletion");
|
||||
setBoolValue("enableVersionModification");
|
||||
|
|
|
|||
88
out/out.RemoveReceiptLog.php
Normal file
88
out/out.RemoveReceiptLog.php
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
// Copyright (C) 2010-2016 Uwe Steinmann
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
if(!isset($settings))
|
||||
require_once("../inc/inc.Settings.php");
|
||||
require_once("inc/inc.Utils.php");
|
||||
require_once("inc/inc.LogInit.php");
|
||||
require_once("inc/inc.Language.php");
|
||||
require_once("inc/inc.Init.php");
|
||||
require_once("inc/inc.Extension.php");
|
||||
require_once("inc/inc.DBInit.php");
|
||||
require_once("inc/inc.ClassUI.php");
|
||||
require_once("inc/inc.ClassAccessOperation.php");
|
||||
require_once("inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
$document = $dms->getDocument(intval($_GET["documentid"]));
|
||||
|
||||
if (!is_object($document)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
$folder = $document->getFolder();
|
||||
|
||||
if (!$user->isAdmin() || $document->getAccessMode($user) < M_ALL) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if (!isset($_GET["version"]) || !is_numeric($_GET["version"]) || intval($_GET["version"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version"));
|
||||
}
|
||||
$version = $_GET["version"];
|
||||
$content = $document->getContentByVersion($version);
|
||||
if (!is_object($content)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
// operation is admitted only for last document version
|
||||
$latestContent = $document->getLatestContent();
|
||||
if ($latestContent->getVersion()!=$version) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
if (!isset($_GET["receiptid"]) || !is_numeric($_GET["receiptid"]) || intval($_GET["receiptid"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_receiptid"));
|
||||
}
|
||||
$receiptid = $_GET['receiptid'];
|
||||
|
||||
/* Create object for checking access to certain operations */
|
||||
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
|
||||
|
||||
$receipts = $content->getReceiptStatus();
|
||||
if(!$receipts) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("no_action"));
|
||||
}
|
||||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||
if($view) {
|
||||
$view->setParam('folder', $folder);
|
||||
$view->setParam('document', $document);
|
||||
$view->setParam('version', $content);
|
||||
$view->setParam('receiptid', $receiptid);
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view($_GET);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -83,6 +83,7 @@ if($view) {
|
|||
$view->setParam('enableDropUpload', $settings->_enableDropUpload);
|
||||
$view->setParam('enableownerrevapp', $settings->_enableOwnerRevApp);
|
||||
$view->setParam('enableremoverevapp', $settings->_enableRemoveRevApp);
|
||||
$view->setParam('enableremovereceipt', $settings->_enableRemoveReceipt);
|
||||
$view->setParam('enableownerreceipt', $settings->_enableOwnerReceipt);
|
||||
$view->setParam('enablereceiptreject', $settings->_enableReceiptReject);
|
||||
$view->setParam('cachedir', $settings->_cacheDir);
|
||||
|
|
|
|||
126
views/bootstrap/class.RemoveReceiptLog.php
Normal file
126
views/bootstrap/class.RemoveReceiptLog.php
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of RemoveReceiptLog view
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
||||
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
||||
* 2010-2012 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include parent class
|
||||
*/
|
||||
//require_once("class.Bootstrap.php");
|
||||
|
||||
/**
|
||||
* Class which outputs the html page for RemoveReceiptLog view
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
||||
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
||||
* 2010-2012 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_View_RemoveReceiptLog extends SeedDMS_Theme_Style {
|
||||
|
||||
function js() { /* {{{ */
|
||||
header('Content-Type: application/javascript; charset=UTF-8');
|
||||
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
|
||||
?>
|
||||
$(document).ready(function() {
|
||||
$("#form1").validate({
|
||||
rules: {
|
||||
comment: {
|
||||
required: true
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
comment: "<?php printMLText("js_no_comment");?>",
|
||||
},
|
||||
});
|
||||
});
|
||||
<?php
|
||||
$this->printFileChooserJs();
|
||||
} /* }}} */
|
||||
|
||||
function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$folder = $this->params['folder'];
|
||||
$document = $this->params['document'];
|
||||
$content = $this->params['version'];
|
||||
$receiptid = $this->params['receiptid'];
|
||||
|
||||
$receipts = $content->getReceiptStatus();
|
||||
foreach($receipts as $receipt) {
|
||||
if($receipt['receiptID'] == $receiptid) {
|
||||
$receiptStatus = $receipt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
|
||||
|
||||
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
|
||||
$this->globalNavigation($folder);
|
||||
$this->contentStart();
|
||||
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
|
||||
$this->contentHeading(getMLText("remove_receipt_log"));
|
||||
$this->warningMsg(getMLText('warning_remove_receipt_log'));
|
||||
|
||||
// Display the Receipt form.
|
||||
if($receiptStatus["status"]!=0) {
|
||||
|
||||
print "<table class=\"table table-content table-sm\"><thead><tr>";
|
||||
print "<th>".getMLText("status")."</th>";
|
||||
print "<th>".getMLText("comment")."</th>";
|
||||
print "<th>".getMLText("last_update")."</th>";
|
||||
print "</tr></thead><tbody><tr>";
|
||||
print "<td>";
|
||||
printReceiptStatusText($receiptStatus["status"]);
|
||||
print "</td>";
|
||||
print "<td>".htmlspecialchars($receiptStatus["comment"])."</td>";
|
||||
$indUser = $dms->getUser($receiptStatus["userID"]);
|
||||
print "<td>".$receiptStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
|
||||
print "</tr></tbody></table><br>\n";
|
||||
}
|
||||
?>
|
||||
<form method="post" action="../op/op.RemoveReceiptLog.php" id="form1" name="form1">
|
||||
<?php echo createHiddenFieldWithKey('removereceiptlog'); ?>
|
||||
<?php
|
||||
$this->contentContainerStart();
|
||||
|
||||
$this->formField(
|
||||
getMLText("comment"),
|
||||
array(
|
||||
'element'=>'textarea',
|
||||
'name'=>'comment',
|
||||
'required'=>true,
|
||||
'rows'=>4,
|
||||
'cols'=>80
|
||||
)
|
||||
);
|
||||
$this->contentContainerEnd();
|
||||
|
||||
$this->formSubmit('<i class="fa fa-remove"></i> '.getMLText('remove_receipt_log'));
|
||||
?>
|
||||
<input type='hidden' name='receiptid' value='<?= $receiptid ?>'/>
|
||||
<input type='hidden' name='documentid' value='<?= $document->getID() ?>'/>
|
||||
<input type='hidden' name='version' value='<?= $content->getVersion() ?>'/>
|
||||
</form>
|
||||
<?php
|
||||
$this->contentEnd();
|
||||
$this->htmlEndPage();
|
||||
} /* }}} */
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
@ -866,6 +866,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
|
|||
<?php $this->showConfigCheckbox('settings_enableAdminReceipt', 'enableAdminReceipt'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableOwnerReceipt', 'enableOwnerReceipt'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableUpdateReceipt', 'enableUpdateReceipt'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableRemoveReceipt', 'enableRemoveReceipt'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableFilterReceipt', 'enableFilterReceipt'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_addManagerAsReviewer', 'addManagerAsReviewer'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_addManagerAsApprover', 'addManagerAsApprover'); ?>
|
||||
|
|
|
|||
|
|
@ -943,6 +943,7 @@ $(document).ready( function() {
|
|||
$enableDropUpload = $this->params['enableDropUpload'];
|
||||
$enableownerrevapp = $this->params['enableownerrevapp'];
|
||||
$enableremoverevapp = $this->params['enableremoverevapp'];
|
||||
$enableremovereceipt = true;//$this->params['enableremovereceipt'];
|
||||
$enableownerreceipt = $this->params['enableownerreceipt'];
|
||||
$enablereceiptworkflow = $this->params['enablereceiptworkflow'];
|
||||
$enablereceiptreject = $this->params['enablereceiptreject'];
|
||||
|
|
@ -1736,6 +1737,9 @@ $(document).ready( function() {
|
|||
}
|
||||
}
|
||||
|
||||
if($enableremovereceipt && $user->isAdmin() && ($r['status'] == 1 || $r['status'] == -1))
|
||||
echo '<li><a href="'.$this->html_url('RemoveReceiptLog', array('documentid'=>$document->getID(), 'version'=>$latestContent->getVersion(), 'receiptid'=>$r['receiptID'])).'" title="'.getMLText('remove_receipt_log').'"><i class="fa fa-remove"></i></a></li>';
|
||||
|
||||
print "</ul></td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user