dolibarr  16.0.5
admin.php
1 <?php
2 /* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
3  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
19 require '../../main.inc.php';
20 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
21 require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
22 
23 $langs->loadLangs(array("admin", "products"));
24 
25 $action = GETPOST('action', 'alphanohtml');
26 
27 // Security check
28 if (!$user->admin || empty($conf->variants->enabled)) {
30 }
31 
32 $error = 0;
33 
34 
35 /*
36  * Actions
37  */
38 
39 if ($action) {
40  $value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD');
41 
42  if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) {
43  setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
44  $error++;
45  }
46 
47  if (!dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) {
48  setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
49  $error++;
50  }
51 
52  if (!$error) {
53  setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
54  }
55 }
56 
57 $title = $langs->trans('ModuleSetup').' '.$langs->trans('Module610Name');
58 llxHeader('', $title);
59 
60 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
61 print load_fiche_titre($title, $linkback, 'title_setup');
62 
63 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
64 print '<input type="hidden" name="token" value="'.newToken().'">';
65 print '<input type="hidden" name="action" value="update">';
66 
67 print '<table class="noborder centpercent">';
68 
69 print '<tr class="liste_titre">';
70 print '<th>'.$langs->trans("Parameters").'</th>'."\n";
71 print '<th class="right" width="60">'.$langs->trans("Value").'</th>'."\n";
72 print '</tr>'."\n";
73 
74 print '<tr class="oddeven"><td>'.$langs->trans('HideProductCombinations').'</td><td>';
75 print $form->selectyesno("PRODUIT_ATTRIBUTES_HIDECHILD", $conf->global->PRODUIT_ATTRIBUTES_HIDECHILD, 1).'</td></tr>';
76 
77 print '<tr class="oddeven"><td>'.$langs->trans('CombinationsSeparator').'</td>';
78 if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
79  $separator = $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR;
80 } else {
81  $separator = "_";
82 }
83 print '<td class="right"><input size="3" type="text" class="flat" name="PRODUIT_ATTRIBUTES_SEPARATOR" value="'.$separator.'"></td></tr>';
84 
85 print '</table>';
86 
87 print '<br><div class="center"><input type="submit" value="'.$langs->trans("Save").'" class="button button-save"></div>';
88 
89 print '</form>';
90 
91 // End of page
92 llxFooter();
93 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
dolibarr_set_const
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:627
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59