diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index 65ad4c091a0..6cf8189f3c8 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -52,7 +52,12 @@ function takepos_prepare_head() $h++; } - complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos'); + $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/other.php'; + $head[$h][1] = $langs->trans("Other"); + $head[$h][2] = 'other'; + $h++; + + complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos'); return $head; } diff --git a/htdocs/takepos/admin/other.php b/htdocs/takepos/admin/other.php new file mode 100644 index 00000000000..ddaaf7dac51 --- /dev/null +++ b/htdocs/takepos/admin/other.php @@ -0,0 +1,179 @@ + + * Copyright (C) 2011-2017 Juanjo Menent + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/takepos/admin/setup.php + * \ingroup takepos + * \brief Setup page for TakePos module + */ + +require '../../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php"; + +// If socid provided by ajax company selector +if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) +{ + $_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); + $_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); + $_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); +} + +// Security check +if (!$user->admin) accessforbidden(); + +$langs->loadLangs(array("admin", "cashdesk")); + +global $db; + +$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement"; +$sql .= " WHERE entity IN (".getEntity('c_paiement').")"; +$sql .= " AND active = 1"; +$sql .= " ORDER BY libelle"; +$resql = $db->query($sql); +$paiements = array(); +if ($resql) { + while ($obj = $db->fetch_object($resql)) { + array_push($paiements, $obj); + } +} + +/* + * Actions + */ +if (GETPOST('action', 'alpha') == 'set') +{ + $db->begin(); + if (GETPOST('socid', 'int') < 0) $_POST["socid"] = ''; + + $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_CUSTOM_RECEIPT", GETPOST('TAKEPOS_CUSTOM_RECEIPT', 'int'), 'int', 0, '', $conf->entity); + //$res = dolibarr_set_const($db, "TAKEPOS_HEAD_BAR", GETPOST('TAKEPOS_HEAD_BAR', 'int'), 'int', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); + if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { + $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_AFFILIATE", GETPOST('TAKEPOS_SUMUP_AFFILIATE', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_APPID", GETPOST('TAKEPOS_SUMUP_APPID', 'alpha'), 'chaine', 0, '', $conf->entity); + } + if ($conf->global->TAKEPOS_ORDER_NOTES == 1) + { + $extrafields = new ExtraFields($db); + $extrafields->addExtraField('order_notes', 'Order notes', 'varchar', 0, 255, 'facturedet', 0, 0, '', '', 0, '', 0, 1); + } + + dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); + + if (!$res > 0) $error++; + + if (!$error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +/* + * View + */ + +$form = new Form($db); +$formproduct = new FormProduct($db); + +llxHeader('', $langs->trans("CashDeskSetup")); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); +$head = takepos_prepare_head(); +dol_fiche_head($head, 'other', 'TakePOS', -1); +print '
'; + + +// Mode +print '
'; +print ''; +print ''; + + +print '
'; + +// Marketplace +print "\n"; +print "\n"; +print ''; +print ''; +print ''; + +print "\n"; +$url = 'https://www.dolistore.com/45-pos'; +print ''; +print ''; +print ''; +print ''; + +print "
'.$langs->trans("WebSiteDesc").''.$langs->trans("URL").'
'.$langs->trans("DolistorePosCategory").''.$url.'
\n"; + +print '
'; + +print '
'; + + + + +print '
'; + +// Support +print "\n"; +print "\n"; +print ''; +print ''; +print ''; + +print "\n"; +$url = 'http://www.takepos.com'; +print ''; +print ''; +print ''; +print ''; + +print "
TakePOS Support'.$langs->trans("URL").'
TakePOS original developers'.$url.'
\n"; + +print '
'; +print '
'; + +llxFooter(); +$db->close(); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 086a929b723..5b6fe25af44 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -175,11 +175,8 @@ print ''; print $langs->trans("SortProductField"); print ''; $prod = new Product($db); -$array = []; -foreach ($prod->fields as $k => $v) { - $array[$k] = $k; -} -print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0); +$array = array('rowid' => 'ID', 'ref' => 'Ref', 'datec' => 'DateCreation', 'tms' => 'DateModification'); +print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0, 0, 0, '', 1); print "\n"; $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); @@ -343,42 +340,5 @@ print '
\n"; - -print '

'; - -// Marketplace -print "\n"; -print "\n"; -print ''; -print ''; -print ''; - -print "\n"; -$url = 'https://www.dolistore.com/45-pos'; - print ''; -print ''; -print ''; -print ''; - -print "
'.$langs->trans("WebSiteDesc").''.$langs->trans("URL").'
'.$langs->trans("DolistorePosCategory").''.$url.'
\n"; -print '
'; - -// Support -print "\n"; -print "\n"; -print ''; -print ''; -print ''; - -print "\n"; -$url = 'http://www.takepos.com'; -print ''; -print ''; -print ''; -print ''; - -print "
TakePOS Support'.$langs->trans("URL").'
TakePOS original developers'.$url.'
\n"; -print '
'; - llxFooter(); $db->close();