From 8803fe64dc368241c746a327acbb9be3056fbb88 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 25 Oct 2021 21:45:00 +0200 Subject: [PATCH 1/4] fix scrutinizer --- htdocs/categories/viewcat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 7ccd80eb4bd..bf089e0cd5b 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -749,7 +749,7 @@ if ($type == Categorie::TYPE_CONTACT) { $permission = $user->rights->societe->creer; $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($contacts < 0) { + if (!is_array($contacts) && $contacts < 0) { dol_print_error($db, $object->error, $object->errors); } else { print '
'; From cfd88cb6e5cc48b343cea190998aa8a4a681e1d1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 25 Oct 2021 21:50:27 +0200 Subject: [PATCH 2/4] fix scrutinizer error --- .../societe/doc/doc_generic_odt.modules.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 8b8069ff34f..6427a6a60a3 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -320,17 +320,22 @@ class doc_generic_odt extends ModeleThirdPartyDoc foreach ($contact_arrray as $array_key => $contact_id) { $res_contact = $contactstatic->fetch($contact_id); - $tmparray = $this->get_substitutionarray_contact($contactstatic, $outputlangs, 'contact'); - foreach ($tmparray as $key => $val) { - try { - $listlines->setVars($key, $val, true, 'UTF-8'); - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); - } catch (SegmentException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + if ((int) $res_contact > 0) { + $tmparray = $this->get_substitutionarray_contact($contactstatic, $outputlangs, 'contact'); + foreach ($tmparray as $key => $val) { + try { + $listlines->setVars($key, $val, true, 'UTF-8'); + } catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } catch (SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } } + $listlines->merge(); + } else { + $this->error = $contactstatic->error; + dol_syslog($this->error, LOG_WARNING); } - $listlines->merge(); } $odfHandler->mergeSegment($listlines); } catch (OdfException $e) { From 9a2e1df94a1813dcbb78f2d5d2e33498f47e2112 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 25 Oct 2021 21:54:56 +0200 Subject: [PATCH 3/4] fix scrutinizer error --- htdocs/resource/class/html.formresource.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index a8b17665fa1..99916b8ed70 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -224,8 +224,9 @@ class FormResource $value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); } elseif ($format == 3) { $value = $arraytypes['code']; + } elseif (empty($value)) { + print ' '; } - print $value ? $value : ' '; print ''; } } From df5b2b67284950e5ab2c5ddea095efe946b1a3d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Oct 2021 17:36:56 +0100 Subject: [PATCH 4/4] Update viewcat.php --- htdocs/categories/viewcat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index d6b663a8804..5912d63c7cf 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -795,7 +795,7 @@ if ($type == Categorie::TYPE_CONTACT) { $permission = $user->rights->societe->creer; $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); - if (!is_array($contacts) && $contacts < 0) { + if (is_numeric($contacts) && $contacts < 0) { dol_print_error($db, $object->error, $object->errors); } else { // Form to add record into a category