mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Qual: Fix some phan notices (#31948)
This commit is contained in:
parent
7a84561bba
commit
78fde76f61
|
|
@ -10,9 +10,9 @@
|
|||
return [
|
||||
// # Issue statistics:
|
||||
// PhanUndeclaredProperty : 560+ occurrences
|
||||
// PhanPossiblyUndeclaredGlobalVariable : 500+ occurrences
|
||||
// PhanPossiblyUndeclaredGlobalVariable : 490+ occurrences
|
||||
// PhanUndeclaredGlobalVariable : 350+ occurrences
|
||||
// PhanTypeMismatchArgumentProbablyReal : 270+ occurrences
|
||||
// PhanTypeMismatchArgumentProbablyReal : 260+ occurrences
|
||||
// PhanPluginUnknownArrayMethodReturnType : 180+ occurrences
|
||||
// PhanTypeMismatchProperty : 140+ occurrences
|
||||
// PhanPluginUnknownPropertyType : 130+ occurrences
|
||||
|
|
@ -21,7 +21,7 @@ return [
|
|||
// PhanPluginUndeclaredVariableIsset : 65+ occurrences
|
||||
// PhanRedefineFunction : 45+ occurrences
|
||||
// PhanTypeExpectedObjectPropAccess : 45+ occurrences
|
||||
// PhanTypeMismatchArgumentNullableInternal : 45+ occurrences
|
||||
// PhanTypeMismatchArgumentNullableInternal : 40+ occurrences
|
||||
// PhanTypeInvalidDimOffset : 35+ occurrences
|
||||
// PhanPluginEmptyStatementIf : 30+ occurrences
|
||||
// PhanTypeMismatchDimFetch : 30+ occurrences
|
||||
|
|
@ -108,19 +108,13 @@ return [
|
|||
'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/compta/bank/various_payment/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'],
|
||||
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable'],
|
||||
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
|
||||
'htdocs/compta/cashcontrol/cashcontrol_list.php' => ['PhanTypeMismatchProperty'],
|
||||
'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullableInternal'],
|
||||
'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/compta/deplacement/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
|
||||
'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginEmptyStatementIf'],
|
||||
'htdocs/compta/facture/card.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
|
||||
'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/compta/facture/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/compta/facture/invoicetemplate_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/compta/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/compta/facture/note.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/compta/facture/prelevement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/compta/facture/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
|
|
@ -599,7 +593,7 @@ return [
|
|||
'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/societe/paymentmodes.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/societe/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/societe/price.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/societe/website.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition'],
|
||||
|
|
|
|||
|
|
@ -280,6 +280,9 @@ $theoricalnbofinvoiceforterminal = array();
|
|||
llxHeader('', $langs->trans("CashControl"));
|
||||
|
||||
|
||||
$terminalid = '';
|
||||
$terminaltouse = '';
|
||||
|
||||
if ($action == "create" || $action == "start" || $action == 'close') {
|
||||
if ($action == 'close') {
|
||||
$posmodule = $object->posmodule;
|
||||
|
|
@ -305,7 +308,7 @@ if ($action == "create" || $action == "start" || $action == 'close') {
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($terminalid) && $terminalid != '') {
|
||||
if (isset($terminalid) && $terminalid != '' && isset($posmodule)) {
|
||||
// Calculate $initialbalanceforterminal for terminal 0
|
||||
foreach ($arrayofpaymentmode as $key => $val) {
|
||||
if ($key != 'cash') {
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
|
|||
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
|
||||
$sql .= ")";
|
||||
}
|
||||
if (preg_match('/^cs\./', $sortfield) || preg_match('/^c\./', $sortfield) || preg_match('/^pc\./', $sortfield) || preg_match('/^pct\./', $sortfield)) {
|
||||
if (preg_match('/^(cs?|pct?)\./', (string) $sortfield)) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
}
|
||||
//$sql.= $db->plimit($limit+1,$offset);
|
||||
|
|
@ -310,7 +310,7 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
|
|||
// so we are compatible when period is not mandatory
|
||||
$sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
}
|
||||
if (preg_match('/^pv\./', $sortfield) || preg_match('/^ptva\./', $sortfield)) {
|
||||
if (preg_match('/^(pv|ptva)\./', (string) $sortfield)) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
}
|
||||
|
||||
|
|
@ -465,7 +465,7 @@ while ($j < $numlt) {
|
|||
// so we are compatible when period is not mandatory
|
||||
$sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
}
|
||||
if (preg_match('/^pv/', $sortfield)) {
|
||||
if (preg_match('/^pv/', (string) $sortfield)) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ if (!$mesg) {
|
|||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
$filename_avg = '';
|
||||
$fileurl_avg = '';
|
||||
if (!$user->hasRight('societe', 'client', 'voir')) {
|
||||
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 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
|
||||
|
|
@ -227,15 +228,15 @@ if ($object->id > 0) {
|
|||
//$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
|
||||
//$morehtmlstatus .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
|
||||
|
||||
if (isModEnabled('agenda')) {
|
||||
/*
|
||||
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
|
||||
$morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
||||
} else {
|
||||
$morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0);
|
||||
}
|
||||
*/
|
||||
//if (isModEnabled('agenda')) {
|
||||
/*
|
||||
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
|
||||
$morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
||||
} else {
|
||||
$morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0);
|
||||
}
|
||||
*/
|
||||
//}
|
||||
|
||||
|
||||
if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2023 Christian Foellmann <christian@foellmann.de>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 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
|
||||
|
|
@ -63,7 +64,7 @@ if ($user->socid) {
|
|||
$object = new Facture($db);
|
||||
// Load object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref, '', '', (getDolGlobalString('INVOICE_USE_SITUATION') ? $conf->global->INVOICE_USE_SITUATION : 0));
|
||||
$ret = $object->fetch($id, $ref, '', 0, (getDolGlobalString('INVOICE_USE_SITUATION') ? $conf->global->INVOICE_USE_SITUATION : 0));
|
||||
}
|
||||
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
|
||||
$hookmanager->initHooks(array('invoicecontactcard', 'globalcard'));
|
||||
|
|
@ -77,7 +78,7 @@ $usercancreate = $user->hasRight("facture", "creer");
|
|||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('id'=>$id);
|
||||
$parameters = array('id' => $id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
|
|
|||
|
|
@ -927,7 +927,7 @@ while ($i < $imaxinloop) {
|
|||
// Payment term
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">';
|
||||
$form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
|
||||
$form->form_conditions_reglement(0, $objp->fk_cond_reglement, 'none');
|
||||
print '</td>'."\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
|
|||
|
|
@ -570,6 +570,8 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement'))
|
|||
$result_sql = $db->query($rsql);
|
||||
if ($result_sql) {
|
||||
$numprlv = $db->num_rows($result_sql);
|
||||
} else {
|
||||
$numprlv = 0;
|
||||
}
|
||||
|
||||
if ($numprlv > 0) {
|
||||
|
|
@ -633,9 +635,11 @@ if ($socid > 0) {
|
|||
if (empty($search_company)) {
|
||||
$search_company = $soc->name;
|
||||
}
|
||||
} else {
|
||||
$soc = null;
|
||||
}
|
||||
|
||||
$title = $langs->trans('BillsCustomers').' '.($socid > 0 ? ' - '.$soc->name : '');
|
||||
$title = $langs->trans('BillsCustomers').' '.(($socid > 0 && $soc !== null) ? ' - '.$soc->name : '');
|
||||
$help_url = 'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
|
|
@ -1341,7 +1345,7 @@ if (isModEnabled('category') && $user->hasRight("categorie", "lire") && ($user->
|
|||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('IncludingProductWithTag');
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 0, 0, 1);
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
|
@ -1509,7 +1513,7 @@ if (!empty($arrayfields['state.nom']['checked'])) {
|
|||
// Country
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth150imp maxwidth150', 'code2', 1, 0, 1, null, 1);
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth150imp maxwidth150', 'code2', 1, 0, 1, array(), 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Company type
|
||||
|
|
@ -2051,10 +2055,10 @@ if ($num > 0) {
|
|||
$multicurrency_remaintopay = 0;
|
||||
}
|
||||
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consumed
|
||||
$remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id);
|
||||
$remaincreditnote = $discount->getAvailableDiscounts($companystatic, null, 'rc.fk_facture_source='.$facturestatic->id);
|
||||
$remaintopay = -$remaincreditnote;
|
||||
$totalallpayments = price2num($facturestatic->total_ttc - $remaintopay);
|
||||
$multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
|
||||
$multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic, null, 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
|
||||
$multicurrency_remaintopay = -$multicurrency_remaincreditnote;
|
||||
$multicurrency_totalpay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user