diff --git a/CHANGELOG b/CHANGELOG index 22b119c2a..386f5bf43 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/inc/inc.ClassNotificationService.php b/inc/inc.ClassNotificationService.php index c106857e9..0a7c15c07 100644 --- a/inc/inc.ClassNotificationService.php +++ b/inc/inc.ClassNotificationService.php @@ -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(); diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index fdcc7fbce..16f3ec83b 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -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); diff --git a/op/op.RemoveReceiptLog.php b/op/op.RemoveReceiptLog.php new file mode 100644 index 000000000..ca8698994 --- /dev/null +++ b/op/op.RemoveReceiptLog.php @@ -0,0 +1,101 @@ + 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"); diff --git a/op/op.Settings.php b/op/op.Settings.php index a6f513d1d..96b800830 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -280,6 +280,7 @@ if ($action == "saveSettings") setBoolValue("enableAdminReceipt"); setBoolValue("enableOwnerReceipt"); setBoolValue("enableUpdateReceipt"); + setBoolValue("enableRemoveReceipt"); setBoolValue("enableFilterReceipt"); setBoolValue("enableVersionDeletion"); setBoolValue("enableVersionModification"); diff --git a/out/out.RemoveReceiptLog.php b/out/out.RemoveReceiptLog.php new file mode 100644 index 000000000..364484b1c --- /dev/null +++ b/out/out.RemoveReceiptLog.php @@ -0,0 +1,88 @@ + 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; +} diff --git a/out/out.ViewDocument.php b/out/out.ViewDocument.php index 4fa2384b4..a6c48b7b4 100644 --- a/out/out.ViewDocument.php +++ b/out/out.ViewDocument.php @@ -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); diff --git a/views/bootstrap/class.RemoveReceiptLog.php b/views/bootstrap/class.RemoveReceiptLog.php new file mode 100644 index 000000000..158359224 --- /dev/null +++ b/views/bootstrap/class.RemoveReceiptLog.php @@ -0,0 +1,126 @@ + + * @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 + * @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: "", + }, + }); +}); +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(''."\n", 'js'); + $this->htmlAddHeader(''."\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 ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + $indUser = $dms->getUser($receiptStatus["userID"]); + print ""; + print "
".getMLText("status")."".getMLText("comment")."".getMLText("last_update")."
"; + printReceiptStatusText($receiptStatus["status"]); + print "".htmlspecialchars($receiptStatus["comment"])."".$receiptStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."

\n"; + } +?> +
+ +contentContainerStart(); + + $this->formField( + getMLText("comment"), + array( + 'element'=>'textarea', + 'name'=>'comment', + 'required'=>true, + 'rows'=>4, + 'cols'=>80 + ) + ); + $this->contentContainerEnd(); + + $this->formSubmit(' '.getMLText('remove_receipt_log')); +?> + + + +
+contentEnd(); + $this->htmlEndPage(); + } /* }}} */ +} +?> + diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php index 9cacd0f57..9797a59f1 100644 --- a/views/bootstrap/class.Settings.php +++ b/views/bootstrap/class.Settings.php @@ -866,6 +866,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk)) showConfigCheckbox('settings_enableAdminReceipt', 'enableAdminReceipt'); ?> showConfigCheckbox('settings_enableOwnerReceipt', 'enableOwnerReceipt'); ?> showConfigCheckbox('settings_enableUpdateReceipt', 'enableUpdateReceipt'); ?> +showConfigCheckbox('settings_enableRemoveReceipt', 'enableRemoveReceipt'); ?> showConfigCheckbox('settings_enableFilterReceipt', 'enableFilterReceipt'); ?> showConfigCheckbox('settings_addManagerAsReviewer', 'addManagerAsReviewer'); ?> showConfigCheckbox('settings_addManagerAsApprover', 'addManagerAsApprover'); ?> diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index e2ec62896..20df66eb2 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -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 '
  • '; + print "\n"; print "\n"; }