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