Fix init before
This commit is contained in:
parent
67db1d4937
commit
aba43b3e35
@ -47,9 +47,19 @@ $id = GETPOST('id', 'int');
|
|||||||
$value = GETPOST('value', 'int');
|
$value = GETPOST('value', 'int');
|
||||||
$field = GETPOST('field', 'alpha');
|
$field = GETPOST('field', 'alpha');
|
||||||
$element = GETPOST('element', 'alpha');
|
$element = GETPOST('element', 'alpha');
|
||||||
|
$format = 'int';
|
||||||
|
|
||||||
$object = new GenericObject($db);
|
$object = new GenericObject($db);
|
||||||
|
|
||||||
|
$tablename = $element;
|
||||||
|
if ($tablename == 'websitepage') {
|
||||||
|
$tablename = 'website_page';
|
||||||
|
}
|
||||||
|
|
||||||
|
$object->table_element = $tablename;
|
||||||
|
$object->id = $id;
|
||||||
|
$object->fields[$field] = array('type' => $format, 'enabled' => 1);
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (!empty($user->socid)) {
|
if (!empty($user->socid)) {
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
@ -69,9 +79,9 @@ top_httphead();
|
|||||||
print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
|
print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
|
||||||
|
|
||||||
if (in_array($field, array('status'))) {
|
if (in_array($field, array('status'))) {
|
||||||
$result = restrictedArea($user, $element, $id);
|
restrictedArea($user, $element, $id);
|
||||||
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
|
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
|
||||||
$result = restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
|
restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
|
||||||
} else {
|
} else {
|
||||||
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
|
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
|
||||||
exit;
|
exit;
|
||||||
@ -85,16 +95,5 @@ if (($action == 'set') && !empty($id)) {
|
|||||||
$triggerkey = 'COMPANY_UPDATE';
|
$triggerkey = 'COMPANY_UPDATE';
|
||||||
}
|
}
|
||||||
|
|
||||||
$tablename = $element;
|
|
||||||
if ($tablename == 'websitepage') {
|
|
||||||
$tablename = 'website_page';
|
|
||||||
}
|
|
||||||
|
|
||||||
$format = 'int';
|
|
||||||
|
|
||||||
$object->table_element = $tablename;
|
|
||||||
$object->id = $id;
|
|
||||||
$object->fields[$field] = array('type' => $format, 'enabled' => 1);
|
|
||||||
|
|
||||||
$object->setValueFrom($field, $value, $tablename, $id, $format, '', $user, $triggerkey);
|
$object->setValueFrom($field, $value, $tablename, $id, $format, '', $user, $triggerkey);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user