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
This commit is contained in:
dvdwalker 2021-02-24 17:00:10 -03:00 committed by GitHub
parent 3b49792985
commit a683acde62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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