Debug v21

This commit is contained in:
Laurent Destailleur 2024-11-22 12:07:48 +01:00
parent 7b30d8d37c
commit 999754c184
12 changed files with 54 additions and 34 deletions

View File

@ -60,7 +60,7 @@ Numberspad=Numbers Pad
BillsCoinsPad=Coins and banknotes Pad
DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr
TakeposNeedsCategories=TakePOS needs at least one product category to work
TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category <b>%s</b> to work
TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 sub-category under the product category <b>%s</b> to work
OrderNotes=Can add some notes to each ordered items
CashDeskBankAccountFor=Default account to use for payments in
NoPaimementModesDefined=No paiment mode defined in TakePOS configuration

View File

@ -60,7 +60,7 @@ Numberspad=Pavé numérique
BillsCoinsPad=Pavé avec montant des Pièces et Billets
DolistorePosCategory=Modules TakePOS et autres solutions de PDV pour Dolibarr
TakeposNeedsCategories=TakePOS a besoin d'au moins une catégorie de produits pour fonctionner
TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS a besoin d'au moins 1 catégorie de produits dans la catégorie <b> %s </b> pour fonctionner
TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS a besoin d'au moins 1 sous-catégorie dans la catégorie de produit <b> %s </b> pour fonctionner
OrderNotes=Il est possible d'ajouter des notes sur chacun des produits commandés
CashDeskBankAccountFor=Compte par défaut à utiliser pour les paiements en
NoPaimementModesDefined=Aucun mode de paiement défini dans la configuration de TakePOS

View File

@ -179,9 +179,9 @@ if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) {
print '<tr class="oddeven"><td>';
print $langs->trans("SupplementCategory");
print '</td>';
print '<td class="">';
print '<td class="nowrap">';
print img_picto('', 'category', 'class="pictofixedwidth"');
print $form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalString('TAKEPOS_SUPPLEMENTS_CATEGORY'), 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0);
print $form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalString('TAKEPOS_SUPPLEMENTS_CATEGORY'), 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0, 0, 'minwidth 200 maxwidth500 widthcentpercentminusx');
print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY');
print "</td></tr>\n";
}

View File

@ -278,7 +278,7 @@ print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("NumberOfTerminals");
print '<td>';
print '<input type="number" name="TAKEPOS_NUM_TERMINALS" min="1" value="' . (!getDolGlobalString('TAKEPOS_NUM_TERMINALS') ? '1' : $conf->global->TAKEPOS_NUM_TERMINALS) . '">';
print '<input type="number" name="TAKEPOS_NUM_TERMINALS" min="1" class="width50" value="' . getDolGlobalString('TAKEPOS_NUM_TERMINALS', '1') . '">';
print "</td></tr>\n";
// Services

View File

@ -59,7 +59,7 @@ $action = GETPOST('action', 'aZ09');
$left = GETPOST('left', 'alpha');
$top = GETPOST('top', 'alpha');
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant
$newname = GETPOST('newname', 'alpha');
$mode = GETPOST('mode', 'alpha');
@ -74,15 +74,22 @@ if (!$user->hasRight('takepos', 'run')) {
*/
if ($action == "getTables" && $user->hasRight('takepos', 'run')) {
$sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables WHERE floor = ".((int) $floor)." AND entity IN (".getEntity('takepos').")";
$resql = $db->query($sql);
$rows = array();
$sql = "SELECT rowid, entity, label, leftpos, toppos, floor";
$sql .= " FROM ".MAIN_DB_PREFIX."takepos_floor_tables";
$sql .= " WHERE floor = ".((int) $floor)." AND entity IN (".getEntity('takepos').")";
$resql = $db->query($sql);
while ($row = $db->fetch_array($resql)) {
$tmpplace = (int) $row['rowid'];
$invoice = new Facture($db);
$result = $invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$row['rowid'].')');
$result = $invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$tmpplace.')');
if ($result > 0) {
$row['occupied'] = "red";
}
$rows[] = $row;
}

View File

