';
- * @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (NOO)' for example. Use '' for no forcing.
+ * @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (NOO)' for example. Use '' for no forcing.
$date = $obj->periode;
$datepaid = dol_mktime(12, 0, 0, GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear"));
$datepaid = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear"));
@@ -132,14 +122,12 @@
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
TaskItem(pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt)
if ($action == "transfert") {
- if ($object->id > 0 && $action == 'addin') {
if (GETPOST('reday')) {
if (GETPOSTINT("reyear") && GETPOSTINT("remonth") && GETPOSTINT("reday")) {
print '';
print '
\n";
if (method_exists($module, 'info')) {
- print $module->info($langs);
+ print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
print $module->description;
}
diff --git a/htdocs/product/ajax/product_lot.php b/htdocs/product/ajax/product_lot.php
index 3c2596e1e10..71de65202a8 100644
--- a/htdocs/product/ajax/product_lot.php
+++ b/htdocs/product/ajax/product_lot.php
@@ -1,6 +1,7 @@
* Copyright (C) 2023 Lionel Vessiller
+ * 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
@@ -60,7 +61,7 @@ $rows = array();
if ($action == 'search' && $batch != '' && $permissiontoread) {
$productLot = new Productlot($db);
- $result = $productLot->fetch('', $productId, $batch);
+ $result = $productLot->fetch(0, $productId, $batch);
if ($result > 0 && $productLot->id > 0) {
$rows[] = array(
diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php
index 6ccec546297..03d81e8a421 100644
--- a/htdocs/product/canvas/product/actions_card_product.class.php
+++ b/htdocs/product/canvas/product/actions_card_product.class.php
@@ -1,6 +1,7 @@
* Copyright (C) 2024 Frédéric France
+ * 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
@@ -34,27 +35,69 @@ class ActionsCardProduct
*/
public $db;
+ /**
+ * @var string
+ */
public $dirmodule;
+ /**
+ * @var string
+ */
public $targetmodule;
+ /**
+ * @var string
+ */
public $canvas;
+ /**
+ * @var string
+ */
public $card;
+ /**
+ * @var string
+ */
public $name;
+ /**
+ * @var string
+ */
public $definition;
+ /**
+ * @var string
+ */
public $description;
+ /**
+ * @var string
+ */
public $price_base_type;
+ /**
+ * @var string
+ */
public $accountancy_code_sell;
+ /**
+ * @var string
+ */
public $accountancy_code_buy;
+ /**
+ * @var string
+ */
public $fieldListName;
+ /**
+ * @var string
+ */
public $next_prev_filter;
- //! Object container
+ /**
+ * @var Product Object container
+ */
public $object;
- //! Template container
+ /**
+ * @var array Template container
+ */
public $tpl = array();
- // List of fields for action=list
+ /**
+ * array,enabled:int<0,1>,order:int}> List of fields for action=list
+ */
public $field_list = array();
/**
@@ -96,8 +139,8 @@ class ActionsCardProduct
/**
* Assign custom values for canvas (for example into this->tpl to be used by templates)
*
- * @param string $action Type of action
- * @param integer $id Id of object
+ * @param string $action Type of action
+ * @param int $id Id of object
* @param string $ref Ref of object
* @return void
*/
@@ -107,6 +150,9 @@ class ActionsCardProduct
global $conf, $langs, $user, $mysoc, $canvas;
global $form, $formproduct;
+ '@phan-var-force Form $form';
+ '@phan-var-force FormProduct $formproduct';
+
$tmpobject = new Product($this->db);
if (!empty($id) || !empty($ref)) {
$tmpobject->fetch($id, $ref);
@@ -147,7 +193,7 @@ class ActionsCardProduct
$this->tpl['price_base_type'] = $form->selectPriceBaseType($this->price_base_type, "price_base_type");
// VAT
- $this->tpl['tva_tx'] = $form->load_tva("tva_tx", -1, $mysoc, '');
+ $this->tpl['tva_tx'] = $form->load_tva("tva_tx", -1, $mysoc, null);
}
if ($action == 'view') {
@@ -290,7 +336,6 @@ class ActionsCardProduct
$fieldlist["visible"] = $obj->visible;
$fieldlist["enabled"] = verifCond($obj->enabled);
$fieldlist["order"] = $obj->rang;
-
array_push($this->field_list, $fieldlist);
$i++;
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index d2e547e5e65..a2634994085 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -97,6 +97,7 @@ $error = 0;
$errors = array();
$refalreadyexists = 0;
+$formbarcode = null;
// Get parameters
$id = GETPOSTINT('id');
@@ -1057,8 +1058,11 @@ if (empty($reshook)) {
// Add product into object (when PRODUCT_ADD_FORM_ADD_TO is set)
if ($object->id > 0 && $action == 'addin') { // Test on permission not required here. it is done later according to object.
- $thirpdartyid = 0;
+ $thirdpartyid = 0;
$permissiontoaddline = false;
+ $propal = null;
+ $facture = null;
+ $commande = null;
// Get object and test permission
if (GETPOST('propalid') > 0) {
@@ -1068,7 +1072,7 @@ if (empty($reshook)) {
dol_print_error($db, $propal->error);
exit;
}
- $thirpdartyid = $propal->socid;
+ $thirdpartyid = $propal->socid;
$permissiontoaddline = $user->hasRight('propal', 'creer');
} elseif (GETPOST('commandeid') > 0) {
$commande = new Commande($db);
@@ -1077,7 +1081,7 @@ if (empty($reshook)) {
dol_print_error($db, $commande->error);
exit;
}
- $thirpdartyid = $commande->socid;
+ $thirdpartyid = $commande->socid;
$permissiontoaddline = $user->hasRight('commande', 'creer');
} elseif (GETPOST('factureid') > 0) {
$facture = new Facture($db);
@@ -1086,13 +1090,13 @@ if (empty($reshook)) {
dol_print_error($db, $facture->error);
exit;
}
- $thirpdartyid = $facture->socid;
+ $thirdpartyid = $facture->socid;
$permissiontoaddline = $user->hasRight('facture', 'creer');
}
- if ($thirpdartyid > 0) {
+ if ($thirdpartyid > 0) {
$soc = new Societe($db);
- $result = $soc->fetch($thirpdartyid);
+ $result = $soc->fetch($thirdpartyid);
if ($result <= 0) {
dol_print_error($db, $soc->error);
exit;
@@ -1148,7 +1152,7 @@ if (empty($reshook)) {
}
}
- if (GETPOST('propalid') > 0 && $permissiontoaddline) {
+ if (GETPOST('propalid') > 0 && $permissiontoaddline && is_object($propal)) {
// Define cost price for margin calculation
$buyprice = 0;
if (($result = $propal->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) {
@@ -1188,7 +1192,7 @@ if (empty($reshook)) {
}
setEventMessages($langs->trans("ErrorUnknown").": $result", null, 'errors');
- } elseif (GETPOST('commandeid') > 0 && $permissiontoaddline) {
+ } elseif (GETPOST('commandeid') > 0 && $permissiontoaddline && is_object($commande)) {
// Define cost price for margin calculation
$buyprice = 0;
if (($result = $commande->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) {
@@ -1207,8 +1211,8 @@ if (empty($reshook)) {
$localtax2_tx, // localtax2
$object->id,
price2num(GETPOST('remise_percent'), '', 2),
- '',
- '',
+ 0,
+ 0,
$price_base_type,
$pu_ttc,
'',
@@ -1217,10 +1221,10 @@ if (empty($reshook)) {
-1,
0,
0,
- null,
+ 0,
$buyprice,
'',
- 0,
+ array(),
$object->fk_unit
);
@@ -1230,7 +1234,7 @@ if (empty($reshook)) {
}
setEventMessages($langs->trans("ErrorUnknown").": $result", null, 'errors');
- } elseif (GETPOST('factureid') > 0 && $permissiontoaddline) {
+ } elseif (GETPOST('factureid') > 0 && $permissiontoaddline && is_object($facture)) {
// Define cost price for margin calculation
$buyprice = 0;
if (($result = $facture->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) {
@@ -1251,9 +1255,9 @@ if (empty($reshook)) {
price2num(GETPOST('remise_percent'), '', 2),
'',
'',
- '',
- '',
- '',
+ 0,
+ 0,
+ 0,
$price_base_type,
$pu_ttc,
Facture::TYPE_STANDARD,
@@ -1262,12 +1266,12 @@ if (empty($reshook)) {
'',
0,
0,
- null,
+ 0,
$buyprice,
'',
- 0,
+ array(),
100,
- '',
+ 0,
$object->fk_unit
);
@@ -1328,6 +1332,7 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-product page-card');
// Load object modBarCodeProduct
$res = 0;
+$modBarCodeProduct = null;
if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) {
$module = strtolower(getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM'));
$dirbarcode = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
@@ -1339,6 +1344,7 @@ if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM'))
}
if ($res > 0) {
$modBarCodeProduct = new $module();
+ '@phan-var-force ModeleBarCode $modBarCodeProduct';
}
}
@@ -1522,7 +1528,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
$showbarcode = 0;
}
- if ($showbarcode) {
+ if ($showbarcode && is_object($modBarCodeProduct)) {
print '
'."\n";
diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
index f8f68ff261c..ecd08ea71a6 100644
--- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
+++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php
@@ -645,9 +645,9 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
/**
* Return list of active generation modules
*
- * @param DoliDB $db Database handler
- * @param integer $maxfilenamelength Max length of value to show
- * @return array List of templates
+ * @param DoliDB $db Database handler
+ * @param int<0,max> $maxfilenamelength Max length of value to show
+ * @return string[]|int<-1,0> List of templates
*/
public static function liste_modeles($db, $maxfilenamelength = 0)
{
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 563269809c4..0e8fee90371 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2570,7 +2570,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
}
$i++;
}
- if ($NBCOLS > 0 && $j % 2 == 1) {
+ if ($NBCOLS > 0 && ($j % 2) == 1) {
print '
';
}
diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php
index b757b28c6b0..2362599a432 100644
--- a/htdocs/societe/class/api_thirdparties.class.php
+++ b/htdocs/societe/class/api_thirdparties.class.php
@@ -1,7 +1,7 @@
* Copyright (C) 2018 Pierre Chéné
- * Copyright (C) 2019 Cedric Ancelin
+ * Copyright (C) 2019 Cedric Ancelin
* Copyright (C) 2020-2024 Frédéric France
* Copyright (C) 2023 Alexandre Janniaux
* Copyright (C) 2024 MDW
diff --git a/htdocs/workstation/class/api_workstations.class.php b/htdocs/workstation/class/api_workstations.class.php
index a35388697d7..263a7b28c77 100644
--- a/htdocs/workstation/class/api_workstations.class.php
+++ b/htdocs/workstation/class/api_workstations.class.php
@@ -1,7 +1,8 @@
- * Copyright (C) 2019 Cedric Ancelin
- * Copyright (C) 2024 Christian Humpel
+/* Copyright (C) 2015 Jean-François Ferry
+ * Copyright (C) 2019 Cedric Ancelin
+ * Copyright (C) 2024 Christian Humpel
+ * 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
@@ -170,7 +171,7 @@ class Workstations extends DolibarrApi
$obj_ret['pagination'] = array(
'total' => (int) $total,
'page' => $page, //count starts from 0
- 'page_count' => ceil((int) $total/$limit),
+ 'page_count' => ceil((int) $total / $limit),
'limit' => $limit
);
}
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index 502b0961488..4dbc3a640b4 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -51,9 +51,11 @@ parameters:
- '#(?:Variable \$(?:_(?:FILES|POST|SERVER)|array_propal_object|baseUri|current_fiscal_period|d(?:b_create_(?:database|user)|olibarr_main_(?:db_prefix|url_root)|raftchecked)|erreur_ajout_date|isImageValid|keyforstripeterminalbank|(?:lo|mar)gin|max|n(?:ewProperty|um)|p(?:ermsgroupbyentitypluszero|ro(?:gressCalculated|parrayofkeyval)|ublic)|t(?:(?:itl|otal_tim)e|va_tx)|var)) in isset\(\) always exists and is not nullable#'
- '#(?:Property CommonOrderLine::\$multicurrency_subprice \(float\) on left side of \?\?|isset\(\)) is not nullable#'
- '#(?:(?:Elsei|I)f condition|Left side of (?:&&|\|\|)|Negated boolean expression|R(?:esult of (?:&&|\|\|)|ight side of (?:&&|\|\|))|Ternary operator condition) is always false#'
- - '#(?:Comparison operation "(?:<(?:" between (?:0(?:(?:\|1)? and 0)|21(?: and 14|\.0 and 17)|int<(?:0, max>(?:(?:\|false)? and 0)|1, max> and 1)|null and 0)|=" between int<2, max> and 1)|>(?:" between (?:(?:-1|0) and 0|0(?: and 1(?:000)?|\|1\|2\|3 and 999)|1 and 1)|=" between 0 and 8))) is always fal#'
+ - '#(?:Comparison operation "(?:<(?:" between (?:0(?:(?:\|1)? and 0)|int<(?:0, max>(?:(?:\|false)? and 0)|1, max> and 1)|null and 0)|=" between int<2, max> and 1)|>(?:" between (?:(?:-1|0) and 0|0(?: and 1(?:000)?|\|1\|2\|3 and 999)|1 and 1)))) is always false#'
+ - '#(?:Comparison operation ">=" between 0 and 8) is always false#'
+
- "#(?:Comparison operation .<. between '' and 0 is always) true#"
- - '#(?:Comparison operation "(?:<(?:" between (?:(?:..|-1) and 0|0 and 4)|=" between (?:0 and 0|int<100, 999> and 999))|>(?:" between (?:1(?:(?:\|2)? and 0)|int<(?:1, max> and 0|2, max> and 1))|=" between (?:\S+ and 0|21\.0 and (?:15|6\.0)|int<(?:0, max> and 0|1, max> and 1))))) is always true#'
+ - '#(?:Comparison operation "(?:<(?:" between (?:(?:..|-1) and 0|0 and 4)|=" between (?:0 and 0|int<100, 999> and 999))|>(?:" between (?:1(?:(?:\|2)? and 0)|int<(?:1, max> and 0|2, max> and 1))|=" between (?:\S+ and 0|int<(?:0, max> and 0|1, max> and 1))))) is always true#'
- '#(?:Else branch is unreachable because (?:(?:previous|ternary operator) condition)) is always true#'
- '#(?:(?:Elsei|I)f condition|Left side of (?:&&|\|\|)|Negated boolean expression|R(?:esult of (?:&&|\|\|)|ight side of (?:&&|\|\|))|Ternary operator condition) is always true#'
- '#is_object\(\) with mixed will always evaluate to false#'
@@ -78,7 +80,8 @@ parameters:
- '#EvalMath::trigger\(\) expects string, int given#'
- '# Diff::generatePartialDiff\(\) expects array#'
- '# EmailCollector::getpart\(\) expects string#'
- - '#expects int, float#'
+ - '#(?:convertSecondToTime) expects int, float\|string given#'
+ - '#(?:Comm(?:(?:ande::updateline|on(?:Invoice::getLibStatut|StickerGenerator::(?:Set_Char_Size|_Croix|convertMetric)))\(\))|Facture(?:(?:::update|FournisseurRec::add)line\(\))|(?:Holiday::addLogCP|Loan::getLibStatut|SupplierProposal::updateline)\(\)|c(?:alcul_price_total|onvert(?:DurationtoHour|SecondToTime))|dol_(?:substr|time_plus_duree)|pdf_(?:azur::_tableau_(?:(?:info|tot)\(\))|ban(?:::_tableau\(\)|k)|c(?:anelle::_tableau_(?:(?:tot|versements)\(\))|ornas::_tableau_(?:(?:info|tot)\(\))|rabe::_tableau_(?:(?:info|tot|versements)\(\))|yan::draw(?:(?:Info|Total)Table\(\)))|e(?:agle(?:(?:::_tableau_tot|_proforma::drawTotalTable)\(\))|instein::_tableau_(?:(?:info|tot)\(\))|ratosthene::draw(?:(?:Info|Total)Table\(\))|spadon::_tableau_tot\(\))|muscadet::_tableau_(?:(?:info|tot)\(\))|octopus::(?:_table(?:(?:FirstPage|au)\(\))|draw(?:(?:Info|Total)Table\(\)))|page(?:foot|head)|(?:rouget::_tableau_tot|s(?:epamandate::_tableau(?:_info)?|ponge::draw(?:(?:Info|Total)Table)|quille::_tableau_tot|t(?:andard_(?:e(?:(?:valuation|xpensereport)::_tableau|xpensereport::tablePayments)|(?:myobjec|supplierpaymen)t::_tableau|supplierpayment::_tableau_cheque)|orm::_tableau_info|rato::tabSignature))|t(?:cpdflabel::writeBarcode|yphon::_tableau_info)|vinci::_tableau_info)\(\)|w(?:atermark|rite(?:LinkedObjects|linedesc))|zenith::_tableau_tot\(\))|usleep) expects int, float given\.#'
- '#::saveboxorder\(\) expects int, array#'
- '# (fetchObjectByElement|print_actions_filter|dol_mktime|dol_remove_file_process) expects int, array\|string given.#'
- '# (CSMSFile) constructor expects int, array\|string given.#'