--- /tmp/dsg/dolibarr/htdocs/takepos/admin/github_19.0.3_bar.php +++ /tmp/dsg/dolibarr/htdocs/takepos/admin/client_bar.php @@ -2,3 +2,2 @@ -/* Copyright (C) 2008-2011 Laurent Destailleur - * Copyright (C) 2011-2017 Juanjo Menent - * Copyright (C) 2022 Alexandre Spangaro +/* Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2011-2017 Juanjo Menent @@ -26 +24,0 @@ -// Load Dolibarr environment @@ -35,3 +33 @@ -if (!$user->admin) { - accessforbidden(); -} +if (!$user->admin) accessforbidden(); @@ -41,2 +37 @@ -$res = 0; - +global $db; @@ -48 +43,2 @@ -if (GETPOST('action', 'alpha') == 'set') { +if (GETPOST('action', 'alpha') == 'set') +{ @@ -51,25 +47,14 @@ - dol_syslog("admin/bar"); - - $suplement_category = GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'); - if ($suplement_category < 0) { - $suplement_category = 0; - } - - $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", $suplement_category, 'chaine', 0, '', $conf->entity); - if ($res <= 0) { - $error++; - } - - if (!$error) { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - -if (getDolGlobalInt('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'); + } +} + @@ -84 +68,0 @@ -$arrayofjs = array(); @@ -91,2 +75,3 @@ -$head = takepos_admin_prepare_head(); -print dol_get_fiche_head($head, 'bar', 'TakePOS', -1, 'cash-register'); +$head = takepos_prepare_head(); +dol_fiche_head($head, 'bar', 'TakePOS', -1, 'cash-register'); +print '
'; @@ -111,8 +96,66 @@ -print '
'; -print $langs->trans("EnableBarOrRestaurantFeatures"); -print ajax_constantonoff("TAKEPOS_BAR_RESTAURANT", array(), $conf->entity, 0, 0, 1, 0); -print '
'; - -print '
'; - -if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { +print ' '.$langs->trans("DefineTablePlan").'
'; +print '

'; + +print '
'; +print ''; +print ''; +print ''; +print "\n"; + +if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") { + print ''; + + print ''; +} + +print ''; + +print ''; + +if ($conf->global->TAKEPOS_SUPPLEMENTS) +{ + print '\n"; +} + +print ''; + +print ''; + +print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; + print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; + print ''; + print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); + print '
'; + print $langs->trans("OrderNotes"); + print ''; + print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); + print '
'; +print $langs->trans("BasicPhoneLayout"); +print ''; +//print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); +print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0); +print '
'; +print $langs->trans("ProductSupplements"); +print ''; +//print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); +print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0); +print '
'; + print $langs->trans("SupplementCategory"); + print ''; + print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); + print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); + print "
'; +print 'QR - '.$langs->trans("AutoOrder"); +print ''; +print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0); +print '
'; +print 'QR - '.$langs->trans("CustomerMenu"); +print ''; +print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0); +print '
'; + + +if ($conf->global->TAKEPOS_AUTO_ORDER) +{ @@ -120,4 +162,0 @@ - print ' '.$langs->trans("DefineTablePlan").'
'; - print '

'; - - print '
'; @@ -126 +165 @@ - print ''.$langs->trans("Parameters").''.$langs->trans("Value").''; + print ''.$langs->trans("Table").''.$langs->trans("URL").''.$langs->trans("QR").''; @@ -128,0 +168,29 @@ + //global $dolibarr_main_url_root; + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables"; + $resql = $db->query($sql); + $rows = array(); + while ($row = $db->fetch_array($resql)) { + print ''; + print $langs->trans("Table")." ".$row['label']; + print ''; + print "".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid']).""; + print ''; + print ""; + print ''; + } + + print ''; +} + + +if ($conf->global->TAKEPOS_QR_MENU) +{ + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + print '
'; + print ''; + print ''; + print ''; + print "\n"; @@ -130,4 +198,3 @@ - print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; - print ''; - print ''; - print ''; - } - /*else { - print ''; - print ''; - - print ''; - print ''; - }*/ - - print ''; - print ''; - - print ''; - print ''; - - if (getDolGlobalInt('TAKEPOS_SUPPLEMENTS')) { - print ''; - print '\n"; - } - - print ''; - print ''; - - print ''; - print ''; - @@ -203,54 +203,7 @@ - print ''; - - print '
'; - - print $form->buttonsSaveCancel("Save", ''); -} - -if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { - if (getDolGlobalInt('TAKEPOS_QR_MENU')) { - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - print '
'; - print '
'.$langs->trans("URL").''.$langs->trans("QR").'
'; - print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); + print "".$urlwithroot."/takepos/public/menu.php"; + print ''; + print ""; @@ -135,67 +201,0 @@ - - if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) { - print '
'; - print $langs->trans("OrderNotes"); - print ''; - print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); - print '
'; - print $langs->trans("OrderPrinters"); - print ''; - print ''.$langs->trans("NotAvailableWithBrowserPrinter").''; - print '
'; - print $langs->trans("OrderNotes"); - print ''; - print ''.$langs->trans("NotAvailableWithBrowserPrinter").''; - print '
'; - print $langs->trans("BasicPhoneLayout"); - print ' ('.$langs->trans("Experimental").')'; - print ''; - //print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); - print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0); - print '
'; - print $langs->trans("ProductSupplements"); - print ''; - //print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); - print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0); - print '
'; - print $langs->trans("SupplementCategory"); - print ''; - print img_picto('', 'category', 'class="pictofixedwidth"'); - print $form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalString('TAKEPOS_SUPPLEMENTS_CATEGORY'), 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); - print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); - print "
'; - print 'QR - '.$langs->trans("CustomerMenu"); - print ''; - print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0); - print '
'; - print 'QR - '.$langs->trans("AutoOrder"); - print ''; - print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0); - print '
'; - print ''; - print ''; - print "\n"; - print ''; - print ''; - print '
'.$langs->trans("URL").' - '.$langs->trans("CustomerMenu").''.$langs->trans("QR").'
'; - print ''.$urlwithroot.'/takepos/public/menu.php'; - print ''; - print ''; - print '
'; - } - - if (getDolGlobalInt('TAKEPOS_AUTO_ORDER')) { - print '
'; - print ''; - print ''; - print ''; - print "\n"; - - //global $dolibarr_main_url_root; - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables WHERE entity IN (".getEntity('takepos').")"; - $resql = $db->query($sql); - $rows = array(); - while ($row = $db->fetch_array($resql)) { - print ''; - print ''; - print ''; - } - - print '
'.$langs->trans("Table").''.$langs->trans("URL").' - '.$langs->trans("AutoOrder").''.$langs->trans("QR").'
'; - print $langs->trans("Table")." ".$row['label']; - print ''; - print ''.$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid']).''; - print ''; - print ''; - print '
'; - } -} - +} + +print '
'; + +print '
'; + +print '
'; --- /tmp/dsg/dolibarr/htdocs/takepos/admin/github_19.0.3_orderprinters.php +++ /tmp/dsg/dolibarr/htdocs/takepos/admin/client_orderprinters.php @@ -29 +28,0 @@ -// Load Dolibarr environment @@ -36 +35,3 @@ -$langs->loadLangs(array("main", "categories", "takepos", "printing")); +$langs->loadLangs(array("main"), "categories", "takepos", "printing"); + +if (!$user->rights->categorie->lire) accessforbidden(); @@ -41 +42 @@ -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); @@ -44 +44,0 @@ -$printer3 = GETPOST('printer3', 'alpha'); @@ -46,8 +46 @@ -if (is_numeric($type)) { - $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility -} - -if (!$user->hasRight('categorie', 'lire')) { - accessforbidden(); -} - +if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility @@ -58 +50,0 @@ - @@ -61,4 +53,2 @@ - if (is_array($printer1)) { - foreach ($printer1 as $cat) { - $printedcategories = $printedcategories.$cat.";"; - } + if (is_array($printer1)) foreach ($printer1 as $cat) { + $printedcategories = $printedcategories.$cat.";"; @@ -71,4 +61,2 @@ - if (is_array($printer2)) { - foreach ($printer2 as $cat) { - $printedcategories = $printedcategories.$cat.";"; - } + if (is_array($printer2)) foreach ($printer2 as $cat) { + $printedcategories = $printedcategories.$cat.";"; @@ -77,10 +64,0 @@ -} - -if ($action == "SavePrinter3") { - $printedcategories = ";"; - if (is_array($printer3)) { - foreach ($printer3 as $cat) { - $printedcategories = $printedcategories.$cat.";"; - } - } - dolibarr_set_const($db, "TAKEPOS_PRINTED_CATEGORIES_3", $printedcategories, 'chaine', 0, '', $conf->entity); @@ -97,28 +75,9 @@ -if ($type == Categorie::TYPE_PRODUCT) { - $title = $langs->trans("ProductsCategoriesArea"); - $typetext = 'product'; -} elseif ($type == Categorie::TYPE_SUPPLIER) { - $title = $langs->trans("SuppliersCategoriesArea"); - $typetext = 'supplier'; -} elseif ($type == Categorie::TYPE_CUSTOMER) { - $title = $langs->trans("CustomersCategoriesArea"); - $typetext = 'customer'; -} elseif ($type == Categorie::TYPE_MEMBER) { - $title = $langs->trans("MembersCategoriesArea"); - $typetext = 'member'; -} elseif ($type == Categorie::TYPE_CONTACT) { - $title = $langs->trans("ContactsCategoriesArea"); - $typetext = 'contact'; -} elseif ($type == Categorie::TYPE_ACCOUNT) { - $title = $langs->trans("AccountsCategoriesArea"); - $typetext = 'bank_account'; -} elseif ($type == Categorie::TYPE_PROJECT) { - $title = $langs->trans("ProjectsCategoriesArea"); - $typetext = 'project'; -} elseif ($type == Categorie::TYPE_USER) { - $title = $langs->trans("UsersCategoriesArea"); - $typetext = 'user'; -} else { - $title = $langs->trans("CategoriesArea"); - $typetext = 'unknown'; -} +if ($type == Categorie::TYPE_PRODUCT) { $title = $langs->trans("ProductsCategoriesArea"); $typetext = 'product'; } +elseif ($type == Categorie::TYPE_SUPPLIER) { $title = $langs->trans("SuppliersCategoriesArea"); $typetext = 'supplier'; } +elseif ($type == Categorie::TYPE_CUSTOMER) { $title = $langs->trans("CustomersCategoriesArea"); $typetext = 'customer'; } +elseif ($type == Categorie::TYPE_MEMBER) { $title = $langs->trans("MembersCategoriesArea"); $typetext = 'member'; } +elseif ($type == Categorie::TYPE_CONTACT) { $title = $langs->trans("ContactsCategoriesArea"); $typetext = 'contact'; } +elseif ($type == Categorie::TYPE_ACCOUNT) { $title = $langs->trans("AccountsCategoriesArea"); $typetext = 'bank_account'; } +elseif ($type == Categorie::TYPE_PROJECT) { $title = $langs->trans("ProjectsCategoriesArea"); $typetext = 'project'; } +elseif ($type == Categorie::TYPE_USER) { $title = $langs->trans("UsersCategoriesArea"); $typetext = 'user'; } +else { $title = $langs->trans("CategoriesArea"); $typetext = 'unknown'; } @@ -126,4 +85 @@ -$arrayofjs = array( - '/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', - '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js', -); +$arrayofjs = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); @@ -141 +96,0 @@ -print '
'; @@ -143 +98,2 @@ -print '
'; +//print ''; +print '
'; @@ -144,0 +101,3 @@ + +//print ''; +print '
'; @@ -158 +117,2 @@ -foreach ($fulltree as $key => $val) { +foreach ($fulltree as $key => $val) +{ @@ -163 +122,0 @@ - @@ -165 +123,0 @@ - @@ -169,4 +127,4 @@ - 'rowid'=>$val['rowid'], - 'fk_menu'=>$val['fk_menu'], - 'fk_parent'=>$val['fk_parent'], - 'label'=>$val['label'] + 'rowid'=>$val['rowid'], + 'fk_menu'=>$val['fk_menu'], + 'fk_menu'=>$val['fk_parent'], + 'label'=>$val['label'] @@ -182,2 +140,2 @@ -print ''; -if ($nbofentries > 0) { +if ($nbofentries > 0) +{ @@ -187,8 +145,2 @@ - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1, ';'.$row["rowid"].';') !== false) { - $checked = 'checked'; - } else { - $checked = ''; - } - if ($row["fk_menu"] >= 0) { - print ''.$row["label"].'
'; - } + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_1, ';'.$row["rowid"].';') !== false) $checked = 'checked'; else $checked = ''; + if ($row["fk_menu"] == 0) print ''.$row["label"].'
'; @@ -197 +149,3 @@ -} else { +} +else +{ @@ -208 +162 @@ -print '

