dolibarr 21.0.0-beta
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="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
89print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
91print dol_get_fiche_head($head, 'appearance', 'TakePOS', -1, 'cash-register');
92
93print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 : $terminal).'" method="post">';
94print '<input type="hidden" name="token" value="'.newToken().'">';
95print '<input type="hidden" name="action" value="set">';
96
97print '<br>';
98
99print '<table class="noborder centpercent">';
100print '<tr class="liste_titre">';
101print '<td>'.$langs->trans("Parameters").'</td><td></td>';
102print "</tr>\n";
103
104// Color theme
105print '<tr class="oddeven"><td>';
106print $langs->trans("ColorTheme");
107print '</td><td>';
108$array = array(0=>"Eldy", 1=>$langs->trans("Colorful"));
109print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (!getDolGlobalString('TAKEPOS_COLOR_THEME') ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0);
110print "</td></tr>\n";
111
112// Don't display category section
113print '<tr class="oddeven"><td>';
114print $langs->trans('HideCategories');
115print '</td><td>';
116print ajax_constantonoff("TAKEPOS_HIDE_CATEGORIES", array(), $conf->entity, 0, 0, 1, 0);
117print "</td></tr>\n";
118
119// Hide category images to speed up
120if (!getDolGlobalString('TAKEPOS_HIDE_CATEGORIES')) {
121 print '<tr class="oddeven"><td>';
122 print $langs->trans('HideCategoryImages');
123 print '</td><td>';
124 print ajax_constantonoff("TAKEPOS_HIDE_CATEGORY_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
125 print "</td></tr>\n";
126}
127
128// Hide category images to speed up
129print '<tr class="oddeven"><td>';
130print $langs->trans('HideProductImages');
131print '</td><td>';
132print ajax_constantonoff("TAKEPOS_HIDE_PRODUCT_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
133print "</td></tr>\n";
134
135// View reference or label of products
136print '<tr class="oddeven"><td>';
137print $langs->trans('ShowProductReference');
138print '</td><td>';
139$array = array("0"=>$langs->trans("Label"), 1=>$langs->trans("Ref").'+'.$langs->trans("Label"), 2=>$langs->trans("Ref"));
140print $form->selectarray('TAKEPOS_SHOW_PRODUCT_REFERENCE', $array, getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE', 2), 0);
141//print ajax_constantonoff("TAKEPOS_SHOW_PRODUCT_REFERENCE", array(), $conf->entity, 0, 0, 1, 0);
142print "</td></tr>\n";
143
144// Lines to show
145print '<tr class="oddeven"><td>';
146print $langs->trans("NumberOfLinesToShow");
147print '</td><td>';
148$array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6");
149print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, getDolGlobalInt('TAKEPOS_LINES_TO_SHOW', 2), 0);
150print "</td></tr>\n";
151
152// Hide stock on line
153print '<tr class="oddeven"><td>';
154print $langs->trans('HideStockOnLine');
155print '</td><td>';
156print ajax_constantonoff("TAKEPOS_HIDE_STOCK_ON_LINE", array(), $conf->entity, 0, 0, 1, 0);
157print "</td></tr>\n";
158
159// Only the products in stock
160print '<tr class="oddeven"><td>';
161print $langs->trans('ShowOnlyProductInStock');
162print '</td><td>';
163print ajax_constantonoff("TAKEPOS_PRODUCT_IN_STOCK", array(), $conf->entity, 0, 0, 1, 0);
164print "</td></tr>\n";
165
166// View description of the categories
167print '<tr class="oddeven"><td>';
168print $langs->trans('ShowCategoryDescription');
169print '</td><td>';
170print ajax_constantonoff("TAKEPOS_SHOW_CATEGORY_DESCRIPTION", array(), $conf->entity, 0, 0, 1, 0);
171print "</td></tr>\n";
172
173print '</table>';
174
175print $form->buttonsSaveCancel("Save", '');
176
177print "</form>\n";
178
179print '<br>';
180
181llxFooter();
182$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).
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:71
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 ...
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
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.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.