From e064a954d2e04b4ea1d91dd1fd19d9bfa8caa4a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2019 15:55:18 +0100 Subject: [PATCH 01/13] Fix avoid error 500 when searching product with no criteria --- htdocs/takepos/ajax.php | 9 ++++----- htdocs/takepos/freezone.php | 2 +- htdocs/takepos/takepos.php | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/takepos/ajax.php b/htdocs/takepos/ajax.php index 9586e71fd18..74f69618a0f 100644 --- a/htdocs/takepos/ajax.php +++ b/htdocs/takepos/ajax.php @@ -48,12 +48,11 @@ if ($action=="getProducts") { $prods = $object->getObjectsInCateg("product"); echo json_encode($prods); } - -elseif ($action=="search") { +elseif ($action=="search" && $term != '') { $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; - $sql .= ' WHERE entity IN ('.getEntity('product').')'; - $sql .= ' AND tosell = 1'; - $sql .= natural_search(array('label','barcode'), $term); + $sql.= ' WHERE entity IN ('.getEntity('product').')'; + $sql.= ' AND tosell = 1'; + $sql.= natural_search(array('label','barcode'), $term); $resql = $db->query($sql); $rows = array(); while ($row = $db->fetch_array($resql)) { diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index ce2c120b63f..4bf96470219 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -60,7 +60,7 @@ if ($action=="freezone") echo ''; ?> - + diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index d9e25688fc3..e02f14d8384 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -26,7 +26,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); -$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS +//$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; From 3930464b84c39e46508753600902fe5a5930796d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2019 17:50:23 +0100 Subject: [PATCH 02/13] Clean code and debug TakePOS module --- htdocs/core/js/lib_foot.js.php | 1 + htdocs/takepos/css/pos.css | 7 ++++ htdocs/takepos/invoice.php | 49 ++++++++++++++++++---------- htdocs/takepos/js/takepos.js | 15 --------- htdocs/takepos/takepos.php | 58 +++++++++++++++++++++------------- 5 files changed, 77 insertions(+), 53 deletions(-) delete mode 100644 htdocs/takepos/js/takepos.js diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 265504cf3f3..14c69259b98 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -53,6 +53,7 @@ if (empty($conf->dol_no_mouse_hover)) hide: { delay: 50 }, tooltipClass: "mytooltip", content: function () { + console.log("Return title for popup"); return $(this).prop(\'title\'); /* To force to get title as is */ } });'."\n"; diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 4b90f712f1d..e6d134019b4 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -208,6 +208,13 @@ div.catwatermark{ padding-left: 5px; } +.selected { + font-weight: bold; +} +.order { + color: limegreen; +} + .colorwhite { color: white; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index e4dde53e9e7..09582063bbc 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -131,8 +131,8 @@ if (($action=="addline" || $action=="freezone") && $placeid == 0) $db->query($sql); } -if ($action == "addline") { - +if ($action == "addline") +{ $prod = new Product($db); $prod->fetch($idproduct); @@ -269,20 +269,14 @@ if ($action == "order" and $placeid != 0) { * View */ +$form = new Form($db); + ?> - + use_javascript_ajax)) +{ + print "\n".''."\n"; + print ''."\n"; +} + print '
'; print ''; print ''; @@ -387,8 +390,22 @@ if ($placeid > 0) { if ($line->special_code == "3") { print ' order'; } - print '" id="' . $line->rowid . '">'; - print ''; print ''; diff --git a/htdocs/takepos/js/takepos.js b/htdocs/takepos/js/takepos.js deleted file mode 100644 index 062a3bb4e4a..00000000000 --- a/htdocs/takepos/js/takepos.js +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (C) 2018 Charles-FR BENKE - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index e02f14d8384..9262e8aff43 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -31,7 +31,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $place = GETPOST('place', 'int'); @@ -61,9 +61,8 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); ?> - - + '."\n"; } + print '
'; print '
' . $line->product_label . $line->desc; + print '" id="' . $line->id . '">'; + print ''; + print $line->product_label; + if ($line->product_label && $line->desc) print '
'; + if ($line->product_label != $line->desc) + { + $firstline = dolGetFirstLineOfText($line->desc); + if ($firstline != $line->desc) + { + print $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); + } + else + { + print $line->desc; + } + } if (!empty($line->array_options['options_order_notes'])) echo "
(".$line->array_options['options_order_notes'].")"; print '
' . $line->qty . '
'; print ''; -print ''; +print ''; print ''; print ''; print ''; print "\n"; -if ($placeid > 0) { - foreach($invoice->lines as $line) +if ($placeid > 0) +{ + $tmplines = array_reverse($invoice->lines); + foreach($tmplines as $line) { - print 'special_code == "3") { - print ' order'; + $htmlforlines.= ' order'; } - print '" id="' . $line->id . '">'; - print ''; - print ''; - print ''; - print ''; - print ''; + if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "
(".$line->array_options['options_order_notes'].")"; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= ''."\n"; + + print $htmlforlines; } } print '
' . $langs->trans('Description') . ''; +print ''; +if ($conf->global->TAKEPOS_BAR_RESTAURANT) +{ + $sql="SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) $place); + $resql = $db->query($sql); + $obj = $db->fetch_object($resql); + if ($obj) + { + $label = $obj->label; + $floor = $obj->floor; + } + print $langs->trans('Place')." ".$label." - "; + print $langs->trans('Floor')." ".$floor." - "; +} +print $langs->trans('TotalTTC'); +print ' : '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; +print '' . $langs->trans('ReductionShort') . '' . $langs->trans('Qty') . '' . $langs->trans('TotalHTShort') . '
'; - print $line->product_label; - if ($line->product_label && $line->desc) print '
'; + $htmlforlines.= '" id="' . $line->id . '">'; + $htmlforlines.= '
'; + $htmlforlines.= $line->product_label; + if ($line->product_label && $line->desc) $htmlforlines.= '
'; if ($line->product_label != $line->desc) { $firstline = dolGetFirstLineOfText($line->desc); if ($firstline != $line->desc) { - print $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); + $htmlforlines.= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); } else { - print $line->desc; + $htmlforlines.= $line->desc; } } - if (!empty($line->array_options['options_order_notes'])) echo "
(".$line->array_options['options_order_notes'].")"; - print '
' . vatrate($line->remise_percent, true) . '' . $line->qty . '' . price($line->total_ttc) . '
' . vatrate($line->remise_percent, true) . '' . $line->qty . '' . price($line->total_ttc) . '
'; -print '

'.$langs->trans('TotalTTC'); - -if ($conf->global->TAKEPOS_BAR_RESTAURANT) print " ".$langs->trans('Place')." ".$place; - -print ': '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).' 

'; - if ($invoice->socid != $conf->global->CASHDESK_ID_THIRDPARTY) { $soc = new Societe($db); diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 6dd80bed342..fed57dcf068 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -34,7 +34,9 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; -$place = GETPOST('place', 'int'); +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS + $invoiceid = GETPOST('invoiceid', 'int'); @@ -51,15 +53,18 @@ else { $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); - $row = $db->fetch_array($resql); - $placeid=$row[0]; - if (! $placeid) + $obj = $db->fetch_object($resql); + if ($obj) { - $placeid=0; // Invoice does not exist yet + $invoiceid = $obj->rowid; + } + if (! $invoiceid) + { + $invoiceid=0; // Invoice does not exist yet } else { - $invoice->fetch($placeid); + $invoice->fetch($invoiceid); } } diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index fb23120623a..7e560a0d40f 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -24,19 +24,27 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->loadLangs(array("main", "cashdesk")); +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS + +$facid=GETPOST('facid', 'int'); + + /* * View */ top_httphead('text/html'); -$facid=GETPOST('facid', 'int'); -$place=GETPOST('place', 'int'); -if ($place>0){ +if ($place > 0) +{ $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); - $row = $db->fetch_array($resql); - $facid=$row[0]; + $obj = $db->fetch_object($resql); + if ($obj) + { + $facid=$obj->rowid; + } } $object=new Facture($db); $object->fetch($facid); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index fb0b0073510..bb57baaf04d 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -32,8 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$place = GETPOST('place', 'int'); -if ($place=="") $place="0"; +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS + $action = GETPOST('action', 'alpha'); $langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter")); @@ -259,7 +260,7 @@ function ClickProduct(position) { if (idproduct=="") return; // Call page invoice.php to generate the section with product lines $("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } } From 9105e205ff1e8a23bab342804da417cf87e7077c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2019 20:20:39 +0100 Subject: [PATCH 11/13] No more need to set scroolTop, lines are sorted with last added first --- htdocs/takepos/customers.php | 2 +- htdocs/takepos/invoice.php | 68 ++++++++++++++++++++---------------- htdocs/takepos/pay.php | 2 +- htdocs/takepos/takepos.php | 18 +++++----- 4 files changed, 49 insertions(+), 41 deletions(-) diff --git a/htdocs/takepos/customers.php b/htdocs/takepos/customers.php index 46e06365a93..05fdf5537c9 100644 --- a/htdocs/takepos/customers.php +++ b/htdocs/takepos/customers.php @@ -61,7 +61,7 @@ if ($action=="change") { ?> diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 4b6aebbe80c..3c39b7e1e4e 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -407,39 +407,47 @@ print "\n"; if ($placeid > 0) { - $tmplines = array_reverse($invoice->lines); - foreach($tmplines as $line) + if (is_array($invoice->lines) && count($invoice->lines)) { - $htmlforlines = ''; - - $htmlforlines.= 'id . '">'; - $htmlforlines.= ''; - $htmlforlines.= $line->product_label; - if ($line->product_label && $line->desc) $htmlforlines.= '
'; - if ($line->product_label != $line->desc) + $tmplines = array_reverse($invoice->lines); + foreach($tmplines as $line) { - $firstline = dolGetFirstLineOfText($line->desc); - if ($firstline != $line->desc) - { - $htmlforlines.= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); - } - else - { - $htmlforlines.= $line->desc; - } - } - if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "
(".$line->array_options['options_order_notes'].")"; - $htmlforlines.= ''; - $htmlforlines.= '' . vatrate($line->remise_percent, true) . ''; - $htmlforlines.= '' . $line->qty . ''; - $htmlforlines.= '' . price($line->total_ttc) . ''; - $htmlforlines.= ''."\n"; + $htmlforlines = ''; + + $htmlforlines.= 'id . '">'; + $htmlforlines.= ''; + $htmlforlines.= $line->product_label; + if ($line->product_label && $line->desc) $htmlforlines.= '
'; + if ($line->product_label != $line->desc) + { + $firstline = dolGetFirstLineOfText($line->desc); + if ($firstline != $line->desc) + { + $htmlforlines.= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); + } + else + { + $htmlforlines.= $line->desc; + } + } + if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "
(".$line->array_options['options_order_notes'].")"; + $htmlforlines.= ''; + $htmlforlines.= '' . vatrate($line->remise_percent, true) . ''; + $htmlforlines.= '' . $line->qty . ''; + $htmlforlines.= '' . price($line->total_ttc) . ''; + $htmlforlines.= ''."\n"; + + print $htmlforlines; + } + } + else + { + print ''.$langs->trans("Empty").''; - print $htmlforlines; } } diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index fed57dcf068..3f9641b37d5 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -170,7 +170,7 @@ 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+"&invoiceid="+invoiceid, function() { - parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight); + //parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight); parent.$.colorbox.close(); }); } diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index bb57baaf04d..9fa2154eaf1 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -66,9 +66,9 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); get_full_arbo('product', 0, (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)?$conf->global->TAKEPOS_ROOT_CATEGORY_ID:0)); -//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0; // Search root category to know its level +//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0; $levelofrootcategory=0; if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) { @@ -267,7 +267,7 @@ function ClickProduct(position) { function deleteline() { $("#poslines").load("invoice.php?action=deleteline&place="+place+"&idline="+selectedline, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } @@ -295,13 +295,13 @@ function TakeposOrderNotes() { function Refresh() { $("#poslines").load("invoice.php?place="+place, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } function Search() { $("#poslines").load("invoice.php?action=search&place="+place, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } @@ -334,7 +334,7 @@ function Edit(number){ if (editaction=='qty' && editnumber!=""){ $("#poslines").load("invoice.php?action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { editnumber=""; - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#qty").html("trans("Qty"); ?>"); }); return; @@ -347,7 +347,7 @@ function Edit(number){ if (editaction=='p' && editnumber!=""){ $("#poslines").load("invoice.php?action=updateprice&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { editnumber=""; - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#price").html("trans("Price"); ?>"); }); return; @@ -360,7 +360,7 @@ function Edit(number){ if (editaction=='r' && editnumber!=""){ $("#poslines").load("invoice.php?action=updatereduction&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { editnumber=""; - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#reduction").html("trans("ReductionShort"); ?>"); }); return; @@ -395,13 +395,13 @@ function Edit(number){ function TakeposPrintingOrder(){ $("#poslines").load("invoice.php?action=order&place="+place, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } function TakeposPrintingTemp(){ $("#poslines").load("invoice.php?action=temp&place="+place, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } From eb1d57226f45de3f1934845d220880b633cb477d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2019 20:28:02 +0100 Subject: [PATCH 12/13] Fix status paid after entering a payment --- htdocs/takepos/invoice.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3c39b7e1e4e..0a748ee32d8 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -116,9 +116,16 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->create($user); $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); - if ($invoice->getRemainToPay() == 0) + $remaintopay = $invoice->getRemainToPay(); + if ($remaintopay == 0) { + dol_syslog("Invoice is paid, so we set it to pay"); $result = $invoice->set_paid($user); + if ($result > 0) $invoice->paye = 1; + } + else + { + dol_syslog("Invoice is not paid, remain to pay = ".$remaintopay); } } From c6543614850007b0c6590df3c312afbb4b112f10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2019 20:46:07 +0100 Subject: [PATCH 13/13] Show link to invoice at the TOP --- htdocs/takepos/invoice.php | 44 ++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 0a748ee32d8..ed3f133b2d4 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -274,6 +274,28 @@ if ($action == "order" and $placeid != 0) { $invoice->fetch($placeid); } +$sectionwithinvoicelink=''; +if ($action=="valid") +{ + $sectionwithinvoicelink.=''."\n"; + $sectionwithinvoicelink.=''; + $sectionwithinvoicelink.=''; + $sectionwithinvoicelink.=$invoice->getNomUrl(1, '', 0, 0, '', 0, 0, -1, '_backoffice')." - "; + if ($invoice->getRemainToPay() > 0) + { + $sectionwithinvoicelink.=$langs->trans('Generated'); + } + else + { + if ($invoice->paye) $sectionwithinvoicelink.=$langs->trans("Payed"); + else $sectionwithinvoicelink.=$langs->trans('BillShortStatusValidated'); + } + $sectionwithinvoicelink.=''; + if ($conf->global->TAKEPOSCONNECTOR) $sectionwithinvoicelink.=' '; + else $sectionwithinvoicelink.=' '; + if ($conf->global->TAKEPOS_AUTO_PRINT_TICKETS) $sectionwithinvoicelink.=''; +} + /* * View @@ -406,6 +428,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) } print $langs->trans('TotalTTC'); print ' : '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; +print '
'.$sectionwithinvoicelink; print ''; print '' . $langs->trans('ReductionShort') . ''; print '' . $langs->trans('Qty') . ''; @@ -470,27 +493,6 @@ if ($invoice->socid != $conf->global->CASHDESK_ID_THIRDPARTY) print '

'; } -if ($action=="valid") -{ - print ''."\n"; - print ''; - print '

'; - print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, -1, '_backoffice')." - "; - if ($invoice->getRemainToPay() > 0) - { - print $langs->trans('Generated'); - } - else - { - if ($invoice->paye) print $langs->trans("Payed"); - else print $langs->trans('BillShortStatusValidated'); - } - print '

'; - if ($conf->global->TAKEPOSCONNECTOR) print '
'; - else print '
'; - if ($conf->global->TAKEPOS_AUTO_PRINT_TICKETS) print ''; -} - if ($action == "search") { print '