2
0
forked from Wavyzz/dolibarr

Merge pull request #28886 from mdeweerd/fix/deprecatedfunccall

Fix Deprecated Function Calls
This commit is contained in:
Laurent Destailleur
2024-03-16 15:33:34 +01:00
committed by GitHub
15 changed files with 125 additions and 110 deletions

View File

@@ -68,7 +68,7 @@ return [
'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'],
'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanTypeMismatchPropertyProbablyReal'],
'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchPropertyProbablyReal'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/intracommreport/list.php' => ['PhanAccessPropertyStaticAsNonStatic'],
@@ -79,8 +79,9 @@ return [
'htdocs/public/opensurvey/index.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/public/recruitment/index.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/societe/paymentmodes.php' => ['PhanTypeMismatchPropertyProbablyReal'],
'htdocs/societe/paymentmodes.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchPropertyProbablyReal'],
'htdocs/societe/class/companybankaccount.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/stripe/admin/stripe.php' => ['PhanDeprecatedFunction'],
'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/takepos/invoice.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/user/class/user.class.php' => ['PhanParamSignatureMismatch'],

View File

@@ -408,7 +408,7 @@ return [
'suppress_issue_types' => [
// Dolibarr uses a lot of internal deprecated stuff, not reporting
'PhanDeprecatedProperty',
'PhanDeprecatedFunction',
// 'PhanDeprecatedFunction',
//'PhanCompatibleNegativeStringOffset',
// 'PhanPluginDuplicateExpressionAssignment',
// Nulls are likely mostly false positives

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2020-2021 Frédéric France <frederic.france@netlogic.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
@@ -98,6 +99,7 @@ $v->setPhoneNumber($object->fax, "TYPE=WORK;FAX");
$country = $object->country_code ? $object->country : '';
$v->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK;POSTAL");
// @phan-suppress-next-line PhanDeprecatedFunction (setLabel is the old method, new is setAddress)
$v->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK");
$v->setEmail($object->email);

View File

@@ -2424,7 +2424,7 @@ class Commande extends CommonOrder
/**
* Applique une remise relative
*
* @deprecated
* @deprecated Use setDiscount() instead.
* @see setDiscount()
* @param User $user User qui positionne la remise
* @param float $remise Discount (percent)
@@ -2435,6 +2435,7 @@ class Commande extends CommonOrder
{
// phpcs:enable
dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE);
// @phan-suppress-next-line PhanDeprecatedFunction
return $this->setDiscount($user, $remise, $notrigger);
}

View File

@@ -12,6 +12,7 @@
* Copyright (C) 2016-2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2023 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2021-2023 Anthony Berton <anthony.berton@bb2a.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
@@ -1107,7 +1108,7 @@ if ($resql) {
// Payment term
if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) {
print '<td class="liste_titre">';
$form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
print '</td>';
}
// Payment mode

View File

@@ -4414,6 +4414,7 @@ class Facture extends CommonInvoice
{
// phpcs:enable
dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE);
// @phan-suppress-next-line PhanDeprecatedFunction
return $this->setDiscount($user, $remise, $notrigger);
}

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* 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
@@ -67,6 +68,7 @@ $v->setPhoneNumber($contact->fax, "TYPE=WORK;FAX");
$country = $contact->country_code ? $contact->country : '';
$v->setAddress("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK;POSTAL");
// @phan-suppress-next-line PhanDeprecatedFunction setLabel applies the old method, setAddress is the new method.
$v->setLabel("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK");
$v->setEmail($contact->email);

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2023 Charlene BENKE <charlene@patas-monkey.com>
* 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
@@ -71,7 +72,7 @@ $ret=$object->fetch_thirdparty();
$head = contract_prepare_head($object);
dol_fiche_head($head, 'ticket', $langs->trans("Contract"), -1, 'contract');
dol_get_fiche_head($head, 'ticket', $langs->trans("Contract"), -1, 'contract');
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid) ? '?socid='.$socid : '').'">';
$linkback .= $langs->trans("BackToList").'</a>';

View File

@@ -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
@@ -88,7 +89,7 @@ abstract class CommonNumRefGenerator
*
* @param Translate $langs Object langs
* @return string Model name
* @deprecated
* @deprecated Use getName() instead
* @see getName()
*/
public function getNom($langs)

View File

@@ -4321,7 +4321,7 @@ class Form
* > 0 : force deposit percentage (for example, from company object)
* @param int $noprint if set to one we return the html to print, if 0 (default) we print it
* @return void|string
* @deprecated
* @deprecated Use getSelectConditionsPaiements() instead and handle noprint locally.
*/
public function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '', $deposit_percent = -1, $noprint = 0)
{

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2021 John BOTELLA <john.botella@atm-consulting.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
@@ -393,6 +394,7 @@ class FormSetup
$item = new FormSetupItem($confKey);
// need to be ignored from scrutinizer setTypeFromTypeString was created as deprecated to incite developer to use object oriented usage
// @phan-suppress-next-line PhanDeprecatedFunction
/** @scrutinizer ignore-deprecated */ $item->setTypeFromTypeString($params['type']);
if (!empty($params['enabled'])) {
@@ -831,7 +833,9 @@ class FormSetupItem
$out = (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans('MissingTranslationForConfKey', $this->confKey));
// if conf defined on entity 0, prepend a picto to indicate it will apply across all entities
if (isModEnabled('multicompany') && $this->entity == 0) $out = img_picto($this->langs->trans('AllEntities'), 'fa-globe-americas em088 opacityhigh') . '&nbsp;' . $out;
if (isModEnabled('multicompany') && $this->entity == 0) {
$out = img_picto($this->langs->trans('AllEntities'), 'fa-globe-americas em088 opacityhigh') . '&nbsp;' . $out;
}
return $out;
}

View File

@@ -90,7 +90,7 @@ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator
$s .= $langs->trans("Name").': <b>'.$this->name.'</b><br>';
$s .= $langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
if ($type != -1) {
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getName($langs).'</b><br>';
}
$s .= '<br>';
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* 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
@@ -125,7 +126,7 @@ abstract class ModeleProductCode extends CommonNumRefGenerator
}
$s = '';
if ($type == -1) {
$s .= $langs->trans("Name").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("Name").': <b>'.$this->getName($langs).'</b><br>';
$s .= $langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
} elseif ($type == 0) {
$s .= $langs->trans("ProductCodeDesc").'<br>';
@@ -133,7 +134,7 @@ abstract class ModeleProductCode extends CommonNumRefGenerator
$s .= $langs->trans("ServiceCodeDesc").'<br>';
}
if ($type != -1) {
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getName($langs).'</b><br>';
}
$s .= '<br>';
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';

View File

@@ -136,14 +136,14 @@ abstract class ModeleThirdPartyCode extends CommonNumRefGenerator
$s = '';
if ($type == -1) {
$s .= $langs->trans("Name").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("Name").': <b>'.$this->getName($langs).'</b><br>';
} elseif ($type == 0) {
$s .= $langs->trans("CustomerCodeDesc").'<br>';
} elseif ($type == 1) {
$s .= $langs->trans("SupplierCodeDesc").'<br>';
}
if ($type != -1) {
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getName($langs).'</b><br>';
}
$s .= '<br>';
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';

View File

@@ -247,7 +247,7 @@ $server->addPlugin($tempFF);
*/
// And off we go!
$server->exec();
$server->start();
if (is_object($db)) {
$db->close();