Qual Fix phan notices (margin)
This commit is contained in:
parent
4de757a774
commit
da81270fb8
6 changed files with 19 additions and 23 deletions
|
|
@ -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'],
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -134,7 +134,7 @@ print '<table class="border centpercent">';
|
|||
|
||||
print '<tr><td class="titlefield">'.$langs->trans('ContactOfInvoice').'</td>';
|
||||
print '<td class="maxwidthonsmartphone" colspan="4">';
|
||||
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 '</td></tr>';
|
||||
|
||||
// Start date
|
||||
|
|
@ -345,8 +345,8 @@ if ($result) {
|
|||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$group_array['htmlname']."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num($pv, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num($pa, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num((float) $pv, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num((float) $pa, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num($marge, 'MT')).'</span></td>';
|
||||
if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
|
||||
print '<td class="nowrap right">'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'</td>';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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 '<tr><td class="titlefield">'.$langs->trans('ThirdPartyName').'</td>';
|
||||
print '<td class="maxwidthonsmartphone" colspan="4">';
|
||||
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 '</td></tr>';
|
||||
}
|
||||
|
||||
|
|
@ -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 '</td></tr>';
|
||||
|
||||
// Categories
|
||||
$TCats = $form->select_all_categories('product', array(), '', 64, 0, 3);
|
||||
$TCats = $form->select_all_categories('product', 0, '', 64, 0, 3);
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans('Category').'</td>';
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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 '</td></tr>';
|
||||
|
||||
// Categories
|
||||
$TCats = $form->select_all_categories('product', array(), '', 64, 0, 3);
|
||||
$TCats = $form->select_all_categories('product', 0, '', 64, 0, 3);
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans('Category').'</td>';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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";
|
||||
|
|
|
|||
Loading…
Reference in a new issue