dolibarr  13.0.2
bar.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 // Security check
33 if (!$user->admin) accessforbidden();
34 
35 $langs->loadLangs(array("admin", "cashdesk", "printing"));
36 
37 $res = 0;
38 
39 
40 /*
41  * Actions
42  */
43 
44 if (GETPOST('action', 'alpha') == 'set')
45 {
46  $db->begin();
47 
48  dol_syslog("admin/bar");
49 
50  $suplement_category = GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha');
51  if ($suplement_category < 0) $suplement_category = 0;
52 
53  $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", $suplement_category, 'chaine', 0, '', $conf->entity);
54  if ($res <= 0) {
55  $error++;
56  }
57 
58  if (!$error)
59  {
60  $db->commit();
61  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
62  } else {
63  $db->rollback();
64  setEventMessages($langs->trans("Error"), null, 'errors');
65  }
66 }
67 
68 if ($conf->global->TAKEPOS_ORDER_NOTES == 1) {
69  $extrafields = new ExtraFields($db);
70  $extrafields->addExtraField('order_notes', 'Order notes', 'varchar', 0, 255, 'facturedet', 0, 0, '', '', 0, '', 0, 1);
71 }
72 
73 /*
74  * View
75  */
76 
77 $form = new Form($db);
78 $formproduct = new FormProduct($db);
79 
80 $arrayofcss = array("/takepos/css/colorbox.css");
81 
82 llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, $arrayofjs, $arrayofcss);
83 
84 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
85 print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
87 print dol_get_fiche_head($head, 'bar', 'TakePOS', -1, 'cash-register');
88 
89 
90 // Mode
91 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
92 print '<input type="hidden" name="token" value="'.newToken().'">';
93 print '<input type="hidden" name="action" value="set">';
94 
95 ?>
96 <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/takepos/js/jquery.colorbox-min.js"></script> <!-- TODO It seems we don't need this -->
97 <script type="text/javascript">
98 function Floors() {
99  console.log("Open box to select floor");
100  $.colorbox({href:"<?php echo DOL_URL_ROOT ?>/takepos/floors.php?mode=edit&place=0", width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors"); ?>"});
101 }
102 </script>
103 
104 <?php
105 
106 print $langs->trans("EnableBarOrRestaurantFeatures");
107 print ajax_constantonoff("TAKEPOS_BAR_RESTAURANT", array(), $conf->entity, 0, 0, 1, 0);
108 
109 print '<br>';
110 
111 if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
112  print '<br>';
113  print '<a href="" onclick="Floors(); return false;"><span class="fa fa-glass-cheers"></span> '.$langs->trans("DefineTablePlan").'</a><br>';
114  print '<br><br>';
115 
116  print '<div class="div-table-responsive-no-min">';
117  print '<table class="noborder centpercent">';
118  print '<tr class="liste_titre">';
119  print '<td class="titlefieldcreate">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
120  print "</tr>\n";
121 
122  if ($conf->global->TAKEPOS_PRINT_METHOD != "browser") {
123  print '<tr class="oddeven value"><td>';
124  print $langs->trans("OrderPrinters").' (<a href="'.DOL_URL_ROOT.'/takepos/admin/orderprinters.php?leftmenu=setup">'.$langs->trans("Setup").'</a>)';
125  print '</td>';
126  print '<td>';
127  print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0);
128  //print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1);
129  print '</td></tr>';
130 
131  print '<tr class="oddeven value"><td>';
132  print $langs->trans("OrderNotes");
133  print '</td>';
134  print '<td>';
135  print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0);
136  //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1);
137  print '</td></tr>';
138  }
139 
140  print '<tr class="oddeven value"><td>';
141  print $langs->trans("BasicPhoneLayout");
142  print '</td>';
143  print '<td>';
144  //print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1);
145  print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0);
146  print '</td></tr>';
147 
148  print '<tr class="oddeven value"><td>';
149  print $langs->trans("ProductSupplements");
150  print '</td>';
151  print '<td>';
152  //print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1);
153  print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0);
154  print '</td></tr>';
155 
156  if ($conf->global->TAKEPOS_SUPPLEMENTS)
157  {
158  print '<tr class="oddeven"><td>';
159  print $langs->trans("SupplementCategory");
160  print '</td>';
161  print '<td>';
162  print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0);
163  print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY');
164  print "</td></tr>\n";
165  }
166 
167  print '<tr class="oddeven value"><td>';
168  print 'QR - '.$langs->trans("CustomerMenu");
169  print '</td>';
170  print '<td>';
171  print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0);
172  print '</td></tr>';
173 
174  print '<tr class="oddeven value"><td>';
175  print 'QR - '.$langs->trans("AutoOrder");
176  print '</td>';
177  print '<td>';
178  print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0);
179  print '</td></tr>';
180 
181  print '</table>';
182  print '</div>';
183 
184  print '<br>';
185 
186  print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
187 }
188 
189 if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
190  if ($conf->global->TAKEPOS_QR_MENU)
191  {
192  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
193  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
194  print '<br>';
195  print '<table class="noborder centpercent">';
196  print '<tr class="liste_titre">';
197  print '<td>'.$langs->trans("URL").'</td><td class="right">'.$langs->trans("QR").'</td>';
198  print "</tr>\n";
199  print '<tr class="oddeven value"><td>';
200  print "<a target='_blank' href='".$urlwithroot."/takepos/public/menu.php'>".$urlwithroot."/takepos/public/menu.php</a>";
201  print '</td>';
202  print '<td class="right">';
203  print "<a target='_blank' href='printqr.php'><img src='".DOL_URL_ROOT."/takepos/genimg/qr.php' height='42' width='42'></a>";
204  print '</td></tr>';
205  print '</table>';
206  }
207 
208  if ($conf->global->TAKEPOS_AUTO_ORDER)
209  {
210  print '<br>';
211  print '<table class="noborder centpercent">';
212  print '<tr class="liste_titre">';
213  print '<td>'.$langs->trans("Table").'</td><td>'.$langs->trans("URL").'</td><td class="right">'.$langs->trans("QR").'</td>';
214  print "</tr>\n";
215 
216  //global $dolibarr_main_url_root;
217  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
218  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
219  $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables";
220  $resql = $db->query($sql);
221  $rows = array();
222  while ($row = $db->fetch_array($resql)) {
223  print '<tr class="oddeven value"><td>';
224  print $langs->trans("Table")." ".$row['label'];
225  print '</td>';
226  print '<td>';
227  print "<a target='_blank' href='".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."'>".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."</a>";
228  print '</td>';
229  print '<td class="right">';
230  print "<a target='_blank' href='printqr.php?id=".$row['rowid']."'><img src='".DOL_URL_ROOT."/takepos/genimg/qr.php?key=".dol_encode($row['rowid'])."' height='42' width='42'></a>";
231  print '</td></tr>';
232  }
233 
234  print '</table>';
235  }
236 }
237 
238 
239 print "</form>\n";
240 
241 print '<br>';
242 
243 llxFooter();
244 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
</td >< tdcolspan="3">< spanclass="opacitymedium"></span ></td ></tr >< trclass="liste_total"> CREANCES DETTES< tdcolspan="3"class="right"></td >< tdcolspan="3"class="right"></td ></tr > CREANCES DETTES RECETTES DEPENSES trips CREANCES DETTES Y m expensereport p date_valid Y m expensereport pe datep $db idate($date_start)."' AND $column < p rowid
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
Class to manage standard extra fields.
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
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
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:105