From f50508b84a0a61262916531bb01d232ae35dae0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Mar 2026 10:23:07 +0100 Subject: [PATCH 1/2] FIX a param must not come from end user entry. --- htdocs/core/ajax/saveinplace.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index 2f88cebf58b..8f964b55148 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -120,6 +120,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e $feature = 'fournisseur'; $feature2 = 'facture'; } + //var_dump(GETPOST('action','aZ09')); //var_dump($newelement.'-'.$subelement."-".$feature."-".$object_id); $check_access = restrictedArea($user, $feature, $object_id, '', $feature2); @@ -205,7 +206,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e $object->fk_element = $fk_element; $object->element = $element; - $ret = $object->$savemethodname($field, $newvalue, $table_element, $fk_element, $format); + $ret = $object->setValueFrom($field, $newvalue, $object->table_element, $fk_element, $format); if ($ret > 0) { if ($type == 'numeric') { $value = price($newvalue); From 69cee514b55bfe1d2652548a46627602061e4fb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Mar 2026 10:30:26 +0100 Subject: [PATCH 2/2] Doc --- htdocs/core/ajax/saveinplace.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index 8f964b55148..0f72d430675 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -71,7 +71,6 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e $value = ($type == 'ckeditor' ? GETPOST('value', '', 2) : GETPOST('value', 'alpha', 2)); $loadmethod = GETPOST('loadmethod', 'alpha', 2); $savemethod = GETPOST('savemethod', 'alpha', 2); - $savemethodname = (!empty($savemethod) ? $savemethod : 'setValueFrom'); $newelement = $element; $view = ''; @@ -120,7 +119,6 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e $feature = 'fournisseur'; $feature2 = 'facture'; } - //var_dump(GETPOST('action','aZ09')); //var_dump($newelement.'-'.$subelement."-".$feature."-".$object_id); $check_access = restrictedArea($user, $feature, $object_id, '', $feature2); @@ -194,11 +192,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e } } - if (!$error) { - if ((isset($object) && !is_object($object)) || empty($savemethod)) { - $object = new GenericObject($db); - } - + if (!$error && isset($object) && is_object($object)) { // Specific for add_object_linked() // TODO add a function for variable treatment $object->ext_fk_element = $newvalue;