salaries.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. /* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
  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. $langs->load("admin");
  28. $langs->load("salaries");
  29. // Security check
  30. if (!$user->admin)
  31. accessforbidden();
  32. $action = GETPOST('action', 'alpha');
  33. // Other parameters SALARIES_*
  34. $list = array (
  35. 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
  36. 'SALARIES_ACCOUNTING_ACCOUNT_CHARGE'
  37. );
  38. /*
  39. * Actions
  40. */
  41. if ($action == 'update')
  42. {
  43. $error = 0;
  44. foreach ($list as $constname) {
  45. $constvalue = GETPOST($constname, 'alpha');
  46. if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
  47. $error++;
  48. }
  49. }
  50. if (! $error)
  51. {
  52. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  53. }
  54. else
  55. {
  56. setEventMessages($langs->trans("Error"), null, 'errors');
  57. }
  58. }
  59. /*
  60. * View
  61. */
  62. llxHeader('',$langs->trans('SalariesSetup'));
  63. $form = new Form($db);
  64. if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db);
  65. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  66. print load_fiche_titre($langs->trans('SalariesSetup'),$linkback,'title_setup');
  67. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  68. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  69. print '<input type="hidden" name="action" value="update">';
  70. //dol_fiche_head(null, '', '', -1);
  71. /*
  72. * Params
  73. */
  74. print '<table class="noborder" width="100%">';
  75. print '<tr class="liste_titre">';
  76. print '<td colspan="3">' . $langs->trans('Options') . '</td>';
  77. print "</tr>\n";
  78. foreach ($list as $key)
  79. {
  80. print '<tr class="oddeven value">';
  81. // Param
  82. $label = $langs->trans($key);
  83. print '<td><label for="'.$key.'">'.$label.'</label></td>';
  84. // Value
  85. print '<td>';
  86. if (! empty($conf->accounting->enabled))
  87. {
  88. print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
  89. }
  90. else
  91. {
  92. print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
  93. }
  94. print '</td></tr>';
  95. }
  96. print '</tr>';
  97. print "</table>\n";
  98. //dol_fiche_end();
  99. print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
  100. print '</form>';
  101. llxFooter();
  102. $db->close();