';
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)) { ?>
-
+
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index db6745e8885..9ac81f1ccf9 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -46,11 +46,17 @@ $action = GETPOST('action', 'aZ09');
$idproduct = GETPOST('idproduct', 'int');
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant
$placeid = 0; // $placeid is ID of invoice
+// Terminal is stored into $_SESSION["takeposterminal"];
if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
accessforbidden();
}
+
+/*
+ * View
+ */
+
if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))
{
// DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED
@@ -110,9 +116,8 @@ $sql = "SELECT id FROM ".MAIN_DB_PREFIX."c_paiement";
$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
$sql .= " AND code = '".$db->escape($paycode)."'";
$resql = $db->query($sql);
-$codes = $db->fetch_array($resql);
-$paiementid = $codes[0];
-
+$obj = $db->fetch_object($resql);
+$paiementid = $obj->id;
$invoice = new Facture($db);
if ($invoiceid > 0)
@@ -145,8 +150,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
$bankaccount = GETPOST('accountid', 'int');
- }
- else {
+ } else {
if ($pay == "cash") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility
elseif ($pay == "card") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$_SESSION["takeposterminal"]}; // For backward compatibility
elseif ($pay == "cheque") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility
@@ -226,6 +230,10 @@ if ($action == 'valid' && $user->rights->facture->creer)
$conf->global->STOCK_CALCULATE_ON_BILL = $savconst;
} else {
$res = $invoice->validate($user);
+ if ($res < 0) {
+ $error++;
+ dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
+ }
}
// Restore save values
@@ -1006,7 +1014,7 @@ $( document ).ready(function() {
$("#customerandsales").html('');
- $("#customerandsales").append(' ');
+ $("#customerandsales").append(' ');
0)
if (is_array($invoice->lines) && count($invoice->lines))
{
- print ''."\n";
+ print ''."\n";
$tmplines = array_reverse($invoice->lines);
foreach ($tmplines as $line)
{
@@ -1307,7 +1315,9 @@ if ($placeid > 0)
}
}
if (!empty($line->array_options['options_order_notes'])) $htmlforlines .= " (".$line->array_options['options_order_notes'].")";
- if ($_SESSION["basiclayout"] == 1) $htmlforlines .= ' | ';
+ 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 .= ' | ';
$htmlforlines .= ''.vatrate($line->remise_percent, true).' | ';
$htmlforlines .= '';
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 .= '';
$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');
|