Qual: Fix phan notices (#35406)

* fix CI

* fix

* Qual: Fix newly appeard phan notices

# Qual: Fix newly appeard phan notices

Fix notices that appearce sin a previous phan report - some of these
notices are masked by the current baseline.

---------

Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
Co-authored-by: Frédéric FRANCE <frederic.france@free.fr>
This commit is contained in:
MDW
2025-09-20 15:59:05 +02:00
committed by GitHub
parent d1572fc3ea
commit b3228aa7ce
9 changed files with 24 additions and 20 deletions

View File

@@ -3243,7 +3243,7 @@ class Commande extends CommonOrder
if ($product_stock < $qty) {
$langs->load("errors");
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', (string) $product->ref);
$this->errors[] = $this->error;
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);

View File

@@ -4647,7 +4647,7 @@ class Facture extends CommonInvoice
if ($product_stock < $qty) {
$langs->load("errors");
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref);
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', (string) $product->ref);
$this->db->rollback();
return -3;
}

View File

@@ -1913,7 +1913,7 @@ function dol_meta_create($object)
if ($dir) {
$object->fetch_thirdparty();
$objectref = dol_sanitizeFileName($object->ref);
$objectref = dol_sanitizeFileName((string) $object->ref);
$dir = $dir."/".$objectref;
$file = $dir."/".$objectref.".meta";

View File

@@ -3429,7 +3429,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
$tmptxt = $object->getLibStatut(6, $object->alreadypaid);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
$tmptxt = $object->getLibStatut(5, $object->alreadypaid);
$tmptxt = $object->getLibStatut(5, (float) $object->alreadypaid);
}
$morehtmlstatus .= $tmptxt;
} elseif (in_array($object->element, array('chargesociales', 'loan', 'tva'))) { // TODO Move this to use ->alreadypaid like for invoices
@@ -8831,7 +8831,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = '
// We will enhance here a common way of forging path for document storage.
// In a future, we may distribute directories on several levels depending on setup and object.
// Here, $object->id, $object->ref and $modulepart are required.
if (in_array($modulepart, array('societe', 'thirdparty')) && $object instanceOf Societe) {
if (in_array($modulepart, array('societe', 'thirdparty')) && $object instanceof Societe) {
// Special case for thirdparty, where the ref is a company name that is not unique so path on disk is using the ID instead of the ref
$path = dol_sanitizeFileName((string) $object->id);
} else {

View File

@@ -1179,7 +1179,7 @@ class pdf_espadon extends ModelePdfExpedition
}
$Yoff += 8;
$pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R');
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities((string) $text), 0, 'R');
$Yoff += 3;
$pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R');

View File

@@ -1035,7 +1035,7 @@ class pdf_rouget extends ModelePdfExpedition
}
$Yoff += 8;
$pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R');
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities((string) $text), 0, 'R');
$Yoff += 3;
$pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R');

View File

@@ -1082,7 +1082,7 @@ class pdf_azur extends ModelePDFPropales
$bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
}
$account = new Account($this->db);
$account->fetch($bankid);
$account->fetch((int) $bankid);
$curx = $this->marge_gauche;
$cury = $posy;

View File

@@ -1250,7 +1250,7 @@ class pdf_cyan extends ModelePDFPropales
$bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
}
$account = new Account($this->db);
$account->fetch($bankid);
$account->fetch((int) $bankid);
$curx = $this->marge_gauche;
$cury = $posy;

View File

@@ -1148,7 +1148,9 @@ class Product extends CommonObject
$sql .= ", fk_unit";
$sql .= ", mandatory_period";
$sql .= ", stockable_product";
if (!empty($this->default_vat_code)) $sql.=", default_vat_code";
if (!empty($this->default_vat_code)) {
$sql .= ", default_vat_code";
}
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($this->date_creation)."'";
$sql .= ", ".(!empty($this->entity) ? (int) $this->entity : (int) $conf->entity);
@@ -1181,7 +1183,9 @@ class Product extends CommonObject
$sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL');
$sql .= ", '".$this->db->escape((string) $this->mandatory_period)."'";
$sql .= ", ".((int) $this->stockable_product);
if (!empty($this->default_vat_code)) $sql.=", '".$this->db->escape($this->default_vat_code)."'";
if (!empty($this->default_vat_code)) {
$sql .= ", '".$this->db->escape($this->default_vat_code)."'";
}
$sql .= ")";
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
@@ -7233,7 +7237,7 @@ class Product extends CommonObject
$return .= '<div class="info-box info-box-sm">';
$return .= '<div class="info-box-img">';
$label = '';
if ($this->is_photo_available($conf->product->multidir_output[$this->entity])) {
if ($this->entity !== null && $this->is_photo_available($conf->product->multidir_output[$this->entity])) {
$label .= $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 120, 160, 0, 0, 0, '', 'photoref photokanban');
$return .= $label;
} else {