Clsoe #13464 Try implementation to allow use of objectonoff for most
modules.
This commit is contained in:
parent
4ab3bf99ec
commit
ceab7f9ce3
@ -39,9 +39,13 @@ $element = GETPOST('element', 'alpha');
|
|||||||
$object = new GenericObject($db);
|
$object = new GenericObject($db);
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (!empty($user->socid))
|
if (!empty($user->socid)) {
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||||
|
accessforbidden('Calling this file is allowed only when MAIN_DIRECT_STATUS_UPDATE is set');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -52,20 +56,27 @@ 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 ($element == 'societe' && in_array($field, array('status')))
|
if ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) // Special case for products
|
||||||
{
|
|
||||||
$result = restrictedArea($user, 'societe', $id);
|
|
||||||
}
|
|
||||||
elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch')))
|
|
||||||
{
|
{
|
||||||
$result = restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
|
$result = restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
|
if (in_array($field, array('status'))) {
|
||||||
exit;
|
$result = restrictedArea($user, $element, $id);
|
||||||
|
} else {
|
||||||
|
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Registering new values
|
// Registering new values
|
||||||
if (($action == 'set') && !empty($id))
|
if (($action == 'set') && !empty($id)) {
|
||||||
$object->setValueFrom($field, $value, $element, $id);
|
$triggerkey = strtoupper($element).'_UPDATE';
|
||||||
|
// Special case
|
||||||
|
if ($triggerkey == 'SOCIETE_UPDATE') {
|
||||||
|
$triggerkey = 'COMPANY_UPDATE';
|
||||||
|
}
|
||||||
|
|
||||||
|
$object->setValueFrom($field, $value, $element, $id, $user, $triggerkey);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user