diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 177dbce72e6..8b57e485aad 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -12480,30 +12480,6 @@ parameters: count: 1 path: ../../../htdocs/product/stats/supplier_proposal.php - - - message: '#^Call to function method_exists\(\) with \$this\(Entrepot\) and ''getLibStatut'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/product/stock/class/entrepot.class.php - - - - message: '#^Call to function method_exists\(\) with \$this\(Entrepot\) and ''getNomUrl'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/product/stock/class/entrepot.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Entrepot\) and ''lieu'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/product/stock/class/entrepot.class.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 2 - path: ../../../htdocs/product/stock/class/entrepot.class.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index d83b6a56791..6b92d2607d8 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005-2008 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2016 Francis Appels +/* Copyright (C) 2003-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005-2008 Regis Houssin + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2016 Francis Appels * Copyright (C) 2019-2025 Frédéric France * Copyright (C) 2024-2025 MDW * @@ -283,12 +283,9 @@ class Entrepot extends CommonObject $id = $this->db->last_insert_id($this->db->prefix()."entrepot"); if ($id > 0) { $this->id = $id; - - if (!$error) { - $result = $this->update($id, $user); - if ($result <= 0) { - $error++; - } + $result = $this->update($id, $user); + if ($result <= 0) { + $error++; } // Actions on extra fields @@ -449,7 +446,7 @@ class Entrepot extends CommonObject $this->db->begin(); - if (!$error && empty($notrigger)) { + if (empty($notrigger)) { // Call trigger $result = $this->call_trigger('WAREHOUSE_DELETE', $user); if ($result < 0) { @@ -484,7 +481,7 @@ class Entrepot extends CommonObject } } - // Removed extrafields + // Remove extrafields if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) { @@ -1002,9 +999,7 @@ class Entrepot extends CommonObject { // phpcs:enable - $sql = "SELECT rowid - FROM ".$this->db->prefix()."entrepot - WHERE fk_parent = ".((int) $id); + $sql = "SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE fk_parent = ".((int) $id); $resql = $this->db->query($sql); if ($resql) { @@ -1084,11 +1079,11 @@ class Entrepot extends CommonObject $return .= img_picto('', $this->picto); $return .= ''; $return .= '
'; - $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + $return .= '' . $this->getNomUrl() . ''; if ($selected >= 0) { $return .= ''; } - if (property_exists($this, 'lieu') && (!empty($this->lieu))) { + if (!empty($this->lieu)) { $return .= '
'.$this->lieu.''; } if ($arraydata['sellvalue'] != 0) { @@ -1098,9 +1093,7 @@ class Entrepot extends CommonObject $return .= '
'.price($arraydata['sellvalue']).''; } } - if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(3).'
'; - } + $return .= '
'.$this->getLibStatut(3).'
'; $return .= '
'; $return .= ''; $return .= '';