2
0
forked from Wavyzz/dolibarr

Update ajax.lib.php

This commit is contained in:
Frédéric FRANCE
2014-10-18 22:46:13 +02:00
parent 3144fd6845
commit a1bedcc263

View File

@@ -462,14 +462,15 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0,
/** /**
* On/off button for object * On/off button for object
* *
* @param int $object Object to set * @param int $object Id product to set
* @param string $code Name of constant : status or status_buy for product by example * @param string $code Name of constant : status or status_buy for product by example
* @param string $field Name of database field : tosell or tobuy for product by example
* @param string $text_on Text if on * @param string $text_on Text if on
* @param string $text_off Text if off * @param string $text_off Text if off
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
* @return void * @return void
*/ */
function ajax_object_onoff($object, $code, $text_on, $text_off, $input=array()) function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=array())
{ {
global $langs; global $langs;
@@ -480,8 +481,10 @@ function ajax_object_onoff($object, $code, $text_on, $text_off, $input=array())
// Set constant // Set constant
$("#set_'.$code.'_'.$object->id.'").click(function() { $("#set_'.$code.'_'.$object->id.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", { $.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
action: \'set'.$code.'\', action: \'set\',
field: \''.$field.'\',
value: \'1\', value: \'1\',
element: \''.$object->element.'\',
id: \''.$object->id.'\' id: \''.$object->id.'\'
}, },
function() { function() {
@@ -508,8 +511,10 @@ function ajax_object_onoff($object, $code, $text_on, $text_off, $input=array())
// Del constant // Del constant
$("#del_'.$code.'_'.$object->id.'").click(function() { $("#del_'.$code.'_'.$object->id.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", { $.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
action: \'set'.$code.'\', action: \'set\',
field: \''.$field.'\',
value: \'0\', value: \'0\',
element: \''.$object->element.'\',
id: \''.$object->id.'\' id: \''.$object->id.'\'
}, },
function() { function() {