From 3b497929853010e562079f8792da41d923b567ea Mon Sep 17 00:00:00 2001 From: dvdwalker Date: Wed, 24 Feb 2021 10:38:11 -0300 Subject: [PATCH 1/2] Update product.class.php --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9a71faa5665..31886b5d662 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4590,7 +4590,7 @@ class Product extends CommonObject $result .= (img_object(($notooltip ? '' : $label), 'product', ($notooltip ? 'class="paddingright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1)); } if ($this->type == Product::TYPE_SERVICE) { - $result .= (img_object(($notooltip ? '' : $label), 'service', ($notooltip ? 'class="paddinright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1)); + $result .= (img_object(($notooltip ? '' : $label), 'service', ($notooltip ? 'class="paddingright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1)); } } $result .= $newref; From a683acde62a85b517fa962c0b5e5b304323e1411 Mon Sep 17 00:00:00 2001 From: dvdwalker Date: Wed, 24 Feb 2021 17:00:10 -0300 Subject: [PATCH 2/2] Fix: Ajax on/off not saving value in DB after updating to version >=12 The issue seams to be that starting in version 12 the "[element]_UPDATE" trigger is called in file core/ajax/objectonoff.php but some properties that are required on $object are not set. Those are (at least for product that is what I use): $object->id $object->table_element $object->fields[$field] The error occurs on the setValueFrom function in core/class/commonobject.class.php file --- htdocs/core/ajax/objectonoff.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index ceb221b4870..593f4fa4dbc 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -78,5 +78,9 @@ if (($action == 'set') && !empty($id)) { $format = 'int'; + $object->table_element = $tablename; + $object->id = $id; + $object->fields[$field] = array('type' => $format, 'enabled' => 1); + $object->setValueFrom($field, $value, $tablename, $id, $format, '', $user, $triggerkey); }