appearance.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <?php
  2. /* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
  4. * Copyright (C) 2019-2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/takepos/admin/appearance.php
  21. * \ingroup takepos
  22. * \brief Setup page for TakePos module
  23. */
  24. // Load Dolibarr environment
  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."/core/lib/takepos.lib.php";
  30. // Security check
  31. if (!$user->admin) {
  32. accessforbidden();
  33. }
  34. $langs->loadLangs(array("admin", "cashdesk", "commercial"));
  35. /*
  36. * Actions
  37. */
  38. if (GETPOST('action', 'alpha') == 'set') {
  39. $db->begin();
  40. $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity);
  41. $res = dolibarr_set_const($db, "TAKEPOS_LINES_TO_SHOW", GETPOST('TAKEPOS_LINES_TO_SHOW', 'alpha'), 'chaine', 0, '', $conf->entity);
  42. dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
  43. if (!($res > 0)) {
  44. $error++;
  45. }
  46. if (!$error) {
  47. $db->commit();
  48. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  49. } else {
  50. $db->rollback();
  51. setEventMessages($langs->trans("Error"), null, 'errors');
  52. }
  53. } elseif (GETPOST('action', 'alpha') == 'setmethod') {
  54. dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity);
  55. }
  56. /*
  57. * View
  58. */
  59. $form = new Form($db);
  60. $formproduct = new FormProduct($db);
  61. llxHeader('', $langs->trans("CashDeskSetup"));
  62. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  63. print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
  64. $head = takepos_admin_prepare_head();
  65. print dol_get_fiche_head($head, 'appearance', 'TakePOS', -1, 'cash-register');
  66. print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 : $terminal).'" method="post">';
  67. print '<input type="hidden" name="token" value="'.newToken().'">';
  68. print '<input type="hidden" name="action" value="set">';
  69. print '<table class="noborder centpercent">';
  70. print '<tr class="liste_titre">';
  71. print '<td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
  72. print "</tr>\n";
  73. // Color theme
  74. print '<tr class="oddeven"><td>';
  75. print $langs->trans("ColorTheme");
  76. print '<td colspan="2">';
  77. $array = array(0=>"Eldy", 1=>$langs->trans("Colorful"));
  78. print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (empty($conf->global->TAKEPOS_COLOR_THEME) ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0);
  79. print "</td></tr>\n";
  80. // Hide category images to speed up
  81. print '<tr class="oddeven"><td>';
  82. print $langs->trans('HideCategoryImages');
  83. print '<td colspan="2">';
  84. print ajax_constantonoff("TAKEPOS_HIDE_CATEGORY_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
  85. print "</td></tr>\n";
  86. // Hide category images to speed up
  87. print '<tr class="oddeven"><td>';
  88. print $langs->trans('HideProductImages');
  89. print '<td colspan="2">';
  90. print ajax_constantonoff("TAKEPOS_HIDE_PRODUCT_IMAGES", array(), $conf->entity, 0, 0, 1, 0);
  91. print "</td></tr>\n";
  92. // Lines to show
  93. print '<tr class="oddeven"><td>';
  94. print $langs->trans("NumberOfLinesToShow");
  95. print '<td colspan="2">';
  96. $array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6");
  97. print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, getDolGlobalInt('TAKEPOS_LINES_TO_SHOW', 2), 0);
  98. print "</td></tr>\n";
  99. // D'ont display category
  100. print '<tr class="oddeven"><td>';
  101. print $langs->trans('HideCategories');
  102. print '<td colspan="2">';
  103. print ajax_constantonoff("TAKEPOS_HIDE_CATEGORIES", array(), $conf->entity, 0, 0, 1, 0);
  104. print "</td></tr>\n";
  105. // Hide stock on line
  106. print '<tr class="oddeven"><td>';
  107. print $langs->trans('HideStockOnLine');
  108. print '<td colspan="2">';
  109. print ajax_constantonoff("TAKEPOS_HIDE_STOCK_ON_LINE", array(), $conf->entity, 0, 0, 1, 0);
  110. print "</td></tr>\n";
  111. // Only the products in stock
  112. print '<tr class="oddeven"><td>';
  113. print $langs->trans('ShowOnlyProductInStock');
  114. print '<td colspan="2">';
  115. print ajax_constantonoff("TAKEPOS_PRODUCT_IN_STOCK", array(), $conf->entity, 0, 0, 1, 0);
  116. print "</td></tr>\n";
  117. // View description of the categories
  118. print '<tr class="oddeven"><td>';
  119. print $langs->trans('ShowCategoryDescription');
  120. print '<td colspan="2">';
  121. print ajax_constantonoff("TAKEPOS_SHOW_CATEGORY_DESCRIPTION", array(), $conf->entity, 0, 0, 1, 0);
  122. print "</td></tr>\n";
  123. // View reference of products
  124. print '<tr class="oddeven"><td>';
  125. print $langs->trans('ShowProductReference');
  126. print '<td colspan="2">';
  127. print ajax_constantonoff("TAKEPOS_SHOW_PRODUCT_REFERENCE", array(), $conf->entity, 0, 0, 1, 0);
  128. print "</td></tr>\n";
  129. // Use price excl. taxes (HT) and not price incl. taxes (TTC)
  130. print '<tr class="oddeven"><td>';
  131. print $langs->trans('UsePriceHT');
  132. print '<td colspan="2">';
  133. print ajax_constantonoff("TAKEPOS_CHANGE_PRICE_HT", array(), $conf->entity, 0, 0, 1, 0);
  134. print "</td></tr>\n";
  135. print '</table>';
  136. print $form->buttonsSaveCancel("Save", '');
  137. print "</form>\n";
  138. print '<br>';
  139. llxFooter();
  140. $db->close();