dolibarr  13.0.2
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) accessforbidden();
34 
35 $langs->loadLangs(array("admin", "cashdesk", "commercial"));
36 
37 /*
38  * Actions
39  */
40 
41 if (GETPOST('action', 'alpha') == 'set')
42 {
43  $db->begin();
44 
45  $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity);
46  $res = dolibarr_set_const($db, "TAKEPOS_LINES_TO_SHOW", GETPOST('TAKEPOS_LINES_TO_SHOW', 'alpha'), 'chaine', 0, '', $conf->entity);
47 
48  dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
49 
50  if (!($res > 0)) $error++;
51 
52  if (!$error)
53  {
54  $db->commit();
55  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
56  } else {
57  $db->rollback();
58  setEventMessages($langs->trans("Error"), null, 'errors');
59  }
60 } elseif (GETPOST('action', 'alpha') == 'setmethod')
61 {
62  dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity);
63 }
64 
65 
66 /*
67  * View
68  */
69 
70 $form = new Form($db);
71 $formproduct = new FormProduct($db);
72 
73 llxHeader('', $langs->trans("CashDeskSetup"));
74 
75 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
76 print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
78 print dol_get_fiche_head($head, 'appearance', 'TakePOS', -1, 'cash-register');
79 
80 print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 : $terminal).'" method="post">';
81 print '<input type="hidden" name="token" value="'.newToken().'">';
82 print '<input type="hidden" name="action" value="set">';
83 
84 print '<table class="noborder centpercent">';
85 print '<tr class="liste_titre">';
86 print '<td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
87 print "</tr>\n";
88 
89 // Color theme
90 print '<tr class="oddeven"><td>';
91 print $langs->trans("ColorTheme");
92 print '<td colspan="2">';
93 $array = array(0=>"Eldy", 1=>$langs->trans("Colorful"));
94 print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (empty($conf->global->TAKEPOS_COLOR_THEME) ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0);
95 print "</td></tr>\n";
96 
97 // Hide category images to speed up
98 print '<tr class="oddeven"><td>';
99 print $langs->trans('HideCategoryImages');
100 print '<td colspan="2">';
101 print ajax_constantonoff("TAKEPOS_HIDE_CATEGORY_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
102 print "</td></tr>\n";
103 
104 // Hide category images to speed up
105 print '<tr class="oddeven"><td>';
106 print $langs->trans('HideProductImages');
107 print '<td colspan="2">';
108 print ajax_constantonoff("TAKEPOS_HIDE_PRODUCT_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
109 print "</td></tr>\n";
110 
111 // Lines to show
112 print '<tr class="oddeven"><td>';
113 print $langs->trans("NumberOfLinesToShow");
114 print '<td colspan="2">';
115 $array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6");
116 print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, (empty($conf->global->TAKEPOS_LINES_TO_SHOW) ? '2' : $conf->global->TAKEPOS_LINES_TO_SHOW), 0);
117 print "</td></tr>\n";
118 
119 print '</table>';
120 
121 print '<br>';
122 
123 print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
124 
125 print "</form>\n";
126 
127 print '<br>';
128 
129 llxFooter();
130 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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:575
Class with static methods for building HTML components related to products Only components common to ...
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
takepos_admin_prepare_head()
Prepare array with list of tabs.
Definition: takepos.lib.php:29
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0)
On/off button for constant.
Definition: ajax.lib.php:503
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 Calling this function terminate execution ...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
llxFooter()
Empty footer.
Definition: wrapper.php:59