clean code (#36053)

* clean code

* clean code
This commit is contained in:
Frédéric FRANCE 2025-11-01 17:47:13 +01:00 committed by GitHub
parent f4b91c40a1
commit 0a3d2c7ddc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 45 deletions

View file

@ -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

View file

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com>
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
@ -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 .= '</div>';
$return .= '<div class="info-box-content" >';
$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->getNomUrl() . '</span>';
if ($selected >= 0) {
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
if (property_exists($this, 'lieu') && (!empty($this->lieu))) {
if (!empty($this->lieu)) {
$return .= '<br><span class="info-box-label opacitymedium">'.$this->lieu.'</span>';
}
if ($arraydata['sellvalue'] != 0) {
@ -1098,9 +1093,7 @@ class Entrepot extends CommonObject
$return .= '<br><span class="info-box-label amount">'.price($arraydata['sellvalue']).'</span>';
}
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
}
$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';