clean code (#35518)

* clean code

* fix

* fix

* clean code
This commit is contained in:
Frédéric FRANCE 2025-09-28 13:58:30 +02:00 committed by GitHub
parent d286de5684
commit 8fa1df6560
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 42 additions and 90 deletions

View file

@ -7578,12 +7578,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php
-
message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\<float\>\|float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 3
path: ../../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
@ -7602,12 +7596,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
-
message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\<float\>\|float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 4
path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
@ -7734,12 +7722,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php
-
message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\<float\>\|float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 4
path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
@ -7770,12 +7752,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php
-
message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\<float\>\|float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 4
path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -7794,12 +7770,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
-
message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\<float\>\|float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 3
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
@ -8586,12 +8556,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
-
message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\<float\>\|float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../../htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
-
message: '#^Property Mo\:\:\$lines \(array\<MoLine\>\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@ -8718,24 +8682,12 @@ parameters:
count: 3
path: ../../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
-
message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\<float\>\|float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 3
path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
count: 1
path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php
-
message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\<float\>\|float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 5
path: ../../../htdocs/core/modules/propale/doc/pdf_cyan.modules.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
@ -8772,12 +8724,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
-
message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\<float\>\|float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../../htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php
-
message: '#^Right side of \|\| is always false\.$#'
identifier: booleanOr.rightAlwaysFalse
@ -8796,12 +8742,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
-
message: '#^Property CommandeFournisseur\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../../htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
-
message: '#^Right side of \|\| is always false\.$#'
identifier: booleanOr.rightAlwaysFalse
@ -8820,12 +8760,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
-
message: '#^Property CommandeFournisseur\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
-
message: '#^Right side of \|\| is always false\.$#'
identifier: booleanOr.rightAlwaysFalse
@ -8844,12 +8778,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
-
message: '#^Property SupplierProposal\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
@ -8862,12 +8790,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php
-
message: '#^Property SupplierProposal\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php
-
message: '#^Right side of \|\| is always false\.$#'
identifier: booleanOr.rightAlwaysFalse

View file

@ -554,7 +554,7 @@ abstract class CommonObject
public $multicurrency_code;
/**
* @var float|float[] Multicurrency rate ("tx" = "taux" in French)
* @var null|float|float[] Multicurrency rate ("tx" = "taux" in French)
* Or, just for the Paiement object, an array: invoice ID => currency rate for that invoice.
*/
public $multicurrency_tx;

View file

@ -276,7 +276,7 @@ class Expedition extends CommonObject
*/
public $multicurrency_code;
/**
* @var float
* @var ?float
*/
public $multicurrency_tx;
/**

View file

@ -198,7 +198,7 @@ class ExpenseReportLine extends CommonObjectLine
public $multicurrency_code;
/**
* @var float
* @var ?float
*/
public $multicurrency_tx;

View file

@ -330,7 +330,7 @@ class CommandeFournisseur extends CommonOrder
public $multicurrency_code;
/**
* @var float Rate
* @var ?float Rate
*/
public $multicurrency_tx;

View file

@ -217,7 +217,7 @@ class ProductFournisseurPrice extends CommonObject
*/
public $multicurrency_code;
/**
* @var float
* @var ?float
*/
public $multicurrency_tx;
/**

View file

@ -234,7 +234,7 @@ class SupplierProposal extends CommonObject
*/
public $multicurrency_code;
/**
* @var float
* @var ?float
*/
public $multicurrency_tx;
/**
@ -542,15 +542,13 @@ class SupplierProposal extends CommonObject
return -1;
}
if ($result < -1) {
$this->error = $productsupplier->error;
$this->errors = $productsupplier->errors;
$this->setErrorsFromObject($productsupplier);
$this->db->rollback();
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_ERR);
return -1;
}
} else {
$this->error = $productsupplier->error;
$this->errors = $productsupplier->errors;
$this->setErrorsFromObject($productsupplier);
$this->db->rollback();
return -1;
}
@ -578,7 +576,23 @@ class SupplierProposal extends CommonObject
$pu = 0;
}
$tabprice = calcul_price_total($qty, $pu, (float) $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
$tabprice = calcul_price_total(
$qty,
$pu,
(float) $remise_percent,
$txtva,
(float) $txlocaltax1,
(float) $txlocaltax2,
0,
$price_base_type,
$info_bits,
$type,
$this->thirdparty,
$localtaxes_type,
100,
(float) $this->multicurrency_tx,
$pu_ht_devise
);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -769,7 +783,23 @@ class SupplierProposal extends CommonObject
$pu = 0;
}
$tabprice = calcul_price_total($qty, $pu, (float) $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
$tabprice = calcul_price_total(
$qty,
$pu,
(float) $remise_percent,
$txtva,
(float) $txlocaltax1,
(float) $txlocaltax2,
0,
$price_base_type,
$info_bits,
$type,
$this->thirdparty,
$localtaxes_type,
100,
(float) $this->multicurrency_tx,
$pu_ht_devise
);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];