From 741e75ee477cd584308dd10eafcb14745596c2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 4 Jun 2024 14:46:54 +0200 Subject: [PATCH] add phpdoc (#29832) * add phpdoc * fix phan * fix phan * fix phan * fix phan * fix phan * fix phan * fix phan * fix phan * fix phan * add phpdoc * fix phan * fix phan --- htdocs/comm/propal/class/propal.class.php | 10 +++++++--- htdocs/contrat/class/contrat.class.php | 15 +++++++++++---- htdocs/core/class/commonobjectline.class.php | 8 ++++++++ htdocs/delivery/class/delivery.class.php | 11 +++++++++++ .../class/expeditionlinebatch.class.php | 4 ++++ .../expensereport/class/expensereport.class.php | 8 ++++++-- htdocs/fichinter/class/fichinter.class.php | 5 +++++ .../class/fournisseur.facture-rec.class.php | 4 ++++ htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/mrp/class/mo.class.php | 16 ++++++++++++++-- htdocs/mrp/mo_production.php | 4 ++-- htdocs/product/class/productbatch.class.php | 4 ++++ .../product/inventory/class/inventory.class.php | 13 +++++++++++++ htdocs/product/inventory/inventory.php | 6 +++--- .../product/stock/class/mouvementstock.class.php | 3 +++ .../class/stocktransferline.class.php | 4 ++++ .../reception/class/receptionlinebatch.class.php | 13 ++++++++++--- htdocs/reception/dispatch.php | 2 +- .../class/recruitmentjobposition.class.php | 12 ++++++++++++ .../class/supplier_proposal.class.php | 13 ++++++++++--- 20 files changed, 133 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 87b4b11e86e..851cf464668 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -603,7 +603,7 @@ class Propal extends CommonObject } $remise_percent = price2num($remise_percent); - $qty = price2num($qty); + $qty = (float) price2num($qty); $pu_ht = price2num($pu_ht); $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); @@ -832,7 +832,7 @@ class Propal extends CommonObject // Clean parameters $remise_percent = price2num($remise_percent); - $qty = price2num($qty); + $qty = (float) price2num($qty); $pu = price2num($pu); $pu_ht_devise = price2num($pu_ht_devise); if (!preg_match('/\((.*)\)/', (string) $txtva)) { @@ -857,7 +857,7 @@ class Propal extends CommonObject return -1; } - if ($this->statut == self::STATUS_DRAFT) { + if ($this->status == self::STATUS_DRAFT) { $this->db->begin(); // Calcul du total TTC et de la TVA pour la ligne a partir de @@ -3999,6 +3999,10 @@ class PropaleLigne extends CommonObjectLine public $tva_tx; public $vat_src_code; + /** + * Unit price before taxes + * @var float + */ public $subprice; public $remise_percent; public $fk_remise_except; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index fbc8db2aae3..68211f0408c 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -3081,7 +3081,11 @@ class ContratLigne extends CommonObjectLine */ public $fk_remise_except; - public $subprice; // Unit price HT + /** + * Unit price before taxes + * @var float + */ + public $subprice; /** * @var float @@ -3090,6 +3094,9 @@ class ContratLigne extends CommonObjectLine */ public $price; + /** + * @var float price without tax + */ public $price_ht; public $total_ht; @@ -3473,11 +3480,11 @@ class ContratLigne extends CommonObjectLine $this->tva_tx = trim((string) $this->tva_tx); $this->localtax1_tx = trim($this->localtax1_tx); $this->localtax2_tx = trim($this->localtax2_tx); - $this->qty = trim((string) $this->qty); + $this->qty = (float) $this->qty; $this->remise_percent = trim((string) $this->remise_percent); $this->fk_remise_except = (int) $this->fk_remise_except; - $this->subprice = price2num($this->subprice); - $this->price_ht = price2num($this->price_ht); + $this->subprice = (float) price2num($this->subprice); + $this->price_ht = (float) price2num($this->price_ht); $this->info_bits = (int) $this->info_bits; $this->fk_user_author = (int) $this->fk_user_author; $this->fk_user_ouverture = (int) $this->fk_user_ouverture; diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 877c5b88d8e..052e22368cf 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -133,6 +133,9 @@ abstract class CommonObjectLine extends CommonObject */ public $fk_product_type; + /** + * @var float Quantity + */ public $qty; public $duree; public $remise_percent; @@ -149,6 +152,11 @@ abstract class CommonObjectLine extends CommonObject * @var int special code */ public $special_code; + + /** + * Unit price before taxes + * @var float + */ public $subprice; public $tva_tx; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 01041a3c570..345ab2cce79 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -1215,8 +1215,19 @@ class DeliveryLine extends CommonObjectLine public $libelle; // From llx_expeditiondet + /** + * @var float Quantity + */ public $qty; + + /** + * @var float Quantity asked + */ public $qty_asked; + + /** + * @var float Quantity shiiped + */ public $qty_shipped; public $fk_product; diff --git a/htdocs/expedition/class/expeditionlinebatch.class.php b/htdocs/expedition/class/expeditionlinebatch.class.php index 9bd94895f31..a1270b3b1c0 100644 --- a/htdocs/expedition/class/expeditionlinebatch.class.php +++ b/htdocs/expedition/class/expeditionlinebatch.class.php @@ -41,6 +41,10 @@ class ExpeditionLineBatch extends CommonObject public $sellby; public $eatby; public $batch; + + /** + * @var float Quantity + */ public $qty; public $dluo_qty; // deprecated, use qty public $entrepot_id; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 134b9d1f05e..f6a327d5a03 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1947,7 +1947,7 @@ class ExpenseReport extends CommonObject $fk_project = 0; } - $qty = price2num($qty); + $qty = (float) price2num($qty); if (!preg_match('/\s*\((.*)\)/', $vatrate)) { $vatrate = price2num($vatrate); // $txtva can have format '5.0 (XXX)' or '5' } @@ -2883,6 +2883,10 @@ class ExpenseReportLine extends CommonObjectLine public $rowid; public $comments; + + /** + * @var float Quantity + */ public $qty; public $value_unit; public $date; @@ -3054,7 +3058,7 @@ class ExpenseReportLine extends CommonObjectLine if (empty($this->value_unit)) { $this->value_unit = 0; } - $this->qty = price2num($this->qty); + $this->qty = (float) price2num($this->qty); $this->vatrate = price2num($this->vatrate); if (empty($this->fk_c_exp_tax_cat)) { $this->fk_c_exp_tax_cat = 0; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index b32e5621f55..be0fb963cdf 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1681,6 +1681,11 @@ class FichinterLigne extends CommonObjectLine public $duration; // Duration of intervention public $rang = 0; public $tva_tx; + + /** + * Unit price before taxes + * @var float + */ public $subprice; /** diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 8a5bd82c21b..6de584c4403 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -2029,6 +2029,10 @@ class FactureFournisseurLigneRec extends CommonInvoiceLine public $description; public $pu_ht; public $pu_ttc; + + /** + * @var float Quantity + */ public $qty; public $remise_percent; public $fk_remise_except; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 4dd2746cf49..b014f3b3223 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3852,7 +3852,7 @@ class SupplierInvoiceLine extends CommonObjectLine /** * Quantity - * @var double + * @var float */ public $qty; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 31404030fdb..0bab434a760 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -121,6 +121,10 @@ class Mo extends CommonObject */ public $mrptype; public $label; + + /** + * @var float Quantity + */ public $qty; public $fk_warehouse; public $fk_soc; @@ -759,7 +763,7 @@ class Mo extends CommonObject if ($line->qty_frozen) { $moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce } else { - $moline->qty = price2num(($line->qty / (!empty($bom->qty) ? $bom->qty : 1)) * $this->qty / (!empty($line->efficiency) ? $line->efficiency : 1), 'MS'); // Calculate with Qty to produce and more presition + $moline->qty = (float) price2num(($line->qty / (!empty($bom->qty) ? $bom->qty : 1)) * $this->qty / (!empty($line->efficiency) ? $line->efficiency : 1), 'MS'); // Calculate with Qty to produce and more presition } if ($moline->qty <= 0) { $error++; @@ -832,7 +836,7 @@ class Mo extends CommonObject if ($moLine->role == 'toconsume' || $moLine->role == 'toproduce') { if (empty($moLine->qty_frozen)) { $qty = $newQty * $moLine->qty / $oldQty; - $moLine->qty = price2num($qty, 'MS'); + $moLine->qty = (float) price2num($qty, 'MS'); $res = $moLine->update($user); if (!$res) { $error++; @@ -2068,7 +2072,15 @@ class MoLine extends CommonObjectLine public $position; public $fk_product; public $fk_warehouse; + + /** + * @var float Quantity + */ public $qty; + + /** + * @var float Quantity frozen + */ public $qty_frozen; public $disable_stock_change; public $efficiency; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 7926ba1cfcf..2f54778e5cf 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -252,7 +252,7 @@ if (empty($reshook)) { $i = 1; while (GETPOSTISSET('qty-'.$line->id.'-'.$i)) { - $qtytoprocess = price2num(GETPOST('qty-'.$line->id.'-'.$i)); + $qtytoprocess = (float) price2num(GETPOST('qty-'.$line->id.'-'.$i)); if ($qtytoprocess != 0) { // Check warehouse is set if we should have to @@ -326,7 +326,7 @@ if (empty($reshook)) { $i = 1; while (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) { - $qtytoprocess = price2num(GETPOST('qtytoproduce-'.$line->id.'-'.$i)); + $qtytoprocess = (float) price2num(GETPOST('qtytoproduce-'.$line->id.'-'.$i)); $pricetoprocess = GETPOST('pricetoproduce-'.$line->id.'-'.$i) ? price2num(GETPOST('pricetoproduce-'.$line->id.'-'.$i)) : 0; if ($qtytoprocess != 0) { diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index b83dbae4b28..bf0ddcda975 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -49,6 +49,10 @@ class Productbatch extends CommonObject public $fk_product_stock; public $batch = ''; + + /** + * @var float Quantity + */ public $qty; public $warehouseid; diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 612d54796e2..ddf130625b4 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -851,9 +851,22 @@ class InventoryLine extends CommonObjectLine public $fk_product; public $batch; public $datec; + + /** + * @var float Quantity stock + */ public $qty_stock; + + /** + * @var float|null Quantity viewed + */ public $qty_view; + + /** + * @var float Quantity regulated + */ public $qty_regulated; + public $pmp_real; public $pmp_expected; diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index a70a9a08faf..09cb73f4f95 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -290,14 +290,14 @@ if (empty($reshook)) { $resultupdate = 0; if (GETPOST("id_".$lineid, 'alpha') != '') { // If a value was set ('0' or something else) - $qtytoupdate = price2num(GETPOST("id_".$lineid, 'alpha'), 'MS'); + $qtytoupdate = (float) price2num(GETPOST("id_".$lineid, 'alpha'), 'MS'); $result = $inventoryline->fetch($lineid); if ($qtytoupdate < 0) { $result = -1; setEventMessages($langs->trans("FieldCannotBeNegative", $langs->transnoentitiesnoconv("RealQty")), null, 'errors'); } if ($result > 0) { - $inventoryline->qty_stock = price2num(GETPOST('stock_qty_'.$lineid, 'alpha'), 'MS'); // The new value that was set in as hidden field + $inventoryline->qty_stock = (float) price2num(GETPOST('stock_qty_'.$lineid, 'alpha'), 'MS'); // The new value that was set in as hidden field $inventoryline->qty_view = $qtytoupdate; // The new value we want $inventoryline->pmp_real = price2num(GETPOST('realpmp_'.$lineid, 'alpha'), 'MS'); $inventoryline->pmp_expected = price2num(GETPOST('expectedpmp_'.$lineid, 'alpha'), 'MS'); @@ -360,7 +360,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';*/ if (GETPOST('addline', 'alpha')) { - $qty = (GETPOST('qtytoadd') != '' ? price2num(GETPOST('qtytoadd', 'MS')) : null); + $qty = (GETPOST('qtytoadd') != '' ? ((float) price2num(GETPOST('qtytoadd'), 'MS')) : null); if ($fk_warehouse <= 0) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index d4899512a9d..6744af04022 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -60,6 +60,9 @@ class MouvementStock extends CommonObject */ public $warehouse_id; + /** + * @var float Quantity + */ public $qty; /** diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index 3439cea673b..3f3d58f047d 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -98,6 +98,10 @@ class StockTransferLine extends CommonObjectLine ); public $rowid; public $amount; + + /** + * @var float Quantity + */ public $qty; public $fk_warehouse_destination; public $fk_warehouse_source; diff --git a/htdocs/reception/class/receptionlinebatch.class.php b/htdocs/reception/class/receptionlinebatch.class.php index 9df90f141dc..26d77de5b3c 100644 --- a/htdocs/reception/class/receptionlinebatch.class.php +++ b/htdocs/reception/class/receptionlinebatch.class.php @@ -90,7 +90,14 @@ class ReceptionLineBatch extends CommonObjectLine */ public $fk_product; + /** + * @var float Quantity + */ public $qty; + + /** + * @var float Quantity asked + */ public $qty_asked; public $libelle; @@ -167,7 +174,7 @@ class ReceptionLineBatch extends CommonObjectLine $this->fk_elementdet = (int) $this->fk_elementdet; } if (isset($this->qty)) { - $this->qty = trim($this->qty); + $this->qty = (float) $this->qty; } if (isset($this->fk_entrepot)) { $this->fk_entrepot = (int) $this->fk_entrepot; @@ -374,7 +381,7 @@ class ReceptionLineBatch extends CommonObjectLine $this->fk_elementdet = (int) $this->fk_elementdet; } if (isset($this->qty)) { - $this->qty = trim($this->qty); + $this->qty = (float) $this->qty; } if (isset($this->fk_entrepot)) { $this->fk_entrepot = (int) $this->fk_entrepot; @@ -640,7 +647,7 @@ class ReceptionLineBatch extends CommonObjectLine $this->fk_element = 0; $this->fk_product = 0; $this->fk_elementdet = 0; - $this->qty = ''; + $this->qty = 0; $this->fk_entrepot = 0; $this->fk_user = 0; $this->datec = ''; diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php index c3a549bf520..8e17afbc87b 100644 --- a/htdocs/reception/dispatch.php +++ b/htdocs/reception/dispatch.php @@ -193,7 +193,7 @@ if ($action == 'updatelines' && $permissiontoreceive) { $error++; } else { $qtystart = $supplierorderdispatch->qty; - $supplierorderdispatch->qty = GETPOST($qty); + $supplierorderdispatch->qty = (float) price2num(GETPOST($qty)); $supplierorderdispatch->fk_entrepot = GETPOSTINT($ent); if ($modebatch == "batch") { $supplierorderdispatch->eatby = $dDLUO; diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 250be53a87f..6b2223d4982 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -142,8 +142,20 @@ class RecruitmentJobPosition extends CommonObject * @var string label */ public $label; + + /** + * @var float Quantity + */ public $qty; + + /** + * @var int ID thirdparty + */ public $fk_soc; + + /** + * @var int ID project + */ public $fk_project; public $fk_user_recruiter; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 5cfc1a462be..a8ba2385a90 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -421,7 +421,7 @@ class SupplierProposal extends CommonObject } $remise_percent = price2num($remise_percent); - $qty = price2num($qty); + $qty = (float) price2num($qty); $pu_ht = price2num($pu_ht); $pu_ttc = price2num($pu_ttc); if (!preg_match('/\((.*)\)/', (string) $txtva)) { @@ -682,7 +682,7 @@ class SupplierProposal extends CommonObject // Clean parameters $remise_percent = price2num($remise_percent); - $qty = price2num($qty); + $qty = (float) price2num($qty); $pu = price2num($pu); if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' @@ -697,7 +697,7 @@ class SupplierProposal extends CommonObject $special_code = 0; // Remove option tag } - if ($this->statut == 0) { + if ($this->status == 0) { $this->db->begin(); // Calcul du total TTC et de la TVA pour la ligne a partir de @@ -2851,10 +2851,17 @@ class SupplierProposalLine extends CommonObjectLine */ public $product_type = Product::TYPE_PRODUCT; + /** + * @var float Quantity + */ public $qty; public $tva_tx; public $vat_src_code; + /** + * Unit price before taxes + * @var float + */ public $subprice; public $remise_percent;