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