Update objectonoff.php

This commit is contained in:
Frédéric FRANCE 2014-10-18 22:47:12 +02:00
parent a1bedcc263
commit 5b9a134d69

View File

@ -32,9 +32,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$id=GETPOST('id', 'int'); $id=GETPOST('id', 'int');
$value=GETPOST('value', 'int'); $value=GETPOST('value', 'int');
$field=GETPOST('field', 'alpha');
$element=GETPOST('element', 'alpha');
$object = new GenericObject($db); $object = new GenericObject($db);
/* /*
* View * View
*/ */
@ -44,9 +45,5 @@ top_httphead();
print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n"; print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
// Registering new values // Registering new values
if (! empty($action) && ! empty($id) && $user->rights->produit->creer) { if (($action == 'set') && ! empty($id))
if ($action == 'setstatus') $object->setValueFrom($field, $value, $element, $id);
$object->setValueFrom('tosell', $value, 'product', $id);
else if ($action == 'setstatus_buy')
$object->setValueFrom('tobuy', $value, 'product', $id);
}