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