dolibarr  16.0.5
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 <http://www.gnu.org/licenses/>.
18  */
19 
26 require '../../main.inc.php'; // Load $user and permissions
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
30 require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php";
31 
32 // Security check
33 if (!$user->admin) {
35 }
36 
37 $langs->loadLangs(array("admin", "cashdesk", "commercial"));
38 
39 /*
40  * Actions
41  */
42 
43 if (GETPOST('action', 'alpha') == 'set') {
44  $db->begin();
45 
46  $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity);
47  $res = dolibarr_set_const($db, "TAKEPOS_LINES_TO_SHOW", GETPOST('TAKEPOS_LINES_TO_SHOW', 'alpha'), 'chaine', 0, '', $conf->entity);
48 
49  dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
50 
51  if (!($res > 0)) {
52  $error++;
53  }
54 
55  if (!$error) {
56  $db->commit();
57  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
58  } else {
59  $db->rollback();
60  setEventMessages($langs->trans("Error"), null, 'errors');
61  }
62 } elseif (GETPOST('action', 'alpha') == 'setmethod') {
63  dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity);
64 }
65 
66 
67 /*
68  * View
69  */
70 
71 $form = new Form($db);
72 $formproduct = new FormProduct($db);
73 
74 llxHeader('', $langs->trans("CashDeskSetup"));
75 
76 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
77 print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
79 print dol_get_fiche_head($head, 'appearance', 'TakePOS', -1, 'cash-register');
80 
81 print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 : $terminal).'" method="post">';
82 print '<input type="hidden" name="token" value="'.newToken().'">';
83 print '<input type="hidden" name="action" value="set">';
84 
85 print '<table class="noborder centpercent">';
86 print '<tr class="liste_titre">';
87 print '<td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
88 print "</tr>\n";
89 
90 // Color theme
91 print '<tr class="oddeven"><td>';
92 print $langs->trans("ColorTheme");
93 print '<td colspan="2">';
94 $array = array(0=>"Eldy", 1=>$langs->trans("Colorful"));
95 print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (empty($conf->global->TAKEPOS_COLOR_THEME) ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0);
96 print "</td></tr>\n";
97 
98 // Hide category images to speed up
99 print '<tr class="oddeven"><td>';
100 print $langs->trans('HideCategoryImages');
101 print '<td colspan="2">';
102 print ajax_constantonoff("TAKEPOS_HIDE_CATEGORY_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
103 print "</td></tr>\n";
104 
105 // Hide category images to speed up
106 print '<tr class="oddeven"><td>';
107 print $langs->trans('HideProductImages');
108 print '<td colspan="2">';
109 print ajax_constantonoff("TAKEPOS_HIDE_PRODUCT_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
110 print "</td></tr>\n";
111 
112 // Lines to show
113 print '<tr class="oddeven"><td>';
114 print $langs->trans("NumberOfLinesToShow");
115 print '<td colspan="2">';
116 $array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6");
117 print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, (empty($conf->global->TAKEPOS_LINES_TO_SHOW) ? '2' : $conf->global->TAKEPOS_LINES_TO_SHOW), 0);
118 print "</td></tr>\n";
119 
120 print '</table>';
121 
122 print $form->buttonsSaveCancel("Save", '');
123 
124 print "</form>\n";
125 
126 print '<br>';
127 
128 llxFooter();
129 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
takepos_admin_prepare_head
takepos_admin_prepare_head()
Prepare array with list of tabs.
Definition: takepos.lib.php:30
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
ajax_constantonoff
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:573
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
FormProduct
Class with static methods for building HTML components related to products Only components common to ...
Definition: html.formproduct.class.php:30
dolibarr_set_const
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:627
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59