Qual: Fix spelling/update .pre-commit configuration (versions) (#30546)

* Qual: Update pre-commit configuration

* Qual: Update spelling

* Ignore use of deprecated constant
This commit is contained in:
MDW
2024-08-07 01:20:43 +02:00
committed by GitHub
parent 782f968eb7
commit d6948077b2
106 changed files with 318 additions and 440 deletions

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@@ -77,7 +78,7 @@ if (!empty($user->socid)) {
// We check permission.
// Check is done on $user->rights->element->create or $user->rights->element->subelement->create (because $action = 'set')
if (preg_match('/statu[st]$/', $field) || ($field == 'evenunsubscribe' && $object->table_element == 'mailing')) {
if (preg_match('/stat[u][st]$/', $field) || ($field == 'evenunsubscribe' && $object->table_element == 'mailing')) {
restrictedArea($user, $object->module, $object, $object->table_element, $usesublevelpermission);
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
restrictedArea($user, 'produit|service', $object, 'product&product', '', '', 'rowid');

View File

@@ -177,7 +177,7 @@ abstract class CommonInvoice extends CommonObject
/**
* Proforma invoice.
* @deprectad Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice !
* @deprecated Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice !
*/
const TYPE_PROFORMA = 4;
@@ -676,7 +676,7 @@ abstract class CommonInvoice extends CommonObject
} elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) {
$labellong = "InvoiceDeposit";
$labelshort = "Deposit";
} elseif ($this->type == CommonInvoice::TYPE_PROFORMA) {
} elseif ($this->type == CommonInvoice::TYPE_PROFORMA) { // @phan-suppress-current-line PhanDeprecatedClassConstant
$labellong = "InvoiceProForma"; // Not used.
$labelshort = "ProForma";
} elseif ($this->type == CommonInvoice::TYPE_SITUATION) {

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 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
@@ -35,7 +36,7 @@ abstract class CommonOrder extends CommonObject
/**
* Return clicable link of object (with eventually picto)
* Return clickable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @param array $arraydata Array of data
@@ -72,7 +73,7 @@ abstract class CommonOrder extends CommonObject
return $return;
}
/** return nb of fines of order where products or services that can be buyed
/** return nb of fines of order where products or services that can be bought
*
* @param boolean $ignoreFree Ignore free lines
* @return int number of products or services on buy in a command
@@ -84,10 +85,12 @@ abstract class CommonOrder extends CommonObject
$return = 0;
foreach ($this->lines as $line) {
if (empty($line->fk_product) && !$ignoreFree) {
$return ++;
$return++;
} elseif ((int) $line->fk_product > 0) {
if ($product->fetch($line->fk_product) > 0) {
if ($product->status_buy) $return ++;
if ($product->status_buy) {
$return++;
}
}
}
}
@@ -143,13 +146,13 @@ abstract class CommonOrderLine extends CommonObjectLine
* Boolean that indicates whether the product is available for sale '1' or not '0'
* @var int
*/
public $product_tosell=0;
public $product_tosell = 0;
/**
* Boolean that indicates whether the product is available for purchase '1' or not '0'
* @var int
*/
public $product_tobuy=0;
public $product_tobuy = 0;
/**
* Product description

View File

@@ -1914,7 +1914,7 @@ class ExtraFields
$resql = $this->db->query($sql);
if ($resql) {
if ($filter_categorie === false) {
$value = ''; // value was used, so now we reste it to use it to build final output
$value = ''; // value was used, so now we reset it to use it to build final output
$obj = $this->db->fetch_object($resql);
@@ -2024,7 +2024,7 @@ class ExtraFields
$resql = $this->db->query($sql);
if ($resql) {
if ($filter_categorie === false) {
$value = ''; // value was used, so now we reste it to use it to build final output
$value = ''; // value was used, so now we reset it to use it to build final output
$toprint = array();
while ($obj = $this->db->fetch_object($resql)) {
// Several field into label (eq table:code|label:rowid)

View File

@@ -301,7 +301,7 @@ class Fiscalyear extends CommonObject
}
/**
* Return clicable link of object (with eventually picto)
* Return clickable link of object (with eventually picto)
*
* @param int $withpicto Add picto into link
* @param int $notooltip 1=Disable tooltip

View File

@@ -5,6 +5,7 @@
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* 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
@@ -388,7 +389,7 @@ class FormCompany extends Form
public function select_state_ajax($parent_field_id = 'country_id', $selected = 0, $country_codeid = 0, $htmlname = 'state_id', $morecss = 'maxwidth200onsmartphone minwidth300')
{
$html = '<script>';
$html.='$("select[name=\"'.$parent_field_id.'\"]").change(function(){
$html .= '$("select[name=\"'.$parent_field_id.'\"]").change(function(){
$.ajax( "'.dol_buildpath('/core/ajax/ziptown.php', 2).'", { data:{ selected: $("select[name=\"'.$htmlname.'\"]").val(), country_codeid: $(this).val(), htmlname:"'.$htmlname.'", morecss:"'.$morecss.'" } } )
.done(function(msg) {
$("span#target_'.$htmlname.'").html(msg);
@@ -399,10 +400,11 @@ class FormCompany extends Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne la liste deroulante des regions actives don't le pays est actif
* La cle de la liste est le code (il peut y avoir plusieurs entree pour
* Provides the dropdown of the active regions including the actif country.
* The key of the list is the code (there may be more than one entry for a
* code but in that case the fields country and language are different).
* un code donnee mais dans ce cas, le champ pays et lang differe).
* Ainsi les liens avec les regions se font sur une region independemment de son name.
* This way the links with the regions are made independent of its name.
*
* @param string $selected Preselected value
* @param string $htmlname Name of HTML select field

View File

@@ -1360,7 +1360,7 @@ class Utils
if ($filesize > $sizelimit) {
$message .= '<br>'.$langs->trans("BackupIsTooLargeSend");
$documenturl = $dolibarr_main_url_root.'/document.php?modulepart=systemtools&atachement=1&file=backup/'.urlencode($filename[0]);
$message .= '<br><a href='.$documenturl.'>Lien de téléchargement</a>';
$message .= '<br><a href='.$documenturl.'>Download link</a>';
$filepath = '';
$mimetype = '';
$filename = '';
@@ -1390,7 +1390,7 @@ class Utils
dol_syslog(__METHOD__, LOG_DEBUG);
$this->error = "Error sending backp file ".((string) $error);
$this->error = "Error sending backup file ".((string) $error);
$this->output = $output;
if ($result) {

View File

@@ -464,7 +464,7 @@ interface Database
/**
* Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 and gmt=0
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
* 19700101020000 -> 7200 whatever is TZ if gmt=1
*
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @param bool $gm 1=Input information are GMT values, otherwise local to server TZ

View File

@@ -357,7 +357,7 @@ abstract class DoliDB implements Database
/**
* Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with server TZ = +1 and $gm='tzserver'
* 19700101020000 -> 7200 whaterver is server TZ if $gm='gmt'
* 19700101020000 -> 7200 whatever is server TZ if $gm='gmt'
*
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @param mixed $gm 'gmt'=Input information are GMT values, 'tzserver'=Local to server TZ

View File

@@ -193,7 +193,7 @@ class DoliDBPgsql extends DoliDB
$line = preg_replace('/\s/', ' ', $line); // Replace tabulation with space
// we are inside create table statement so lets process datatypes
// we are inside create table statement so let's process datatypes
if (preg_match('/(ISAM|innodb)/i', $line)) { // end of create table sequence
$line = preg_replace('/\)[\s\t]*type[\s\t]*=[\s\t]*(MyISAM|innodb).*;/i', ');', $line);
$line = preg_replace('/\)[\s\t]*engine[\s\t]*=[\s\t]*(MyISAM|innodb).*;/i', ');', $line);

View File

@@ -166,7 +166,7 @@ class DoliDBSqlite3 extends DoliDB
if ($type == 'dml') {
$line = preg_replace('/\s/', ' ', $line); // Replace tabulation with space
// we are inside create table statement so lets process datatypes
// we are inside create table statement so let's process datatypes
if (preg_match('/(ISAM|innodb)/i', $line)) { // end of create table sequence
$line = preg_replace('/\)[\s\t]*type[\s\t]*=[\s\t]*(MyISAM|innodb);/i', ');', $line);
$line = preg_replace('/\)[\s\t]*engine[\s\t]*=[\s\t]*(MyISAM|innodb);/i', ');', $line);

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This file is a modified version of datepicker.php from phpBSM to fix some
* bugs, to add new features and to dramatically increase speed.
@@ -103,10 +104,10 @@ top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
print '<body class="getmenudiv">'."\n";
// Javascript to make menu active like Jmobile did.
// JavaScript to make menu active like Jmobile did.
print '
<style>
/*Lets hide the non active LIs by default*/
/* Hide the non active LIs by default*/
body {
font-size: 16px;
}
@@ -155,7 +156,7 @@ if ($langs->trans("DIRECTION") == 'rtl') {
} else {
print 'background-position-x: 10px;';
}
print '
print '
background-position-y: 18px;
padding: 1em 15px 1em 40px;
display: block;
@@ -191,9 +192,9 @@ if ($langs->trans("DIRECTION") == 'rtl') {
} else {
print 'background-position-x: 10px;';
}
print 'background-position-y: 1px;';
print 'padding-left: 20px;';
print '
print 'background-position-y: 1px;';
print 'padding-left: 20px;';
print '
}
li.lilevel1 a, li.lilevel1 {
color: #000;

View File

@@ -8364,7 +8364,7 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
// List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/Events
$out = preg_replace('/on(mouse|drag|key|load|touch|pointer|select|transition)[a-z]*\s*=/i', '', $out); // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)>
$out = preg_replace('/on(abort|after|animation|auxclick|before|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)[a-z]*\s*=/i', '', $out);
$out = preg_replace('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', '', $out);
$out = preg_replace('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus(in|out)?|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', '', $out);
$out = preg_replace('/on(lostpointercapture|offline|online|pagehide|pageshow)[a-z]*\s*=/i', '', $out);
$out = preg_replace('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)[a-z]*\s*=/i', '', $out);
$out = preg_replace('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)[a-z]*\s*=/i', '', $out);

View File

@@ -41,7 +41,7 @@
* @param float $qty Quantity
* @param float $pu Unit price (HT or TTC depending on price_base_type. TODO Add also mode 'INCT' when pu is price HT+VAT+LT1+LT2)
* @param float $remise_percent_ligne Discount for line
* @param float $txtva 0=do not apply VAT tax, VAT rate=apply (this is VAT rate only without text code, we don't need text code because we alreaydy have all tax info into $localtaxes_array)
* @param float $txtva 0=do not apply VAT tax, VAT rate=apply (this is VAT rate only without text code, we don't need text code because we already have all tax info into $localtaxes_array)
* @param float $uselocaltax1_rate 0=do not use localtax1, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
* @param float $uselocaltax2_rate 0=do not use localtax2, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
* @param float $remise_percent_global 0

View File

@@ -100,7 +100,7 @@ class MenuManager
$_SESSION["mainmenu"] = $mainmenu;
$_SESSION["leftmenuopened"] = "";
} else {
// On va le chercher en session si non defini par le lien
// Look for the menu in the session if not set by the link
$mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : '';
}
if (!empty($forcemainmenu)) {
@@ -119,7 +119,7 @@ class MenuManager
$_SESSION["leftmenuopened"] = $leftmenu;
}
} else {
// On va le chercher en session si non defini par le lien
// Look for the menu in the session if not set by the link
$leftmenu = isset($_SESSION["leftmenu"]) ? $_SESSION["leftmenu"] : '';
}
if (!empty($forceleftmenu)) {

View File

@@ -99,7 +99,7 @@ class MenuManager
$_SESSION["mainmenu"] = $mainmenu;
$_SESSION["leftmenuopened"] = "";
} else {
// On va le chercher en session si non defini par le lien
// Look for the menu in the session if not set by the link
$mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : '';
}
if (!empty($forcemainmenu)) {
@@ -118,7 +118,7 @@ class MenuManager
$_SESSION["leftmenuopened"] = $leftmenu;
}
} else {
// On va le chercher en session si non defini par le lien
// Look for the menu in the session if not set by the link
$leftmenu = isset($_SESSION["leftmenu"]) ? $_SESSION["leftmenu"] : '';
}
if (!empty($forceleftmenu)) {

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.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
@@ -317,10 +318,10 @@ class mailing_contacts1 extends MailingTargets
/**
* Renvoie url lien vers fiche de la source du destinataire du mailing
* Provide the URL to the car of the source information of the recipient for the mailing
*
* @param int $id ID
* @return string Url lien
* @return string URL link
*/
public function url($id)
{

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2018-2023 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
@@ -212,10 +213,10 @@ class mailing_fraise extends MailingTargets
/**
* Renvoie url lien vers fiche de la source du destinataire du mailing
* Provide the URL to the car of the source information of the recipient for the mailing
*
* @param int $id ID
* @return string Url lien
* @param int $id ID
* @return string URL link
*/
public function url($id)
{

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.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
@@ -137,10 +138,10 @@ class mailing_pomme extends MailingTargets
/**
* Renvoie url lien vers fiche de la source du destinataire du mailing
* Provide the URL to the car of the source information of the recipient for the mailing
*
* @param int $id ID
* @return string Url lien
* @return string URL link
*/
public function url($id)
{

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@@ -87,10 +88,10 @@ class mailing_xinputfile extends MailingTargets
/**
* Renvoie url lien vers fiche de la source du destinataire du mailing
* Provide the URL to the car of the source information of the recipient for the mailing
*
* @param int $id ID
* @return string Url lien
* @return string URL link
*/
public function url($id)
{

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@@ -87,10 +88,10 @@ class mailing_xinputuser extends MailingTargets
/**
* Renvoie url lien vers fiche de la source du destinataire du mailing
* Provide the URL to the car of the source information of the recipient for the mailing
*
* @param int $id ID
* @return string Url lien
* @return string URL link
*/
public function url($id)
{