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;
}