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/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index becfa8b9a65..dc6ae7dc02e 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -50,13 +50,14 @@ TheoricalAmount=Theorical amount RealAmount=Real amount CashFenceDone=Cash fence done for the period NbOfInvoices=Nb of invoices -Paymentnumpad=Payment Num Pad +Paymentnumpad=Type of Pad to enter payment Numberspad=Numbers Pad -BillsCoinsPad=Bills and Coins Pad +BillsCoinsPad=Coins and banknotes Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr TakeposNeedsCategories=TakePOS needs product categories to work OrderNotes=Order Notes CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration TicketVatGrouped=Group VAT by rate in tickets -AutoPrintTickets=Automatically print tickets \ No newline at end of file +AutoPrintTickets=Automatically print tickets +EnableBarOrRestaurantFeatures=Enable features for Bar or Restaurant \ No newline at end of file diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 973c8cbd9cc..e17ea0ee036 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -64,7 +64,7 @@ if (GETPOST('action', 'alpha') == 'set') if (GETPOST('socid', 'int') < 0) $_POST["socid"]=''; $res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY", (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity); - + $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH", (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE", (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB", (GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') : ''), 'chaine', 0, '', $conf->entity); @@ -177,7 +177,8 @@ if ($conf->global->TAKEPOSCONNECTOR){ // Bar Restaurant mode print ''; -print 'Bar Restaurant'; +print $langs->trans("EnableBarOrRestaurantFeatures"); +print ''; print ''; print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1); print "\n"; @@ -276,7 +277,7 @@ if (! empty($conf->banque->enabled)) print ''; $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB, 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", 1); print ''; - + foreach($paiements as $modep) { if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; $name="CASHDESK_ID_BANKACCOUNT_".$modep->code; 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/css/pos.css b/htdocs/takepos/css/pos.css index 4b90f712f1d..a94e737f273 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -46,7 +46,7 @@ button.calcbutton3 { text-align: center; font-size:120%; overflow: visible; /* removes extra width in IE */ - width:12%; + width:24%; height:24%; } @@ -60,7 +60,7 @@ button.actionbutton { text-align: center; overflow: visible; /* removes extra width in IE */ width:33%; - height:33%; + height:24%; } div.wrapper{ @@ -208,6 +208,13 @@ div.catwatermark{ padding-left: 5px; } +.selected { + font-weight: bold; +} +.order { + color: limegreen; +} + .colorwhite { color: white; } diff --git a/htdocs/takepos/customers.php b/htdocs/takepos/customers.php index 6c526a97ea3..05fdf5537c9 100644 --- a/htdocs/takepos/customers.php +++ b/htdocs/takepos/customers.php @@ -45,7 +45,8 @@ $show_files=GETPOST('show_files', 'int'); $confirm=GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $idcustomer = GETPOST('idcustomer', 'int'); -$place = (GETPOSTISSET('place')?GETPOST('place', 'int'):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 $_GET['optioncss'] = 'print'; @@ -60,7 +61,7 @@ if ($action=="change") { ?> diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index ceb8c73f211..0206fe1a8e0 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -25,24 +25,26 @@ 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 - require '../main.inc.php'; // Load $user and permissions $langs->loadLangs(array("bills","orders","commercial","cashdesk")); -$floor=GETPOST('floor', 'alpha'); +$floor=GETPOST('floor', 'int'); if ($floor=="") $floor=1; $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $left = GETPOST('left', 'alpha'); $top = GETPOST('top', 'alpha'); -$place = GETPOST('place', 'int'); -$newname = GETPOST('newname'); + +$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 + +$newname = GETPOST('newname', 'alpha'); $mode = GETPOST('mode', 'alpha'); -if ($action=="getTables"){ - $sql="SELECT * from ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; +if ($action=="getTables") +{ + $sql="SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; $resql = $db->query($sql); $rows = array(); while($row = $db->fetch_array($resql)){ @@ -56,20 +58,21 @@ if ($action=="update") { if ($left>95) $left=95; if ($top>95) $top=95; - if ($left>3 or $top>4) $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=$left, toppos=$top where label='$place'"); - else $db->query("delete from ".MAIN_DB_PREFIX."takepos_floor_tables where label='$place'"); + if ($left>3 or $top>4) $db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=".$left.", toppos=".$top." WHERE rowid='".$place."'"); + else $db->query("DELETE from ".MAIN_DB_PREFIX."takepos_floor_tables where rowid='".$place."'"); } if ($action=="updatename") { $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars - $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label='$newname' where label='$place'"); + $db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set label='".$db->escape($newname)."' WHERE rowid='".$place."'"); } if ($action=="add") { - $asdf=$db->query("insert into ".MAIN_DB_PREFIX."takepos_floor_tables values ('', '', '', '45', '45', $floor)"); + $sql="INSERT INTO ".MAIN_DB_PREFIX."takepos_floor_tables(entity, label, leftpos, toppos, floor) VALUES (".$conf->entity.", '', '45', '45', ".$floor.")"; + $asdf=$db->query($sql); $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names } @@ -101,6 +104,7 @@ height: 100%; var DragDrop='trans("DragDrop"); ?>'; function updateplace(idplace, left, top) { + console.log("updateplace idplace="+idplace+" left="+left+" top="+top); $.ajax({ type: "POST", url: "floors.php", @@ -110,12 +114,13 @@ function updateplace(idplace, left, top) { }); } -function updatename(before) { - var after=$("#"+before).text(); +function updatename(rowid) { + var after=$("#tablename"+rowid).text(); + console.log("updatename rowid="+rowid+" after="+after); $.ajax({ type: "POST", url: "floors.php", - data: { action: "updatename", place: before, newname: after } + data: { action: "updatename", place: rowid, newname: after } }).done(function( msg ) { window.location.href='floors.php?mode=edit&floor='; }); @@ -130,8 +135,8 @@ $( document ).ready(function() { $.getJSON('./floors.php?action=getTables&floor=', function(data) { $.each(data, function(key, val) { - $('body').append('
'+val.label+'
'); - $( "#"+val.label ).draggable( + $('body').append('
'+val.label+'
'); + $( "#tablename"+val.rowid ).draggable( { start: function() { $("#add").html("trans("Delete"); ?>"); @@ -139,7 +144,7 @@ $( document ).ready(function() { stop: function() { var left=$(this).offset().left*100/$(window).width(); var top=$(this).offset().top*100/$(window).height(); - updateplace($(this).attr('id'), left, top); + updateplace($(this).attr('id').substr(9), left, top); } } ); @@ -149,7 +154,7 @@ $( document ).ready(function() { }) - $('body').append('
'+val.label+'
'); + $('body').append('
'+val.label+'
'); }); }); @@ -171,7 +176,13 @@ $( document ).ready(function() {
-

';">trans("Floor")." ".$floor; ?>

+

+ 1) { ?> + ';"> + + trans("Floor")." ".$floor; ?> + +

diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index ce2c120b63f..f9a270b247c 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -29,7 +29,9 @@ require '../main.inc.php'; // Load $user and permissions $langs->loadLangs(array("bills", "cashdesk")); -$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 + $idline = GETPOST('idline', 'int'); $action = GETPOST('action'); @@ -60,7 +62,7 @@ if ($action=="freezone") echo ''; ?> - + diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index e4dde53e9e7..ed3f133b2d4 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -35,7 +35,10 @@ $langs->loadLangs(array("bills", "cashdesk")); $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $idproduct = GETPOST('idproduct', 'int'); -$place = (GETPOSTISSET('place')?GETPOST('place', 'int'):0); // $place is id of POS + +$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 + $number = GETPOST('number', 'alpha'); $idline = GETPOST('idline', 'int'); $desc = GETPOST('desc', 'alpha'); @@ -113,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); } } @@ -124,15 +134,15 @@ if (($action=="addline" || $action=="freezone") && $placeid == 0) $invoice->socid = $conf->global->CASHDESK_ID_THIRDPARTY; $invoice->date = dol_now(); $invoice->module_source = 'takepos'; - $invoice->pos_source = (string) $place; + $invoice->pos_source = (string) $posnb; $placeid = $invoice->create($user); $sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS-".$place.")' where rowid=".$placeid; $db->query($sql); } -if ($action == "addline") { - +if ($action == "addline") +{ $prod = new Product($db); $prod->fetch($idproduct); @@ -178,8 +188,8 @@ if ($action == "deleteline") { $invoice->deleteline($idline); $invoice->fetch($placeid); } - elseif ($placeid > 0) { //If exist invoice, but no line selected, proced to delete last line - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='$placeid' order by rowid DESC"; + elseif ($placeid > 0) { //If exist invoice, but no line selected, proceed to delete last line + $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture='".$placeid."' order by rowid DESC"; $resql = $db->query($sql); $row = $db->fetch_array($resql); $deletelineid = $row[0]; @@ -264,25 +274,41 @@ 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 */ +$form = new Form($db); + ?> - + use_javascript_ajax)) +{ + print "\n".''."\n"; + print ''."\n"; +} + + print '
'; print ''; print ''; -print ''; +print ''; +print ''; print ''; print ''; print "\n"; -if ($placeid > 0) { - foreach($invoice->lines as $line) +if ($placeid > 0) +{ + if (is_array($invoice->lines) && count($invoice->lines)) { - print 'lines); + foreach($tmplines as $line) + { + $htmlforlines = ''; + + $htmlforlines.= 'id . '">'; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= ''."\n"; + + print $htmlforlines; } - print '" id="' . $line->rowid . '">'; - print ''; - print ''; - print ''; - print ''; + } + else + { + print ''; + } } 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 '
'.$sectionwithinvoicelink; +print '
' . $langs->trans('ReductionShort') . '' . $langs->trans('Qty') . '' . $langs->trans('TotalHTShort') . '
'; + $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.= '
' . vatrate($line->remise_percent, true) . '' . $line->qty . '' . price($line->total_ttc) . '
' . $line->product_label . $line->desc; - if (!empty($line->array_options['options_order_notes'])) echo "
(".$line->array_options['options_order_notes'].")"; - print '
' . $line->qty . '' . price($line->total_ttc) . '
'.$langs->trans("Empty").'
'; -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); @@ -415,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 '
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/pay.php b/htdocs/takepos/pay.php index 589b4fe6479..3f9641b37d5 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -31,12 +31,12 @@ 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 - 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'); @@ -53,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); } } @@ -167,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/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 d9e25688fc3..9fa2154eaf1 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -26,24 +26,23 @@ 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 - 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'); -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")); $categorie = new Categorie($db); -$MAXCATEG = 16; -$MAXPRODUCT = 32; +$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG)?16:$conf->global->TAKEPOS_NB_MAXCATEG); +$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?32:$conf->global->TAKEPOS_NB_MAXPRODUCT);; /* @@ -61,16 +60,15 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); ?> - - +