dolibarr 25.0.0-alpha
takepos.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2026 Jose Martinez <jose.martinez@pichinov.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * or see https://www.gnu.org/
20 */
21
33{
34 global $langs, $conf;
35
36 $h = 0;
37 $head = array();
38
39 $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/setup.php';
40 $head[$h][1] = $langs->trans("Parameters");
41 $head[$h][2] = 'setup';
42 $h++;
43
44 $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/appearance.php';
45 $head[$h][1] = $langs->trans("Appearance");
46 $head[$h][2] = 'appearance';
47 $h++;
48
49 $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php';
50 $head[$h][1] = $langs->trans("Printers").' / '.$langs->trans("Receipt");
51 $head[$h][2] = 'receipt';
52 $h++;
53
54 $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/bar.php';
55 $head[$h][1] = $langs->trans("BarRestaurant");
56 $head[$h][2] = 'bar';
57 $h++;
58
59 $numterminals = max(1, getDolGlobalInt('TAKEPOS_NUM_TERMINALS', 1));
60 for ($i = 1; $i <= $numterminals; $i++) {
61 $label = getDolGlobalString('TAKEPOS_TERMINAL_NAME_'.$i, $langs->trans("TerminalName", $i));
62 if (!takeposTerminalIsEnabled($i)) {
63 // A disabled terminal is greyed out but still listed, so it can be enabled again
64 $label = '<span class="opacitymedium">'.$label.' ('.$langs->trans("Disabled").')</span>';
65 }
66 $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/terminal.php?terminal='.$i;
67 $head[$h][1] = $label;
68 $head[$h][2] = 'terminal'.$i;
69 $h++;
70 }
71
72 /*
73 $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/other.php';
74 $head[$h][1] = $langs->trans("About");
75 $head[$h][2] = 'other';
76 $h++;
77 */
78
79 complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos_admin');
80
81 complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos_admin', 'remove');
82
83 return $head;
84}
85
97function takeposTerminalIsEnabled($terminal)
98{
99 return !getDolGlobalInt('TAKEPOS_TERMINAL_DISABLED_'.((int) $terminal));
100}
101
108{
109 $result = array();
110 $numterminals = max(1, getDolGlobalInt('TAKEPOS_NUM_TERMINALS', 1));
111 for ($i = 1; $i <= $numterminals; $i++) {
112 if (takeposTerminalIsEnabled($i)) {
113 $result[] = $i;
114 }
115 }
116 return $result;
117}
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
takeposEnabledTerminals()
Return the list of the TakePOS terminals that can be used.
takepos_admin_prepare_head()
Prepare array with list of tabs.
takeposTerminalIsEnabled($terminal)
Tell if a TakePOS terminal can be used.