diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 961168221f6..ef6ca77722a 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -483,7 +483,7 @@ function TakeposOrderNotes() { } function Refresh() { - console.log("Refresh"); + console.log("Refresh by reloading place="+place); $("#poslines").load("invoice.php?place="+place, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); @@ -491,9 +491,10 @@ function Refresh() { function New() { // If we go here,it means $conf->global->TAKEPOS_BAR_RESTAURANT is not defined - console.log("New with place = , js place="+place); - invoiceid = $("#invoiceid").val(); + + console.log("New with place = , js place="+place+", invoiceid="+invoiceid); + $.getJSON('/takepos/ajax/ajax.php?action=getInvoice&id='+invoiceid, function(data) { var r; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index d2fd153e5be..55b576a040d 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -572,16 +572,9 @@ if ($action == "deleteline") { } } +// Action to delete or discard an invoice if ($action == "delete") { // $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 begining of page works. - - /*$reg = array(); - if (preg_match('/^(\d+)-(\d+)$/', $place, $reg)) { - - $place = $reg[1]; - var_dump($place); - }*/ - if ($placeid > 0) { $result = $invoice->fetch($placeid); @@ -599,7 +592,9 @@ if ($action == "delete") { } } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture"; + $sql .= " SET fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}.", "; + $sql .= " datec = '".$db->idate(dol_now())."'"; $sql .= " WHERE ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; $resql1 = $db->query($sql);