diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 9127cc89a87..eec2a78feee 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1584,7 +1584,7 @@ class FormMail extends Form
$out .= '';
if (isModEnabled('product') || isModEnabled('service')) {
- include_once DOL_DOCUMENT_ROOT.'/htdocs/core/class/html.form.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form = new Form($this->db);
$out .= '
';
$out .= '';
diff --git a/htdocs/core/upload_page.php b/htdocs/core/upload_page.php
index 1f96104673e..baba144d931 100644
--- a/htdocs/core/upload_page.php
+++ b/htdocs/core/upload_page.php
@@ -104,6 +104,7 @@ if ($action == 'uploadfile') { // Test on permission not required here. Done lat
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+ // @phpstan-ignore-next-line $error may have been modified by actions_linkedfiles.inc.php
if (!$error) {
header("Location: ".DOL_URL_ROOT.'/core/upload_page2.php?file='.urlencode($fileprefix));
exit;
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index a6e15584445..1008f265c60 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -3680,7 +3680,7 @@ class Product extends CommonObject
$sql .= " UNION ";
- $sql .= "SELECT SUM(".$this->db->ifsql('f.type=2', -1, 1)." * fd.qty) as count FROM ".$this->db->prefix()."facturedet as fd ";
+ $sql .= "SELECT SUM(".$this->db->ifsql('f.type=2', '-1', '1')." * fd.qty) as count FROM ".$this->db->prefix()."facturedet as fd ";
$sql .= " JOIN ".$this->db->prefix()."facture as f ON fd.fk_facture = f.rowid";
$sql .= " JOIN ".$this->db->prefix()."element_element as el ON el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture' ";
$sql .= " JOIN ".$this->db->prefix()."commande as c ON el.fk_source = c.rowid";