diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 47f28a257ba..716996e9d84 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,14 +9,14 @@ */ return [ // # Issue statistics: - // PhanTypeMismatchArgument : 2570+ occurrences + // PhanTypeMismatchArgument : 2560+ occurrences // PhanUndeclaredProperty : 530+ occurrences // PhanTypeMismatchArgumentNullable : 450+ occurrences // PhanUndeclaredGlobalVariable : 190+ occurrences // PhanPluginUnknownArrayMethodReturnType : 180+ occurrences // PhanPossiblyUndeclaredGlobalVariable : 160+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 130+ occurrences // PhanTypeMismatchProperty : 130+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 120+ occurrences // PhanPluginUnknownArrayMethodParamType : 110+ occurrences // PhanRedefineFunction : 40+ occurrences // PhanTypeExpectedObjectPropAccess : 40+ occurrences @@ -187,7 +187,6 @@ return [ 'htdocs/bookmarks/card.php' => ['PhanTypeMismatchArgument'], 'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/categories/class/categorie.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/categories/edit.php' => ['PhanTypeMismatchArgument'], 'htdocs/categories/photos.php' => ['PhanTypeMismatchArgument'], 'htdocs/categories/viewcat.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], 'htdocs/collab/index.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'], @@ -453,7 +452,6 @@ return [ 'htdocs/core/modules/member/doc/pdf_standard_member.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/member/modules_cards.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/modAdherent.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/core/modules/modAgenda.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/modCommande.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/modContrat.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/core/modules/modDon.class.php' => ['PhanTypeMismatchArgument'], @@ -624,10 +622,6 @@ return [ 'htdocs/loan/document.php' => ['PhanUndeclaredProperty'], 'htdocs/loan/note.php' => ['PhanUndeclaredProperty'], 'htdocs/loan/payment/payment.php' => ['PhanUndeclaredProperty'], - 'htdocs/margin/agentMargins.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/margin/customerMargins.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/margin/productMargins.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/margin/tabs/productMargins.php' => ['PhanTypeMismatchArgument'], 'htdocs/modulebuilder/index.php' => ['PhanTypeMismatchArgumentNullable'], 'htdocs/modulebuilder/template/admin/setup.php' => ['PhanTypeMismatchArgument'], 'htdocs/modulebuilder/template/ajax/myobject.php' => ['PhanTypeMismatchArgument'], diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 55699796ffa..8772968c774 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5498,7 +5498,7 @@ class Form * Return list of categories having chosen type * * @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated. - * @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element). Not used if $outputmode = 1. + * @param int|'auto'|'' $selected Id of category preselected or 'auto' (autoselect category if there is only one element). Not used if $outputmode = 1. * @param string $htmlname HTML field name * @param int $maxlength Maximum length for labels * @param int|string|int[] $fromid Keep only or Exclude (depending on $include parameter) all categories (including the leaf $fromid) into the tree after this id $fromid. diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 95c4ba1ad06..9bf8f5c3a0d 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -2,7 +2,7 @@ /* Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2015 Marcos García - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -134,7 +134,7 @@ print ''; print ''; print ''; // Start date @@ -345,8 +345,8 @@ if ($result) { print ''; print "\n"; - print ''; - print ''; + print ''; + print ''; print ''; if (getDolGlobalString('DISPLAY_MARGIN_RATES')) { print ''; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 1ec4b367601..a3fbcca6799 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Ferran Marcet - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -65,7 +65,7 @@ if (GETPOST('startdatemonth')) { $startdate = dol_mktime(0, 0, 0, GETPOSTINT('startdatemonth'), GETPOSTINT('startdateday'), GETPOSTINT('startdateyear')); } if (GETPOST('enddatemonth')) { - $enddate = dol_mktime(23, 59, 59, GETPOSTINT('enddatemonth'), GETPOSTINT('enddateday'), GETPOST('enddateyear')); + $enddate = dol_mktime(23, 59, 59, GETPOSTINT('enddatemonth'), GETPOSTINT('enddateday'), GETPOSTINT('enddateyear')); } // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context @@ -135,7 +135,7 @@ if ($socid > 0) { } else { print ''; print ''; } @@ -155,7 +155,7 @@ if (!$sortfield) { } // Products -$TRes = $form->select_produits_list('', '', '', '', 0, '', 1, 2, 1, 0, '', 1); +$TRes = $form->select_produits_list(0, '', '', 0, 0, '', 1, 2, 1, 0, '', 1); $TProducts = array(); foreach ($TRes as $prod) { @@ -168,7 +168,7 @@ print img_picto('', 'product').$form->multiselectarray('products', $TProducts, $ print ''; // Categories -$TCats = $form->select_all_categories('product', array(), '', 64, 0, 3); +$TCats = $form->select_all_categories('product', 0, '', 64, 0, 3); print ''; print ''; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index dac098bf848..459a1376dfb 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2020 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -77,7 +78,7 @@ if (GETPOST('startdatemonth')) { $startdate = dol_mktime(0, 0, 0, GETPOSTINT('startdatemonth'), GETPOSTINT('startdateday'), GETPOSTINT('startdateyear')); } if (GETPOST('enddatemonth')) { - $enddate = dol_mktime(23, 59, 59, GETPOSTINT('enddatemonth'), GETPOSTINT('enddateday'), GETPOST('enddateyear')); + $enddate = dol_mktime(23, 59, 59, GETPOSTINT('enddatemonth'), GETPOSTINT('enddateday'), GETPOSTINT('enddateyear')); } // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context @@ -130,7 +131,7 @@ print img_picto('', 'product', 'class="pictofixedwidth"').$form->select_produits print ''; // Categories -$TCats = $form->select_all_categories('product', array(), '', 64, 0, 3); +$TCats = $form->select_all_categories('product', 0, '', 64, 0, 3); print ''; print ''; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index cb4c213efc6..280ccc458ca 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -213,9 +214,9 @@ if ($id > 0 || !empty($ref)) { $sql .= " sc.fk_soc, sc.fk_user,"; } $sql .= " sum(d.total_ht) as selling_price,"; // may be negative or positive - $sql .= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty) as qty,"; // not always positive in case of Credit note - $sql .= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty * d.buy_price_ht * (d.situation_percent / 100)) as buying_price,"; // not always positive in case of Credit note - $sql .= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100))) as marge"; // not always positive in case of Credit note + $sql .= " ".$db->ifsql('f.type = 2', '-1', '1')." * sum(d.qty) as qty,"; // not always positive in case of Credit note + $sql .= " ".$db->ifsql('f.type = 2', '-1', '1')." * sum(d.qty * d.buy_price_ht * (d.situation_percent / 100)) as buying_price,"; // not always positive in case of Credit note + $sql .= " ".$db->ifsql('f.type = 2', '-1', '1')." * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100))) as marge"; // not always positive in case of Credit note $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."facture as f"; $sql .= ", ".MAIN_DB_PREFIX."facturedet as d";
'.$langs->trans('ContactOfInvoice').''; -print img_picto('', 'user').$form->select_dolusers($agentid, 'agentid', 1, '', $user->hasRight('margins', 'read', 'all') ? 0 : 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print img_picto('', 'user').$form->select_dolusers($agentid, 'agentid', 1, null, $user->hasRight('margins', 'read', 'all') ? 0 : 1, '', '', '0', 0, 0, '', 0, '', 'maxwidth300'); print '
".$group_array['htmlname']."'.price(price2num($pv, 'MT')).''.price(price2num($pa, 'MT')).''.price(price2num((float) $pv, 'MT')).''.price(price2num((float) $pa, 'MT')).''.price(price2num($marge, 'MT')).''.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'
'.$langs->trans('ThirdPartyName').''; - print img_picto('', 'company').$form->select_company(null, 'socid', '((client:=:1) OR (client:=:3))', 1, 0, 0); + print img_picto('', 'company').$form->select_company(0, 'socid', '((client:=:1) OR (client:=:3))', 1, 0, 0); print '
'.$langs->trans('Category').'
'.$langs->trans('Category').'