From 2107a61bbefbe0f1f82cb4820febf809ebf14dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 18 Oct 2014 16:32:32 +0200 Subject: [PATCH] Update ajax.lib.php For use in a list of object --- htdocs/core/lib/ajax.lib.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 2f9732a0876..46442460feb 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -477,15 +477,15 @@ function ajax_object_onoff($object, $code, $input=array()) var input = '.json_encode($input).'; // Set constant - $("#set_'.$code.'").click(function() { + $("#set_'.$code.'_'.$object->id.'").click(function() { $.get( "'.DOL_URL_ROOT.'/core/ajax/productonoff.php", { action: \'set'.$code.'\', value: \'1\', id: \''.$object->id.'\' }, function() { - $("#set_'.$code.'").hide(); - $("#del_'.$code.'").show(); + $("#set_'.$code.'_'.$object->id.'").hide(); + $("#del_'.$code.'_'.$object->id.'").show(); // Enable another element if (input.disabled && input.disabled.length > 0) { $.each(input.disabled, function(key,value) { @@ -505,15 +505,15 @@ function ajax_object_onoff($object, $code, $input=array()) }); // Del constant - $("#del_'.$code.'").click(function() { + $("#del_'.$code.'_'.$object->id.'").click(function() { $.get( "'.DOL_URL_ROOT.'/core/ajax/productonoff.php", { action: \'set'.$code.'\', value: \'0\', id: \''.$object->id.'\' }, function() { - $("#del_'.$code.'").hide(); - $("#set_'.$code.'").show(); + $("#del_'.$code.'_'.$object->id.'").hide(); + $("#set_'.$code.'_'.$object->id.'").show(); // Disable another element if (input.disabled && input.disabled.length > 0) { $.each(input.disabled, function(key,value) { @@ -534,12 +534,12 @@ function ajax_object_onoff($object, $code, $input=array()) }); '; if ($code=='status') { - $out.= ''.img_picto($langs->trans("ProductStatusNotOnSell"),'switch_off').''; - $out.= ''.img_picto($langs->trans("ProductStatusOnSell"),'switch_on').''; + $out.= ''.img_picto($langs->trans("ProductStatusNotOnSell"),'switch_off').''; + $out.= ''.img_picto($langs->trans("ProductStatusOnSell"),'switch_on').''; } if ($code=='status_buy') { - $out.= ''.img_picto($langs->trans("ProductStatusNotOnBuy"),'switch_off').''; - $out.= ''.img_picto($langs->trans("ProductStatusOnBuy"),'switch_on').''; + $out.= ''.img_picto($langs->trans("ProductStatusNotOnBuy"),'switch_off').''; + $out.= ''.img_picto($langs->trans("ProductStatusOnBuy"),'switch_on').''; } return $out; }