resource.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 <http://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. if (! empty($conf->resouce->enabled)) require_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php';
  29. $langs->load("admin");
  30. $langs->load("resource");
  31. // Security check
  32. if (!$user->admin)
  33. accessforbidden();
  34. $action = GETPOST('action', 'alpha');
  35. /*
  36. * Actions
  37. */
  38. if ($action == 'updateoptions')
  39. {
  40. if (GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT'))
  41. {
  42. if (dolibarr_set_const($db, "RESOURCE_USE_SEARCH_TO_SELECT", GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT'), 'chaine', 0, '', $conf->entity))
  43. {
  44. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  45. } else {
  46. setEventMessages($langs->trans("Error"), null, 'errors');
  47. }
  48. }
  49. }
  50. /*
  51. * View
  52. */
  53. llxHeader('',$langs->trans('ResourceSetup'));
  54. $form = new Form($db);
  55. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  56. print load_fiche_titre($langs->trans('ResourceSetup'),$linkback,'title_setup');
  57. $head=resource_admin_prepare_head();
  58. dol_fiche_head($head, 'general', $langs->trans("ResourceSingular"), 0, 'action');
  59. print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
  60. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  61. print '<input type="hidden" name="action" value="updateoptions">';
  62. $var=true;
  63. print '<table class="noborder" width="100%">';
  64. print '<tr class="liste_titre">';
  65. print '<td>'.$langs->trans("Parameters").'</td>'."\n";
  66. print '<td align="right" width="60">'.$langs->trans("Value").'</td>'."\n";
  67. print '<td></td>';
  68. // Utilisation formulaire Ajax sur choix produit
  69. print '<tr class="oddeven">';
  70. print '<td width="80%">'.$langs->trans("UseSearchToSelectResource").'</td>';
  71. if (empty($conf->use_javascript_ajax))
  72. {
  73. print '<td class="nowrap" align="right" colspan="2">';
  74. print $langs->trans("NotAvailableWhenAjaxDisabled");
  75. print '</td>';
  76. }
  77. else
  78. {
  79. print '<td width="60" align="right">';
  80. $arrval=array(
  81. '0'=>$langs->trans("No"),
  82. '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
  83. '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')',
  84. '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')',
  85. );
  86. print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT",$arrval,$conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
  87. print '</td>';
  88. print '<td align="right">';
  89. print '<input type="submit" class="button" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
  90. print '</td>';
  91. }
  92. print '</tr>';
  93. print '<tr class="oddeven">';
  94. print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
  95. print '<td>';
  96. echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
  97. print '</td>';
  98. print '<td></td>';
  99. print '</tr>';
  100. print '<tr class="oddeven">';
  101. print '<td>'.$langs->trans('DisabledResourceLinkContact').'</td>';
  102. print '<td>';
  103. echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
  104. print '</td>';
  105. print '<td></td>';
  106. print '</tr>';
  107. print '</table>';
  108. print '</form>';
  109. //RESOURCE_HIDE_ADD_CONTACT_USER
  110. //RESOURCE_HIDE_ADD_CONTACT_THIPARTY
  111. dol_fiche_end();
  112. llxFooter();
  113. $db->close();