diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index ac56139964c..7769ea3eb03 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17988,39 +17988,9 @@ parameters: count: 1 path: ../../htdocs/don/class/api_donations.class.php - - - message: '#^Call to function method_exists\(\) with \$this\(Don\) and ''LibStatut'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^Call to function method_exists\(\) with \$this\(Don\) and ''getNomUrl'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Don\) and ''amount'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Don\) and ''date'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/don/class/don.class.php - - message: '#^Call to function property_exists\(\) with \$this\(Don\) and ''societe'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType - count: 2 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue count: 1 path: ../../htdocs/don/class/don.class.php diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 9ba0ac8de98..da8bc1d2cf0 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -6,9 +6,9 @@ * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2019 Thibault FOUCART - * Copyright (C) 2019-2024 Frédéric France - * Copyright (C) 2021 Maxime DEMAREST - * Copyright (C) 2024 MDW + * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2021 Maxime DEMAREST + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -594,7 +594,7 @@ class Don extends CommonObject $this->db->begin(); - if (!$error && !$notrigger) { + if (!$notrigger) { // Call trigger $result = $this->call_trigger('DON_DELETE', $user); @@ -1185,20 +1185,20 @@ class Don extends CommonObject $return .= img_picto('', $this->picto); $return .= ''; $return .= '
'; - $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + $return .= '' . $this->getNomUrl(1) . ''; if ($selected >= 0) { $return .= ''; } - if (property_exists($this, 'date')) { + if (isDolTms($this->date)) { $return .= '   |   '.dol_print_date($this->date, 'day', 'tzuserrel').''; } - if (property_exists($this, 'societe') && !empty($this->societe)) { + if (!empty($this->societe)) { $return .= '
'.$langs->trans("Company").' : '.$this->societe.''; } - if (property_exists($this, 'amount')) { + if (!empty($this->amount)) { $return .= '
'.price($this->amount, 1, $langs, 1, -1, -1, $conf->currency).''; } - if (method_exists($this, 'LibStatut')) { + if (isset($this->status)) { $return .= '
'.$this->getLibStatut(3).'
'; } $return .= '
'; diff --git a/htdocs/don/list.php b/htdocs/don/list.php index da96c68cb04..39962377a14 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -469,6 +469,10 @@ while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); $donationstatic->setVarsFromFetchObj($obj); + $donationstatic->id = $obj->rowid; + $donationstatic->ref = $obj->rowid; + $donationstatic->date = $db->jdate($obj->datedon); + $donationstatic->status = $obj->status; $company = new Societe($db); $result = $company->fetch($obj->socid); @@ -480,10 +484,6 @@ while ($i < $imaxinloop) { } // Output Kanban $donationstatic->amount = $obj->amount; - $donationstatic->date = $obj->datedon; - $donationstatic->status = $obj->status; - $donationstatic->id = $obj->rowid; - $donationstatic->ref = $obj->rowid; if (!empty($obj->socid) && $company->id > 0) { $donationstatic->societe = $company->getNomUrl(1); @@ -506,8 +506,6 @@ while ($i < $imaxinloop) { print ''; } } else { - $donationstatic->id = $obj->rowid; - $donationstatic->ref = $obj->rowid; $donationstatic->lastname = $obj->lastname; $donationstatic->firstname = $obj->firstname;