From cb40e2ebd2b14231a8eec694ee6a044b50459d99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Jun 2023 14:52:44 +0200 Subject: [PATCH] Fix warnings --- htdocs/admin/emailcollector_list.php | 2 +- htdocs/admin/mails_senderprofile_list.php | 2 +- htdocs/asset/list.php | 2 +- htdocs/asset/model/list.php | 2 +- htdocs/bom/bom_list.php | 2 +- htdocs/bookcal/availabilities_list.php | 2 +- htdocs/bookcal/booking_list.php | 2 +- htdocs/compta/cashcontrol/cashcontrol_list.php | 2 +- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +- htdocs/hrm/evaluation_list.php | 2 +- htdocs/hrm/job_list.php | 2 +- htdocs/hrm/position.php | 4 ++-- htdocs/hrm/position_list.php | 2 +- htdocs/hrm/skill_list.php | 2 +- htdocs/knowledgemanagement/knowledgerecord_list.php | 2 +- htdocs/modulebuilder/template/myobject_list.php | 2 +- htdocs/mrp/mo_list.php | 2 +- htdocs/partnership/partnership_list.php | 2 +- htdocs/product/inventory/list.php | 2 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/product/stock/stocktransfer/stocktransfer_list.php | 6 ++++-- htdocs/recruitment/recruitmentcandidature_list.php | 2 +- htdocs/recruitment/recruitmentjobposition_list.php | 2 +- htdocs/salaries/list.php | 2 +- htdocs/salaries/payments.php | 2 +- htdocs/societe/website.php | 2 +- htdocs/ticket/list.php | 2 +- htdocs/user/list.php | 2 +- htdocs/variants/list.php | 2 +- htdocs/webhook/target_list.php | 2 +- htdocs/workstation/workstation_list.php | 2 +- 32 files changed, 36 insertions(+), 34 deletions(-) diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 96b015c19c6..39e7d4f67c8 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -527,7 +527,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 1a8f9ff90d5..734b64d3331 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -551,7 +551,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 5ff5f6d0382..adbb6afd400 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -534,7 +534,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index 76f826ef706..6a7928e0a1e 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -540,7 +540,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index de7a2c4b4f7..f025e768201 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -658,7 +658,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/bookcal/availabilities_list.php b/htdocs/bookcal/availabilities_list.php index 59095d8f03d..bbf9ee19c67 100644 --- a/htdocs/bookcal/availabilities_list.php +++ b/htdocs/bookcal/availabilities_list.php @@ -612,7 +612,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php index 53bd76d9c72..48c31a221ea 100644 --- a/htdocs/bookcal/booking_list.php +++ b/htdocs/bookcal/booking_list.php @@ -612,7 +612,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 5e536f39dde..775de1c495b 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -544,7 +544,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 69be0367ec8..5f639e2e565 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -865,7 +865,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if ($val && preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 38e6b11c06b..0a56a19b0bb 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -913,7 +913,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if ($val && preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index a2548a2385f..b972211ebbb 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -559,7 +559,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index 18129d56c12..535f717d829 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -577,7 +577,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index 29dc18aa828..2b58ac44241 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -637,7 +637,7 @@ if ($job->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create' $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } @@ -1199,7 +1199,7 @@ function DisplayPositionList() $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index e9b2eaa9b50..7044efb5489 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -588,7 +588,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index dee90553457..e97f20a057c 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -589,7 +589,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if ($val && preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index 6ce878389c2..f4aeaad2c36 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -638,7 +638,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if ($val && preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index f567b89ceda..31edf70e20b 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -673,7 +673,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if ($val && preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index ab9ee3e3645..1d81a4d137e 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -588,7 +588,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 01a1cb9b602..106932910a7 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -840,7 +840,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if ($val && preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 1e71791929c..c25ca957aa1 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -620,7 +620,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if ($val && preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 43eb7c1fd1f..af43ddc4a39 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -582,7 +582,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_list.php b/htdocs/product/stock/stocktransfer/stocktransfer_list.php index 4cb5e195f4a..0641660f18b 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_list.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_list.php @@ -418,9 +418,11 @@ print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine = 0; -if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { +if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object + if (!is_null($val) && preg_match('/\$object/', $val)) { + $needToFetchEachLine++; // There is at least one compute field that use $object + } } } diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 0bf19a4a045..03f7c539262 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -719,7 +719,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if ($val && preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 11e74280a50..d62f62000df 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -564,7 +564,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index c907f494ff1..d18dd9decc6 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -606,7 +606,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if ($val && preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 5be2f163282..9e8239a4791 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -541,7 +541,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; } // There is at least one compute field that use $object diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 1a5a93bbabd..2c38ad02770 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -476,7 +476,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index f79eba64a52..3464b740d01 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -983,7 +983,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if ($val && preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 2e15acce7b8..c408772f99b 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -950,7 +950,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index d9daf1e28d4..7969096b3ad 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -642,7 +642,7 @@ print ''."\n"; $needToFetchEachLine = 0; //if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { // foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { -// if (preg_match('/\$object/', $val)) { +// if (!is_null($val) && preg_match('/\$object/', $val)) { // $needToFetchEachLine++; // There is at least one compute field that use $object // } // } diff --git a/htdocs/webhook/target_list.php b/htdocs/webhook/target_list.php index 1196e439c9c..69b838733d8 100644 --- a/htdocs/webhook/target_list.php +++ b/htdocs/webhook/target_list.php @@ -606,7 +606,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index f77ee16fc96..e67d231bb18 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -601,7 +601,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if (!is_null($val) && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } }