cancel checkout needs confirmation

This commit is contained in:
Uwe Steinmann 2021-04-22 14:31:36 +02:00
parent 39b81e03c3
commit 73a7f8a5f2
2 changed files with 16 additions and 2 deletions

View File

@ -41,6 +41,10 @@ if(empty($settings->_enableCancelCheckout)) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("operation_disallowed")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("operation_disallowed"));
} }
if(empty($_POST['confirm'])) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("operation_disallowed"));
}
$document->cancelCheckOut($comment); $document->cancelCheckOut($comment);
if (is_bool($result) && !$result) { if (is_bool($result) && !$result) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));

View File

@ -699,6 +699,15 @@ $(document).ready(function() {
<input type="hidden" name="documentid" value="<?php print $document->getID(); ?>"> <input type="hidden" name="documentid" value="<?php print $document->getID(); ?>">
<?php <?php
echo createHiddenFieldWithKey('cancelcheckout'); echo createHiddenFieldWithKey('cancelcheckout');
$this->formField(
getMLText("checkout_cancel_confirm"),
array(
'element'=>'input',
'type'=>'checkbox',
'name'=>'confirm',
'value'=>1
)
);
$this->formSubmit(getMLText('cancel_checkout')); $this->formSubmit(getMLText('cancel_checkout'));
?> ?>
</form> </form>
@ -710,7 +719,8 @@ $(document).ready(function() {
<form action="../op/op.CancelCheckOut.php" method="post"> <form action="../op/op.CancelCheckOut.php" method="post">
<?php echo createHiddenFieldWithKey('cancelcheckout'); ?> <?php echo createHiddenFieldWithKey('cancelcheckout'); ?>
<input type="hidden" name="documentid" value="<?php print $document->getID(); ?>"> <input type="hidden" name="documentid" value="<?php print $document->getID(); ?>">
<input type="submit" class="btn" value="<?php printMLText("cancel_checkout"); ?>"> <input type="hidden" name="confirm" value="1">
<input type="submit" class="btn btn-danger" value="<?php printMLText("cancel_checkout"); ?>">
</form> </form>
<?php <?php
} }