From 6b0092c30ac3c52ac74f5fc98783cb3d77849c6a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Dec 2020 00:58:51 +0100 Subject: [PATCH] Several minor bugfixes. Hide option TAKEPOS_NUMPAD_USE_PAYMENT_ICON. --- htdocs/takepos/admin/setup.php | 7 +++- htdocs/takepos/index.php | 6 ++- htdocs/takepos/invoice.php | 68 +++++++++++++++++++++------------- htdocs/takepos/pay.php | 30 +++++++++------ htdocs/takepos/reduction.php | 4 +- 5 files changed, 72 insertions(+), 43 deletions(-) diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 88911f10b7d..84efe32839e 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -232,6 +232,8 @@ foreach ($dirmodels as $reldir) } print "
\n"; +print '
'; + // Mode print '
'; print ''; @@ -241,7 +243,7 @@ print '
'; print ''; print ''; -print ''; +print ''; print "\n"; // Terminals @@ -301,11 +303,12 @@ print $form->selectarray('TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS print "\n"; // Numpad use payment icons -print '\n"; +*/ // Direct Payment print ''; $htmlforlines .= ''; $htmlforlines .= ''; $htmlforlines .= '
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Parameters").''.$langs->trans("Value").'
'; +/*print '
'; print $langs->trans('TakeposNumpadUsePaymentIcon'); print ''; print ajax_constantonoff("TAKEPOS_NUMPAD_USE_PAYMENT_ICON", array(), $conf->entity, 0, 0, 1, 0); print "
'; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index f76f46fa579..a2293786924 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -813,7 +813,9 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { multicurrency->enabled)) { - print ''.$langs->trans("Currency").''; + print ''; + print ''.$langs->trans("Currency").''; + print ''; } ?> @@ -830,7 +832,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { dol_use_jmobile)) { ?> - +   '; + if ($_SESSION["basiclayout"] == 1) { + $htmlforlines .= '  '; + } if ($_SESSION["basiclayout"] != 1) { $moreinfo = ''; @@ -1318,32 +1328,40 @@ if ($placeid > 0) $moreinfo .= '
'.$langs->transcountry("TotalLT2", $mysoc->country_code).': '.price($line->total_localtax2); $moreinfo .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).': '.price($line->total_ttc); //$moreinfo .= $langs->trans("TotalHT").': '.$line->total_ht; - if ($line->date_start || $line->date_end) $htmlforlines .= '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + if ($line->date_start || $line->date_end) $htmlforlines .= '
'.get_date_range($line->date_start, $line->date_end).'
'; $htmlforlines .= '
'.vatrate($line->remise_percent, true).''; if (!empty($conf->stock->enabled) && !empty($user->rights->stock->mouvement->lire)) { $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; - $sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp"; - $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; - $sql .= " ".MAIN_DB_PREFIX."product_stock as ps"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product"; - $sql .= " WHERE ps.reel != 0"; - $sql .= " AND ps.fk_entrepot = ".$conf->global->$constantforkey; - $sql .= " AND e.entity IN (".getEntity('stock').")"; - $sql .= " AND ps.fk_product = ".$line->fk_product; - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - $stock_real = price2num($obj->reel, 'MS'); + if (!empty($conf->global->$constantforkey)) { + $sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp"; + $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; + $sql .= " ".MAIN_DB_PREFIX."product_stock as ps"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product"; + $sql .= " WHERE ps.reel != 0"; + $sql .= " AND ps.fk_entrepot = ".$conf->global->$constantforkey; + $sql .= " AND e.entity IN (".getEntity('stock').")"; + $sql .= " AND ps.fk_product = ".$line->fk_product; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $stock_real = price2num($obj->reel, 'MS'); + $htmlforlines .= $line->qty; + if ($line->qty && $line->qty > $stock_real) $htmlforlines .= ''; + $htmlforlines .= ' ('.$langs->trans("Stock").' '.$stock_real.')'; + if ($line->qty && $line->qty > $stock_real) $htmlforlines .= ""; + } else { + dol_print_error($db); + } + } else { $htmlforlines .= $line->qty; - if ($line->qty && $line->qty > $stock_real) $htmlforlines .= ''; - $htmlforlines .= ' ('.$langs->trans("Stock").' '.$stock_real.')'; - if ($line->qty && $line->qty > $stock_real) $htmlforlines .= ""; } + } else { + $htmlforlines .= $line->qty; } - else $htmlforlines .= $line->qty; + $htmlforlines .= ''; $htmlforlines .= price($line->total_ttc, 1, '', 1, -1, -1, $conf->currency); diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 0d80eeffbc0..c1683073371 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -192,8 +192,14 @@ else print "var received=0;"; } console.log("We click on the payment mode to pay amount = "+amountpayed); parent.$("#poslines").load("invoice.php?place=&action=valid&pay="+payment+"&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() { - if (amountpayed > || amountpayed == || amountpayed==0 ) parent.$.colorbox.close(); - else location.reload(); + if (amountpayed > || amountpayed == || amountpayed==0 ) { + console.log("Close popup"); + parent.$.colorbox.close(); + } + else { + console.log("Amount is not comple, so we do NOT close popup and reload it."); + location.reload(); + } }); } @@ -288,16 +294,16 @@ print ''; + print ''; } else { print ''; } @@ -311,13 +317,13 @@ print ''; @@ -335,13 +341,13 @@ print ''; diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index fa458d96318..dd808d9a19d 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -74,9 +74,9 @@ top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss); $langs->loadLangs(array('main', 'bills', 'cashdesk')); -if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { +if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { $htmlReductionPercent = ''; - $htmlReductionAmount = ''; + $htmlReductionAmount = '
'.$langs->trans('Amount'); } else { $htmlReductionPercent = $langs->trans('ReductionShort').'
%'; $htmlReductionAmount = $langs->trans('ReductionShort').'
'.$langs->trans('Amount');