mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-11 02:12:33 +01:00
Merge pull request #32330 from frederic34/product_class_phpstan
fix phpstan
This commit is contained in:
@@ -25374,36 +25374,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../htdocs/product/class/product.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Product\:\:\$stats_bom has no type specified\.$#'
|
||||
identifier: missingType.property
|
||||
count: 1
|
||||
path: ../../htdocs/product/class/product.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Product\:\:\$stats_facture_fournisseur has no type specified\.$#'
|
||||
identifier: missingType.property
|
||||
count: 1
|
||||
path: ../../htdocs/product/class/product.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Product\:\:\$stats_facturerec has no type specified\.$#'
|
||||
identifier: missingType.property
|
||||
count: 1
|
||||
path: ../../htdocs/product/class/product.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Product\:\:\$stats_mrptoconsume has no type specified\.$#'
|
||||
identifier: missingType.property
|
||||
count: 1
|
||||
path: ../../htdocs/product/class/product.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Product\:\:\$stats_mrptoproduce has no type specified\.$#'
|
||||
identifier: missingType.property
|
||||
count: 1
|
||||
path: ../../htdocs/product/class/product.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Product\:\:\$status \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
@@ -25434,12 +25404,6 @@ parameters:
|
||||
count: 2
|
||||
path: ../../htdocs/product/class/product.class.php
|
||||
|
||||
-
|
||||
message: '#^Ternary operator condition is always true\.$#'
|
||||
identifier: ternary.alwaysTrue
|
||||
count: 1
|
||||
path: ../../htdocs/product/class/product.class.php
|
||||
|
||||
-
|
||||
message: '#^Negated boolean expression is always true\.$#'
|
||||
identifier: booleanNot.alwaysTrue
|
||||
|
||||
@@ -646,10 +646,30 @@ class Product extends CommonObject
|
||||
* @var array{}|array{customers_toconsume:int,nb_toconsume:int,qty_toconsume:float,customers_consumed:int,nb_consumed:int,qty_consumed:float,customers_toproduce:int,nb_toproduce:int,qty_toproduce:float,customers_produced:int,nb_produced:int,qty_produced:float} stats by role toconsume, consumed, toproduce, produced
|
||||
*/
|
||||
public $stats_mo = array();
|
||||
|
||||
/**
|
||||
* @var array{}|array{nb_toproduce:int,nb_toconsume:int,qty_toproduce:float,qty_toconsume:float}
|
||||
*/
|
||||
public $stats_bom = array();
|
||||
|
||||
/**
|
||||
* @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats mrp to consume
|
||||
*/
|
||||
public $stats_mrptoconsume = array();
|
||||
|
||||
/**
|
||||
* @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats mrp to produce
|
||||
*/
|
||||
public $stats_mrptoproduce = array();
|
||||
|
||||
/**
|
||||
* @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats facture rec
|
||||
*/
|
||||
public $stats_facturerec = array();
|
||||
|
||||
/**
|
||||
* @var array{}|array{suppliers:int,nb:int,rows:int,qty:float} stats supplier invoices
|
||||
*/
|
||||
public $stats_facture_fournisseur = array();
|
||||
|
||||
/**
|
||||
@@ -1137,10 +1157,10 @@ class Product extends CommonObject
|
||||
|
||||
if ($id > 0) {
|
||||
$this->id = $id;
|
||||
$this->price = $price_ht;
|
||||
$this->price_ttc = $price_ttc;
|
||||
$this->price_min = $price_min_ht;
|
||||
$this->price_min_ttc = $price_min_ttc;
|
||||
$this->price = $price_ht;
|
||||
$this->price_ttc = $price_ttc;
|
||||
$this->price_min = $price_min_ht;
|
||||
$this->price_min_ttc = $price_min_ttc;
|
||||
|
||||
$result = $this->_log_price($user);
|
||||
if ($result > 0) {
|
||||
@@ -3079,7 +3099,7 @@ class Product extends CommonObject
|
||||
$this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null;
|
||||
$this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null;
|
||||
// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
|
||||
$this->multiprices_tva_tx[$i] = $result ? $result["tva_tx"].($result ? ' ('.$result['default_vat_code'].')' : '') : null;
|
||||
$this->multiprices_tva_tx[$i] = $result ? $result["tva_tx"].(!empty($result['default_vat_code']) ? ' ('.$result['default_vat_code'].')' : '') : null;
|
||||
$this->multiprices_recuperableonly[$i] = $result ? $result["recuperableonly"] : null;
|
||||
|
||||
// Price by quantity
|
||||
@@ -3909,36 +3929,36 @@ class Product extends CommonObject
|
||||
$this->stats_mrptoconsume['customers'] = 0;
|
||||
$this->stats_mrptoconsume['nb'] = 0;
|
||||
$this->stats_mrptoconsume['rows'] = 0;
|
||||
$this->stats_mrptoconsume['qty'] = 0;
|
||||
$this->stats_mrptoconsume['qty'] = 0.0;
|
||||
$this->stats_mrptoproduce['customers'] = 0;
|
||||
$this->stats_mrptoproduce['nb'] = 0;
|
||||
$this->stats_mrptoproduce['rows'] = 0;
|
||||
$this->stats_mrptoproduce['qty'] = 0;
|
||||
$this->stats_mrptoproduce['qty'] = 0.0;
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
while ($obj = $this->db->fetch_object($result)) {
|
||||
if ($obj->role == 'toconsume' && empty($warehouseid)) {
|
||||
$this->stats_mrptoconsume['customers'] += $obj->nb_customers;
|
||||
$this->stats_mrptoconsume['nb'] += $obj->nb;
|
||||
$this->stats_mrptoconsume['rows'] += $obj->nb_rows;
|
||||
$this->stats_mrptoconsume['qty'] += ($obj->qty ? $obj->qty : 0);
|
||||
$this->stats_mrptoconsume['customers'] += (int) $obj->nb_customers;
|
||||
$this->stats_mrptoconsume['nb'] += (int) $obj->nb;
|
||||
$this->stats_mrptoconsume['rows'] += (int) $obj->nb_rows;
|
||||
$this->stats_mrptoconsume['qty'] += ($obj->qty ? (float) $obj->qty : 0.0);
|
||||
}
|
||||
if ($obj->role == 'consumed' && empty($warehouseid)) {
|
||||
//$this->stats_mrptoconsume['customers'] += $obj->nb_customers;
|
||||
//$this->stats_mrptoconsume['nb'] += $obj->nb;
|
||||
//$this->stats_mrptoconsume['rows'] += $obj->nb_rows;
|
||||
$this->stats_mrptoconsume['qty'] -= ($obj->qty ? $obj->qty : 0);
|
||||
$this->stats_mrptoconsume['qty'] -= ($obj->qty ? (float) $obj->qty : 0.0);
|
||||
}
|
||||
if ($obj->role == 'toproduce') {
|
||||
if ($warehouseid) {
|
||||
$this->stock_warehouse[$warehouseid]->stats_mrptoproduce['qty'] += ($obj->qty ? $obj->qty : 0);
|
||||
$this->stock_warehouse[$warehouseid]->stats_mrptoproduce['qty'] += ($obj->qty ? (float) $obj->qty : 0.0);
|
||||
} else {
|
||||
$this->stats_mrptoproduce['customers'] += $obj->nb_customers;
|
||||
$this->stats_mrptoproduce['nb'] += $obj->nb;
|
||||
$this->stats_mrptoproduce['rows'] += $obj->nb_rows;
|
||||
$this->stats_mrptoproduce['qty'] += ($obj->qty ? $obj->qty : 0);
|
||||
$this->stats_mrptoproduce['customers'] += (int) $obj->nb_customers;
|
||||
$this->stats_mrptoproduce['nb'] += (int) $obj->nb;
|
||||
$this->stats_mrptoproduce['rows'] += (int) $obj->nb_rows;
|
||||
$this->stats_mrptoproduce['qty'] += ($obj->qty ? (float) $obj->qty : 0.0);
|
||||
}
|
||||
}
|
||||
if ($obj->role == 'produced') {
|
||||
@@ -4164,10 +4184,10 @@ class Product extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->stats_facturerec['customers'] = $obj->nb_customers;
|
||||
$this->stats_facturerec['nb'] = $obj->nb;
|
||||
$this->stats_facturerec['rows'] = $obj->nb_rows;
|
||||
$this->stats_facturerec['qty'] = $obj->qty ? $obj->qty : 0;
|
||||
$this->stats_facturerec['customers'] = (int) $obj->nb_customers;
|
||||
$this->stats_facturerec['nb'] = (int) $obj->nb;
|
||||
$this->stats_facturerec['rows'] = (int) $obj->nb_rows;
|
||||
$this->stats_facturerec['qty'] = $obj->qty ? (float) $obj->qty : 0.0;
|
||||
|
||||
// if it's a virtual product, maybe it is in invoice by extension
|
||||
if (getDolGlobalString('PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC')) {
|
||||
@@ -4238,10 +4258,10 @@ class Product extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->stats_facture_fournisseur['suppliers'] = $obj->nb_suppliers;
|
||||
$this->stats_facture_fournisseur['nb'] = $obj->nb;
|
||||
$this->stats_facture_fournisseur['rows'] = $obj->nb_rows;
|
||||
$this->stats_facture_fournisseur['qty'] = $obj->qty ? $obj->qty : 0;
|
||||
$this->stats_facture_fournisseur['suppliers'] = (int) $obj->nb_suppliers;
|
||||
$this->stats_facture_fournisseur['nb'] = (int) $obj->nb;
|
||||
$this->stats_facture_fournisseur['rows'] = (int) $obj->nb_rows;
|
||||
$this->stats_facture_fournisseur['qty'] = $obj->qty ? (float) $obj->qty : 0.0;
|
||||
|
||||
$parameters = array('socid' => $socid);
|
||||
$reshook = $hookmanager->executeHooks('loadStatsSupplierInvoice', $parameters, $this, $action);
|
||||
|
||||
Reference in New Issue
Block a user