dolibarr  13.0.2
other.php
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 
24 require '../../main.inc.php'; // Load $user and permissions
25 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
26 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
29 require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php";
30 
31 // If socid provided by ajax company selector
32 if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) {
33  $_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
34  $_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
35  $_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
36 }
37 
38 // Security check
39 if (!$user->admin) accessforbidden();
40 
41 $langs->loadLangs(array("admin", "cashdesk"));
42 
43 global $db;
44 
45 $sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
46 $sql .= " WHERE entity IN (".getEntity('c_paiement').")";
47 $sql .= " AND active = 1";
48 $sql .= " ORDER BY libelle";
49 $resql = $db->query($sql);
50 $paiements = array();
51 if ($resql) {
52  while ($obj = $db->fetch_object($resql)) {
53  array_push($paiements, $obj);
54  }
55 }
56 
57 
58 /*
59  * Actions
60  */
61 
62 if (GETPOST('action', 'alpha') == 'set') {
63  $db->begin();
64  if (GETPOST('socid', 'int') < 0) $_POST["socid"] = '';
65 
66  $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity);
67  $res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity);
68  $res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity);
69  $res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity);
70  $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity);
71  $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity);
72  $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity);
73  $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity);
74  $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity);
75  $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity);
76  $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity);
77  $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity);
78  $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity);
79  $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity);
80  //$res = dolibarr_set_const($db, "TAKEPOS_HEAD_BAR", GETPOST('TAKEPOS_HEAD_BAR', 'int'), 'int', 0, '', $conf->entity);
81  $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity);
82  if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) {
83  $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_AFFILIATE", GETPOST('TAKEPOS_SUMUP_AFFILIATE', 'alpha'), 'chaine', 0, '', $conf->entity);
84  $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_APPID", GETPOST('TAKEPOS_SUMUP_APPID', 'alpha'), 'chaine', 0, '', $conf->entity);
85  }
86 
87  dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
88 
89  if (!($res > 0)) $error++;
90 
91  if (!$error) {
92  $db->commit();
93  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
94  } else {
95  $db->rollback();
96  setEventMessages($langs->trans("Error"), null, 'errors');
97  }
98 }
99 
100 
101 /*
102  * View
103  */
104 
105 llxHeader('', $langs->trans("CashDeskSetup"));
106 
107 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
108 print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
110 print dol_get_fiche_head($head, 'other', 'TakePOS', -1, 'cash-register');
111 print '<br>';
112 
113 
114 // Mode
115 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
116 print '<input type="hidden" name="token" value="'.newToken().'">';
117 print '<input type="hidden" name="action" value="set">';
118 
119 
120 print '<div class="div-table-responsive-no-min">';
121 
122 // Marketplace
123 print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
124 print '<tr class="liste_titre">'."\n";
125 print '<td class="titlefield" colspan="2">'.$langs->trans("WebSiteDesc").'</td>';
126 print '<td>'.$langs->trans("URL").'</td>';
127 print '</tr>';
128 
129 $url = 'https://www.dolistore.com/45-pos';
130 
131 print '<tr class="oddeven">'."\n";
132 print '<td class="titlefield"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
133 print '<td>'.$langs->trans("DolistorePosCategory").'</td>';
134 print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
135 print '</tr>';
136 
137 print "</table>\n";
138 
139 print '</div>';
140 
141 print '<br>';
142 
143 
144 print '<div class="div-table-responsive-no-min">';
145 
146 // Support
147 print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
148 print '<tr class="liste_titre">'."\n";
149 print '<td colspan="2">TakePOS Support</td>';
150 print '<td>'.$langs->trans("URL").'</td>';
151 print '</tr>';
152 
153 $url = 'http://www.takepos.com';
154 
155 print '<tr class="oddeven">'."\n";
156 print '<td class="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="../img/takepos.png"></a></td>';
157 print '<td>TakePOS original developers</td>';
158 print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
159 print '</tr>';
160 
161 print "</table>\n";
162 
163 print '</div>';
164 print '<br>';
165 
166 llxFooter();
167 $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
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
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(!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
llxFooter()
Empty footer.
Definition: wrapper.php:59