dolibarr 23.0.3
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 *
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 */
20
27// Load Dolibarr environment
28require '../../main.inc.php'; // Load $user and permissions
29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
32require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php";
33
42// Security check
43if (!$user->admin) {
45}
46
47$langs->loadLangs(array("admin", "cashdesk", "commercial"));
48
49/*
50 * Actions
51 */
52$error = 0;
53
54if (GETPOST('action', 'alpha') == 'set') {
55 $db->begin();
56
57 $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity);
58 $res = dolibarr_set_const($db, "TAKEPOS_LINES_TO_SHOW", GETPOST('TAKEPOS_LINES_TO_SHOW', 'alpha'), 'chaine', 0, '', $conf->entity);
59 if (GETPOSTISSET('TAKEPOS_SHOW_PRODUCT_REFERENCE')) {
60 $res = dolibarr_set_const($db, "TAKEPOS_SHOW_PRODUCT_REFERENCE", GETPOST('TAKEPOS_SHOW_PRODUCT_REFERENCE', 'alpha'), 'chaine', 0, '', $conf->entity);
61 }
62
63 dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
64
65 if (!($res > 0)) {
66 $error++;
67 }
68
69 if (!$error) {
70 $db->commit();
71 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
72 } else {
73 $db->rollback();
74 setEventMessages($langs->trans("Error"), null, 'errors');
75 }
76}
77
78
79/*
80 * View
81 */
82
83$form = new Form($db);
84$formproduct = new FormProduct($db);
85
86llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, '', '', '', 'mod-takepos page-admin_appearance');
87
88$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>';
89
90print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
92print dol_get_fiche_head($head, 'appearance', 'TakePOS', -1, 'cash-register');
93
94print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 : $terminal).'" method="post">';
95print '<input type="hidden" name="token" value="'.newToken().'">';
96print '<input type="hidden" name="action" value="set">';
97
98print '<br>';
99
100print '<table class="noborder centpercent">';
101print '<tr class="liste_titre">';
102print '<td>'.$langs->trans("Parameters").'</td><td></td>';
103print "</tr>\n";
104
105// Color theme
106print '<tr class="oddeven"><td>';
107print $langs->trans("ColorTheme");
108print '</td><td>';
109$array = array(0=>"Eldy", 1=>$langs->trans("Colorful"));
110print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (!getDolGlobalString('TAKEPOS_COLOR_THEME') ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0);
111print "</td></tr>\n";
112
113// Don't display category section
114print '<tr class="oddeven"><td>';
115print $langs->trans('HideCategories');
116print '</td><td>';
117print ajax_constantonoff("TAKEPOS_HIDE_CATEGORIES", array(), $conf->entity, 0, 0, 1, 0);
118print "</td></tr>\n";
119
120// Hide category images to speed up
121if (!getDolGlobalString('TAKEPOS_HIDE_CATEGORIES')) {
122 print '<tr class="oddeven"><td>';
123 print $langs->trans('HideCategoryImages');
124 print '</td><td>';
125 print ajax_constantonoff("TAKEPOS_HIDE_CATEGORY_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
126 print "</td></tr>\n";
127}
128
129// Hide category images to speed up
130print '<tr class="oddeven"><td>';
131print $langs->trans('HideProductImages');
132print '</td><td>';
133print ajax_constantonoff("TAKEPOS_HIDE_PRODUCT_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
134print "</td></tr>\n";
135
136// View reference or label of products
137print '<tr class="oddeven"><td>';
138print $langs->trans('ShowProductReference');
139print '</td><td>';
140$array = array("0"=>$langs->trans("Label"), 1=>$langs->trans("Ref").'+'.$langs->trans("Label"), 2=>$langs->trans("Ref"));
141print $form->selectarray('TAKEPOS_SHOW_PRODUCT_REFERENCE', $array, getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE', 2), 0);
142//print ajax_constantonoff("TAKEPOS_SHOW_PRODUCT_REFERENCE", array(), $conf->entity, 0, 0, 1, 0);
143print "</td></tr>\n";
144
145// Lines to show
146print '<tr class="oddeven"><td>';
147print $langs->trans("NumberOfLinesToShow");
148print '</td><td>';
149$array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6");
150print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, getDolGlobalInt('TAKEPOS_LINES_TO_SHOW', 2), 0);
151print "</td></tr>\n";
152
153// Hide stock on line
154print '<tr class="oddeven"><td>';
155print $langs->trans('HideStockOnLine');
156print '</td><td>';
157print ajax_constantonoff("TAKEPOS_HIDE_STOCK_ON_LINE", array(), $conf->entity, 0, 0, 1, 0);
158print "</td></tr>\n";
159
160// Only the products in stock
161print '<tr class="oddeven"><td>';
162print $langs->trans('ShowOnlyProductInStock');
163print '</td><td>';
164print ajax_constantonoff("TAKEPOS_PRODUCT_IN_STOCK", array(), $conf->entity, 0, 0, 1, 0);
165print "</td></tr>\n";
166
167// View description of the categories
168print '<tr class="oddeven"><td>';
169print $langs->trans('ShowCategoryDescription');
170print '</td><td>';
171print ajax_constantonoff("TAKEPOS_SHOW_CATEGORY_DESCRIPTION", array(), $conf->entity, 0, 0, 1, 0);
172print "</td></tr>\n";
173
174print '</table>';
175
176print $form->buttonsSaveCancel("Save", '');
177
178print "</form>\n";
179
180print '<br>';
181
182llxFooter();
183$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 ...
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
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.