Update ajax.lib.php

This commit is contained in:
Frédéric FRANCE 2014-10-12 15:55:18 +02:00
parent 633f01e5a2
commit f25c4f18e6

View File

@ -468,12 +468,11 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0,
* @param int $entity Entity to set * @param int $entity Entity to set
* @return void * @return void
*/ */
function ajax_productonoff($id, $code, $input=array(), $entity=null) function ajax_productonoff($id, $code, $input=array())
{ {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
global $conf, $langs, $db; global $conf, $langs, $db;
$entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
$object = new Product($db); $object = new Product($db);
$object->fetch($id); $object->fetch($id);
@ -484,10 +483,9 @@ function ajax_productonoff($id, $code, $input=array(), $entity=null)
// Set constant // Set constant
$("#set_'.$code.'").click(function() { $("#set_'.$code.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/productonoff.php", { $.get( "'.DOL_URL_ROOT.'/core/ajax/productonoff.php", {
action: \'set\', action: \'set'.$code.'\',
name: \''.$code.'\', value: \'1\',
id: \''.$id.'\', id: \''.$id.'\'
entity: \''.$entity.'\'
}, },
function() { function() {
$("#set_'.$code.'").hide(); $("#set_'.$code.'").hide();
@ -513,10 +511,9 @@ function ajax_productonoff($id, $code, $input=array(), $entity=null)
// Del constant // Del constant
$("#del_'.$code.'").click(function() { $("#del_'.$code.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/productonoff.php", { $.get( "'.DOL_URL_ROOT.'/core/ajax/productonoff.php", {
action: \'del\', action: \'set'.$code.'\',
name: \''.$code.'\', value: \'0\',
id: \''.$id.'\', id: \''.$id.'\'
entity: \''.$entity.'\'
}, },
function() { function() {
$("#del_'.$code.'").hide(); $("#del_'.$code.'").hide();