admin.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
  3. * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
  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. // Load Dolibarr environment
  19. require '../../main.inc.php';
  20. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  21. require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
  22. $langs->loadLangs(array("admin", "products"));
  23. $action = GETPOST('action', 'alphanohtml');
  24. // Security check
  25. if (!$user->admin || !isModEnabled('variants')) {
  26. accessforbidden();
  27. }
  28. $error = 0;
  29. /*
  30. * Actions
  31. */
  32. if ($action) {
  33. $value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD');
  34. if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) {
  35. setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
  36. $error++;
  37. }
  38. if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) {
  39. setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
  40. $error++;
  41. }
  42. if (!$error) {
  43. setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
  44. }
  45. }
  46. $title = $langs->trans('ModuleSetup').' '.$langs->trans('Module610Name');
  47. llxHeader('', $title);
  48. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  49. print load_fiche_titre($title, $linkback, 'title_setup');
  50. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  51. print '<input type="hidden" name="token" value="'.newToken().'">';
  52. print '<input type="hidden" name="action" value="update">';
  53. print '<table class="noborder centpercent">';
  54. print '<tr class="liste_titre">';
  55. print '<th>'.$langs->trans("Parameters").'</th>'."\n";
  56. print '<th class="right" width="60">'.$langs->trans("Value").'</th>'."\n";
  57. print '</tr>'."\n";
  58. print '<tr class="oddeven"><td>'.$langs->trans('HideProductCombinations').'</td><td>';
  59. print $form->selectyesno("PRODUIT_ATTRIBUTES_HIDECHILD", $conf->global->PRODUIT_ATTRIBUTES_HIDECHILD, 1).'</td></tr>';
  60. print '<tr class="oddeven"><td>'.$langs->trans('CombinationsSeparator').'</td>';
  61. if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
  62. $separator = $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR;
  63. } else {
  64. $separator = "_";
  65. }
  66. print '<td class="right"><input size="3" type="text" class="flat" name="PRODUIT_ATTRIBUTES_SEPARATOR" value="'.$separator.'"></td></tr>';
  67. print '</table>';
  68. print '<br><div class="center"><input type="submit" value="'.$langs->trans("Save").'" class="button button-save"></div>';
  69. print '</form>';
  70. // End of page
  71. llxFooter();
  72. $db->close();