dolibarr 25.0.0-alpha
appearance.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
4 * Copyright (C) 2019-2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
5 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2026 Jose Martinez <jose.martinez@pichinov.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../../main.inc.php'; // Load $user and permissions
30require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
33require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php";
34
43// Security check
44if (!$user->admin) {
46}
47
48$langs->loadLangs(array("admin", "cashdesk", "commercial"));
49
50/*
51 * Actions
52 */
53$error = 0;
54
55if (GETPOST('action', 'alpha') == 'set') {
56 $db->begin();
57
58 $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity);
59 $res = dolibarr_set_const($db, "TAKEPOS_LINES_TO_SHOW", GETPOST('TAKEPOS_LINES_TO_SHOW', 'alpha'), 'chaine', 0, '', $conf->entity);
60 if (GETPOSTISSET('TAKEPOS_SHOW_PRODUCT_REFERENCE')) {
61 $res = dolibarr_set_const($db, "TAKEPOS_SHOW_PRODUCT_REFERENCE", GETPOST('TAKEPOS_SHOW_PRODUCT_REFERENCE', 'alpha'), 'chaine', 0, '', $conf->entity);
62 }
63
64 dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
65
66 if (!($res > 0)) {
67 $error++;
68 }
69
70 if (!$error) {
71 $db->commit();
72 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
73 } else {
74 $db->rollback();
75 setEventMessages($langs->trans("Error"), null, 'errors');
76 }
77}
78
79
80/*
81 * View
82 */
83
84$form = new Form($db);
85$formproduct = new FormProduct($db);
86
87llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, '', '', '', 'mod-takepos page-admin_appearance');
88
89$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
90
91print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
93print dol_get_fiche_head($head, 'appearance', 'TakePOS', -1, 'cash-register');
94
95print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 : $terminal).'" method="post">';
96print '<input type="hidden" name="token" value="'.newToken().'">';
97print '<input type="hidden" name="action" value="set">';
98
99print '<br>';
100
101print '<table class="noborder centpercent">';
102print '<tr class="liste_titre">';
103print '<td>'.$langs->trans("Parameters").'</td><td></td>';
104print "</tr>\n";
105
106// Color theme
107print '<tr class="oddeven"><td>';
108print $langs->trans("ColorTheme");
109print '</td><td>';
110$array = array(0=>"Eldy", 1=>$langs->trans("Colorful"));
111print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (!getDolGlobalString('TAKEPOS_COLOR_THEME') ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0);
112print "</td></tr>\n";
113
114// Don't display category section
115print '<tr class="oddeven"><td>';
116print $langs->trans('HideCategories');
117print '</td><td>';
118print ajax_constantonoff("TAKEPOS_HIDE_CATEGORIES", array(), $conf->entity, 0, 0, 1, 0);
119print "</td></tr>\n";
120
121// Hide category images to speed up
122if (!getDolGlobalString('TAKEPOS_HIDE_CATEGORIES')) {
123 print '<tr class="oddeven"><td>';
124 print $langs->trans('HideCategoryImages');
125 print '</td><td>';
126 print ajax_constantonoff("TAKEPOS_HIDE_CATEGORY_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
127 print "</td></tr>\n";
128}
129
130// Hide category images to speed up
131print '<tr class="oddeven"><td>';
132print $langs->trans('HideProductImages');
133print '</td><td>';
134print ajax_constantonoff("TAKEPOS_HIDE_PRODUCT_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
135print "</td></tr>\n";
136
137// View reference or label of products
138print '<tr class="oddeven"><td>';
139print $langs->trans('ShowProductReference');
140print '</td><td>';
141$array = array("0"=>$langs->trans("Label"), 1=>$langs->trans("Ref").'+'.$langs->trans("Label"), 2=>$langs->trans("Ref"));
142print $form->selectarray('TAKEPOS_SHOW_PRODUCT_REFERENCE', $array, getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE', 2), 0);
143//print ajax_constantonoff("TAKEPOS_SHOW_PRODUCT_REFERENCE", array(), $conf->entity, 0, 0, 1, 0);
144print "</td></tr>\n";
145
146// Lines to show
147print '<tr class="oddeven"><td>';
148print $langs->trans("NumberOfLinesToShow");
149print '</td><td>';
150$array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6");
151print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, getDolGlobalInt('TAKEPOS_LINES_TO_SHOW', 2), 0);
152print "</td></tr>\n";
153
154// Hide stock on line
155print '<tr class="oddeven"><td>';
156print $langs->trans('HideStockOnLine');
157print '</td><td>';
158print ajax_constantonoff("TAKEPOS_HIDE_STOCK_ON_LINE", array(), $conf->entity, 0, 0, 1, 0);
159print "</td></tr>\n";
160
161// Only the products in stock
162print '<tr class="oddeven"><td>';
163print $langs->trans('ShowOnlyProductInStock');
164print '</td><td>';
165print ajax_constantonoff("TAKEPOS_PRODUCT_IN_STOCK", array(), $conf->entity, 0, 0, 1, 0);
166print "</td></tr>\n";
167
168// View description of the categories
169print '<tr class="oddeven"><td>';
170print $langs->trans('ShowCategoryDescription');
171print '</td><td>';
172print ajax_constantonoff("TAKEPOS_SHOW_CATEGORY_DESCRIPTION", array(), $conf->entity, 0, 0, 1, 0);
173print "</td></tr>\n";
174
175print '</table>';
176
177print $form->buttonsSaveCancel("Save", '');
178
179print "</form>\n";
180
181print '<br>';
182
183llxFooter();
184$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
Class with static methods for building HTML components related to products Only components common to ...
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
Definition html.lib.php:519
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
takepos_admin_prepare_head()
Prepare array with list of tabs.