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