19 require
'../main.inc.php';
20 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductAttribute.class.php';
23 $label =
GETPOST(
'label',
'alpha');
24 $backtopage =
GETPOST(
'backtopage',
'alpha');
25 $action =
GETPOST(
'action',
'alpha');
32 if ($action ==
'add') {
33 if (empty($ref) || empty($label)) {
37 $prodattr->label = $label;
38 $prodattr->ref = $ref;
40 $resid = $prodattr->create($user);
45 header(
'Location: '.$backtopage);
47 header(
'Location: '.DOL_URL_ROOT.
'/variants/card.php?id='.$resid.
'&backtopage='.urlencode($backtopage));
51 setEventMessages($langs->trans(
'ErrorRecordAlreadyExists'), $prodattr->errors,
'errors');
56 $langs->load(
'products');
63 $title = $langs->trans(
'NewProductAttribute');
71 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
72 print '<input type="hidden" name="token" value="'.newToken().
'">';
73 print '<input type="hidden" name="action" value="add">';
74 print '<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
78 <table
class=
"border centpercent">
80 <td
class=
"titlefield fieldrequired"><label
for=
"ref"><?php echo $langs->trans(
'Ref') ?></label></td>
81 <td><input
type=
"text" id=
"ref" name=
"ref" value=
"<?php echo $ref ?>"></td>
82 <td><?php echo $langs->trans(
"VariantRefExample"); ?>
85 <td
class=
"fieldrequired"><label
for=
"label"><?php echo $langs->trans(
'Label') ?></label></td>
86 <td><input type=
"text" id=
"label" name=
"label" value=
"<?php echo $label ?>"></td>
87 <td><?php echo $langs->trans(
"VariantLabelExample"); ?>
95 print '<div class="center"><input type="submit" class="button" value="'.$langs->trans(
"Create").
'"></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
$conf db name
Only used if Module[ID]Name translation string is not found.
Class ProductAttribute Used to represent a product attribute.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type