salaries.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. /* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. */
  18. /**
  19. * \file htdocs/admin/salaries.php
  20. * \ingroup Salaries
  21. * \brief Setup page to configure salaries module
  22. */
  23. require '../main.inc.php';
  24. // Class
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  26. if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
  27. // Load translation files required by the page
  28. $langs->loadLangs(array('admin', 'salaries'));
  29. // Security check
  30. if (!$user->admin)
  31. accessforbidden();
  32. $action = GETPOST('action', 'alpha');
  33. // Other parameters SALARIES_*
  34. $list = array (
  35. 'SALARIES_XXX',
  36. );
  37. /*
  38. * Actions
  39. */
  40. if ($action == 'update')
  41. {
  42. $error = 0;
  43. foreach ($list as $constname) {
  44. $constvalue = GETPOST($constname, 'alpha');
  45. if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
  46. $error++;
  47. }
  48. }
  49. if (! $error)
  50. {
  51. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  52. }
  53. else
  54. {
  55. setEventMessages($langs->trans("Error"), null, 'errors');
  56. }
  57. }
  58. /*
  59. * View
  60. */
  61. llxHeader('',$langs->trans('SalariesSetup'));
  62. $form = new Form($db);
  63. if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
  64. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  65. print load_fiche_titre($langs->trans('SalariesSetup'),$linkback,'title_setup');
  66. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  67. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  68. print '<input type="hidden" name="action" value="update">';
  69. //dol_fiche_head(null, '', '', -1);
  70. /*
  71. * Params
  72. */
  73. print '<table class="noborder" width="100%">';
  74. print '<tr class="liste_titre">';
  75. print '<td colspan="3">' . $langs->trans('Options') . '</td>';
  76. print "</tr>\n";
  77. foreach ($list as $key)
  78. {
  79. print '<tr class="oddeven value">';
  80. // Param
  81. $label = $langs->trans($key);
  82. print '<td><label for="'.$key.'">'.$label.'</label></td>';
  83. // Value
  84. print '<td>';
  85. if (! empty($conf->accounting->enabled))
  86. {
  87. print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
  88. }
  89. else
  90. {
  91. print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
  92. }
  93. print '</td></tr>';
  94. }
  95. print '</tr>';
  96. print "</table>\n";
  97. //dol_fiche_end();
  98. print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
  99. print '</form>';
  100. // End of page
  101. llxFooter();
  102. $db->close();