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