Update productonoff.php
This commit is contained in:
parent
f25c4f18e6
commit
052e507271
@ -27,12 +27,14 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
|||||||
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$name=GETPOST('name','alpha');
|
$name=GETPOST('name','alpha');
|
||||||
$id=GETPOST('id', 'int');
|
$id=GETPOST('id', 'int');
|
||||||
|
$value=GETPOST('value', 'int');
|
||||||
|
|
||||||
|
$object = new GenericObject($db);
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -42,24 +44,15 @@ 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 the location of boxes
|
// Registering the location of boxes
|
||||||
if (! empty($action) && ! empty($name) &&! empty($id))
|
if (! empty($action) && ! empty($id))
|
||||||
{
|
{
|
||||||
//$entity = GETPOST('entity','int');
|
//$entity = GETPOST('entity','int');
|
||||||
|
|
||||||
if ($user->rights->produit->creer) {
|
if ($user->rights->produit->creer) {
|
||||||
if ($action == 'set' && $name== 'status') {
|
if ($action == 'setstatus')
|
||||||
$sql = "UPDATE llx_product SET tosell=1 WHERE rowid=".$id;
|
$object->setValueFrom('tosell', $value, 'product', $id);
|
||||||
$resql = $db->query($sql);
|
else if ($action == 'setstatus_buy')
|
||||||
} else if ($action == 'set' && $name== 'status_buy') {
|
$object->setValueFrom('tobuy', $value, 'product', $id);
|
||||||
$sql = "UPDATE llx_product SET tobuy=1 WHERE rowid=".$id;
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
} else if ($action == 'del' && $name== 'status') {
|
|
||||||
$sql = "UPDATE llx_product SET tosell=0 WHERE rowid=".$id;
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
} else if ($action == 'del' && $name== 'status_buy') {
|
|
||||||
$sql = "UPDATE llx_product SET tobuy=0 WHERE rowid=".$id;
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user