dolibarr/htdocs/variants/admin/admin.php

75 lines
3.1 KiB
PHP
Raw Normal View History

2016-07-23 16:37:21 +02:00
<?php
2018-07-25 09:36:34 +02:00
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
2016-07-23 16:37:21 +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-07-23 16:37:21 +02:00
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
2018-05-26 09:40:00 +02:00
$langs->loadLangs(array("admin", "products"));
2016-07-23 16:37:21 +02:00
// Security check
if (! $user->admin || (empty($conf->product->enabled) && empty($conf->service->enabled)))
accessforbidden();
if ($_POST) {
$value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD');
if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) {
2018-07-27 14:49:33 +02:00
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
2016-07-23 16:37:21 +02:00
} else {
2018-07-27 14:49:33 +02:00
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
2016-07-23 16:37:21 +02:00
}
2019-10-26 20:53:39 +02:00
if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} else {
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
}
2016-07-23 16:37:21 +02:00
}
$title = $langs->trans('ModuleSetup').' '.$langs->trans('ProductAttributes');
llxHeader('', $title);
2018-02-26 09:20:05 +01:00
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($title, $linkback, 'title_setup');
2016-07-23 16:37:21 +02:00
dol_fiche_head(array(), 'general', $tab, 0, 'product');
print '<form method="post">';
2019-02-16 08:00:16 +01:00
print '<table class="noborder centpercent">';
2016-07-23 16:37:21 +02:00
print '<tr class="liste_titre">';
2019-02-16 08:00:16 +01:00
print '<th>'.$langs->trans("Parameters").'</td>'."\n";
print '<th class="right" width="60">'.$langs->trans("Value").'</td>'."\n";
print '<th width="80">&nbsp;</td></tr>'."\n";
2018-05-26 09:40:00 +02:00
print '<tr class="oddeven"><td>'.$langs->trans('HideProductCombinations').'</td><td>';
print $form->selectyesno("PRODUIT_ATTRIBUTES_HIDECHILD", $conf->global->PRODUIT_ATTRIBUTES_HIDECHILD, 1).'</td></tr>';
2018-05-26 09:40:00 +02:00
print '<tr class="oddeven"><td>'.$langs->trans('CombinationsSeparator').'</td>';
2019-02-16 08:00:16 +01:00
if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
2018-07-25 09:36:34 +02:00
$separator = $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR;
} else {
2018-07-25 09:36:34 +02:00
$separator = "_";
}
2019-02-16 08:00:16 +01:00
print '<td class="right"><input size="3" type="text" class="flat" name="PRODUIT_ATTRIBUTES_SEPARATOR" value="'.$separator.'"></td></tr>';
2016-07-23 16:37:21 +02:00
print '</table>';
2019-02-16 08:00:16 +01:00
print '<br><div class="center"><input type="submit" value="'.$langs->trans('Save').'" class="button"></div>';
2016-07-23 16:37:21 +02:00
print '</form>';
2018-08-04 15:58:05 +02:00
// End of page
2016-07-23 16:37:21 +02:00
llxFooter();
$db->close();