dolibarr 18.0.8
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
3 * Copyright (C) 2019 Josep LluĂ­s Amador <joseplluis@lliuretic.cat>
4 * Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
27// if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
28// if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
29// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
30
31if (!defined('NOREQUIREMENU')) {
32 define('NOREQUIREMENU', '1');
33}
34if (!defined('NOREQUIREHTML')) {
35 define('NOREQUIREHTML', '1');
36}
37if (!defined('NOREQUIREAJAX')) {
38 define('NOREQUIREAJAX', '1');
39}
40
41// Load Dolibarr environment
42require '../main.inc.php'; // Load $user and permissions
43require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
44require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
46require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
47require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
48require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
49require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
50
51
52$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant or multiple sales
53$action = GETPOST('action', 'aZ09');
54$setterminal = GETPOST('setterminal', 'int');
55$setcurrency = GETPOST('setcurrency', 'aZ09');
56
57$hookmanager->initHooks(array('takeposfrontend'));
58if (empty($_SESSION["takeposterminal"])) {
59 if (getDolGlobalInt('TAKEPOS_NUM_TERMINALS') == 1) {
60 $_SESSION["takeposterminal"] = 1; // Use terminal 1 if there is only 1 terminal
61 } elseif (!empty($_COOKIE["takeposterminal"])) {
62 $_SESSION["takeposterminal"] = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE["takeposterminal"]); // Restore takeposterminal from previous session
63 }
64}
65
66if ($setterminal > 0) {
67 $_SESSION["takeposterminal"] = $setterminal;
68 setcookie("takeposterminal", $setterminal, (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Permanent takeposterminal var in a cookie
69}
70
71if ($setcurrency != "") {
72 $_SESSION["takeposcustomercurrency"] = $setcurrency;
73 // We will recalculate amount for foreign currency at next call of invoice.php when $_SESSION["takeposcustomercurrency"] differs from invoice->multicurrency_code.
74}
75
76
77$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter", "banks"));
78
79$categorie = new Categorie($db);
80
81$maxcategbydefaultforthisdevice = 12;
82$maxproductbydefaultforthisdevice = 24;
83if ($conf->browser->layout == 'phone') {
84 $maxcategbydefaultforthisdevice = 8;
85 $maxproductbydefaultforthisdevice = 16;
86 //REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT ENABLED
87 if ($_SESSION["takeposterminal"] != "" && $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1) {
88 $_SESSION["basiclayout"] = 1;
89 header("Location: phone.php?mobilepage=invoice");
90 exit;
91 }
92}
93$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG) ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG);
94$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT) ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT);
95
96$term = empty($_SESSION['takeposterminal']) ? 1 : $_SESSION['takeposterminal'];
97$socid = getDolGlobalInt('CASHDESK_ID_THIRDPARTY' . $term);
98/*
99 $constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
100 $soc = new Societe($db);
101 if ($invoice->socid > 0) $soc->fetch($invoice->socid);
102 else $soc->fetch($conf->global->$constforcompanyid);
103 */
104
105// Security check
106$result = restrictedArea($user, 'takepos', 0, '');
107
108
109
110/*
111 * View
112 */
113
114$form = new Form($db);
115
116$disablejs = 0;
117$disablehead = 0;
118$arrayofjs = array('/takepos/js/jquery.colorbox-min.js'); // TODO It seems we don't need this
119$arrayofcss = array('/takepos/css/pos.css.php', '/takepos/css/colorbox.css');
120
121if (getDolGlobalInt('TAKEPOS_COLOR_THEME') == 1) {
122 $arrayofcss[] = '/takepos/css/colorful.css';
123}
124
125
126// Title
127$title = 'TakePOS - Dolibarr '.DOL_VERSION;
128if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
129 $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
130}
131$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
132<meta name="apple-mobile-web-app-capable" content="yes">
133<meta name="mobile-web-app-capable" content="yes">
134<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
135top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
136
137
138$categories = $categorie->get_full_arbo('product', ((getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) ? getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') : 0), 1);
139
140
141// Search root category to know its level
142//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
143$levelofrootcategory = 0;
144if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) {
145 foreach ($categories as $key => $categorycursor) {
146 if ($categorycursor['id'] == getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID')) {
147 $levelofrootcategory = $categorycursor['level'];
148 break;
149 }
150 }
151}
152
153$levelofmaincategories = $levelofrootcategory + 1;
154
155$maincategories = array();
156$subcategories = array();
157foreach ($categories as $key => $categorycursor) {
158 if ($categorycursor['level'] == $levelofmaincategories) {
159 $maincategories[$key] = $categorycursor;
160 } else {
161 $subcategories[$key] = $categorycursor;
162 }
163}
164
165$maincategories = dol_sort_array($maincategories, 'label');
166$subcategories = dol_sort_array($subcategories, 'label');
167?>
168
169<body class="bodytakepos" style="overflow: hidden;">
170
171<script>
172var categories = <?php echo json_encode($maincategories); ?>;
173var subcategories = <?php echo json_encode($subcategories); ?>;
174
175var currentcat;
176var pageproducts=0;
177var pagecategories=0;
178var pageactions=0;
179var place="<?php echo $place; ?>";
180var editaction="qty";
181var editnumber="";
182var invoiceid=0;
183var search2_timer=null;
184
185/*
186var app = this;
187app.hasKeyboard = false;
188this.keyboardPress = function() {
189 app.hasKeyboard = true;
190 $(window).unbind("keyup", app.keyboardPress);
191 localStorage.hasKeyboard = true;
192 console.log("has keyboard!")
193}
194$(window).on("keyup", app.keyboardPress)
195if(localStorage.hasKeyboard) {
196 app.hasKeyboard = true;
197 $(window).unbind("keyup", app.keyboardPress);
198 console.log("has keyboard from localStorage")
199}
200*/
201
202function ClearSearch() {
203 console.log("ClearSearch");
204 $("#search").val('');
205 $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
206 $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
207 $("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>").removeClass('clicked');
208 <?php if ($conf->browser->layout == 'classic') { ?>
209 setFocusOnSearchField();
210 <?php } ?>
211}
212
213// Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically
214function setFocusOnSearchField() {
215 console.log("Call setFocusOnSearchField in page index.php");
216 <?php if ($conf->browser->layout == 'classic') { ?>
217 console.log("has keyboard from localStorage, so we can force focus on search field");
218 $("#search").focus();
219 <?php } ?>
220}
221
222function PrintCategories(first) {
223 console.log("PrintCategories");
224 for (i = 0; i < <?php echo ($MAXCATEG - 2); ?>; i++) {
225 if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined")
226 {
227 $("#catdivdesc"+i).hide();
228 $("#catdesc"+i).text("");
229 $("#catimg"+i).attr("src","genimg/empty.png");
230 $("#catwatermark"+i).hide();
231 $("#catdiv"+i).attr('class', 'wrapper divempty');
232 continue;
233 }
234 $("#catdivdesc"+i).show();
235 <?php
236 if (getDolGlobalString('TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
237 $("#catdesc"+i).html(categories[parseInt(i)+parseInt(first)]['label'].bold() + ' - ' + categories[parseInt(i)+parseInt(first)]['description']);
238 <?php } else { ?>
239 $("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']);
240 <?php } ?>
241 $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']);
242 $("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']);
243 $("#catdiv"+i).attr('class', 'wrapper');
244 $("#catwatermark"+i).show();
245 }
246}
247
248function MoreCategories(moreorless) {
249 console.log("MoreCategories moreorless="+moreorless+" pagecategories="+pagecategories);
250 if (moreorless == "more") {
251 $('#catimg15').animate({opacity: '0.5'}, 1);
252 $('#catimg15').animate({opacity: '1'}, 100);
253 pagecategories=pagecategories+1;
254 }
255 if (moreorless == "less") {
256 $('#catimg14').animate({opacity: '0.5'}, 1);
257 $('#catimg14').animate({opacity: '1'}, 100);
258 if (pagecategories==0) return; //Return if no less pages
259 pagecategories=pagecategories-1;
260 }
261 if (typeof (categories[<?php echo ($MAXCATEG - 2); ?> * pagecategories] && moreorless == "more") == "undefined") { // Return if no more pages
262 pagecategories=pagecategories-1;
263 return;
264 }
265
266 for (i = 0; i < <?php echo ($MAXCATEG - 2); ?>; i++) {
267 if (typeof (categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]) == "undefined") {
268 // complete with empty record
269 console.log("complete with empty record");
270 $("#catdivdesc"+i).hide();
271 $("#catdesc"+i).text("");
272 $("#catimg"+i).attr("src","genimg/empty.png");
273 $("#catwatermark"+i).hide();
274 continue;
275 }
276 $("#catdivdesc"+i).show();
277 <?php
278 if (getDolGlobalString('TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
279 $("#catdesc"+i).html(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['label'].bold() + ' - ' + categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['description']);
280 <?php } else { ?>
281 $("#catdesc"+i).text(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['label']);
282 <?php } ?>
283 $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
284 $("#catdiv"+i).data("rowid",categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
285 $("#catwatermark"+i).show();
286 }
287
288 ClearSearch();
289}
290
291// LoadProducts
292function LoadProducts(position, issubcat) {
293 console.log("LoadProducts");
294 var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
295
296 if (position=="supplements") currentcat="supplements";
297 else
298 {
299 $('#catimg'+position).animate({opacity: '0.5'}, 1);
300 $('#catimg'+position).animate({opacity: '1'}, 100);
301 if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid');
302 else currentcat=$('#catdiv'+position).data('rowid');
303 }
304 if (currentcat == undefined) return;
305 pageproducts=0;
306 ishow=0; //product to show counter
307
308 jQuery.each(subcategories, function(i, val) {
309 if (currentcat==val.fk_parent) {
310 $("#prodivdesc"+ishow).show();
311 <?php if (getDolGlobalString('TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
312 $("#prodesc"+ishow).html(val.label.bold() + ' - ' + val.description);
313 $("#probutton"+ishow).html(val.label);
314 <?php } else { ?>
315 $("#prodesc"+ishow).text(val.label);
316 $("#probutton"+ishow).text(val.label);
317 <?php } ?>
318 $("#probutton"+ishow).show();
319 $("#proprice"+ishow).attr("class", "hidden");
320 $("#proprice"+ishow).html("");
321 $("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid);
322 $("#prodiv"+ishow).data("rowid",val.rowid);
323 $("#prodiv"+ishow).data("iscat",1);
324 $("#prowatermark"+ishow).show();
325 ishow++;
326 }
327 });
328
329 idata=0; //product data counter
330 var limit = 0;
331 if (maxproduct >= 1) {
332 limit = maxproduct-1;
333 }
334
335 // Get socid
336 let socid = jQuery('#thirdpartyid').val();
337 if ((socid === undefined || socid === "") && parseInt("<?php echo dol_escape_js($socid) ?>") > 0) {
338 socid = parseInt("<?php echo dol_escape_js($socid); ?>");
339 }
340
341 // Only show products for sale (tosell=1)
342 $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + socid + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) {
343 console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs");
344 console.log(data);
345 while (ishow < maxproduct) {
346 //console.log("ishow"+ishow+" idata="+idata);
347 console.log(data[idata]);
348 if (typeof (data[idata]) == "undefined") {
349 <?php if (!getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) {
350 echo '$("#prodivdesc"+ishow).hide();';
351 echo '$("#prodesc"+ishow).text("");';
352 echo '$("#proimg"+ishow).attr("title","");';
353 echo '$("#proimg"+ishow).attr("src","genimg/empty.png");';
354 } else {
355 echo '$("#probutton"+ishow).hide();';
356 echo '$("#probutton"+ishow).text("");';
357 }?>
358 $("#proprice"+ishow).attr("class", "hidden");
359 $("#proprice"+ishow).html("");
360 $("#prodiv"+ishow).data("rowid","");
361 $("#prodiv"+ishow).attr("class","wrapper2 divempty");
362 } else {
363 <?php
364 $titlestring = "'".dol_escape_js($langs->transnoentities('Ref').': ')."' + data[idata]['ref']";
365 $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[idata]['barcode']";
366 ?>
367 var titlestring = <?php echo $titlestring; ?>;
368 <?php if (!getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) {
369 echo '$("#prodivdesc"+ishow).show();';
370 if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) {
371 echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);';
372 } else {
373 echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'label\']);';
374 }
375 echo '$("#proimg"+ishow).attr("title", titlestring);';
376 echo '$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);';
377 } else {
378 echo '$("#probutton"+ishow).show();';
379 echo '$("#probutton"+ishow).html(data[parseInt(idata)][\'label\']);';
380 }
381 ?>
382 if (data[parseInt(idata)]['price_formated']) {
383 $("#proprice" + ishow).attr("class", "productprice");
384 <?php
385 if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
386 ?>
387 $("#proprice" + ishow).html(data[parseInt(idata)]['price_formated']);
388 <?php
389 } else {
390 ?>
391 $("#proprice" + ishow).html(data[parseInt(idata)]['price_ttc_formated']);
392 <?php
393 }
394 ?>
395 }
396 console.log("#prodiv"+ishow+".data(rowid)="+data[idata]['id']);
397 console.log($("#prodiv"+ishow));
398
399 $("#prodiv"+ishow).data("rowid", data[idata]['id']);
400 console.log($('#prodiv4').data('rowid'));
401 $("#prodiv"+ishow).data("iscat", 0);
402 $("#prodiv"+ishow).attr("class","wrapper2");
403
404 <?php
405 // Add js from hooks
406 $parameters=array();
407 $parameters['caller'] = 'loadProducts';
408 $hookmanager->executeHooks('completeJSProductDisplay', $parameters);
409 print $hookmanager->resPrint;
410 ?>
411 }
412 $("#prowatermark"+ishow).hide();
413 ishow++; //Next product to show after print data product
414 idata++; //Next data everytime
415 }
416 });
417
418 ClearSearch();
419}
420
421function MoreProducts(moreorless) {
422 console.log("MoreProducts");
423
424 if ($('#search_pagination').val() != '') {
425 return Search2('<?php echo (isset($keyCodeForEnter) ? $keyCodeForEnter : ''); ?>', moreorless);
426 }
427
428 var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
429
430 if (moreorless=="more"){
431 $('#proimg31').animate({opacity: '0.5'}, 1);
432 $('#proimg31').animate({opacity: '1'}, 100);
433 pageproducts=pageproducts+1;
434 }
435 if (moreorless=="less"){
436 $('#proimg30').animate({opacity: '0.5'}, 1);
437 $('#proimg30').animate({opacity: '1'}, 100);
438 if (pageproducts==0) return; //Return if no less pages
439 pageproducts=pageproducts-1;
440 }
441
442 ishow=0; //product to show counter
443 idata=0; //product data counter
444 var limit = 0;
445 if (maxproduct >= 1) {
446 limit = maxproduct-1;
447 }
448 var offset = <?php echo ($MAXPRODUCT - 2); ?> * pageproducts;
449
450 // Get socid
451 let socid = jQuery('#thirdpartyid').val();
452 if ((socid === undefined || socid === "") && parseInt("<?php echo dol_escape_js($socid) ?>") > 0) {
453 socid = parseInt("<?php echo dol_escape_js($socid); ?>");
454 }
455
456 // Only show products for sale (tosell=1)
457 $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + socid + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
458 console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
459
460 if (typeof (data[0]) == "undefined" && moreorless=="more"){ // Return if no more pages
461 pageproducts=pageproducts-1;
462 return;
463 }
464
465 while (ishow < maxproduct) {
466 if (typeof (data[idata]) == "undefined") {
467 $("#prodivdesc"+ishow).hide();
468 $("#prodesc"+ishow).text("");
469 $("#probutton"+ishow).text("");
470 $("#probutton"+ishow).hide();
471 $("#proprice"+ishow).attr("class", "");
472 $("#proprice"+ishow).html("");
473 $("#proimg"+ishow).attr("src","genimg/empty.png");
474 $("#prodiv"+ishow).data("rowid","");
475 } else {
476 $("#prodivdesc"+ishow).show();
477 <?php
478 if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { ?>
479 $("#prodesc"+ishow).html(data[parseInt(idata)]['ref'].bold() + ' - ' + data[parseInt(idata)]['label']);
480 <?php } else { ?>
481 $("#prodesc"+ishow).html(data[parseInt(idata)]['label']);
482 <?php } ?>
483 $("#probutton"+ishow).html(data[parseInt(idata)]['label']);
484 $("#probutton"+ishow).show();
485 if (data[parseInt(idata)]['price_formated']) {
486 $("#proprice" + ishow).attr("class", "productprice");
487 <?php
488 if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
489 ?>
490 $("#proprice" + ishow).html(data[parseInt(idata)]['price_formated']);
491 <?php
492 } else {
493 ?>
494 $("#proprice" + ishow).html(data[parseInt(idata)]['price_ttc_formated']);
495 <?php
496 }
497 ?>
498 }
499 $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
500 $("#prodiv"+ishow).data("rowid",data[idata]['id']);
501 $("#prodiv"+ishow).data("iscat",0);
502 }
503 $("#prowatermark"+ishow).hide();
504 ishow++; //Next product to show after print data product
505 idata++; //Next data everytime
506 }
507 });
508
509 ClearSearch();
510}
511
512function ClickProduct(position, qty = 1) {
513 console.log("ClickProduct at position"+position);
514 $('#proimg'+position).animate({opacity: '0.5'}, 1);
515 $('#proimg'+position).animate({opacity: '1'}, 100);
516 if ($('#prodiv'+position).data('iscat')==1){
517 console.log("Click on a category at position "+position);
518 LoadProducts(position, true);
519 }
520 else{
521 console.log($('#prodiv4').data('rowid'));
522 invoiceid = $("#invoiceid").val();
523 idproduct=$('#prodiv'+position).data('rowid');
524 console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty);
525 if (idproduct=="") return;
526 // Call page invoice.php to generate the section with product lines
527 $("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty+"&invoiceid="+invoiceid, function() {
528 <?php if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) echo "CustomerDisplay();";?>
529 });
530 }
531
532 ClearSearch();
533}
534
535function ChangeThirdparty(idcustomer) {
536 console.log("ChangeThirdparty");
537 // Call page list.php to change customer
538 $("#poslines").load("../societe/list.php?action=change&token=<?php echo newToken();?>&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() {
539 });
540
541 ClearSearch();
542}
543
544function deleteline() {
545 console.log("Delete line");
546 invoiceid = $("#invoiceid").val();
547 $("#poslines").load("invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&invoiceid="+invoiceid, function() {
548 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
549 });
550 ClearSearch();
551}
552
553function Customer() {
554 console.log("Open box to select the thirdparty place="+place);
555 $.colorbox({href:"../societe/list.php?type=t&contextpage=poslist&nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Customer"); ?>"});
556}
557
558function History()
559{
560 console.log("Open box to select the history");
561 $.colorbox({href:"../compta/facture/list.php?contextpage=poslist", width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("History"); ?>"});
562}
563
564function Reduction() {
565 invoiceid = $("#invoiceid").val();
566 console.log("Open popup to enter reduction on invoiceid="+invoiceid);
567 $.colorbox({href:"reduction.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
568}
569
570function CloseBill() {
571 invoiceid = $("#invoiceid").val();
572 console.log("Open popup to enter payment on invoiceid="+invoiceid);
573 $.colorbox({href:"pay.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
574}
575
576function Split() {
577 invoiceid = $("#invoiceid").val();
578 console.log("Open popup to split on invoiceid="+invoiceid);
579 $.colorbox({href:"split.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
580}
581
582function Floors() {
583 console.log("Open box to select floor place="+place);
584 $.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors"); ?>"});
585}
586
587function FreeZone() {
588 console.log("Open box to enter a free product");
589 $.colorbox({href:"freezone.php?action=freezone&token=<?php echo newToken(); ?>&place="+place, width:"80%", height:"200px", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"});
590}
591
592function TakeposOrderNotes() {
593 console.log("Open box to order notes");
594 ModalBox('ModalNote');
595 $("#textinput").focus();
596}
597
598function Refresh() {
599 console.log("Refresh by reloading place="+place+" invoiceid="+invoiceid);
600 $("#poslines").load("invoice.php?place="+place+"&invoiceid="+invoiceid, function() {
601 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
602 });
603}
604
605function New() {
606 // If we go here,it means $conf->global->TAKEPOS_BAR_RESTAURANT is not defined
607 invoiceid = $("#invoiceid").val(); // This is a hidden field added by invoice.php
608
609 console.log("New with place = <?php echo $place; ?>, js place="+place+", invoiceid="+invoiceid);
610
611 $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken();?>&id='+invoiceid, function(data) {
612 var r;
613
614 if (parseInt(data['paye']) === 1) {
615 r = true;
616 } else {
617 r = confirm('<?php echo ($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>');
618 }
619
620 if (r == true) {
621 // Reload section with invoice lines
622 $("#poslines").load("invoice.php?action=delete&token=<?php echo newToken(); ?>&place=" + place, function () {
623 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
624 });
625 ClearSearch();
626 }
627 });
628}
629
637function Search2(keyCodeForEnter, moreorless) {
638 var eventKeyCode = window.event.keyCode;
639
640 console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+", eventKeyCode="+eventKeyCode);
641
642 var search_term = $('#search').val();
643 var search_start = 0;
644 var search_limit = <?php echo $MAXPRODUCT - 2; ?>;
645 if (moreorless != null) {
646 search_term = $('#search_pagination').val();
647 search_start = $('#search_start_'+moreorless).val();
648 }
649
650 console.log("search_term="+search_term);
651
652 if (search_term == '') {
653 $("[id^=prowatermark]").html("");
654 $("[id^=prodesc]").text("");
655 $("[id^=probutton]").text("");
656 $("[id^=probutton]").hide();
657 $("[id^=proprice]").attr("class", "hidden");
658 $("[id^=proprice]").html("");
659 $("[id^=proimg]").attr("src", "genimg/empty.png");
660 $("[id^=prodiv]").data("rowid", "");
661 return;
662 }
663
664 var search = false;
665 if (keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter) {
666 search = true;
667 }
668
669 if (search === true) {
670 // if a timer has been already started (search2_timer is a global js variable), we cancel it now
671 // we click onto another key, we will restart another timer just after
672 if (search2_timer) {
673 clearTimeout(search2_timer);
674 }
675
676 // temporization time to give time to type
677 search2_timer = setTimeout(function(){
678 pageproducts = 0;
679 jQuery(".wrapper2 .catwatermark").hide();
680 var nbsearchresults = 0;
681
682 // Only show products for sale (tosell=1)
683 let socid = jQuery('#thirdpartyid').val();
684 if ((socid === undefined || socid === "") && parseInt("<?php echo dol_escape_js($socid) ?>") > 0) {
685 socid = parseInt("<?php echo dol_escape_js($socid); ?>");
686 }
687
688 $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&term=' + search_term + '&thirdpartyid=' + socid + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
689 for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
690 if (typeof (data[i]) == "undefined") {
691 $("#prowatermark" + i).html("");
692 $("#prodesc" + i).text("");
693 $("#probutton" + i).text("");
694 $("#probutton" + i).hide();
695 $("#proprice" + i).attr("class", "hidden");
696 $("#proprice" + i).html("");
697 $("#proimg" + i).attr("src", "genimg/empty.png");
698 $("#prodiv" + i).data("rowid", "");
699 continue;
700 }
701 <?php
702 $titlestring = "'".dol_escape_js($langs->transnoentities('Ref').': ')."' + data[i]['ref']";
703 $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[i]['barcode']";
704 ?>
705 var titlestring = <?php echo $titlestring; ?>;
706 <?php
707 if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { ?>
708 $("#prodesc" + i).html(data[i]['ref'].bold() + ' - ' + data[i]['label']);
709 <?php } else { ?>
710 $("#prodesc" + i).html(data[i]['label']);
711 <?php } ?>
712 $("#prodivdesc" + i).show();
713 $("#probutton" + i).html(data[i]['label']);
714 $("#probutton" + i).show();
715 if (data[i]['price_formated']) {
716 $("#proprice" + i).attr("class", "productprice");
717 <?php
718 if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
719 ?>
720 $("#proprice" + i).html(data[i]['price_formated']);
721 <?php
722 } else {
723 ?>
724 $("#proprice" + i).html(data[i]['price_ttc_formated']);
725 <?php
726 }
727 ?>
728 }
729 $("#proimg" + i).attr("title", titlestring);
730 if( undefined !== data[i]['img']) {
731 $("#proimg" + i).attr("src", data[i]['img']);
732 }
733 else {
734 $("#proimg" + i).attr("src", "genimg/index.php?query=pro&id=" + data[i]['rowid']);
735 }
736 $("#prodiv" + i).data("rowid", data[i]['rowid']);
737 $("#prodiv" + i).data("iscat", 0);
738
739 <?php
740 // Add js from hooks
741 $parameters=array();
742 $parameters['caller'] = 'search2';
743 $hookmanager->executeHooks('completeJSProductDisplay', $parameters);
744 print $hookmanager->resPrint;
745 ?>
746
747 nbsearchresults++;
748 }
749 }).always(function (data) {
750 // If there is only 1 answer
751 if ($('#search').val().length > 0 && data.length == 1) {
752 console.log($('#search').val()+' - '+data[0]['barcode']);
753 if ($('#search').val() == data[0]['barcode'] && 'thirdparty' == data[0]['object']) {
754 console.log("There is only 1 answer with barcode matching the search, so we change the thirdparty "+data[0]['rowid']);
755 ChangeThirdparty(data[0]['rowid']);
756 }
757 else if ('product' == data[0]['object'] && $('#search').val() == data[0]['barcode']) {
758 console.log("There is only 1 answer and we found search on a barcode, so we add the product in basket, qty="+data[0]['qty']);
759 ClickProduct(0, data[0]['qty']);
760 }
761 }
762 if (eventKeyCode == keyCodeForEnter){
763 if (data.length == 0) {
764 $('#search').val('<?php
765 $langs->load('errors');
766 echo dol_escape_js($langs->transnoentitiesnoconv("ErrorRecordNotFoundShort"));
767 ?> ('+search_term+')');
768 $('#search').select();
769 }
770 else ClearSearch();
771 }
772 // memorize search_term and start for pagination
773 $("#search_pagination").val($("#search").val());
774 if (search_start == 0) {
775 $("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").hide();
776 }
777 else {
778 $("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show();
779 var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>));
780 $("#search_start_less").val(search_start_less);
781 }
782 if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) {
783 $("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").hide();
784 }
785 else {
786 $("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show();
787 var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>);
788 $("#search_start_more").val(search_start_more);
789 }
790 });
791 }, 500); // 500ms delay
792 }
793
794}
795
796/* Function called on an action into the PAD */
797function Edit(number) {
798 console.log("We click on PAD on key="+number);
799
800 if (typeof(selectedtext) == "undefined") {
801 return; // We click on an action on the number pad but there is no line selected
802 }
803
804 var text=selectedtext+"<br> ";
805
806
807 if (number=='c') {
808 editnumber='';
809 Refresh();
810 $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
811 $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
812 $("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>").removeClass('clicked');
813 return;
814 } else if (number=='qty') {
815 if (editaction=='qty' && editnumber != '') {
816 $("#poslines").load("invoice.php?action=updateqty&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
817 editnumber="";
818 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
819 $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
820 });
821
822 setFocusOnSearchField();
823 return;
824 }
825 else {
826 editaction="qty";
827 }
828 } else if (number=='p') {
829 if (editaction=='p' && editnumber!="") {
830 $("#poslines").load("invoice.php?action=updateprice&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
831 editnumber="";
832 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
833 $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
834 });
835
836 ClearSearch();
837 return;
838 }
839 else {
840 editaction="p";
841 }
842 } else if (number=='r') {
843 if (editaction=='r' && editnumber!="") {
844 $("#poslines").load("invoice.php?action=updatereduction&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
845 editnumber="";
846 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
847 $("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>").removeClass('clicked');
848 });
849
850 ClearSearch();
851 return;
852 }
853 else {
854 editaction="r";
855 }
856 }
857 else {
858 editnumber=editnumber+number;
859 }
860 if (editaction=='qty'){
861 text=text+"<?php echo $langs->trans("Modify")." -> ".$langs->trans("Qty").": "; ?>";
862 $("#qty").html("OK").addClass("clicked");
863 $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
864 $("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>").removeClass('clicked');
865 }
866 if (editaction=='p'){
867 text=text+"<?php echo $langs->trans("Modify")." -> ".$langs->trans("Price").": "; ?>";
868 $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
869 $("#price").html("OK").addClass("clicked");
870 $("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>").removeClass('clicked');
871 }
872 if (editaction=='r'){
873 text=text+"<?php echo $langs->trans("Modify")." -> ".$langs->trans("ReductionShort").": "; ?>";
874 $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
875 $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
876 $("#reduction").html("OK").addClass("clicked");
877 }
878 $('#'+selectedline).find("td:first").html(text+editnumber);
879}
880
881
882function TakeposPrintingOrder(){
883 console.log("TakeposPrintingOrder");
884 $("#poslines").load("invoice.php?action=order&token=<?php echo newToken();?>&place="+place, function() {
885 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
886 });
887}
888
889function TakeposPrintingTemp(){
890 console.log("TakeposPrintingTemp");
891 $("#poslines").load("invoice.php?action=temp&token=<?php echo newToken();?>&place="+place, function() {
892 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
893 });
894}
895
896function OpenDrawer(){
897 console.log("OpenDrawer call ajax url http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>:8111/print");
898 $.ajax({
899 type: "POST",
900 data: { token: 'notrequired' },
901 <?php
902 if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
903 echo "url: '".getDolGlobalString('TAKEPOS_PRINT_SERVER', 'localhost')."/printer/drawer.php',";
904 } else {
905 echo "url: 'http://".getDolGlobalString('TAKEPOS_PRINT_SERVER', 'localhost').":8111/print',";
906 }
907 ?>
908 data: "opendrawer"
909 });
910}
911
912function DolibarrOpenDrawer() {
913 console.log("DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken();?>&term=<?php print urlencode($_SESSION["takeposterminal"]); ?>");
914 $.ajax({
915 type: "GET",
916 data: { token: '<?php echo currentToken(); ?>' },
917 url: "<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=opendrawer&token='.newToken().'&term='.urlencode($_SESSION["takeposterminal"]); ?>",
918 });
919}
920
921function MoreActions(totalactions){
922 if (pageactions==0){
923 pageactions=1;
924 for (i = 0; i <= totalactions; i++){
925 if (i<12) $("#action"+i).hide();
926 else $("#action"+i).show();
927 }
928 }
929 else if (pageactions==1){
930 pageactions=0;
931 for (i = 0; i <= totalactions; i++){
932 if (i<12) $("#action"+i).show();
933 else $("#action"+i).hide();
934 }
935 }
936
937 return true;
938}
939
940function ControlCashOpening()
941{
942 $.colorbox({href:"../compta/cashcontrol/cashcontrol_card.php?action=create&contextpage=takepos", width:"90%", height:"60%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("NewCashFence"); ?>"});
943}
944
945function CloseCashFence(rowid)
946{
947 $.colorbox({href:"../compta/cashcontrol/cashcontrol_card.php?id="+rowid+"&contextpage=takepos", width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("NewCashFence"); ?>"});
948}
949
950function CashReport(rowid)
951{
952 $.colorbox({href:"../compta/cashcontrol/report.php?id="+rowid+"&contextpage=takepos", width:"60%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("CashReport"); ?>"});
953}
954
955// TakePOS Popup
956function ModalBox(ModalID)
957{
958 var modal = document.getElementById(ModalID);
959 modal.style.display = "block";
960}
961
962function DirectPayment(){
963 console.log("DirectPayment");
964 $("#poslines").load("invoice.php?place="+place+"&action=valid&token=<?php echo newToken(); ?>&pay=LIQ", function() {
965 });
966}
967
968function FullScreen() {
969 document.documentElement.requestFullscreen();
970}
971
972function WeighingScale(){
973 console.log("Weighing Scale");
974 $.ajax({
975 type: "POST",
976 data: { token: 'notrequired' },
977 url: '<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>/scale/index.php',
978 })
979 .done(function( editnumber ) {
980 $("#poslines").load("invoice.php?&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
981 editnumber="";
982 });
983 });
984}
985
986$( document ).ready(function() {
987 PrintCategories(0);
988 LoadProducts(0);
989 Refresh();
990 <?php
991 //IF NO TERMINAL SELECTED
992 if ($_SESSION["takeposterminal"] == "") {
993 print "ModalBox('ModalTerminal');";
994 }
995
996 if (getDolGlobalString('TAKEPOS_CONTROL_CASH_OPENING')) {
997 $sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
998 $sql .= " entity = ".((int) $conf->entity)." AND ";
999 $sql .= " posnumber = ".((int) $_SESSION["takeposterminal"])." AND ";
1000 $sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'";
1001 $resql = $db->query($sql);
1002 if ($resql) {
1003 $obj = $db->fetch_object($resql);
1004 // If there is no cash control from today open it
1005 if (!isset($obj->rowid) || is_null($obj->rowid)) {
1006 print "ControlCashOpening();";
1007 }
1008 }
1009 }
1010 ?>
1011
1012 /* For Header Scroll */
1013 var elem1 = $("#topnav-left")[0];
1014 var elem2 = $("#topnav-right")[0];
1015 var checkOverflow = function() {
1016 if (scrollBars().horizontal) $("#topnav").addClass("overflow");
1017 else $("#topnav").removeClass("overflow");
1018 }
1019
1020 var scrollBars = function(){
1021 var container= $('#topnav')[0];
1022 return {
1023 vertical:container.scrollHeight > container.clientHeight,
1024 horizontal:container.scrollWidth > container.clientWidth
1025 }
1026 }
1027
1028 $(window).resize(function(){
1029 checkOverflow();
1030 });
1031
1032 let resizeObserver = new ResizeObserver(() => {
1033 checkOverflow();
1034 });
1035 resizeObserver.observe(elem1);
1036 resizeObserver.observe(elem2);
1037 checkOverflow();
1038
1039 var pressTimer = [];
1040 var direction = 1;
1041 var step = 200;
1042
1043 $(".indicator").mousedown(function(){
1044 direction = $(this).hasClass("left") ? -1 : 1;
1045 scrollTo();
1046 pressTimer.push(setInterval(scrollTo, 100));
1047 });
1048
1049 $(".indicator").mouseup(function(){
1050 pressTimer.forEach(clearInterval);
1051 });
1052
1053 $("body").mouseup(function(){
1054 pressTimer.forEach(clearInterval);
1055 console.log("body");
1056 });
1057
1058 function scrollTo(){
1059 console.log("here");
1060 var pos = $("#topnav").scrollLeft();
1061 document.getElementById("topnav").scrollTo({ left: $("#topnav").scrollLeft() + direction * step, behavior: 'smooth' })
1062 }
1063
1064 $("#topnav").scroll(function(){
1065 if (($("#topnav").offsetWidth + $("#topnav").scrollLeft >= $("#topnav").scrollWidth)) {
1066 console.log("end");
1067 }
1068 });
1069 /* End Header Scroll */
1070});
1071</script>
1072
1073<?php
1074$keyCodeForEnter = getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) > 0 ? getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) : '';
1075?>
1076<div class="container">
1077
1078<?php
1079if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1080 ?>
1081 <div class="header">
1082 <div id="topnav" class="topnav">
1083 <div id="topnav-left" class="topnav-left">
1084 <div class="inline-block valignmiddle">
1085 <a class="topnav-terminalhour" onclick="ModalBox('ModalTerminal')">
1086 <span class="fa fa-cash-register"></span>
1087 <span class="hideonsmartphone">
1088 <?php echo getDolGlobalString("TAKEPOS_TERMINAL_NAME_".$_SESSION["takeposterminal"], $langs->trans("TerminalName", $_SESSION["takeposterminal"])); ?>
1089 </span>
1090 <?php
1091 echo '<span class="hideonsmartphone"> - '.dol_print_date(dol_now(), "day").'</span>';
1092 ?>
1093 </a>
1094 <?php
1095 if (isModEnabled('multicurrency')) {
1096 print '<a class="valignmiddle tdoverflowmax100" id="multicurrency" onclick="ModalBox(\'ModalCurrency\')" title=""><span class="fas fa-coins paddingrightonly"></span>';
1097 print '<span class="hideonsmartphone">'.$langs->trans("Currency").'</span>';
1098 print '</a>';
1099 }
1100 ?>
1101 </div>
1102 <!-- section for customer -->
1103 <div class="inline-block valignmiddle" id="customerandsales"></div>
1104 <!-- section for shopping carts -->
1105 <div class="inline-block valignmiddle" id="shoppingcart"></div>
1106 <!-- More info about customer -->
1107 <div class="inline-block valignmiddle tdoverflowmax150onsmartphone" id="moreinfo"></div>
1108 <?php
1109 if (isModEnabled('stock')) {
1110 ?>
1111 <!-- More info about warehouse -->
1112 <div class="inline-block valignmiddle tdoverflowmax150onsmartphone" id="infowarehouse"></div>
1113 <?php
1114 }
1115 ?>
1116 </div>
1117 <div id="topnav-right" class="topnav-right">
1118 <?php
1119 $reshook = $hookmanager->executeHooks('takepos_login_block_other');
1120 if ($reshook == 0) { //Search method ?>
1121 <div class="login_block_other">
1122 <input type="text" id="search" name="search" class="input-search-takepos" onkeyup="Search2('<?php echo dol_escape_js($keyCodeForEnter); ?>', null);" placeholder="<?php echo dol_escape_htmltag($langs->trans("Search")); ?>" autofocus>
1123 <a onclick="ClearSearch();"><span class="fa fa-backspace"></span></a>
1124 <a href="<?php echo DOL_URL_ROOT.'/'; ?>" target="backoffice" rel="opener"><!-- we need rel="opener" here, we are on same domain and we need to be able to reuse this tab several times -->
1125 <span class="fas fa-home"></span></a>
1126 <?php if (empty($conf->dol_use_jmobile)) {?>
1127 <a class="hideonsmartphone" onclick="FullScreen();" title="<?php echo dol_escape_htmltag($langs->trans("ClickFullScreenEscapeToLeave")); ?>"><span class="fa fa-expand-arrows-alt"></span></a>
1128 <?php }?>
1129 </div>
1130 <?php
1131 }?>
1132 <div class="login_block_user">
1133 <?php
1134 print top_menu_user(1, DOL_URL_ROOT.'/user/logout.php?token='.newtoken().'&urlfrom='.urlencode('/takepos/?setterminal='.((int) $term)));
1135 ?>
1136 </div>
1137 </div>
1138 <div class="arrows">
1139 <span class="indicator left"><i class="fa fa-arrow-left"></i></span>
1140 <span class="indicator right"><i class="fa fa-arrow-right"></i></span>
1141 </div>
1142 </div>
1143 </div>
1144 <?php
1145}
1146?>
1147
1148<!-- Modal terminal box -->
1149<div id="ModalTerminal" class="modal">
1150 <div class="modal-content">
1151 <div class="modal-header">
1152 <?php
1153 if (empty($conf->global->TAKEPOS_FORCE_TERMINAL_SELECT)) {
1154 ?>
1155 <span class="close" href="#" onclick="document.getElementById('ModalTerminal').style.display = 'none';">&times;</span>
1156 <?php } ?>
1157 <h3><?php print $langs->trans("TerminalSelect"); ?></h3>
1158 </div>
1159 <div class="modal-body">
1160 <button type="button" class="block" onclick="location.href='index.php?setterminal=1'"><?php print getDolGlobalString("TAKEPOS_TERMINAL_NAME_1", $langs->trans("TerminalName", 1)); ?></button>
1161 <?php
1162 $nbloop = getDolGlobalInt('TAKEPOS_NUM_TERMINALS');
1163 for ($i = 2; $i <= $nbloop; $i++) {
1164 print '<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.'\'">'.getDolGlobalString("TAKEPOS_TERMINAL_NAME_".$i, $langs->trans("TerminalName", $i)).'</button>';
1165 }
1166 ?>
1167 </div>
1168</div>
1169</div>
1170
1171<!-- Modal multicurrency box -->
1172<?php if (isModEnabled('multicurrency')) { ?>
1173<div id="ModalCurrency" class="modal">
1174 <div class="modal-content">
1175 <div class="modal-header">
1176 <span class="close" href="#" onclick="document.getElementById('ModalCurrency').style.display = 'none';">&times;</span>
1177 <h3><?php print $langs->trans("SetMultiCurrencyCode"); ?></h3>
1178 </div>
1179 <div class="modal-body">
1180 <?php
1181 $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
1182 $sql .= " WHERE entity IN ('".getEntity('multicurrency')."')";
1183 $resql = $db->query($sql);
1184 if ($resql) {
1185 while ($obj = $db->fetch_object($resql)) {
1186 print '<button type="button" class="block" onclick="location.href=\'index.php?setcurrency='.$obj->code.'\'">'.$obj->code.'</button>';
1187 }
1188 }
1189 ?>
1190 </div>
1191 </div>
1192</div>
1193<?php } ?>
1194
1195<!-- Modal terminal Credit Note -->
1196<div id="ModalCreditNote" class="modal">
1197 <div class="modal-content">
1198 <div class="modal-header">
1199 <span class="close" href="#" onclick="document.getElementById('ModalCreditNote').style.display = 'none';">&times;</span>
1200 <h3><?php print $langs->trans("invoiceAvoirWithLines"); ?></h3>
1201 </div>
1202 <div class="modal-body">
1203 <button type="button" class="block" onclick="CreditNote(); document.getElementById('ModalCreditNote').style.display = 'none';"><?php print $langs->trans("Yes"); ?></button>
1204 <button type="button" class="block" onclick="document.getElementById('ModalCreditNote').style.display = 'none';"><?php print $langs->trans("No"); ?></button>
1205 </div>
1206</div>
1207</div>
1208
1209<!-- Modal Note -->
1210<div id="ModalNote" class="modal">
1211 <div class="modal-content">
1212 <div class="modal-header">
1213 <span class="close" href="#" onclick="document.getElementById('ModalNote').style.display = 'none';">&times;</span>
1214 <h3><?php print $langs->trans("Note"); ?></h3>
1215 </div>
1216 <div class="modal-body">
1217 <input type="text" class="block" id="textinput">
1218 <button type="button" class="block" onclick="SetNote(); document.getElementById('ModalNote').style.display = 'none';">OK</button>
1219 </div>
1220</div>
1221</div>
1222
1223 <div class="row1<?php if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1224 print 'withhead';
1225 } ?>">
1226
1227 <div id="poslines" class="div1">
1228 </div>
1229
1230 <div class="div2">
1231 <button type="button" class="calcbutton" onclick="Edit(7);">7</button>
1232 <button type="button" class="calcbutton" onclick="Edit(8);">8</button>
1233 <button type="button" class="calcbutton" onclick="Edit(9);">9</button>
1234 <button type="button" id="qty" class="calcbutton2" onclick="Edit('qty')"><?php echo $langs->trans("Qty"); ?></button>
1235 <button type="button" class="calcbutton" onclick="Edit(4);">4</button>
1236 <button type="button" class="calcbutton" onclick="Edit(5);">5</button>
1237 <button type="button" class="calcbutton" onclick="Edit(6);">6</button>
1238 <button type="button" id="price" class="calcbutton2" onclick="Edit('p')"><?php echo $langs->trans("Price"); ?></button>
1239 <button type="button" class="calcbutton" onclick="Edit(1);">1</button>
1240 <button type="button" class="calcbutton" onclick="Edit(2);">2</button>
1241 <button type="button" class="calcbutton" onclick="Edit(3);">3</button>
1242 <button type="button" id="reduction" class="calcbutton2" onclick="Edit('r')"><?php echo $langs->trans("ReductionShort"); ?></button>
1243 <button type="button" class="calcbutton" onclick="Edit(0);">0</button>
1244 <button type="button" class="calcbutton" onclick="Edit('.')">.</button>
1245 <button type="button" class="calcbutton poscolorblue" onclick="Edit('c')">C</button>
1246 <button type="button" class="calcbutton2 poscolordelete" id="delete" onclick="deleteline()"><span class="fa fa-trash"></span></button>
1247 </div>
1248
1249<?php
1250
1251// TakePOS setup check
1252if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) {
1253 $sql = "SELECT code, libelle FROM " . MAIN_DB_PREFIX . "c_paiement";
1254 $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
1255 $sql .= " AND active = 1";
1256 $sql .= " ORDER BY libelle";
1257
1258 $resql = $db->query($sql);
1259 $paiementsModes = array();
1260 if ($resql) {
1261 while ( $obj = $db->fetch_object($resql) ) {
1262 $paycode = $obj->code;
1263 if ($paycode == 'LIQ') {
1264 $paycode = 'CASH';
1265 }
1266 if ($paycode == 'CHQ') {
1267 $paycode = 'CHEQUE';
1268 }
1269
1270 $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"];
1271 //var_dump($constantforkey.' '.$conf->global->$constantforkey);
1272 if ( !empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) {
1273 array_push($paiementsModes, $obj);
1274 }
1275 }
1276 }
1277
1278 if (empty($paiementsModes) && isModEnabled("banque")) {
1279 $langs->load('errors');
1280 setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
1281 setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
1282 }
1283}
1284
1285if (count($maincategories) == 0) {
1286 if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) {
1287 $tmpcategory = new Categorie($db);
1288 $tmpcategory->fetch($conf->global->TAKEPOS_ROOT_CATEGORY_ID);
1289 setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory", $tmpcategory->label), null, 'errors');
1290 } else {
1291 setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors');
1292 }
1293}
1294// User menu and external TakePOS modules
1295$menus = array();
1296$r = 0;
1297
1298if (empty($conf->global->TAKEPOS_BAR_RESTAURANT)) {
1299 $menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">'.$langs->trans("New").'</div>', 'action'=>'New();');
1300} else {
1301 // BAR RESTAURANT specific menu
1302 $menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">'.$langs->trans("Place").'</div>', 'action'=>'Floors();');
1303}
1304
1305if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1306 $menus[$r++] = array('title'=>'<span class="far fa-building paddingrightonly"></span><div class="trunc">'.$langs->trans("Customer").'</div>', 'action'=>'Customer();');
1307}
1308if ( ! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) {
1309 $menus[$r++] = array('title'=>'<span class="fa fa-history paddingrightonly"></span><div class="trunc">'.$langs->trans("History").'</div>', 'action'=>'History();');
1310}
1311$menus[$r++] = array('title'=>'<span class="fa fa-cube paddingrightonly"></span><div class="trunc">'.$langs->trans("FreeZone").'</div>', 'action'=>'FreeZone();');
1312$menus[$r++] = array('title'=>'<span class="fa fa-percent paddingrightonly"></span><div class="trunc">'.$langs->trans("Reduction").'</div>', 'action'=>'Reduction();');
1313$menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Payment").'</div>', 'action'=>'CloseBill();');
1314
1315if (getDolGlobalString('TAKEPOS_DIRECT_PAYMENT')) {
1316 $menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("DirectPayment").' <span class="opacitymedium">('.$langs->trans("Cash").')</span></div>', 'action'=>'DirectPayment();');
1317}
1318
1319$menus[$r++] = array('title'=>'<span class="fas fa-cut paddingrightonly"></span><div class="trunc">'.$langs->trans("SplitSale").'</div>', 'action'=>'Split();');
1320
1321// BAR RESTAURANT specific menu
1322if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1323 if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) {
1324 $menus[$r++] = array('title'=>'<span class="fa fa-blender-phone paddingrightonly"></span><div class="trunc">'.$langs->trans("Order").'</span>', 'action'=>'TakeposPrintingOrder();');
1325 }
1326 //Button to print receipt before payment
1327 if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1328 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
1329 if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
1330 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'TakeposConnector(placeid);');
1331 } else {
1332 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'TakeposPrinting(placeid);');
1333 }
1334 } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
1335 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'DolibarrTakeposPrinting(placeid);');
1336 } else {
1337 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'Print(placeid);');
1338 }
1339 }
1340 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && getDolGlobalString('TAKEPOS_ORDER_NOTES') == 1) {
1341 $menus[$r++] = array('title'=>'<span class="fa fa-sticky-note paddingrightonly"></span><div class="trunc">'.$langs->trans("OrderNotes").'</div>', 'action'=>'TakeposOrderNotes();');
1342 }
1343 if (getDolGlobalString('TAKEPOS_SUPPLEMENTS')) {
1344 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("ProductSupplements").'</div>', 'action'=>'LoadProducts(\'supplements\');');
1345 }
1346}
1347
1348if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
1349 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("DOL_OPEN_DRAWER").'</div>', 'action'=>'OpenDrawer();');
1350}
1351if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
1352 $menus[$r++] = array(
1353 'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("DOL_OPEN_DRAWER").'</div>',
1354 'action' => 'DolibarrOpenDrawer();',
1355 );
1356}
1357
1358$sql = "SELECT rowid, status, entity FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
1359$sql .= " entity = ".((int) $conf->entity)." AND ";
1360$sql .= " posnumber = ".((int) $_SESSION["takeposterminal"])." AND ";
1361$sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'";
1362
1363$resql = $db->query($sql);
1364if ($resql) {
1365 $num = $db->num_rows($resql);
1366 if ($num) {
1367 $obj = $db->fetch_object($resql);
1368 $menus[$r++] = array('title'=>'<span class="fas fa-file-invoice-dollar paddingrightonly"></span><div class="trunc">'.$langs->trans("CashReport").'</div>', 'action'=>'CashReport('.$obj->rowid.');');
1369 if ($obj->status == 0) {
1370 $menus[$r++] = array('title'=>'<span class="fas fa-cash-register paddingrightonly"></span><div class="trunc">'.$langs->trans("CloseCashFence").'</div>', 'action'=>'CloseCashFence('.$obj->rowid.');');
1371 }
1372 }
1373}
1374
1375$parameters = array('menus'=>$menus);
1376$reshook = $hookmanager->executeHooks('ActionButtons', $parameters);
1377if ($reshook == 0) { //add buttons
1378 if (is_array($hookmanager->resArray) ) {
1379 foreach ($hookmanager->resArray as $resArray) {
1380 foreach ($resArray as $butmenu) {
1381 $menus[$r++] = $butmenu;
1382 }
1383 }
1384 }
1385} elseif ($reshook == 1) {
1386 $r = 0; //replace buttons
1387 if (is_array($hookmanager->resArray) ) {
1388 foreach ($hookmanager->resArray as $resArray) {
1389 foreach ($resArray as $butmenu) {
1390 $menus[$r++] = $butmenu;
1391 }
1392 }
1393 }
1394}
1395
1396if ($r % 3 == 2) {
1397 $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;');
1398}
1399
1400if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1401 $menus[$r++] = array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Logout").'</div>', 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'\';');
1402}
1403
1404if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) {
1405 $menus[$r++] = array('title'=>'<span class="fa fa-balance-scale paddingrightonly"></span><div class="trunc">'.$langs->trans("WeighingScale").'</div>', 'action'=>'WeighingScale();');
1406}
1407
1408?>
1409 <!-- Show buttons -->
1410 <div class="div3">
1411 <?php
1412 $i = 0;
1413 foreach ($menus as $menu) {
1414 $i++;
1415 if (count($menus) > 12 and $i == 12) {
1416 echo '<button style="'.(empty($menu['style']) ? '' : $menu['style']).'" type="button" id="actionnext" class="actionbutton" onclick="MoreActions('.count($menus).')">'.$langs->trans("Next").'</button>';
1417 echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.(empty($menu['action']) ? '' : $menu['action']).'">'.$menu['title'].'</button>';
1418 } elseif ($i > 12) {
1419 echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.(empty($menu['action']) ? '' : $menu['action']).'">'.$menu['title'].'</button>';
1420 } else {
1421 echo '<button style="'.(empty($menu['style']) ? '' : $menu['style']).'" type="button" id="action'.$i.'" class="actionbutton" onclick="'.(empty($menu['action']) ? '' : $menu['action']).'">'.$menu['title'].'</button>';
1422 }
1423 }
1424
1425 if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1426 print '<!-- Show the search input text -->'."\n";
1427 print '<div class="margintoponly">';
1428 print '<input type="text" id="search" class="input-search-takepos" name="search" onkeyup="Search2(\''.dol_escape_js($keyCodeForEnter).'\', null);" style="width: 80%; width:calc(100% - 51px); font-size: 150%;" placeholder="'.dol_escape_htmltag($langs->trans("Search")).'" autofocus> ';
1429 print '<a class="marginleftonly hideonsmartphone" onclick="ClearSearch();">'.img_picto('', 'searchclear').'</a>';
1430 print '</div>';
1431 }
1432 ?>
1433 </div>
1434 </div>
1435
1436 <div class="row2<?php if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1437 print 'withhead';
1438 } ?>">
1439
1440 <!-- Show categories -->
1441 <?php
1442 if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1443 print '<div class="div4" style= "display: none;">';
1444 } else {
1445 print '<div class="div4">';
1446 }
1447
1448 $count = 0;
1449 while ($count < $MAXCATEG) {
1450 ?>
1451 <div class="wrapper" <?php if ($count == ($MAXCATEG - 2)) {
1452 echo 'onclick="MoreCategories(\'less\')"';
1453 } elseif ($count == ($MAXCATEG - 1)) {
1454 echo 'onclick="MoreCategories(\'more\')"';
1455 } else {
1456 echo 'onclick="LoadProducts('.$count.')"';
1457 } ?> id="catdiv<?php echo $count; ?>">
1458 <?php
1459 if ($count == ($MAXCATEG - 2)) {
1460 //echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="catimg'.$count.'" />';
1461 echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1462 } elseif ($count == ($MAXCATEG - 1)) {
1463 //echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="catimg'.$count.'" />';
1464 echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1465 } else {
1466 if (!getDolGlobalString('TAKEPOS_HIDE_CATEGORY_IMAGES')) {
1467 echo '<img class="imgwrapper" id="catimg'.$count.'" />';
1468 }
1469 }
1470 ?>
1471 <?php if ($count != ($MAXCATEG - 2) && $count != ($MAXCATEG - 1)) { ?>
1472 <div class="description" id="catdivdesc<?php echo $count; ?>">
1473 <div class="description_content" id="catdesc<?php echo $count; ?>"></div>
1474 </div>
1475 <?php } ?>
1476 <div class="catwatermark" id='catwatermark<?php echo $count; ?>'>...</div>
1477 </div>
1478 <?php
1479 $count++;
1480 }
1481 ?>
1482 </div>
1483
1484 <!-- Show product -->
1485 <div class="div5"<?php if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1486 print ' style="width:100%;"';
1487 } ?>>
1488 <?php
1489 $count = 0;
1490 while ($count < $MAXPRODUCT) {
1491 print '<div class="wrapper2 arrow" id="prodiv'.$count.'" ';
1492 ?>
1493 <?php if ($count == ($MAXPRODUCT - 2)) {
1494 ?> onclick="MoreProducts('less')" <?php
1495 } if ($count == ($MAXPRODUCT - 1)) {
1496 ?> onclick="MoreProducts('more')" <?php
1497 } else {
1498 echo 'onclick="ClickProduct('.$count.')"';
1499 } ?>>
1500 <?php
1501 if ($count == ($MAXPRODUCT - 2)) {
1502 //echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="proimg'.$count.'" />';
1503 print '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1504 } elseif ($count == ($MAXPRODUCT - 1)) {
1505 //echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="proimg'.$count.'" />';
1506 print '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1507 } else {
1508 if (getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) {
1509 echo '<button type="button" id="probutton'.$count.'" class="productbutton" style="display: none;"></button>';
1510 } else {
1511 print '<div class="" id="proprice'.$count.'"></div>';
1512 print '<img class="imgwrapper" title="" id="proimg'.$count.'">';
1513 }
1514 }
1515 ?>
1516 <?php if ($count != ($MAXPRODUCT - 2) && $count != ($MAXPRODUCT - 1) && !getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) { ?>
1517 <div class="description" id="prodivdesc<?php echo $count; ?>">
1518 <div class="description_content" id="prodesc<?php echo $count; ?>"></div>
1519 </div>
1520 <?php } ?>
1521 <div class="catwatermark" id='prowatermark<?php echo $count; ?>'>...</div>
1522 </div>
1523 <?php
1524 $count++;
1525 }
1526 ?>
1527 <input type="hidden" id="search_start_less" value="0">
1528 <input type="hidden" id="search_start_more" value="0">
1529 <input type="hidden" id="search_pagination" value="">
1530 </div>
1531 </div>
1532</div>
1533</body>
1534<?php
1535
1536llxFooter();
1537
1538$db->close();
llxFooter()
Empty footer.
Definition wrapper.php:70
Class to manage categories.
Class to manage generation of HTML components Only common components must be here.
dol_get_first_hour($date, $gm='tzserver')
Return GMT time for first hour of a given GMT date (it removes hours, min and second part)
Definition date.lib.php:638
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
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 dolibarr global constant string value.
rtl background position
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall right right takeposterminal SELECT e rowid
Definition invoice.php:1655
top_menu_user($hideloginname=0, $urllogout='')
Build the tooltip on user login.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
ui dialog ui datepicker calendar ui widget content ui state ui datepicker calendar ui widget header ui state ui datepicker calendar ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:120
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:123
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
Search2(keyCodeForEnter, moreorless)
Search products.
Definition index.php:637