dolibarr  16.0.5
terminal.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) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
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 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.'/categories/class/categorie.class.php';
31 require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php";
32 
33 $terminal = GETPOST('terminal', 'int');
34 // If socid provided by ajax company selector
35 if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal.'_id'])) {
36  $_GET['CASHDESK_ID_THIRDPARTY'.$terminal] = GETPOST('CASHDESK_ID_THIRDPARTY'.$terminal.'_id', 'alpha');
37  $_POST['CASHDESK_ID_THIRDPARTY'.$terminal] = GETPOST('CASHDESK_ID_THIRDPARTY'.$terminal.'_id', 'alpha');
38  $_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal] = GETPOST('CASHDESK_ID_THIRDPARTY'.$terminal.'_id', 'alpha');
39 }
40 
41 // Security check
42 if (!$user->admin) {
44 }
45 
46 $langs->loadLangs(array("admin", "cashdesk", "printing", "receiptprinter"));
47 
48 global $db;
49 
50 $sql = "SELECT code, libelle as label FROM ".MAIN_DB_PREFIX."c_paiement";
51 $sql .= " WHERE entity IN (".getEntity('c_paiement').")";
52 $sql .= " AND active = 1";
53 $sql .= " ORDER BY libelle";
54 $resql = $db->query($sql);
55 $paiements = array();
56 if ($resql) {
57  while ($obj = $db->fetch_object($resql)) {
58  array_push($paiements, $obj);
59  }
60 }
61 
62 $terminaltouse = $terminal;
63 
64 
65 /*
66  * Actions
67  */
68 
69 if (GETPOST('action', 'alpha') == 'set') {
70  $db->begin();
71 
72  $res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY".$terminaltouse, (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity);
73 
74  $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
75  $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
76  $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
77  if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) {
78  $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_SUMUP".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
79  }
80  foreach ($paiements as $modep) {
81  if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) {
82  continue;
83  }
84  $name = "CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse;
85  $res = dolibarr_set_const($db, $name, (GETPOST($name, 'alpha') > 0 ? GETPOST($name, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
86  }
87  $res = dolibarr_set_const($db, "CASHDESK_ID_WAREHOUSE".$terminaltouse, (GETPOST('CASHDESK_ID_WAREHOUSE'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
88  $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminaltouse, GETPOST('CASHDESK_NO_DECREASE_STOCK'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
89  $res = dolibarr_set_const($db, "TAKEPOS_PRINTER_TO_USE".$terminaltouse, GETPOST('TAKEPOS_PRINTER_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
90  $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER1_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
91  $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER2_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
92  $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER3_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
93  $res = dolibarr_set_const($db, "TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES".$terminaltouse, GETPOST('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
94  $res = dolibarr_set_const($db, "TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS".$terminaltouse, GETPOST('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
95 
96  $res = dolibarr_set_const($db, 'CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse, (GETPOST('CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse, 'int') > 0 ? GETPOST('CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse, 'int') : ''), 'chaine', 0, '', $conf->entity);
97 
98  $res = dolibarr_set_const($db, "TAKEPOS_ADDON".$terminaltouse, GETPOST('TAKEPOS_ADDON'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
99 
100  // add free text on each terminal of cash desk
101  $res = dolibarr_set_const($db, 'TAKEPOS_HEADER'.$terminaltouse, GETPOST('TAKEPOS_HEADER'.$terminaltouse, 'restricthtml'), 'chaine', 0, '', $conf->entity);
102  $res = dolibarr_set_const($db, 'TAKEPOS_FOOTER'.$terminaltouse, GETPOST('TAKEPOS_FOOTER'.$terminaltouse, 'restricthtml'), 'chaine', 0, '', $conf->entity);
103 
104  dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
105 
106  if (!($res > 0)) {
107  $error++;
108  }
109 
110  if (!$error) {
111  $db->commit();
112  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
113  } else {
114  $db->rollback();
115  setEventMessages($langs->trans("Error"), null, 'errors');
116  }
117 }
118 
119 
120 /*
121  * View
122  */
123 
124 $form = new Form($db);
125 $formproduct = new FormProduct($db);
126 
127 llxHeader('', $langs->trans("CashDeskSetup"));
128 
129 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
130 print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
132 print dol_get_fiche_head($head, 'terminal'.$terminal, 'TakePOS', -1, 'cash-register');
133 print '<br>';
134 
135 
136 // Mode
137 print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 : $terminal).'" method="post">';
138 print '<input type="hidden" name="token" value="'.newToken().'">';
139 print '<input type="hidden" name="action" value="set">';
140 
141 print '<div class="div-table-responsive">';
142 print '<table class="noborder centpercent">';
143 print '<tr class="liste_titre">';
144 print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
145 print "</tr>\n";
146 
147 print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
148 print '<td>';
149 print $form->select_company(getDolGlobalInt('CASHDESK_ID_THIRDPARTY'.$terminaltouse), 'socid', '(s.client IN (1, 3) AND s.status = 1)', 1, 0, 0, array(), 0);
150 print '</td></tr>';
151 
152 $atleastonefound = 0;
153 if (isModEnabled('banque')) {
154  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>';
155  print '<td>';
156  print img_picto('', 'bank_account', 'class="pictofixedwidth"');
157  $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1);
158  if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse)) {
159  $atleastonefound++;
160  }
161  print '</td></tr>';
162  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
163  print '<td>';
164  print img_picto('', 'bank_account', 'class="pictofixedwidth"');
165  $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1);
166  if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse)) {
167  $atleastonefound++;
168  }
169  print '</td></tr>';
170  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCB").'</td>';
171  print '<td>';
172  print img_picto('', 'bank_account', 'class="pictofixedwidth"');
173  $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1);
174  if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse)) {
175  $atleastonefound++;
176  }
177  print '</td></tr>';
178  if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) {
179  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSumup").'</td>';
180  print '<td>';
181  print img_picto('', 'bank_account', 'class="pictofixedwidth"');
182  $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 0, "courant=1", 1);
183  if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse)) {
184  $atleastonefound++;
185  }
186  print '</td></tr>';
187  }
188 
189  foreach ($paiements as $modep) {
190  if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) {
191  continue; // Already managed before
192  }
193  $name = "CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse;
194  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountFor").' '.$langs->trans($modep->label).'</td>';
195  print '<td>';
196  if (!empty($conf->global->$name)) {
197  $atleastonefound++;
198  }
199  $cour = preg_match('/^LIQ.*/', $modep->code) ? 2 : 1;
200  print img_picto('', 'bank_account', 'class="pictofixedwidth"');
201  $form->select_comptes(getDolGlobalInt($name), $name, 0, "courant=".$cour, 1);
202  print '</td></tr>';
203  }
204 }
205 
206 if (isModEnabled('stock')) {
207  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value)
208  print '<td>';
209  if (!isModEnabled('productbatch') || getDolGlobalInt('CASHDESK_FORCE_DECREASE_STOCK')) {
210  print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, getDolGlobalInt('CASHDESK_NO_DECREASE_STOCK'.$terminal), 1);
211  } else {
212  if (getDolGlobalInt('CASHDESK_NO_DECREASE_STOCK'.$terminal)) {
213  $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminal, 1, 'chaine', 0, '', $conf->entity);
214  }
215  print $langs->trans("Yes").'<br>';
216  print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>';
217  }
218  print '</td></tr>';
219 
220  $disabled = $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal};
221 
222 
223  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskIdWareHouse").'</td>'; // Force warehouse (this is not a default value)
224  print '<td class="minwidth300">';
225  if (!$disabled) {
226  print img_picto('', 'bank_account', 'class="pictofixedwidth"');
227  print $formproduct->selectWarehouses($conf->global->{'CASHDESK_ID_WAREHOUSE'.$terminal}, 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled, 0, '', 0, 0, array(), 'maxwidth250');
228  print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?&terminal='.$terminal).'"><span class="fa fa-plus-circle valignmiddle"></span></a>';
229  } else {
230  print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>';
231  }
232  print '</td></tr>';
233 
234  if (isModEnabled('productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK) && !$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) {
235  print '<tr class="oddeven"><td>'.$langs->trans('CashDeskForceDecreaseStockLabel').'</td>';
236  print '<td>';
237  print '<span class="opacitymedium">'.$langs->trans('CashDeskForceDecreaseStockDesc').'</span>';
238  print '</td></tr>';
239  }
240 }
241 
242 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter" || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
243  // Select printer to use with terminal
244  require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
245  $printer = new dolReceiptPrinter($db);
246  if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
247  $printer->listprinters();
248  $printers = array();
249  foreach ($printer->listprinters as $key => $value) {
250  $printers[$value['rowid']] = $value['name'];
251  }
252  print '<tr class="oddeven"><td>'.$langs->trans("MainPrinterToUse").'</td>';
253  print '<td>';
254  print $form->selectarray('TAKEPOS_PRINTER_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$terminal), 1);
255  print '</td></tr>';
256  if (getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')) {
257  print '<tr class="oddeven"><td>'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 1</td>';
258  print '<td>';
259  print $form->selectarray('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal), 1);
260  print '</td></tr>';
261  print '<tr class="oddeven"><td>'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 2</td>';
262  print '<td>';
263  print $form->selectarray('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal), 1);
264  print '</td></tr>';
265  print '<tr class="oddeven"><td>'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 3</td>';
266  print '<td>';
267  print $form->selectarray('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal), 1);
268  print '</td></tr>';
269  }
270  }
271  $printer->listPrintersTemplates();
272  $templates = array();
273  foreach ($printer->listprinterstemplates as $key => $value) {
274  $templates[$value['rowid']] = $value['name'];
275  }
276  print '<tr class="oddeven"><td>'.$langs->trans("MainTemplateToUse").' (<a href="'.DOL_URL_ROOT.'/admin/receiptprinter.php?mode=template">'.$langs->trans("SetupReceiptTemplate").'</a>)</td>';
277  print '<td>';
278  print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal), 1);
279  print '</td></tr>';
280  if (getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')) {
281  print '<tr class="oddeven"><td>'.$langs->trans("OrderTemplateToUse").'</td>';
282  print '<td>';
283  print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal), 1);
284  print '</td></tr>';
285  }
286 }
287 
288 print '<tr class="oddeven"><td>'.$langs->trans('CashDeskReaderKeyCodeForEnter').'</td>';
289 print '<td>';
290 print '<input type="text" name="CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse.'" value="'.getDolGlobalString('CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse).'" />';
291 print '</td></tr>';
292 
293 // Numbering module
294 if (getDolGlobalString('TAKEPOS_ADDON') == "terminal") {
295  print '<tr class="oddeven"><td>';
296  print $langs->trans("BillsNumberingModule");
297  print '<td colspan="2">';
298  $array = array(0=>$langs->trans("Default"));
299  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
300  foreach ($dirmodels as $reldir) {
301  $dir = dol_buildpath($reldir."core/modules/facture/");
302  if (is_dir($dir)) {
303  $handle = opendir($dir);
304  if (is_resource($handle)) {
305  while (($file = readdir($handle)) !== false) {
306  if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) {
307  $filebis = $file;
308  $classname = preg_replace('/\.php$/', '', $file);
309  // For compatibility
310  if (!is_file($dir.$filebis)) {
311  $filebis = $file."/".$file.".modules.php";
312  $classname = "mod_facture_".$file;
313  }
314  // Check if there is a filter on country
315  preg_match('/\-(.*)_(.*)$/', $classname, $reg);
316  if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) {
317  continue;
318  }
319 
320  $classname = preg_replace('/\-.*$/', '', $classname);
321  if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php') {
322  // Charging the numbering class
323  require_once $dir.$filebis;
324 
325  $module = new $classname($db);
326 
327  // Show modules according to features level
328  if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
329  continue;
330  }
331  if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
332  continue;
333  }
334 
335  if ($module->isEnabled()) {
336  $array[preg_replace('/\-.*$/', '', preg_replace('/\.php$/', '', $file))] = preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
337  }
338  }
339  }
340  }
341  closedir($handle);
342  }
343  }
344  }
345  print $form->selectarray('TAKEPOS_ADDON'.$terminaltouse, $array, (empty($conf->global->{'TAKEPOS_ADDON'.$terminaltouse}) ? '0' : $conf->global->{'TAKEPOS_ADDON'.$terminaltouse}), 0);
346  print "</td></tr>\n";
347  print '</table>';
348  print '</div>';
349 }
350 
351 print '</table>';
352 print '</div>';
353 
354 // add free text on each terminal of cash desk
355 $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
356 $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans('Translation');
357 $htmltext = '<i>'.$langs->trans('AvailableVariables').':<br>';
358 foreach ($substitutionarray as $key => $val) {
359  $htmltext .= $key.'<br>';
360 }
361 $htmltext .= '</i>';
362 
363 print '<br>';
364 print load_fiche_titre($langs->trans('FreeLegalTextOnInvoices'), '', '');
365 
366 print '<div class="div-table-responsive-no-min">';
367 print '<table class="noborder centpercent">';
368 print '<tr class="liste_titre">';
369 print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans('Value').'</td>';
370 print '</tr>';
371 
372 // free text on header
373 print '<tr class="oddeven">';
374 print '<td>';
375 print $form->textwithpicto($langs->trans('Header'), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
376 print '</td>';
377 print '<td>';
378 $variablename = 'TAKEPOS_HEADER'.$terminaltouse;
379 if (!getDolGlobalInt('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
380  print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->{$variablename}.'</textarea>';
381 } else {
382  include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
383  $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
384  print $doleditor->Create();
385 }
386 print '</td></tr>';
387 
388 // free text on footer
389 print '<tr class="oddeven">';
390 print '<td>';
391 print $form->textwithpicto($langs->trans('Footer'), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
392 print '</td>';
393 print '<td>';
394 $variablename = 'TAKEPOS_FOOTER'.$terminaltouse;
395 if (!getDolGlobalInt('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
396  print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->{$variablename}.'</textarea>';
397 } else {
398  include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
399  $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
400  print $doleditor->Create();
401 }
402 print '</td></tr>';
403 
404 print '</table>';
405 print '</div>';
406 
407 if ($atleastonefound == 0 && isModEnabled('banque')) {
408  print info_admin($langs->trans("AtLeastOneDefaultBankAccountMandatory"), 0, 0, 'error');
409 }
410 
411 print '<br>';
412 
413 print $form->buttonsSaveCancel("Save", '');
414 
415 print "</form>\n";
416 
417 print '<br>';
418 
419 llxFooter();
420 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
dolReceiptPrinter
Class to manage Receipt Printers.
Definition: dolreceiptprinter.class.php:119
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
dol_buildpath
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Definition: functions.lib.php:1062
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
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
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
getDolGlobalString
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:80
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3747
info_admin
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
Definition: functions.lib.php:4800
FormProduct
Class with static methods for building HTML components related to products Only components common to ...
Definition: html.formproduct.class.php:30
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
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
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
pdf_getSubstitutionArray
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
Definition: pdf.lib.php:737
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
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:93
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
DolEditor
Class to manage a WYSIWYG editor.
Definition: doleditor.class.php:30