NEW no confirm discard ticket if paid

This commit is contained in:
VESSILLER 2020-03-09 17:40:32 +01:00
parent ca4c62be56
commit 99d5b175c6
2 changed files with 27 additions and 7 deletions

View File

@ -120,4 +120,13 @@ elseif ($action == 'search' && $term != '') {
$object->fetch($id);
$ret = $printer->sendToPrinter($object, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$term}, $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$term});
}
} elseif ($action == 'getInvoice') {
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
$object = new Facture($db);
if ($id > 0) {
$object->fetch($id);
}
echo json_encode($object);
}

View File

@ -429,13 +429,24 @@ function Refresh() {
function New() {
// If we go here,it means $conf->global->TAKEPOS_BAR_RESTAURANT is not defined
console.log("New with place = <?php echo $place; ?>, js place="+place);
var r = confirm('<?php echo ($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>');
if (r == true) {
$("#poslines").load("invoice.php?action=delete&place="+place, function() {
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
ClearSearch();
}
invoiceid = $("#invoiceid").val();
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&id='+invoiceid, function(data) {
var r;
if (parseInt(data['paye']) === 1) {
r = true;
} else {
r = confirm('<?php echo ($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>');
}
if (r == true) {
$("#poslines").load("invoice.php?action=delete&place=" + place, function () {
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
ClearSearch();
}
});
}
/**