resource.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. /* Copyright (C) 2016 Florian HENRY <florian.henry@atm-consulting.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 <https://www.gnu.org/licenses/>.
  16. *
  17. */
  18. /**
  19. * \file htdocs/admin/resource.php
  20. * \ingroup resource
  21. * \brief Setup page to configure resource module
  22. */
  23. require '../main.inc.php';
  24. // Class
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
  29. // Load translation files required by the page
  30. $langs->loadLangs(array("admin", "resource"));
  31. // Security check
  32. if (!$user->admin) {
  33. accessforbidden();
  34. }
  35. $action = GETPOST('action', 'aZ09');
  36. /*
  37. * Actions
  38. */
  39. if ($action == 'updateoptions') {
  40. if (GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT') != '') {
  41. if (dolibarr_set_const($db, "RESOURCE_USE_SEARCH_TO_SELECT", GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT'), 'chaine', 0, '', $conf->entity)) {
  42. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  43. } else {
  44. setEventMessages($langs->trans("Error"), null, 'errors');
  45. }
  46. }
  47. }
  48. /*
  49. * View
  50. */
  51. llxHeader('', $langs->trans('ResourceSetup'));
  52. $form = new Form($db);
  53. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  54. print load_fiche_titre($langs->trans('ResourceSetup'), $linkback, 'title_setup');
  55. $head = resource_admin_prepare_head();
  56. print dol_get_fiche_head($head, 'general', $langs->trans("ResourceSingular"), -1, 'action');
  57. print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
  58. print '<input type="hidden" name="token" value="'.newToken().'">';
  59. print '<input type="hidden" name="action" value="updateoptions">';
  60. print '<div class="div-table-responsive-no-min">';
  61. print '<table class="noborder centpercent">';
  62. print '<tr class="liste_titre">';
  63. print '<td>'.$langs->trans("Parameters").'</td>'."\n";
  64. print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
  65. print '<td></td>';
  66. // Utilisation formulaire Ajax sur choix produit
  67. print '<tr class="oddeven">';
  68. print '<td width="80%">'.$langs->trans("UseSearchToSelectResource").'</td>';
  69. if (empty($conf->use_javascript_ajax)) {
  70. print '<td class="nowrap right" colspan="2">';
  71. print $langs->trans("NotAvailableWhenAjaxDisabled");
  72. print '</td>';
  73. } else {
  74. print '<td width="60" class="right">';
  75. $arrval = array(
  76. '0'=>$langs->trans("No"),
  77. '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
  78. '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
  79. '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
  80. );
  81. print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
  82. print '</td>';
  83. print '<td class="right">';
  84. print '<input type="submit" class="button small" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
  85. print '</td>';
  86. }
  87. print '</tr>';
  88. print '<tr class="oddeven">';
  89. print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
  90. print '<td class="right">';
  91. echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
  92. print '</td>';
  93. print '<td></td>';
  94. print '</tr>';
  95. /*
  96. print '<tr class="oddeven">';
  97. print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
  98. print '<td class="right">';
  99. echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
  100. print '</td>';
  101. print '<td></td>';
  102. print '</tr>';
  103. print '<tr class="oddeven">';
  104. print '<td>'.$langs->trans('DisabledResourceLinkContact').'</td>';
  105. print '<td class="right">';
  106. echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
  107. print '</td>';
  108. print '<td></td>';
  109. print '</tr>';
  110. */
  111. print '</table>';
  112. print '</div>';
  113. print '</form>';
  114. //RESOURCE_HIDE_ADD_CONTACT_USER
  115. //RESOURCE_HIDE_ADD_CONTACT_THIPARTY
  116. print dol_get_fiche_end();
  117. // End of page
  118. llxFooter();
  119. $db->close();