'; +print '

'; @@ -216,2 +170,2 @@ -print ''; -if ($nbofentries > 0) { +if ($nbofentries > 0) +{ @@ -221,8 +175,2 @@ - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2, ';'.$row["rowid"].';') !== false) { - $checked = 'checked'; - } else { - $checked = ''; - } - if ($row["fk_menu"] >= 0) { - print ''.$row["label"].'
'; - } + if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_2, ';'.$row["rowid"].';') !== false) $checked = 'checked'; else $checked = ''; + if ($row["fk_menu"] == 0) print ''.$row["label"].'
'; @@ -231 +179,3 @@ -} else { +} +else +{ @@ -242,36 +192 @@ -print ''; - -//Printer3 -print ''; -print ''; -$nbofentries = (count($data) - 1); -print ''; -print ''; -if ($nbofentries > 0) { - print ''; -} else { - print ''; - print ''; - print ''; -} - -print "
'.$langs->trans("Printer").' 3'; -print '
'; - print ''; - foreach ($data as $row) { - if (strpos($conf->global->TAKEPOS_PRINTED_CATEGORIES_3, ';'.$row["rowid"].';') !== false) { - $checked = 'checked'; - } else { - $checked = ''; - } - if ($row["fk_menu"] >= 0) { - print ''.$row["label"].'
'; - } - } - print '
'; - print ''; - print ''; - print '
'.img_picto_common('', 'treemenu/branchbottom.gif').''; - print $langs->trans("NoCategoryYet"); - print ' 
"; -print ''; +print ''; --- /tmp/dsg/dolibarr/htdocs/takepos/admin/github_19.0.3_other.php +++ /tmp/dsg/dolibarr/htdocs/takepos/admin/client_other.php @@ -20 +20 @@ - * \file htdocs/takepos/admin/other.php + * \file htdocs/takepos/admin/setup.php @@ -39,3 +39 @@ -if (!$user->admin) { - accessforbidden(); -} +if (!$user->admin) accessforbidden(); @@ -64 +62,41 @@ -// Nothing +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_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'); + } +} @@ -75,2 +113,2 @@ -$head = takepos_admin_prepare_head(); -print dol_get_fiche_head($head, 'other', 'TakePOS', -1, 'cash-register'); +$head = takepos_prepare_head(); +dol_fiche_head($head, 'other', 'TakePOS', -1, 'cash-register'); @@ -83,0 +122 @@ + @@ -97 +136 @@ -print ''; +print ''; @@ -99 +138 @@ -print ''.$url.''; +print ''.$url.''; @@ -118 +157 @@ -$url = 'https://www.takepos.com'; +$url = 'http://www.takepos.com'; @@ -121 +160 @@ -print ''; +print ''; @@ -123 +162 @@ -print ''.$url.''; +print ''.$url.''; --- /tmp/dsg/dolibarr/htdocs/takepos/admin/github_19.0.3_receipt.php +++ /tmp/dsg/dolibarr/htdocs/takepos/admin/client_receipt.php @@ -2,5 +2,3 @@ -/* Copyright (C) 2008-2011 Laurent Destailleur - * Copyright (C) 2011-2017 Juanjo Menent - * Copyright (C) 2019 Andreu Bisquerra Gaya - * Copyright (C) 2021 Nicolas ZABOURI - * Copyright (C) 2022 Alexandre Spangaro +/* Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2011-2017 Juanjo Menent + * Copyright (C) 2019 Andreu Bisquerra Gaya @@ -19 +17 @@ - * along with this program. If not, see . + * along with this program. If not, see . @@ -23 +21 @@ - * \file htdocs/takepos/admin/receipt.php + * \file htdocs/takepos/admin/terminal.php @@ -28 +25,0 @@ -// Load Dolibarr environment @@ -36,3 +33 @@ -if (!$user->admin) { - accessforbidden(); -} +if (!$user->admin) accessforbidden(); @@ -41 +35,0 @@ - @@ -47 +41,2 @@ -if (GETPOST('action', 'alpha') == 'set') { +if (GETPOST('action', 'alpha') == 'set') +{ @@ -50,2 +45,2 @@ - $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'restricthtml'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'restricthtml'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -53,2 +48,3 @@ - $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, 'TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT', GETPOST('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT', 'alphanohtml'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -58,17 +54,16 @@ - if (!($res > 0)) { - $error++; - } - - if (!$error) { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} elseif (GETPOST('action', 'alpha') == 'setmethod') { - dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); - // TakePOS connector require ReceiptPrinter module - if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && !isModEnabled('receiptprinter')) { - activateModule("modReceiptPrinter"); - } + if (!$res > 0) $error++; + + if (!$error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} +elseif (GETPOST('action', 'alpha') == 'setmethod') +{ + dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -89,2 +84,2 @@ -$head = takepos_admin_prepare_head(); -print dol_get_fiche_head($head, 'receipt', 'TakePOS', -1, 'cash-register'); +$head = takepos_prepare_head(); +dol_fiche_head($head, 'receipt', 'TakePOS', -1, 'cash-register'); @@ -96,3 +91,68 @@ -print load_fiche_titre($langs->trans("Receipt"), '', ''); - -print '
'; +print load_fiche_titre($langs->trans("PrintMethod"), '', ''); + +print ''; +print ''; +print ''; +print "\n"; + +// Browser method +print '\n"; + +// Receipt printer module +if ($conf->global->MAIN_FEATURES_LEVEL >= 1) { + print '\n"; +} + +// TakePOS Connector +print '\n"; +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").'
'; +print $langs->trans('Browser'); +print ''; +print $langs->trans('BrowserMethodDescription'); +print ''; +if ($conf->global->TAKEPOS_PRINT_METHOD == "browser") +{ + print img_picto($langs->trans("Activated"), 'switch_on'); +} +else +{ + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; +} +print "
'; + print $langs->trans('DolibarrReceiptPrinter'); + print ''; + print $langs->trans('ReceiptPrinterMethodDescription'); + print '
'; + print ''.$langs->trans("Setup").''; + print '
'; + if ($conf->receiptprinter->enabled) { + if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") + { + print img_picto($langs->trans("Activated"), 'switch_on'); + } + else + { + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + } + } else { + print ''; + print $langs->trans("ModuleReceiptPrinterMustBeEnabled"); + print ''; + } + print "
'; +print "TakePOS Connector"; +print ''; +print $langs->trans('TakeposConnectorMethodDescription'); +print ''; +if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") +{ + print img_picto($langs->trans("Activated"), 'switch_on'); +} +else +{ + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; +} +print "
'; + +print load_fiche_titre($langs->trans("Setup"), '', ''); + @@ -104,9 +164,10 @@ -// VAT Grouped on ticket -print ''; -print $langs->trans('TicketVatGrouped'); -print ''; -print ajax_constantonoff("TAKEPOS_TICKET_VAT_GROUPPED", array(), $conf->entity, 0, 0, 1, 0); -print "\n"; - -if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "browser" || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { - $substitutionarray = pdf_getSubstitutionArray($langs, array('ticket', 'member', 'candidate'), null, 2, array('company', 'user', 'object', 'system')); +if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { + print ''; + print $langs->trans("URL")." / ".$langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; + print ''; + print ''; + print ''; +} + +if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { + $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); @@ -114 +174,0 @@ - @@ -116,3 +176 @@ - foreach ($substitutionarray as $key => $val) { - $htmltext .= $key.'
'; - } + foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
'; @@ -125,3 +183,6 @@ - if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { - print ''; - } else { + if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) + { + print ''; + } + else + { @@ -129 +190 @@ - $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes'); + $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); @@ -138,3 +199,6 @@ - if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { - print ''; - } else { + if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) + { + print ''; + } + else + { @@ -142 +206 @@ - $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes'); + $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); @@ -148 +212 @@ - print ''; + print ''; @@ -155,45 +219 @@ - print ajax_constantonoff("TAKEPOS_SHOW_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0); - print "\n"; - - // Print payment method - print ''; - print $langs->trans('PrintPaymentMethodOnReceipts'); - print ''; - print ajax_constantonoff("TAKEPOS_PRINT_PAYMENT_METHOD", array(), $conf->entity, 0, 0, 1, 0); - print "\n"; -} - -// Show price without vat -print ''; -print $langs->trans('ShowPriceHTOnReceipt'); -print ''; -print ajax_constantonoff("TAKEPOS_SHOW_HT_RECEIPT", array(), $conf->entity, 0, 0, 1, 0); -print "\n"; - -if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { - print ''; - print $langs->trans('WeighingScale'); - print ''; - print ajax_constantonoff("TAKEPOS_WEIGHING_SCALE", array(), $conf->entity, 0, 0, 1, 0); - print "\n"; -} - -if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { - print ''; - print $langs->trans('CustomerDisplay'); - print ''; - print ajax_constantonoff("TAKEPOS_CUSTOMER_DISPLAY", array(), $conf->entity, 0, 0, 1, 0); - print "\n"; -} - -// Print without details -print ''; -print $langs->trans('PrintWithoutDetailsButton'); -print ''; -print ajax_constantonoff('TAKEPOS_PRINT_WITHOUT_DETAILS', array(), $conf->entity, 0, 0, 1, 0); -print "\n"; -if (getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS')) { - print ''; - print $langs->trans('PrintWithoutDetailsLabelDefault'); - print ''; - print ''; + print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); @@ -207 +227 @@ -print ajax_constantonoff("TAKEPOS_AUTO_PRINT_TICKETS", array(), $conf->entity, 0, 0, 1, 0); +print $form->selectyesno("TAKEPOS_AUTO_PRINT_TICKETS", $conf->global->TAKEPOS_AUTO_PRINT_TICKETS, 1); @@ -210 +229,0 @@ - @@ -212 +230,0 @@ -print '
'; @@ -216 +234 @@ -print $form->buttonsSaveCancel("Save", ''); +print '
'; @@ -219,7 +236,0 @@ - -print load_fiche_titre($langs->trans("Preview"), '', ''); -print '
'; -print '
'; -print ''; -print '
'; -print '
'; --- /tmp/dsg/dolibarr/htdocs/takepos/admin/github_19.0.3_setup.php +++ /tmp/dsg/dolibarr/htdocs/takepos/admin/client_setup.php @@ -2,4 +2,2 @@ -/* Copyright (C) 2008-2011 Laurent Destailleur - * Copyright (C) 2011-2017 Juanjo Menent - * Copyright (C) 2021 Nicolas ZABOURI - * Copyright (C) 2022 Alexandre Spangaro +/* Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2011-2017 Juanjo Menent @@ -27 +24,0 @@ -// Load Dolibarr environment @@ -37 +34,2 @@ -if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) { +if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) +{ @@ -44,3 +42 @@ -if (!$user->admin) { - accessforbidden(); -} +if (!$user->admin) accessforbidden(); @@ -64 +60 @@ -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); @@ -73 +69,2 @@ -if ($action == 'set') { +if ($action == 'set') +{ @@ -74,0 +72 @@ + if (GETPOST('socid', 'int') < 0) $_POST["socid"] = ''; @@ -79,0 +78 @@ + $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -82,2 +81,2 @@ - $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); - if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) { + $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)) { @@ -87,2 +86,4 @@ - if (isModEnabled('barcode')) { - $res = dolibarr_set_const($db, 'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT', GETPOST('TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT', '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); @@ -93,9 +94,10 @@ - if (!($res > 0)) { - $error++; - } - - if (!$error) { - $db->commit(); - } else { - $db->rollback(); - } + if (!$res > 0) $error++; + + if (!$error) + { + $db->commit(); + } + else + { + $db->rollback(); + } @@ -103 +105 @@ - $maskconst = GETPOST('maskconst', 'aZ09'); + $maskconst = GETPOST('maskconst', 'alpha'); @@ -105,4 +107,2 @@ - if ($maskconst && preg_match('/_MASK$/', $maskconst)) { - $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); - } - if (!($res > 0)) { + if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { @@ -132,3 +132 @@ -$help_url = 'EN:Module_Point_of_sale_(TakePOS)'; - -llxHeader('', $langs->trans("CashDeskSetup"), $help_url); +llxHeader('', $langs->trans("CashDeskSetup")); @@ -138,2 +136,2 @@ -$head = takepos_admin_prepare_head(); -print dol_get_fiche_head($head, 'setup', 'TakePOS', -1, 'cash-register'); +$head = takepos_prepare_head(); +dol_fiche_head($head, 'setup', 'TakePOS', -1, 'cash-register'); @@ -147,2 +145 @@ -print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table -print ''; +print '
'; @@ -153,2 +150,2 @@ -print ''; -print ''; +print ''; +print ''; @@ -159 +156,2 @@ -foreach ($dirmodels as $reldir) { +foreach ($dirmodels as $reldir) +{ @@ -162 +160,2 @@ - if (is_dir($dir)) { + if (is_dir($dir)) + { @@ -164 +163,2 @@ - if (is_resource($handle)) { + if (is_resource($handle)) + { @@ -167,2 +167,4 @@ - while (($file = readdir($handle)) !== false) { - if (substr($file, 0, 16) == 'mod_takepos_ref_' && substr($file, dol_strlen($file) - 3, 3) == 'php') { + while (($file = readdir($handle)) !== false) + { + if (substr($file, 0, 16) == 'mod_takepos_ref_' && substr($file, dol_strlen($file) - 3, 3) == 'php') + { @@ -173 +175 @@ - $module = new $file(); + $module = new $file; @@ -176,8 +178,5 @@ - if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { - continue; - } - if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { - continue; - } - - if ($module->isEnabled()) { + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + + if ($module->isEnabled()) + { @@ -185 +184 @@ - print $module->info($langs); + print $module->info(); @@ -191,7 +190,9 @@ - if (preg_match('/^Error/', $tmp)) { - $langs->load("errors"); - print '
'.$langs->trans($tmp).'
'; - } elseif ($tmp == 'NotConfigured') { - print $langs->trans($tmp); - } else { - print $tmp; + if (preg_match('/^Error/', $tmp)) print '
'.$langs->trans($tmp).'
'; + elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); + else print $tmp; + print ''."\n"; + + print ''."\n"; - - print '
'.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''; + if ($conf->global->TAKEPOS_REF_ADDON == "$file") + { + print img_picto($langs->trans("Activated"), 'switch_on'); @@ -199,7 +200,3 @@ - print ''; - if (getDolGlobalString('TAKEPOS_REF_ADDON') == "$file") { - print img_picto($langs->trans("Activated"), 'switch_on'); - } else { - print ''; + else + { + print ''; @@ -224 +221 @@ - if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') @@ -226 +222,0 @@ - } @@ -245,5 +241 @@ -print "
\n"; -print '
'; -print "\n"; - -print '
'; +print "
\n"; @@ -260 +252 @@ -print ''.$langs->trans("Parameters").''.$langs->trans("Value").''; +print ''.$langs->trans("Parameters").''.$langs->trans("Value").''; @@ -266,2 +258,3 @@ -print ''; -print ''; +print ''; +$array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6", 7=>"7", 8=>"8", 9=>"9"); +print $form->selectarray('TAKEPOS_NUM_TERMINALS', $array, (empty($conf->global->TAKEPOS_NUM_TERMINALS) ? '0' : $conf->global->TAKEPOS_NUM_TERMINALS), 0); @@ -271 +264,2 @@ -if (isModEnabled("service")) { +if (!empty($conf->service->enabled)) +{ @@ -274 +268 @@ - print ''; + print ''; @@ -283,2 +277,2 @@ -print ''; -print img_object('', 'category', 'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID'), 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0, 0, 'maxwidth500 widthcentpercentminusx'); +print ''; +print img_object('', 'category', 'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_ROOT_CATEGORY_ID, 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0); @@ -287,0 +282,8 @@ +// VAT Grouped on ticket +print ''; +print $langs->trans('TicketVatGrouped'); +print ''; +print ajax_constantonoff("TAKEPOS_TICKET_VAT_GROUPPED", array(), $conf->entity, 0, 0, 1, 0); +//print $form->selectyesno("TAKEPOS_TICKET_VAT_GROUPPED", $conf->global->TAKEPOS_TICKET_VAT_GROUPPED, 1); +print "\n"; + @@ -291 +293 @@ -print ''; +print ''; @@ -294 +296 @@ -print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, getDolGlobalString('TAKEPOS_SORTPRODUCTFIELD', 'rowid'), 0, 0, 0, '', 1); +print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0, 0, 0, '', 1); @@ -299 +301 @@ -print ''; +print ''; @@ -306,3 +308 @@ -foreach ($substitutionarray as $key => $val) { - $htmltext .= $key.'
'; -} +foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
'; @@ -310,0 +311,8 @@ +// Color theme +print ''; +print $langs->trans("ColorTheme"); +print ''; +$array = array(0=>"Eldy", 1=>$langs->trans("Colorful")); +print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (empty($conf->global->TAKEPOS_COLOR_THEME) ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0); +print "\n"; + @@ -314 +322 @@ -print ''; +print ''; @@ -316 +324 @@ -print $form->selectarray('TAKEPOS_NUMPAD', $array, (!getDolGlobalString('TAKEPOS_NUMPAD') ? '0' : $conf->global->TAKEPOS_NUMPAD), 0); +print $form->selectarray('TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS_NUMPAD) ? '0' : $conf->global->TAKEPOS_NUMPAD), 0); @@ -320 +328 @@ -/*print ''; +print ''; @@ -325 +332,0 @@ -*/ @@ -330 +337 @@ -print ''; +print ''; @@ -346 +353 @@ -print ''; +print ''; @@ -353,8 +360,8 @@ - foreach ($formmail->lines_model as $modelmail) { - //var_dump($modelmail); - $moreonlabel = ''; - if (!empty($arrayofmessagename[$modelmail->label])) { - $moreonlabel = ' ('.$langs->trans("SeveralLangugeVariatFound").')'; - } - $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->topic)).$moreonlabel; - } + foreach ($formmail->lines_model as $modelmail) { + //var_dump($modelmail); + $moreonlabel = ''; + if (!empty($arrayofmessagename[$modelmail->label])) { + $moreonlabel = ' ('.$langs->trans("SeveralLangugeVariatFound").')'; + } + $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->topic)).$moreonlabel; + } @@ -364 +371 @@ -print $form->selectarray('TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename, getDolGlobalString('TAKEPOS_EMAIL_TEMPLATE_INVOICE'), 'None', 1, 0, '', 0, 0, 0, '', 'maxwidth500 widthcentpercentminusx', 1); +print $form->selectarray('TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename, $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE, 'None', 1, 0, '', 0, 0, 0, '', '', 1); @@ -370 +377 @@ -print ''; +print ''; @@ -373,37 +379,0 @@ - -// Gift receipt -print ''; -print $langs->trans('GiftReceiptButton'); -print ''; -print ajax_constantonoff("TAKEPOS_GIFT_RECEIPT", array(), $conf->entity, 0, 0, 1, 0); -print "\n"; - -// Delayed Pay Button -print ''; -print $langs->trans('AllowDelayedPayment'); -print ''; -print ajax_constantonoff("TAKEPOS_DELAYED_PAYMENT", array(), $conf->entity, 0, 0, 1, 0); -print "\n"; - -// Show price without vat -print ''; -print $langs->trans('ShowPriceHT'); -print ''; -print ajax_constantonoff("TAKEPOS_SHOW_HT", array(), $conf->entity, 0, 0, 1, 0); -print "\n"; - -// Use price excl. taxes (HT) and not price incl. taxes (TTC) -print ''; -print $langs->trans('UsePriceHT'); -print ''; -print ajax_constantonoff("TAKEPOS_CHANGE_PRICE_HT", array(), $conf->entity, 0, 0, 1, 0); -print "\n"; - -// Barcode rule to insert product -if (isModEnabled('barcode')) { - print ''; - print $form->textwithpicto($langs->trans("TakeposBarcodeRuleToInsertProduct"), $langs->trans("TakeposBarcodeRuleToInsertProductDesc"), 1, 'help', '', 0, 3, 'barcoderuleonsmartphone'); - print ''; - print ''; - print "\n"; -} @@ -467,0 +438,8 @@ +print ''; +print $langs->trans("EnableBarOrRestaurantFeatures"); +print ''; +print ''; +print ajax_constantonoff("TAKEPOS_BAR_RESTAURANT", array(), $conf->entity, 0, 0, 1, 0); +//print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1); +print "\n"; + @@ -473 +451 @@ -if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) { +if ($conf->global->TAKEPOS_ENABLE_SUMUP) { @@ -486 +464 @@ - print ''; + print ''; @@ -491 +469 @@ - print ''; + print ''; @@ -500 +478 @@ -print $form->buttonsSaveCancel("Save", ''); +print '
'; --- /tmp/dsg/dolibarr/htdocs/takepos/admin/github_19.0.3_terminal.php +++ /tmp/dsg/dolibarr/htdocs/takepos/admin/client_terminal.php @@ -4,2 +3,0 @@ - * Copyright (C) 2021 Thibault FOUCART - * Copyright (C) 2022 Alexandre Spangaro @@ -27 +24,0 @@ -// Load Dolibarr environment @@ -34 +30,0 @@ -require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; @@ -38 +34,2 @@ -if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal.'_id'])) { +if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal.'_id'])) +{ @@ -45,5 +42,3 @@ -if (!$user->admin) { - accessforbidden(); -} - -$langs->loadLangs(array("admin", "cashdesk", "printing", "receiptprinter")); +if (!$user->admin) accessforbidden(); + +$langs->loadLangs(array("admin", "cashdesk", "printing")); @@ -72 +67,2 @@ -if (GETPOST('action', 'alpha') == 'set') { +if (GETPOST('action', 'alpha') == 'set') +{ @@ -74,2 +70 @@ - - $res = dolibarr_set_const($db, "TAKEPOS_TERMINAL_NAME_".$terminaltouse, (!empty(GETPOST('terminalname'.$terminaltouse, 'restricthtml')) ? GETPOST('terminalname'.$terminaltouse, 'restricthtml') : $langs->trans("TerminalName", $terminaltouse)), 'chaine', 0, '', $conf->entity); + if (GETPOST('socid', 'int') < 0) $_POST["socid"] = ''; @@ -82,4 +77 @@ - if (isModEnabled('stripe') && getDolGlobalString('STRIPE_CARD_PRESENT')) { - $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$terminaltouse, GETPOST('CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); - } - if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) { + if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { @@ -89,4 +81,2 @@ - if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) { - continue; - } - $name = "CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse; + if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; + $name = "CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse; @@ -94,9 +84,8 @@ - } - $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); - $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminaltouse, GETPOST('CASHDESK_NO_DECREASE_STOCK'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_PRINTER_TO_USE".$terminaltouse, GETPOST('TAKEPOS_PRINTER_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER1_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER2_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER3_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); - $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); - $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); + } + $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); + $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminaltouse, GETPOST('CASHDESK_NO_DECREASE_STOCK'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_PRINTER_TO_USE".$terminaltouse, GETPOST('TAKEPOS_PRINTER_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER1_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTER2_TO_USE".$terminaltouse, GETPOST('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); + $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); + $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); @@ -108,4 +96,0 @@ - // add free text on each terminal of cash desk - $res = dolibarr_set_const($db, 'TAKEPOS_HEADER'.$terminaltouse, GETPOST('TAKEPOS_HEADER'.$terminaltouse, 'restricthtml'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, 'TAKEPOS_FOOTER'.$terminaltouse, GETPOST('TAKEPOS_FOOTER'.$terminaltouse, 'restricthtml'), 'chaine', 0, '', $conf->entity); - @@ -114,11 +99,12 @@ - if (!($res > 0)) { - $error++; - } - - if (!$error) { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); - } + if (!$res > 0) $error++; + + if (!$error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } @@ -139,2 +125,2 @@ -$head = takepos_admin_prepare_head(); -print dol_get_fiche_head($head, 'terminal'.$terminal, 'TakePOS', -1, 'cash-register'); +$head = takepos_prepare_head(); +dol_fiche_head($head, 'terminal'.$terminal, 'TakePOS', -1, 'cash-register'); @@ -155,5 +140,0 @@ -print ''.$langs->trans("TerminalNameDesc").''; -print ''; -print 'trans("TerminalName", $terminal)).'" >'; -print ''; - @@ -162,3 +143 @@ -print img_picto('', 'company', 'class="pictofixedwidth"'); -$filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; -print $form->select_company(getDolGlobalInt('CASHDESK_ID_THIRDPARTY'.$terminaltouse), 'socid', $filter, 1, 0, 0, array(), 0, 'maxwidth500 widthcentpercentminusx'); +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); @@ -168,9 +147,6 @@ -if (isModEnabled("banque")) { - print ''.$langs->trans("CashDeskBankAccountForSell").''; - print ''; - print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1); - print ' '; - if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse)) { - $atleastonefound++; - } +if (!empty($conf->banque->enabled)) +{ + print ''.$langs->trans("CashDeskBankAccountForSell").''; + print ''; + $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1); + if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse})) $atleastonefound++; @@ -180,6 +156,2 @@ - print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1); - print ' '; - if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse)) { - $atleastonefound++; - } + $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1); + if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse})) $atleastonefound++; @@ -189,46 +161,4 @@ - print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1); - print ' '; - if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse)) { - $atleastonefound++; - } - print ''; - - if (isModEnabled('stripe') && getDolGlobalString('STRIPE_CARD_PRESENT')) { - print ''.$langs->trans("CashDeskBankAccountForStripeTerminal").''; // Force Stripe Terminal - print ''; - $service = 'StripeTest'; - $servicestatus = 0; - if (getDolGlobalString('STRIPE_LIVE') && !GETPOST('forcesandbox', 'alpha')) { - $service = 'StripeLive'; - $servicestatus = 1; - } - global $stripearrayofkeysbyenv; - $site_account = $stripearrayofkeysbyenv[$servicestatus]['secret_key']; - \Stripe\Stripe::setApiKey($site_account); - if (isModEnabled('stripe') && (!getDolGlobalString('STRIPE_LIVE') || GETPOST('forcesandbox', 'alpha'))) { - $service = 'StripeTest'; - $servicestatus = '0'; - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); - } else { - $service = 'StripeLive'; - $servicestatus = '1'; - } - $stripe = new Stripe($db); - $stripeacc = $stripe->getStripeAccount($service); - if ($stripeacc) { - $readers = \Stripe\Terminal\Reader::all('', array("location" => $conf->global->STRIPE_LOCATION, "stripe_account" => $stripeacc)); - } else { - $readers = \Stripe\Terminal\Reader::all('', array("location" => $conf->global->STRIPE_LOCATION)); - } - - $reader = array(); - $reader[""] = $langs->trans("NoReader"); - foreach ($readers as $tmpreader) { - $reader[$tmpreader->id] = $tmpreader->label.' ('.$tmpreader->status.')'; - } - print $form->selectarray('CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse, $reader, getDolGlobalString('CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse)); - print ''; - } - - if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) { + $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1); + if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse})) $atleastonefound++; + print ''; + if ($conf->global->TAKEPOS_ENABLE_SUMUP) { @@ -237,6 +167,2 @@ - print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 0, "courant=1", 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1); - print ' '; - if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse)) { - $atleastonefound++; - } + $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 0, "courant=1", 1); + if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse})) $atleastonefound++; @@ -247,4 +173,2 @@ - if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) { - continue; // Already managed before - } - $name = "CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse; + if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; // Already managed before + $name = "CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse; @@ -253,3 +177 @@ - if (getDolGlobalString($name)) { - $atleastonefound++; - } + if (!empty($conf->global->$name)) $atleastonefound++; @@ -257,36 +179,34 @@ - print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(getDolGlobalInt($name), $name, 0, "courant=".$cour, 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1); - print ' '; - print ''; - } -} - -if (isModEnabled('stock')) { - print ''; - print $form->textwithpicto($langs->trans("CashDeskDoNotDecreaseStock"), $langs->trans("CashDeskDoNotDecreaseStockHelp")); - print ''; // Force warehouse (this is not a default value) - print ''; - print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, getDolGlobalInt('CASHDESK_NO_DECREASE_STOCK'.$terminal), 1); - print ''; - - $disabled = getDolGlobalString('CASHDESK_NO_DECREASE_STOCK'.$terminal); - - - print ''; - if (!$disabled) { - print ''; - } - print $langs->trans("CashDeskIdWareHouse"); - if (!$disabled) { - print ''; - } - if (!getDolGlobalString('CASHDESK_ID_WAREHOUSE'.$terminal)) { - print img_warning($langs->trans("DisableStockChange").' - '.$langs->trans("NoWarehouseDefinedForTerminal")); - } - print ''; // Force warehouse (this is not a default value) - print ''; - if (!$disabled) { - print img_picto('', 'stock', 'class="pictofixedwidth"'); - print $formproduct->selectWarehouses(getDolGlobalString('CASHDESK_ID_WAREHOUSE'.$terminal), 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); - print ' '; - } else { + $form->select_comptes($conf->global->$name, $name, 0, "courant=".$cour, 1); + print ''; + } +} + +if (!empty($conf->stock->enabled)) +{ + print ''.$langs->trans("CashDeskDoNotDecreaseStock").''; // Force warehouse (this is not a default value) + print ''; + if (empty($conf->productbatch->enabled) || !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) { + print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}, 1); + } + else + { + if (!$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) { + $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminal, 1, 'chaine', 0, '', $conf->entity); + } + print $langs->trans("Yes").'
'; + print ''.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').''; + } + print ''; + + $disabled = $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}; + + + print ''.$langs->trans("CashDeskIdWareHouse").''; // Force warehouse (this is not a default value) + print ''; + if (!$disabled) + { + print $formproduct->selectWarehouses($conf->global->{'CASHDESK_ID_WAREHOUSE'.$terminal}, 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled); + print ' '; + } + else + { @@ -297,2 +217 @@ - // Deprecated: CASHDESK_FORCE_DECREASE_STOCK is now always false. No more required/used. - if (isModEnabled('productbatch') && getDolGlobalString('CASHDESK_FORCE_DECREASE_STOCK') && !getDolGlobalString('CASHDESK_NO_DECREASE_STOCK'.$terminal)) { + if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK) && !$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) { @@ -306 +225 @@ -if (isModEnabled('receiptprinter')) { +if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { @@ -310 +228,0 @@ - @@ -316,10 +234,8 @@ - print ''.$langs->trans("MainPrinterToUse"); - print ' ('.$langs->trans("MainPrinterToUseMore").')'; - print ''; - print ''; - print $form->selectarray('TAKEPOS_PRINTER_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$terminal), 1); - print ''; - if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT') && getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')) { - print ''.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 1'; - print ''; - print $form->selectarray('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal), 1); + print ''.$langs->trans("MainPrinterToUse").''; + print ''; + 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); + print ''; + if ($conf->global->TAKEPOS_ORDER_PRINTERS) { + print ''.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 1'; + print ''; + 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); @@ -329,13 +245,3 @@ - print $form->selectarray('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal), 1); - print ''; - print ''.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 3'; - print ''; - print $form->selectarray('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal), 1); - print ''; - } -} - -if (isModEnabled('receiptprinter') || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter" || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { - // Select printer to use with terminal - require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; - $printer = new dolReceiptPrinter($db); + 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); + print ''; + } @@ -347,7 +253,5 @@ - print ''.$langs->trans("MainTemplateToUse"); - print ' ('.$langs->trans("MainTemplateToUseMore").')'; - print ' ('.$langs->trans("SetupReceiptTemplate").')'; - print ''; - print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal), 1); - print ''; - if (getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')) { + print ''.$langs->trans("MainTemplateToUse").''; + print ''; + 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); + print ''; + if ($conf->global->TAKEPOS_ORDER_PRINTERS) { @@ -356 +260 @@ - print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal), 1); + 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); @@ -363 +267 @@ -print ''; +print ''; @@ -367 +271 @@ -if (getDolGlobalString('TAKEPOS_ADDON') == "terminal") { +if ($conf->global->TAKEPOS_ADDON == "terminal") { @@ -371 +275 @@ - $array = array(0 => $langs->trans("Default")); + $array = array(0=>$langs->trans("Default")); @@ -373 +277,2 @@ - foreach ($dirmodels as $reldir) { + foreach ($dirmodels as $reldir) + { @@ -375 +280,2 @@ - if (is_dir($dir)) { + if (is_dir($dir)) + { @@ -377,3 +283,6 @@ - if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { - if (!is_dir($dir.$file) || (substr($file, 0, 1) != '.' && substr($file, 0, 3) != 'CVS')) { + if (is_resource($handle)) + { + while (($file = readdir($handle)) !== false) + { + if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) + { @@ -383 +292,2 @@ - if (!is_file($dir.$filebis)) { + if (!is_file($dir.$filebis)) + { @@ -389,3 +299 @@ - if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) { - continue; - } + if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue; @@ -394 +302,2 @@ - if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php') { + if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php') + { @@ -398 +307 @@ - $module = new $classname($db); + $module = new $classname($db); @@ -401,8 +310,5 @@ - if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { - continue; - } - if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { - continue; - } - - if ($module->isEnabled()) { + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + + if ($module->isEnabled()) + { @@ -418 +324 @@ - print $form->selectarray('TAKEPOS_ADDON'.$terminaltouse, $array, getDolGlobalString('TAKEPOS_ADDON'.$terminaltouse, '0'), 0); + print $form->selectarray('TAKEPOS_ADDON'.$terminaltouse, $array, (empty($conf->global->{'TAKEPOS_ADDON'.$terminaltouse}) ? '0' : $conf->global->{'TAKEPOS_ADDON'.$terminaltouse}), 0); @@ -427,8 +333,4 @@ -// add free text on each terminal of cash desk -$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans('Translation'); -$htmltext = ''.$langs->trans('AvailableVariables').':
'; -foreach ($substitutionarray as $key => $val) { - $htmltext .= $key.'
'; -} -$htmltext .= '
'; +if ($atleastonefound == 0 && !empty($conf->banque->enabled)) +{ + print info_admin($langs->trans("AtLeastOneDefaultBankAccountMandatory"), 0, 0, 'error'); +} @@ -437,50 +339,2 @@ -print load_fiche_titre($langs->trans('FreeLegalTextOnInvoices'), '', ''); - -print '
'; -print ''; -print ''; -print ''; -print ''; - -// free text on header -print ''; -print ''; -print ''; - -// free text on footer -print ''; -print ''; -print ''; - -print '
'.$langs->trans("Parameters").''.$langs->trans('Value').'
'; -print $form->textwithpicto($langs->trans('Header'), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -print '
'; -$variablename = 'TAKEPOS_HEADER'.$terminaltouse; -if (!getDolGlobalInt('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { - print ''; -} else { - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print '
'; -print $form->textwithpicto($langs->trans('Footer'), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -print '
'; -$variablename = 'TAKEPOS_FOOTER'.$terminaltouse; -if (!getDolGlobalInt('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { - print ''; -} else { - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print '
'; -print '
'; - -if ($atleastonefound == 0 && isModEnabled("banque")) { - print info_admin($langs->trans("AtLeastOneDefaultBankAccountMandatory"), 0, 0, 'error'); -} - -print '
'; - -print $form->buttonsSaveCancel("Save", ''); + +print '
';