dolibarr  13.0.2
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  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 require '../../main.inc.php'; // Load $user and permissions
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
30 require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php";
31 
32 $terminal = GETPOST('terminal', 'int');
33 // If socid provided by ajax company selector
34 if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal.'_id']))
35 {
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) accessforbidden();
43 
44 $langs->loadLangs(array("admin", "cashdesk", "printing", "receiptprinter"));
45 
46 global $db;
47 
48 $sql = "SELECT code, libelle as label FROM ".MAIN_DB_PREFIX."c_paiement";
49 $sql .= " WHERE entity IN (".getEntity('c_paiement').")";
50 $sql .= " AND active = 1";
51 $sql .= " ORDER BY libelle";
52 $resql = $db->query($sql);
53 $paiements = array();
54 if ($resql) {
55  while ($obj = $db->fetch_object($resql)) {
56  array_push($paiements, $obj);
57  }
58 }
59 
60 $terminaltouse = $terminal;
61 
62 
63 /*
64  * Actions
65  */
66 
67 if (GETPOST('action', 'alpha') == 'set')
68 {
69  $db->begin();
70  if (GETPOST('socid', 'int') < 0) $_POST["socid"] = '';
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 (!empty($conf->global->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'))) continue;
82  $name = "CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse;
83  $res = dolibarr_set_const($db, $name, (GETPOST($name, 'alpha') > 0 ? GETPOST($name, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
84  }
85  $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);
86  $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminaltouse, GETPOST('CASHDESK_NO_DECREASE_STOCK'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
87  $res = dolibarr_set_const($db, "TAKEPOS_PRINTER_TO_USE".$terminaltouse, GETPOST('TAKEPOS_PRINTER_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
88  $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER1_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
89  $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER2_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
90  $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER3_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
91  $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);
92  $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);
93 
94  $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);
95 
96  $res = dolibarr_set_const($db, "TAKEPOS_ADDON".$terminaltouse, GETPOST('TAKEPOS_ADDON'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
97 
98  // add free text on each terminal of cash desk
99  $res = dolibarr_set_const($db, 'TAKEPOS_HEADER'.$terminaltouse, GETPOST('TAKEPOS_HEADER'.$terminaltouse, 'restricthtml'), 'chaine', 0, '', $conf->entity);
100  $res = dolibarr_set_const($db, 'TAKEPOS_FOOTER'.$terminaltouse, GETPOST('TAKEPOS_FOOTER'.$terminaltouse, 'restricthtml'), 'chaine', 0, '', $conf->entity);
101 
102  dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
103 
104  if (!($res > 0)) $error++;
105 
106  if (!$error)
107  {
108  $db->commit();
109  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
110  } else {
111  $db->rollback();
112  setEventMessages($langs->trans("Error"), null, 'errors');
113  }
114 }
115 
116 
117 /*
118  * View
119  */
120 
121 $form = new Form($db);
122 $formproduct = new FormProduct($db);
123 
124 llxHeader('', $langs->trans("CashDeskSetup"));
125 
126 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
127 print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
129 print dol_get_fiche_head($head, 'terminal'.$terminal, 'TakePOS', -1, 'cash-register');
130 print '<br>';
131 
132 
133 // Mode
134 print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 : $terminal).'" method="post">';
135 print '<input type="hidden" name="token" value="'.newToken().'">';
136 print '<input type="hidden" name="action" value="set">';
137 
138 print '<div class="div-table-responsive">';
139 print '<table class="noborder centpercent">';
140 print '<tr class="liste_titre">';
141 print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
142 print "</tr>\n";
143 
144 print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
145 print '<td>';
146 print $form->select_company($conf->global->{'CASHDESK_ID_THIRDPARTY'.$terminaltouse}, 'socid', '(s.client IN (1, 3) AND s.status = 1)', 1, 0, 0, array(), 0);
147 print '</td></tr>';
148 
149 $atleastonefound = 0;
150 if (!empty($conf->banque->enabled))
151 {
152  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>';
153  print '<td>';
154  $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1);
155  if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse})) $atleastonefound++;
156  print '</td></tr>';
157  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
158  print '<td>';
159  $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1);
160  if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse})) $atleastonefound++;
161  print '</td></tr>';
162  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCB").'</td>';
163  print '<td>';
164  $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1);
165  if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse})) $atleastonefound++;
166  print '</td></tr>';
167  if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
168  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSumup").'</td>';
169  print '<td>';
170  $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 0, "courant=1", 1);
171  if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse})) $atleastonefound++;
172  print '</td></tr>';
173  }
174 
175  foreach ($paiements as $modep) {
176  if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; // Already managed before
177  $name = "CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse;
178  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountFor").' '.$langs->trans($modep->label).'</td>';
179  print '<td>';
180  if (!empty($conf->global->$name)) $atleastonefound++;
181  $cour = preg_match('/^LIQ.*/', $modep->code) ? 2 : 1;
182  $form->select_comptes($conf->global->$name, $name, 0, "courant=".$cour, 1);
183  print '</td></tr>';
184  }
185 }
186 
187 if (!empty($conf->stock->enabled))
188 {
189  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value)
190  print '<td>';
191  if (empty($conf->productbatch->enabled) || !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
192  print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}, 1);
193  } else {
194  if (!$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) {
195  $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminal, 1, 'chaine', 0, '', $conf->entity);
196  }
197  print $langs->trans("Yes").'<br>';
198  print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>';
199  }
200  print '</td></tr>';
201 
202  $disabled = $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal};
203 
204 
205  print '<tr class="oddeven"><td>'.$langs->trans("CashDeskIdWareHouse").'</td>'; // Force warehouse (this is not a default value)
206  print '<td class="minwidth300">';
207  if (!$disabled)
208  {
209  print $formproduct->selectWarehouses($conf->global->{'CASHDESK_ID_WAREHOUSE'.$terminal}, 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled, 0, '', 0, 0, array(), 'maxwidth250');
210  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>';
211  } else {
212  print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>';
213  }
214  print '</td></tr>';
215 
216  if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK) && !$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) {
217  print '<tr class="oddeven"><td>'.$langs->trans('CashDeskForceDecreaseStockLabel').'</td>';
218  print '<td>';
219  print '<span class="opacitymedium">'.$langs->trans('CashDeskForceDecreaseStockDesc').'</span>';
220  print '</td></tr>';
221  }
222 }
223 
224 if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") {
225  // Select printer to use with terminal
226  require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
227  $printer = new dolReceiptPrinter($db);
228  if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
229  $printer->listprinters();
230  $printers = array();
231  foreach ($printer->listprinters as $key => $value) {
232  $printers[$value['rowid']] = $value['name'];
233  }
234  print '<tr class="oddeven"><td>'.$langs->trans("MainPrinterToUse").'</td>';
235  print '<td>';
236  print $form->selectarray('TAKEPOS_PRINTER_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$terminal}), 1);
237  print '</td></tr>';
238  if ($conf->global->TAKEPOS_ORDER_PRINTERS) {
239  print '<tr class="oddeven"><td>'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 1</td>';
240  print '<td>';
241  print $form->selectarray('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal}), 1);
242  print '</td></tr>';
243  print '<tr class="oddeven"><td>'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 2</td>';
244  print '<td>';
245  print $form->selectarray('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal}), 1);
246  print '</td></tr>';
247  print '<tr class="oddeven"><td>'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 3</td>';
248  print '<td>';
249  print $form->selectarray('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal}), 1);
250  print '</td></tr>';
251  }
252  }
253  $printer->listPrintersTemplates();
254  $templates = array();
255  foreach ($printer->listprinterstemplates as $key => $value) {
256  $templates[$value['rowid']] = $value['name'];
257  }
258  print '<tr class="oddeven"><td>'.$langs->trans("MainTemplateToUse").' (<a href="'.DOL_URL_ROOT.'/admin/receiptprinter.php?mode=template">'.$langs->trans("SetupReceiptTemplate").'</a>)</td>';
259  print '<td>';
260  print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, (empty($conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}), 1);
261  print '</td></tr>';
262  if ($conf->global->TAKEPOS_ORDER_PRINTERS) {
263  print '<tr class="oddeven"><td>'.$langs->trans("OrderTemplateToUse").'</td>';
264  print '<td>';
265  print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal, $templates, (empty($conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal}), 1);
266  print '</td></tr>';
267  }
268 }
269 
270 print '<tr class="oddeven"><td>'.$langs->trans('CashDeskReaderKeyCodeForEnter').'</td>';
271 print '<td>';
272 print '<input type="text" name="CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse.'" value="'.$conf->global->{'CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse}.'" />';
273 print '</td></tr>';
274 
275 // Numbering module
276 if ($conf->global->TAKEPOS_ADDON == "terminal") {
277  print '<tr class="oddeven"><td>';
278  print $langs->trans("BillsNumberingModule");
279  print '<td colspan="2">';
280  $array = array(0=>$langs->trans("Default"));
281  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
282  foreach ($dirmodels as $reldir)
283  {
284  $dir = dol_buildpath($reldir."core/modules/facture/");
285  if (is_dir($dir))
286  {
287  $handle = opendir($dir);
288  if (is_resource($handle))
289  {
290  while (($file = readdir($handle)) !== false)
291  {
292  if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
293  {
294  $filebis = $file;
295  $classname = preg_replace('/\.php$/', '', $file);
296  // For compatibility
297  if (!is_file($dir.$filebis))
298  {
299  $filebis = $file."/".$file.".modules.php";
300  $classname = "mod_facture_".$file;
301  }
302  // Check if there is a filter on country
303  preg_match('/\-(.*)_(.*)$/', $classname, $reg);
304  if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
305 
306  $classname = preg_replace('/\-.*$/', '', $classname);
307  if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php')
308  {
309  // Charging the numbering class
310  require_once $dir.$filebis;
311 
312  $module = new $classname($db);
313 
314  // Show modules according to features level
315  if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
316  if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
317 
318  if ($module->isEnabled())
319  {
320  $array[preg_replace('/\-.*$/', '', preg_replace('/\.php$/', '', $file))] = preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
321  }
322  }
323  }
324  }
325  closedir($handle);
326  }
327  }
328  }
329  print $form->selectarray('TAKEPOS_ADDON'.$terminaltouse, $array, (empty($conf->global->{'TAKEPOS_ADDON'.$terminaltouse}) ? '0' : $conf->global->{'TAKEPOS_ADDON'.$terminaltouse}), 0);
330  print "</td></tr>\n";
331  print '</table>';
332  print '</div>';
333 }
334 
335 print '</table>';
336 print '</div>';
337 
338 // add free text on each terminal of cash desk
339 $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
340 $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans('Translation');
341 $htmltext = '<i>'.$langs->trans('AvailableVariables').':<br>';
342 foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
343 $htmltext .= '</i>';
344 
345 print '<br>';
346 print load_fiche_titre($langs->trans('FreeLegalTextOnInvoices'), '', '');
347 
348 print '<div class="div-table-responsive">';
349 print '<table class="noborder centpercent">';
350 print '<tr class="liste_titre">';
351 print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans('Value').'</td>';
352 print '</tr>';
353 
354 // free text on header
355 print '<tr class="oddeven">';
356 print '<td>';
357 print $form->textwithpicto($langs->trans('Header'), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
358 print '</td>';
359 print '<td>';
360 $variablename = 'TAKEPOS_HEADER'.$terminaltouse;
361 if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
362  print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->{$variablename}.'</textarea>';
363 } else {
364  include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
365  $doleditor = new DolEditor($variablename, $conf->global->{$variablename}, '', 80, 'dolibarr_notes');
366  print $doleditor->Create();
367 }
368 print '</td></tr>';
369 
370 // free text on footer
371 print '<tr class="oddeven">';
372 print '<td>';
373 print $form->textwithpicto($langs->trans('Footer'), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
374 print '</td>';
375 print '<td>';
376 $variablename = 'TAKEPOS_FOOTER'.$terminaltouse;
377 if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
378  print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->{$variablename}.'</textarea>';
379 } else {
380  include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
381  $doleditor = new DolEditor($variablename, $conf->global->{$variablename}, '', 80, 'dolibarr_notes');
382  print $doleditor->Create();
383 }
384 print '</td></tr>';
385 
386 print '</table>';
387 print '</div>';
388 
389 if ($atleastonefound == 0 && !empty($conf->banque->enabled))
390 {
391  print info_admin($langs->trans("AtLeastOneDefaultBankAccountMandatory"), 0, 0, 'error');
392 }
393 
394 print '<br>';
395 
396 print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
397 
398 print "</form>\n";
399 
400 print '<br>';
401 
402 llxFooter();
403 $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
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
takepos_admin_prepare_head()
Prepare array with list of tabs.
Definition: takepos.lib.php:29
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Class to manage Receipt Printers.
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 ...
print $_SERVER["PHP_SELF"]
Edit parameters.
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:643
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
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
Class to manage a WYSIWYG editor.
llxFooter()
Empty footer.
Definition: wrapper.php:59
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.