mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
add discarding of checked out document
This commit is contained in:
parent
c9a2aaca9c
commit
67a8d10797
|
@ -5,7 +5,8 @@
|
|||
- merge changes up to 5.1.21
|
||||
- document links can be added by regular users again
|
||||
- add list of checked out documents to tasks
|
||||
- issue a warning when removing a document with is checked out
|
||||
- issue a warning when removing a document which is checked out
|
||||
- checked out can be discarded if it was changed
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 6.0.13
|
||||
|
|
|
@ -1178,10 +1178,17 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if($infos) {
|
||||
$info = $infos[0];
|
||||
|
||||
$db->startTransaction();
|
||||
$queryStr = "DELETE FROM `tblDocumentCheckOuts` WHERE `document` = ".$this->_id;
|
||||
if (!$db->getResult($queryStr))
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
SeedDMS_Core_File::removeFile($info['filename']);
|
||||
}
|
||||
if(!SeedDMS_Core_File::removeFile($info['filename'])) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
$db->commitTransaction();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -188,6 +188,8 @@ class Settings { /* {{{ */
|
|||
var $_enableDuplicateDocNames = true;
|
||||
// enable/disable duplicate names of a subfolder in a folder
|
||||
var $_enableDuplicateSubFolderNames = true;
|
||||
// allow/disallow to cancel a checkout
|
||||
var $_enableCancelCheckout = true;
|
||||
// override mimetype set by browser when uploading a file
|
||||
var $_overrideMimeType = false;
|
||||
// advanced access control lists
|
||||
|
@ -749,6 +751,7 @@ class Settings { /* {{{ */
|
|||
$this->_enableVersionModification = Settings::boolval($tab["enableVersionModification"]);
|
||||
$this->_enableDuplicateDocNames = Settings::boolval($tab["enableDuplicateDocNames"]);
|
||||
$this->_enableDuplicateSubFolderNames = Settings::boolval($tab["enableDuplicateSubFolderNames"]);
|
||||
$this->_enableCancelCheckout = Settings::boolval($tab["enableCancelCheckout"]);
|
||||
$this->_overrideMimeType = Settings::boolval($tab["overrideMimeType"]);
|
||||
$this->_advancedAcl = Settings::boolval($tab["advancedAcl"]);
|
||||
$this->_removeFromDropFolder = Settings::boolval($tab["removeFromDropFolder"]);
|
||||
|
@ -1099,6 +1102,7 @@ class Settings { /* {{{ */
|
|||
$this->setXMLAttributValue($node, "enableVersionModification", $this->_enableVersionModification);
|
||||
$this->setXMLAttributValue($node, "enableDuplicateDocNames", $this->_enableDuplicateDocNames);
|
||||
$this->setXMLAttributValue($node, "enableDuplicateSubFolderNames", $this->_enableDuplicateSubFolderNames);
|
||||
$this->setXMLAttributValue($node, "enableCancelCheckout", $this->_enableCancelCheckout);
|
||||
$this->setXMLAttributValue($node, "overrideMimeType", $this->_overrideMimeType);
|
||||
$this->setXMLAttributValue($node, "advancedAcl", $this->_advancedAcl);
|
||||
$this->setXMLAttributValue($node, "removeFromDropFolder", $this->_removeFromDropFolder);
|
||||
|
|
50
op/op.CancelCheckOut.php
Normal file
50
op/op.CancelCheckOut.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
// SeedDMS. Document Management System
|
||||
// Copyright (C) 2015 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.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.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
/* Check if the form data comes from a trusted request */
|
||||
if(!checkFormKey('cancelcheckout')) {
|
||||
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(empty($settings->_enableCancelCheckout)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("operation_disallowed"));
|
||||
}
|
||||
|
||||
$document->cancelCheckOut($comment);
|
||||
if (is_bool($result) && !$result) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||
}
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_cancel_checkout')));
|
||||
add_log_line("?documentid=".$documentid);
|
||||
header("Location:../out/out.ViewDocument.php?documentid=".$documentid);
|
|
@ -25,6 +25,11 @@ include("../inc/inc.DBInit.php");
|
|||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
/* Check if the form data comes from a trusted request */
|
||||
if(!checkFormKey('checkindocument')) {
|
||||
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"));
|
||||
}
|
||||
|
@ -427,5 +432,3 @@ else
|
|||
add_log_line("?documentid=".$documentid);
|
||||
header("Location:../out/out.ViewDocument.php?documentid=".$documentid);
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
@ -216,6 +216,7 @@ if ($action == "saveSettings")
|
|||
$settings->_enableVersionModification = getBoolValue("enableVersionModification");
|
||||
$settings->_enableDuplicateDocNames = getBoolValue("enableDuplicateDocNames");
|
||||
$settings->_enableDuplicateSubFolderNames = getBoolValue("enableDuplicateSubFolderNames");
|
||||
$settings->_enableCancelCheckout = getBoolValue("enableCancelCheckout");
|
||||
$settings->_overrideMimeType = getBoolValue("overrideMimeType");
|
||||
$settings->_advancedAcl = getBoolValue("advancedAcl");
|
||||
$settings->_removeFromDropFolder = getBoolValue("removeFromDropFolder");
|
||||
|
|
|
@ -77,6 +77,7 @@ $(document).ready(function() {
|
|||
function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$settings = $this->params['settings'];
|
||||
$folder = $this->params['folder'];
|
||||
$document = $this->params['document'];
|
||||
$strictformcheck = $this->params['strictformcheck'];
|
||||
|
@ -688,9 +689,22 @@ $(document).ready(function() {
|
|||
$this->formSubmit(getMLText('checkin_document'));
|
||||
?>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$this->contentContainerEnd();
|
||||
if(!empty($settings->_enableCancelCheckout)) {
|
||||
$this->contentContainerStart();
|
||||
$this->warningMsg(getMLText('cancel_checkout_warning'));
|
||||
?>
|
||||
<form class="form-horizontal" action="../op/op.CancelCheckOut.php" method="post">
|
||||
<input type="hidden" name="documentid" value="<?php print $document->getID(); ?>">
|
||||
<?php
|
||||
echo createHiddenFieldWithKey('cancelcheckout');
|
||||
$this->formSubmit(getMLText('cancel_checkout'));
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
$this->contentContainerEnd();
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<form action="../op/op.CheckInDocument.php" method="post">
|
||||
|
|
|
@ -485,6 +485,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
|
|||
<?php $this->showConfigCheckbox('settings_enableVersionModification', 'enableVersionModification'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableDuplicateDocNames', 'enableDuplicateDocNames'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableDuplicateSubFolderNames', 'enableDuplicateSubFolderNames'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_enableCancelCheckout', 'enableCancelCheckout'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_overrideMimeType', 'overrideMimeType'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_advancedAcl', 'advancedAcl'); ?>
|
||||
<?php $this->showConfigCheckbox('settings_removeFromDropFolder', 'removeFromDropFolder'); ?>
|
||||
|
|
Loading…
Reference in New Issue
Block a user