From db5292e647f40166355854b9fe350a2542697b85 Mon Sep 17 00:00:00 2001 From: bahfir abbes Date: Thu, 15 Oct 2020 01:15:45 +0100 Subject: [PATCH] new:handle new type reference in add and update actions --- htdocs/core/actions_addupdatedelete.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 219d35e46fb..6d6edc1b360 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -74,7 +74,9 @@ if ($action == 'add' && !empty($permissiontoadd)) } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) { $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup } elseif ($object->fields[$key]['type'] == 'boolean') { - $value = ((GETPOST($key) == '1' || GETPOST($key) == 'on') ? 1 : 0); + $value = (GETPOST($key) == '1' ? 1 : 0); + } elseif ($object->fields[$key]['type'] == 'reference') { + $value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2'); } else { $value = GETPOST($key, 'alphanohtml'); } @@ -161,7 +163,9 @@ if ($action == 'update' && !empty($permissiontoadd)) } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) { $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup } elseif ($object->fields[$key]['type'] == 'boolean') { - $value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0); + $value = (GETPOST($key) == '1' ? 1 : 0); + } elseif ($object->fields[$key]['type'] == 'reference') { + $value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2'); } else { $value = GETPOST($key, 'alpha'); }