mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 11:31:26 +01:00
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:
@@ -3243,7 +3243,7 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
if ($product_stock < $qty) {
|
if ($product_stock < $qty) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
|
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', (string) $product->ref);
|
||||||
$this->errors[] = $this->error;
|
$this->errors[] = $this->error;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||||
|
|||||||
@@ -4647,7 +4647,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
if ($product_stock < $qty) {
|
if ($product_stock < $qty) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref);
|
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', (string) $product->ref);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1913,7 +1913,7 @@ function dol_meta_create($object)
|
|||||||
if ($dir) {
|
if ($dir) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$objectref = dol_sanitizeFileName($object->ref);
|
$objectref = dol_sanitizeFileName((string) $object->ref);
|
||||||
$dir = $dir."/".$objectref;
|
$dir = $dir."/".$objectref;
|
||||||
$file = $dir."/".$objectref.".meta";
|
$file = $dir."/".$objectref.".meta";
|
||||||
|
|
||||||
|
|||||||
@@ -3429,7 +3429,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
|||||||
}
|
}
|
||||||
$tmptxt = $object->getLibStatut(6, $object->alreadypaid);
|
$tmptxt = $object->getLibStatut(6, $object->alreadypaid);
|
||||||
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
|
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
|
||||||
$tmptxt = $object->getLibStatut(5, $object->alreadypaid);
|
$tmptxt = $object->getLibStatut(5, (float) $object->alreadypaid);
|
||||||
}
|
}
|
||||||
$morehtmlstatus .= $tmptxt;
|
$morehtmlstatus .= $tmptxt;
|
||||||
} elseif (in_array($object->element, array('chargesociales', 'loan', 'tva'))) { // TODO Move this to use ->alreadypaid like for invoices
|
} 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.
|
// 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.
|
// In a future, we may distribute directories on several levels depending on setup and object.
|
||||||
// Here, $object->id, $object->ref and $modulepart are required.
|
// 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
|
// 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);
|
$path = dol_sanitizeFileName((string) $object->id);
|
||||||
} else {
|
} else {
|
||||||
@@ -11650,14 +11650,14 @@ function dol_eval_new($s)
|
|||||||
{
|
{
|
||||||
// Only this global variables can be read by eval function and returned to caller
|
// Only this global variables can be read by eval function and returned to caller
|
||||||
global $conf, // Read of const is done with getDolGlobalString() but we need $conf->currency for example
|
global $conf, // Read of const is done with getDolGlobalString() but we need $conf->currency for example
|
||||||
$db, $langs, $user, $website, $websitepage,
|
$db, $langs, $user, $website, $websitepage,
|
||||||
$action, $mainmenu, $leftmenu,
|
$action, $mainmenu, $leftmenu,
|
||||||
$mysoc,
|
$mysoc,
|
||||||
$objectoffield, // To allow the use of $objectoffield in computed fields
|
$objectoffield, // To allow the use of $objectoffield in computed fields
|
||||||
|
|
||||||
// Old variables used
|
// Old variables used
|
||||||
$object,
|
$object,
|
||||||
$obj; // To get $obj used into list when dol_eval() is used for computed fields and $obj is not yet $object
|
$obj; // To get $obj used into list when dol_eval() is used for computed fields and $obj is not yet $object
|
||||||
|
|
||||||
// PHP < 7.4.0
|
// PHP < 7.4.0
|
||||||
defined('T_COALESCE_EQUAL') || define('T_COALESCE_EQUAL', PHP_INT_MAX);
|
defined('T_COALESCE_EQUAL') || define('T_COALESCE_EQUAL', PHP_INT_MAX);
|
||||||
|
|||||||
@@ -1179,7 +1179,7 @@ class pdf_espadon extends ModelePdfExpedition
|
|||||||
}
|
}
|
||||||
$Yoff += 8;
|
$Yoff += 8;
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
|
$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;
|
$Yoff += 3;
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
|
$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');
|
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R');
|
||||||
|
|||||||
@@ -1035,7 +1035,7 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
}
|
}
|
||||||
$Yoff += 8;
|
$Yoff += 8;
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
|
$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;
|
$Yoff += 3;
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
|
$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');
|
$pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date, "day", false, $outputlangs, true), 0, 'R');
|
||||||
|
|||||||
@@ -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
|
$bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
|
||||||
}
|
}
|
||||||
$account = new Account($this->db);
|
$account = new Account($this->db);
|
||||||
$account->fetch($bankid);
|
$account->fetch((int) $bankid);
|
||||||
|
|
||||||
$curx = $this->marge_gauche;
|
$curx = $this->marge_gauche;
|
||||||
$cury = $posy;
|
$cury = $posy;
|
||||||
|
|||||||
@@ -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
|
$bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
|
||||||
}
|
}
|
||||||
$account = new Account($this->db);
|
$account = new Account($this->db);
|
||||||
$account->fetch($bankid);
|
$account->fetch((int) $bankid);
|
||||||
|
|
||||||
$curx = $this->marge_gauche;
|
$curx = $this->marge_gauche;
|
||||||
$cury = $posy;
|
$cury = $posy;
|
||||||
|
|||||||
@@ -891,7 +891,7 @@ class Product extends CommonObject
|
|||||||
//'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>'0', 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
|
//'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>'0', 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
|
||||||
//'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>'0', 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
|
//'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>'0', 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
|
||||||
'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000),
|
'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000),
|
||||||
'stockable_product' =>array('type' => 'integer', 'label' => 'stockable_product', 'enabled' => 1, 'visible' => 1, 'default' => '1', 'notnull' => 1, 'index' => 1, 'position' => 502),
|
'stockable_product' => array('type' => 'integer', 'label' => 'stockable_product', 'enabled' => 1, 'visible' => 1, 'default' => '1', 'notnull' => 1, 'index' => 1, 'position' => 502),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1148,7 +1148,9 @@ class Product extends CommonObject
|
|||||||
$sql .= ", fk_unit";
|
$sql .= ", fk_unit";
|
||||||
$sql .= ", mandatory_period";
|
$sql .= ", mandatory_period";
|
||||||
$sql .= ", stockable_product";
|
$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 .= ") VALUES (";
|
||||||
$sql .= "'".$this->db->idate($this->date_creation)."'";
|
$sql .= "'".$this->db->idate($this->date_creation)."'";
|
||||||
$sql .= ", ".(!empty($this->entity) ? (int) $this->entity : (int) $conf->entity);
|
$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->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL');
|
||||||
$sql .= ", '".$this->db->escape((string) $this->mandatory_period)."'";
|
$sql .= ", '".$this->db->escape((string) $this->mandatory_period)."'";
|
||||||
$sql .= ", ".((int) $this->stockable_product);
|
$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 .= ")";
|
$sql .= ")";
|
||||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
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 info-box-sm">';
|
||||||
$return .= '<div class="info-box-img">';
|
$return .= '<div class="info-box-img">';
|
||||||
$label = '';
|
$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');
|
$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;
|
$return .= $label;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user