38if (!defined(
'NOTOKENRENEWAL')) {
39 define(
'NOTOKENRENEWAL',
'1');
41if (!defined(
'NOREQUIREMENU')) {
42 define(
'NOREQUIREMENU',
'1');
44if (!defined(
'NOREQUIREHTML')) {
45 define(
'NOREQUIREHTML',
'1');
47if (!defined(
'NOREQUIREAJAX')) {
48 define(
'NOREQUIREAJAX',
'1');
51if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
52 print
'This page must be called by takepos/public/auto_order.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
64$action =
GETPOST(
'action',
'aZ09');
67$mobilepage =
GETPOST(
'mobilepage',
'alphanohtml');
69if ($setterminal > 0) {
70 $_SESSION[
"takeposterminal"] = $setterminal;
73$langs->loadLangs(array(
"bills",
"orders",
"commercial",
"cashdesk",
"receiptprinter"));
80$title =
'TakePOS - Dolibarr '.DOL_VERSION;
86if (empty($mobilepage)) {
87 $head =
'<meta name="apple-mobile-web-app-title" content="TakePOS"/>
88 <meta name="apple-mobile-web-app-capable" content="yes">
89 <meta name="mobile-web-app-capable" content="yes">
90 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
92 '/takepos/css/phone.css',
94 $arrayofjs = array(
'/takepos/js/jquery.colorbox-min.js');
97 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
99 print
'<body style="background-color:#D1D1D1;">'.
"\n";
107if ($action ==
"productinfo" && $user->hasRight(
'takepos',
'run')) {
109 $prod->fetch($idproduct);
110 print
'<button type="button" class="publicphonebutton2 phoneblue total" onclick="AddProductConfirm(place, '.$idproduct.
')">'.$langs->trans(
'Add').
'</button>';
111 print
"<br><b>".$prod->label.
"</b><br>";
112 print
'<img class="imgwrapper" width="60%" src="'.DOL_URL_ROOT.
'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$idproduct.
'">';
113 print
"<br>".$prod->description;
116} elseif ($action ==
"editline" && $user->hasRight(
'takepos',
'run')) {
120 $invoice->fetch($placeid);
121 foreach ($invoice->lines as $line) {
122 if ($line->id == $selectedline) {
124 $prod->fetch($line->fk_product);
125 print
"<b>".$prod->label.
"</b><br>";
126 print
'<img class="imgwrapper" width="60%" src="'.DOL_URL_ROOT.
'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$line->fk_product.
'">';
127 print
"<br>".$prod->description;
130 print
'<button type="button" class="publicphonebutton2 phonered width24" onclick="SetQty(place, '.$selectedline.
', '.($line->qty - 1).
')">-</button>';
131 print
'<button type="button" class="publicphonebutton2 phonegreen width24" onclick="SetQty(place, '.$selectedline.
', '.($line->qty + 1).
')">+</button>';
132 print
'<button type="button" class="publicphonebutton2 phoneblue width24" onclick="SetNote(place, '.$selectedline.
')">'.$langs->trans(
'Note').
'</button>';
137 <div
class=
"container">
138 <div
class=
"phonebuttonsrow center">
140 print
'<button type="button" class="publicphonebutton phoneblue uppercase" onclick="LoadCats();">'.dol_trunc($langs->trans(
'Categories'), 8,
'right',
'UTF-8').
'</button>';
141 print
'<button type="button" class="publicphonebutton phoneorange uppercase" onclick="PublicPreOrder();">'.dol_trunc($langs->trans(
'Order'), 8,
'right',
'UTF-8').
'</button>';
146 <div
class=
"phonerow2">
147 <div
id=
"phonediv2" class=
"phonediv2"></div>
149 <div
class=
"phonerow1">
150 <div
id=
"phonediv1" class=
"phonediv1"></div>
154 <script
type=
"text/javascript">
157 $categories = $categorie->get_full_arbo(
'product',
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID'), 1);
161 $levelofrootcategory = 0;
163 foreach ($categories as $key => $categorycursor) {
164 if ($categorycursor[
'id'] ==
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID')) {
165 $levelofrootcategory = $categorycursor[
'level'];
170 $levelofmaincategories = $levelofrootcategory + 1;
172 $maincategories = array();
173 $subcategories = array();
174 foreach ($categories as $key => $categorycursor) {
175 if ($categorycursor[
'level'] == $levelofmaincategories) {
176 $maincategories[$key] = $categorycursor;
178 $subcategories[$key] = $categorycursor;
182 sort($maincategories);
183 sort($subcategories);
186 var categories = <?php echo json_encode($maincategories); ?>;
187 var subcategories = <?php echo json_encode($subcategories); ?>;
191 var pagecategories=0;
193 var place=
"<?php echo $place; ?>";
194 var editaction=
"qty";
198 $( document ).ready(
function() {
199 console.log(
"Refresh");
203 function LoadPlace(placeid){
206 echo
'$("#phonediv2").load("'.DOL_URL_ROOT.
'/takepos/public/auto_order.php?mobilepage=invoice&place="+place+" #tablelines", function() {
212 function AddProduct(placeid, productid){
215 print
'place=placeid;
216 $("#phonediv1").load("'.DOL_URL_ROOT.
'/takepos/public/auto_order.php?action=productinfo&token='.newToken().
'&place="+place+"&idproduct="+productid, function() {
221 function PublicPreOrder(){
222 $(
"#phonediv1").load(
"<?php echo DOL_URL_ROOT.'/takepos/public/auto_order.php?action=publicpreorder&token='.newToken(); ?>&place="+place,
function() {
226 function AddProductConfirm(placeid, productid){
229 echo
'$("#phonediv2").load("'.DOL_URL_ROOT.
'/takepos/public/auto_order.php?mobilepage=invoice&action=addline&token='.newToken().
'&place="+place+"&idproduct="+productid, function() {
236 function SetQty(place, selectedline, qty){
237 console.log(
"We click on SetQty()");
239 $(
"#phonediv2").load(
"<?php echo DOL_URL_ROOT ?>/takepos/public/auto_order.php?mobilepage=invoice&action=deleteline&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline,
function() {
243 $(
"#phonediv2").load(
"<?php echo DOL_URL_ROOT ?>/takepos/public/auto_order.php?mobilepage=invoice&action=updateqty&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+qty,
function() {
251 function SetNote(place, selectedline){
252 console.log(
"We click on SetNote()");
253 var note = prompt(
"<?php dol_escape_js($langs->trans('Note')); ?>",
"");
254 $(
"#phonediv2").load(
"<?php echo DOL_URL_ROOT ?>/takepos/public/auto_order.php?mobilepage=invoice&action=updateqty&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+qty,
function() {
260 console.log(
"We click on LoadCats()");
263 echo
'$("#phonediv1").load("'.DOL_URL_ROOT.
'/takepos/public/auto_order.php?format=div&mobilepage=cats&place="+place+" #tablelines", function() {
268 function LoadProducts(idcat) {
269 console.log(
"We click on LoadProducts()");
271 echo
'$("#phonediv1").load("'.DOL_URL_ROOT.
'/takepos/public/auto_order.php?format=div&mobilepage=products&catid="+idcat+"&place="+place+"", function() {
276 function LoadPlacesList(){
277 $(
"#phonediv1").load(
"invoice.php?mobilepage=places",
function() {
281 function TakeposPrintingOrder(){
282 console.log(
"TakeposPrintingOrder");
284 echo
'$("#phonediv2").load("'.DOL_URL_ROOT.
'/takepos/public/auto_order.php?action=order&token='.newToken().
'&mobilepage=order&place="+place, function() {
290 console.log(
"Click on Exit");
291 window.location.href=
'<?php echo DOL_URL_ROOT ?>/user/logout.php?token=<?php echo newToken(); ?>';
294 function CheckPlease(payment){
295 console.log(
"Click on CheckPlease");
296 if (payment==undefined){
297 $(
"#phonediv1").load(
"<?php echo DOL_URL_ROOT ?>/takepos/public/auto_order.php?action=checkplease&token=<?php echo newToken(); ?>&place="+place,
function() {
301 console.log(
"Request the check to the waiter");
302 $(
"#phonediv1").load(
"<?php echo DOL_URL_ROOT ?>/takepos/public/auto_order.php?action=checkplease&token=<?php echo newToken(); ?>&place=<?php echo urlencode($place); ?>&payment="+payment,
function() {
311 if (
getDolGlobalString(
'TAKEPOS_NUM_TERMINALS') !=
"1" && $_SESSION[
"takeposterminal"] ==
"") {
312 print
'<div class="dialog-info-takepos-terminal" id="dialog-info" title="TakePOS">'.$langs->trans(
'TerminalSelect').
'</div>';
Class to manage categories.
Class to manage invoices.
Class to manage products or services.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
dol_decode($chain, $key='1')
Decode a base 64 encoded + specific delta change.