From 884ac621dedeb9bd853d3161b4b6fcd91c2c29b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 May 2023 17:43:37 +0200 Subject: [PATCH 1/2] Fix php8 --- htdocs/core/class/commonobject.class.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b82970baa97..5c0139aeb8e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9738,14 +9738,16 @@ abstract class CommonObject } // Force values to default values when known - foreach ($this->fields as $key => $value) { - // If fields are already set, do nothing - if (array_key_exists($key, $fields)) { - continue; - } + if (property_exists($this, 'fields')) { + foreach ($this->fields as $key => $value) { + // If fields are already set, do nothing + if (array_key_exists($key, $fields)) { + continue; + } - if (!empty($value['default'])) { - $this->$key = $value['default']; + if (!empty($value['default'])) { + $this->$key = $value['default']; + } } } From a47f59c5adbca3c8bd0a3266fd0dd3fc1cb8853f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Thu, 25 May 2023 17:58:21 +0200 Subject: [PATCH 2/2] FIX error expedition qty 0 --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 1af15ca8297..e0044dfd2c9 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -357,7 +357,7 @@ if (empty($reshook)) { $entrepot_id = 0; } - $ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i]); + $ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOSTINT($qty), $array_options[$i]); if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++;