19 require
'../main.inc.php';
20 require
'class/ProductAttribute.class.php';
21 require
'class/ProductAttributeValue.class.php';
25 $value =
GETPOST(
'value',
'alpha');
27 $action =
GETPOST(
'action',
'aZ09');
28 $cancel =
GETPOST(
'cancel',
'alpha');
29 $backtopage =
GETPOST(
'backtopage',
'alpha');
34 if ($object->fetch($id) < 1) {
47 header(
'Location: '.DOL_URL_ROOT.
'/variants/card.php?id='.$object->id);
61 if (empty($ref) || empty($value)) {
64 $objectval->fk_product_attribute = $object->id;
65 $objectval->ref = $ref;
66 $objectval->value = $value;
68 if ($objectval->create($user) > 0) {
70 header(
'Location: '.DOL_URL_ROOT.
'/variants/card.php?id='.$object->id);
73 setEventMessages($langs->trans(
'ErrorCreatingProductAttributeValue'), $objectval->errors,
'errors');
78 $langs->load(
'products');
80 $title = $langs->trans(
'ProductAttributeName',
dol_htmlentities($object->label));
85 $head[$h][0] = DOL_URL_ROOT.
'/variants/card.php?id='.$object->id;
86 $head[$h][1] = $langs->trans(
"ProductAttributeName");
87 $head[$h][2] =
'variant';
92 print '<div class="fichecenter">';
93 print
'<div class="underbanner clearboth"></div>';
95 <table
class=
"border" style=
"width: 100%">
97 <td
class=
"titlefield fieldrequired"><?php echo $langs->trans(
'Ref') ?></td>
101 <td
class=
"fieldrequired"><?php echo $langs->trans(
'Label') ?></td>
114 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
115 print
'<input type="hidden" name="token" value="'.newToken().
'">';
116 print
'<input type="hidden" name="action" value="add">';
117 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
118 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
125 <table
class=
"border" style=
"width: 100%">
127 <td
class=
"titlefield fieldrequired"><label
for=
"ref"><?php echo $langs->trans(
'Ref') ?></label></td>
128 <td><input
id=
"ref" type=
"text" name=
"ref" value=
"<?php echo $ref ?>"></td>
131 <td
class=
"fieldrequired"><label
for=
"value"><?php echo $langs->trans(
'Label') ?></label></td>
132 <td><input
id=
"value" type=
"text" name=
"value" value=
"<?php echo $value ?>"></td>
139 print
'<div class="center">';
140 print
'<input type="submit" class="button" name="create" value="'.$langs->trans(
"Create").
'">';
142 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_htmlentities($string, $flags=null, $encoding= 'UTF-8', $double_encode=false)
Replace htmlentities functions.
Class ProductAttributeValue Used to represent a product attribute value.
$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_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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