@ -624,7 +624,9 @@ if (empty($reshook)) {
if ($placeid < 0) {
dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid = ".((int) $placeid);
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
$sql .= " SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
$sql .= " WHERE rowid = ".((int) $placeid);
$resql = $db->query($sql);
if (!$resql) {
$error++;
@ -898,7 +900,7 @@ if (empty($reshook)) {
if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') {
$permissiontoupdateline = true;
// TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object
// TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID
// TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID
}
}*/
@ -928,11 +930,12 @@ if (empty($reshook)) {
// Action to delete or discard an invoice
if ($action == "delete" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) {
// $placeid is the invoice id (it differs from place) and is defined if the place is set and the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at beginning of page works.
// $placeid is the invoice id (it differs from place) and is defined if the place is set and
// the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at beginning of page works.
if ($placeid > 0) {
$result = $invoice->fetch($placeid);
if ($result > 0 && $invoice->statut == Facture::STATUS_DRAFT) {
if ($result > 0 && $invoice->status == Facture::STATUS_DRAFT) {
$db->begin();
// We delete the lines
@ -973,7 +976,7 @@ if (empty($reshook)) {
if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') {
$permissiontoupdateline = true;
// TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object
// TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID
// TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID
}
}
if (!$permissiontoupdateline) {
@ -1023,7 +1026,7 @@ if (empty($reshook)) {
if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') {
$permissiontoupdateline = true;
// TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object
// TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID
// TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID
}
}
@ -1074,7 +1077,7 @@ if (empty($reshook)) {
if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') {
$permissiontoupdateline = true;
// TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object
// TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID
// TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID
}
}
if (!$permissiontoupdateline) {

View File

@ -187,7 +187,7 @@ if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
if (!getDolGlobalString($keyforstripeterminalbank)) { ?>
const config = {
simulated: <?php if (empty($servicestatus) && getDolGlobalString('STRIPE_TERMINAL_SIMULATED')) { ?> true <?php } else { ?> false <?php } ?>
<?php if (getDolGlobalString('STRIPE_LOCATION')) { ?>, location: '<?php echo $conf->global->STRIPE_LOCATION; ?>'<?php } ?>
<?php if (getDolGlobalString('STRIPE_LOCATION')) { ?>, location: '<?php echo dol_escape_js(getDolGlobalString('STRIPE_LOCATION')); ?>'<?php } ?>
}
terminal.discoverReaders(config).then(function(discoverResult) {
if (discoverResult.error) {
@ -233,8 +233,8 @@ if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
</script>
<?php
// Define list of possible payments
$arrayOfValidPaymentModes = array();
// Define list of possible payments
$arrayOfValidPaymentModes = array();
$arrayOfValidBankAccount = array();
$sql = "SELECT code, libelle as label FROM ".MAIN_DB_PREFIX."c_paiement";
@ -301,10 +301,10 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
$('.change1').val(parseFloat(received));
alreadypaydplusreceived=price2numjs(alreadypayed + parseFloat(received));
//console.log("already+received = "+alreadypaydplusreceived);
//console.log("total_ttc = "+<?php echo $invoice->total_ttc; ?>);
if (alreadypaydplusreceived > <?php echo $invoice->total_ttc; ?>)
//console.log("total_ttc = "+<?php echo (float) $invoice->total_ttc; ?>);
if (alreadypaydplusreceived > <?php echo (float) $invoice->total_ttc; ?>)
{
var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo $invoice->total_ttc; ?>);
var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo (float) $invoice->total_ttc; ?>);
$('.change2').html(pricejs(change, 'MT'));
$('.change2').val(change);
$('.change1').removeClass('colorred');
@ -439,7 +439,7 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) {
fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(function(client_secret) {
<?php if (empty($servicestatus) && getDolGlobalString('STRIPE_TERMINAL_SIMULATED')) { ?>
terminal.setSimulatorConfiguration({testCardNumber: '<?php echo $conf->global->STRIPE_TERMINAL_SIMULATED; ?>'});
terminal.setSimulatorConfiguration({testCardNumber: '<?php echo dol_escape_js(getDolGlobalString('STRIPE_TERMINAL_SIMULATED')); ?>'});
<?php } ?>
document.getElementById("card-present-alert").innerHTML = '<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal'); ?></div>';
terminal.collectPaymentMethod(client_secret).then(function(result) {

View File

@ -78,8 +78,11 @@ if (!$user->hasRight('takepos', 'run')) {
top_htmlhead('', '', 1);
if ($place > 0) {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'";
if ((string) $place != '') {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture";
$sql .= " WHERE ref = '(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'";
$sql .= " AND entity IN (".getEntity('invoice').")";
$resql = $db->query($sql);
$obj = $db->fetch_object($resql);
if ($obj) {

View File

@ -69,7 +69,10 @@ $invoice = new Facture($db);
if ($invoiceid > 0) {
$invoice->fetch($invoiceid);
} else {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture";
$sql .= " WHERE ref = '(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
$sql .= " AND entity IN (".getEntity('invoice').")";
$resql = $db->query($sql);
$obj = $db->fetch_object($resql);
if ($obj) {

View File

@ -62,7 +62,7 @@ if (!$user->hasRight('takepos', 'run')) {
* Actions
*/
if ($action=="split" && $user->hasRight('takepos', 'run')) {
if ($action == "split" && $user->hasRight('takepos', 'run')) {
$line = GETPOSTINT('line');
$split = GETPOSTINT('split');
if ($split==1) { // Split line
@ -85,16 +85,17 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) {
if ($placeid < 0) {
dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-SPLIT)' where rowid=".$placeid;
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-SPLIT)'";
$sql .= " WHERE rowid = ".((int) $placeid);
$db->query($sql);
}
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set fk_facture=".$placeid." where rowid=".$line;
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET fk_facture = ".((int) $placeid)." WHERE rowid = ".((int) $line);
$db->query($sql);
} elseif ($split==0) { // Unsplit line
$invoice = new Facture($db);
if ($place=="SPLIT") {
$place="0";
if ($place == "SPLIT") {
$place = "0";
} // Avoid move line to the same place (from SPLIT to SPLIT place)
$ret = $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')');
if ($ret > 0) {
@ -114,7 +115,9 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) {
if ($placeid < 0) {
dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid;
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
$sql .= " WHERE rowid = ".((int) $placeid);
$db->query($sql);
}
}
@ -123,6 +126,7 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) {
}
$invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-SPLIT)');
$invoice->update_price();
$invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')');
$invoice->update_price();
}

View File

@ -5363,7 +5363,7 @@ img.boxhandle, img.boxclose {
.add-filter-btn {
margin: 0 !important;
}
.search-component-assistance .operand, .operator, .value {
.search-component-assistance .operand, .search-component-assistance .operator, .search-component-assistance .value {
display: contents;
}
.search-component-assistance .btn-div{

View File

@ -5352,7 +5352,7 @@ img.boxhandle, img.boxclose {
.add-filter-btn {
margin: 0 !important;
}
.search-component-assistance .operand, .operator, .value {
.search-component-assistance .operand, .search-component-assistance .operator, .search-component-assistance .value {
display: contents;
}
.search-component-assistance .btn-div{