dolibarr/htdocs/admin/resource.php

160 lines
4.7 KiB
PHP
Raw Permalink Normal View History

2016-10-19 22:14:51 +02:00
<?php
/* Copyright (C) 2016 Florian HENRY <florian.henry@atm-consulting.fr>
add baseline exclude for phpstan (#31632) * add baseline exclude for phpstan * update * update * update * update * update * merge * restore one filter * delete old errors * fix * fix * fix * $moreforfilter can t be empty * fix * enable check * refresh baseline * add phpdoc * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 23:53:20 +01:00
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
2016-10-19 22:14:51 +02:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2016-10-19 22:14:51 +02:00
*
*/
/**
* \file htdocs/admin/resource.php
* \ingroup resource
* \brief Setup page to configure resource module
*/
2022-09-07 20:08:59 +02:00
// Load Dolibarr environment
2016-10-19 22:14:51 +02:00
require '../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
2016-10-19 22:14:51 +02:00
add baseline exclude for phpstan (#31632) * add baseline exclude for phpstan * update * update * update * update * update * merge * restore one filter * delete old errors * fix * fix * fix * $moreforfilter can t be empty * fix * enable check * refresh baseline * add phpdoc * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 23:53:20 +01:00
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
2018-05-26 18:52:14 +02:00
// Load translation files required by the page
$langs->loadLangs(array("admin", "resource"));
2016-10-19 22:14:51 +02:00
// Security check
2021-02-26 22:04:03 +01:00
if (!$user->admin) {
accessforbidden();
2021-02-26 22:04:03 +01:00
}
2016-10-19 22:14:51 +02:00
2020-09-16 19:39:50 +02:00
$action = GETPOST('action', 'aZ09');
2016-10-19 22:14:51 +02:00
/*
* Actions
*/
2021-02-26 22:04:03 +01:00
if ($action == 'updateoptions') {
if (GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT') != '') {
if (dolibarr_set_const($db, "RESOURCE_USE_SEARCH_TO_SELECT", GETPOST('activate_RESOURCE_USE_SEARCH_TO_SELECT'), 'chaine', 0, '', $conf->entity)) {
2016-10-19 22:24:04 +02:00
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
2016-10-19 22:14:51 +02:00
}
/*
* View
*/
llxHeader('', $langs->trans('ResourceSetup'), '', '', 0, 0, '', '', '', 'mod-admin page-resource');
2016-10-19 22:14:51 +02:00
$form = new Form($db);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans('ResourceSetup'), $linkback, 'title_setup');
2016-10-19 22:14:51 +02:00
$head = resource_admin_prepare_head();
2016-10-19 22:14:51 +02:00
2020-10-22 22:50:03 +02:00
print dol_get_fiche_head($head, 'general', $langs->trans("ResourceSingular"), -1, 'action');
2016-10-19 22:14:51 +02:00
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
2016-10-19 22:24:04 +02:00
print '<input type="hidden" name="action" value="updateoptions">';
2016-10-19 22:14:51 +02:00
2021-05-24 19:05:25 +02:00
print '<div class="div-table-responsive-no-min">';
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">';
2016-10-19 22:14:51 +02:00
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
2025-01-24 13:12:48 +01:00
print '<td class="right"></td>'."\n";
2016-10-19 22:24:04 +02:00
print '<td></td>';
2016-10-19 22:14:51 +02:00
// Use an Ajax form for the product choice
print '<tr class="oddeven">';
2016-10-19 22:24:04 +02:00
print '<td width="80%">'.$langs->trans("UseSearchToSelectResource").'</td>';
2021-02-26 22:04:03 +01:00
if (empty($conf->use_javascript_ajax)) {
2019-01-31 12:40:50 +01:00
print '<td class="nowrap right" colspan="2">';
2016-10-19 22:14:51 +02:00
print $langs->trans("NotAvailableWhenAjaxDisabled");
print '</td>';
2020-05-21 09:35:30 +02:00
} else {
2019-01-31 12:40:50 +01:00
print '<td width="60" class="right">';
$arrval = array(
2024-01-18 21:31:48 +01:00
$langs->trans("No"),
$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
2016-10-19 22:14:51 +02:00
);
2024-01-18 21:31:48 +01:00
print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalInt('RESOURCE_USE_SEARCH_TO_SELECT'));
2016-10-19 22:24:04 +02:00
print '</td>';
2019-01-22 11:56:09 +01:00
print '<td class="right">';
print '<input type="submit" class="button small" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
2016-10-19 22:14:51 +02:00
print '</td>';
}
print '</tr>';
print '<tr class="oddeven">';
2022-05-19 09:36:47 +02:00
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
print '<td class="right">';
2022-05-19 09:36:47 +02:00
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
2016-10-19 22:14:51 +02:00
print '</td>';
2016-10-19 22:24:04 +02:00
print '<td></td>';
2016-10-19 22:14:51 +02:00
print '</tr>';
2022-05-19 09:36:47 +02:00
/*
print '<tr class="oddeven">';
2022-05-19 09:36:47 +02:00
print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
print '<td class="right">';
2022-05-19 09:36:47 +02:00
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
2016-10-19 22:14:51 +02:00
print '</td>';
2016-10-19 22:24:04 +02:00
print '<td></td>';
2016-10-19 22:14:51 +02:00
print '</tr>';
print '<tr class="oddeven">';
2022-05-19 09:36:47 +02:00
print '<td>'.$langs->trans('DisabledResourceLinkContact').'</td>';
print '<td class="right">';
2022-05-19 09:36:47 +02:00
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
print '</td>';
print '<td></td>';
print '</tr>';
2022-05-19 09:36:47 +02:00
*/
2016-10-19 22:14:51 +02:00
print '</table>';
2021-05-24 19:05:25 +02:00
print '</div>';
2016-10-19 22:14:51 +02:00
print '</form>';
//RESOURCE_HIDE_ADD_CONTACT_USER
//RESOURCE_HIDE_ADD_CONTACT_THIPARTY
2020-10-27 18:19:31 +01:00
print dol_get_fiche_end();
2016-10-19 22:14:51 +02:00
2018-07-28 18:03:14 +02:00
// End of page
2016-10-19 22:14:51 +02:00
llxFooter();
$db->close();