2
0
forked from Wavyzz/dolibarr

fix phpstan (#28727)

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan
This commit is contained in:
Frédéric FRANCE
2024-03-09 14:48:06 +01:00
committed by GitHub
parent 38618b405c
commit e00a9816f8
9 changed files with 25 additions and 34 deletions

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -81,7 +82,7 @@ class FormCategory extends Form
$filter .= $langs->trans('UseOrOperatorShort');
$filter .= '</label>';
$filter .= '<script>'."\n";;
$filter .= '<script>'."\n";
$filter .= "var nbSelected = jQuery('#".$htmlName."').val().length;";
$filter .= "console.log('Nb of element now = '+nbSelected);\n";
$filter .= "if (nbSelected > 1) { jQuery('.".$htmlName2."').show(); } else { jQuery('.".$htmlName2."').hide(); }\n";

View File

@@ -5,6 +5,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -46,7 +47,7 @@
* @param string $price_base_type 'HT'=Unit price parameter $pu is HT, 'TTC'=Unit price parameter $pu is TTC (HT+VAT but not Localtax. TODO Add also mode 'INCT' when pu is price HT+VAT+LT1+LT2)
* @param int $info_bits Miscellaneous information on line
* @param int $type 0/1=Product/service
* @param Societe $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
* @param Societe|string $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
* @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
* @param double $multicurrency_tx Currency rate (1 by default)
@@ -83,7 +84,7 @@
* 25=multicurrency_total_tax1 for total_ht
* 26=multicurrency_total_tax2 for total_ht
*/
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array = '', $progress = 100, $multicurrency_tx = 1, $pu_devise = 0, $multicurrency_code = '')
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array = [], $progress = 100, $multicurrency_tx = 1, $pu_devise = 0, $multicurrency_code = '')
{
global $conf, $mysoc, $db;
@@ -114,7 +115,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
dol_syslog("Price.lib::calcul_price_total Warning: function was called with a bad value for vat rate (should be often < 100, always < 1000). There is surely a bug.", LOG_ERR);
}
// Too verbose. Enable for debug only
//dol_syslog("Price.lib::calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate.' remise_percent_global='.$remise_percent_global.' price_base_type='.$ice_base_type.' type='.$type.' progress='.$progress);
// dol_syslog("Price.lib::calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate.' remise_percent_global='.$remise_percent_global.' price_base_type='.$ice_base_type.' type='.$type.' progress='.$progress);
$countryid = $seller->country_id;
@@ -439,12 +440,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$result[25] = $result[9];
$result[26] = $result[10];
}
//var_dump($result);
// initialize result array
//for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i];
dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.(!getDolGlobalString('MAIN_ROUNDING_RULE_TOT') ? '' : $conf->global->MAIN_ROUNDING_RULE_TOT).' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]);
dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.getDolGlobalString('MAIN_ROUNDING_RULE_TOT').' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]);
return $result;
}

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -1101,7 +1102,7 @@ function getImagePublicURLOfObject($object, $no = 1, $extName = '')
* @param int $status 0 or 1, or -1 for both
* @return array Array with results of search
*/
function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield = 'date_creation', $sortorder = 'DESC', $langcode = '', $otherfilters = 'null', $status = 1)
function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield = 'date_creation', $sortorder = 'DESC', $langcode = '', $otherfilters = [], $status = 1)
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
@@ -1261,7 +1262,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
* @param string $urltograb URL to grab (example: http://www.nltechno.com/ or http://www.nltechno.com/dir1/ or http://www.nltechno.com/dir1/mapage1)
* @param string $tmp Content to parse
* @param string $action Var $action
* @param string $modifylinks 0=Do not modify content, 1=Replace links with a link to viewimage
* @param int $modifylinks 0=Do not modify content, 1=Replace links with a link to viewimage
* @param int $grabimages 0=Do not grab images, 1=Grab images
* @param string $grabimagesinto 'root' or 'subpage'
* @return void
@@ -1316,10 +1317,6 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify
$filetosave = preg_replace('/\/[^\/]+\/\.\./', '', $filetosave);
$filename = preg_replace('/\/[^\/]+\/\.\./', '', $filename);
//var_dump($filetosave);
//var_dump($filename);
//exit;
if (empty($alreadygrabbed[$urltograbbis])) {
if ($grabimages) {
$tmpgeturl = getURLContent($urltograbbis, 'GET', '', 1, array(), array('http', 'https'), 0);
@@ -1385,10 +1382,6 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify
$filetosave = preg_replace('/\/[^\/]+\/\.\./', '', $filetosave);
$filename = preg_replace('/\/[^\/]+\/\.\./', '', $filename);
//var_dump($filetosave);
//var_dump($filename);
//exit;
if (empty($alreadygrabbed[$urltograbbis])) {
if ($grabimages) {
$tmpgeturl = getURLContent($urltograbbis, 'GET', '', 1, array(), array('http', 'https'), 0);

View File

@@ -131,14 +131,14 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* @param int $type Type of barcode (EAN, ISBN, ...) as rowid
* @return string
*/
public function literalBarcodeType($db, $type = '')
public function literalBarcodeType($db, $type = 0)
{
global $conf;
$out = '';
$sql = "SELECT rowid, code, libelle as label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql .= " WHERE rowid = '".$db->escape($type)."'";
$sql .= " WHERE rowid = ".(int) $type;
$sql .= " AND entity = ".((int) $conf->entity);
$result = $db->query($sql);
if ($result) {

View File

@@ -143,14 +143,14 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
* @param int $type Type of barcode (EAN, ISBN, ...) as rowid
* @return string
*/
public function literalBarcodeType($db, $type = '')
public function literalBarcodeType($db, $type = 0)
{
global $conf;
$out = '';
$sql = "SELECT rowid, code, libelle as label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql .= " WHERE rowid = '".$db->escape($type)."'";
$sql .= " WHERE rowid = ". (int) $type;
$sql .= " AND entity = ".((int) $conf->entity);
$result = $db->query($sql);
if ($result) {

View File

@@ -289,11 +289,11 @@ class LoanSchedule extends CommonObject
/**
* Update database
*
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param User|null $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function update($user = 0, $notrigger = 0)
public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
$error = 0;

View File

@@ -1190,7 +1190,7 @@ class Task extends CommonObjectLine
*
* @param User|null $userp Return roles on project for this internal user. If set, usert and taskid must not be defined.
* @param User|null $usert Return roles on task for this internal user. If set userp must NOT be defined. -1 means no filter.
* @param int $projectid Project id list separated with , to filter on project
* @param string $projectid Project id list separated with , to filter on project
* @param int $taskid Task id to filter on a task
* @param integer $filteronprojstatus Filter on project status if userp is set. Not used if userp not defined.
* @return array|int Array (projectid => 'list of roles for project' or taskid => 'list of roles for task')
@@ -1595,7 +1595,7 @@ class Task extends CommonObjectLine
/**
* Calculate quantity and value of time consumed using the thm (hourly amount value of work for user entering time)
*
* @param User $fuser Filter on a dedicated user
* @param User|string $fuser Filter on a dedicated user
* @param string $dates Start date (ex 00:00:00)
* @param string $datee End date (ex 23:59:59)
* @return array Array of info for task array('amount','nbseconds','nblinesnull')

View File

@@ -47,7 +47,7 @@ body > nav {
.spacer{
--spacer-margin: calc(var(--font-size) * 2);
margin-top: var(--spacer-margin);
margin-bottom: var(--spacer-margin);;
margin-bottom: var(--spacer-margin);
}
html{

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2023-2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023-2024 Lionel Vessiller <lvessiller@easya.solutions>
* Copyright (C) 2023-2024 Patrice Andreani <pandreani@easya.solutions>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -539,14 +540,14 @@ class FormListWebPortal
// Remain to pay
if (!empty($arrayfields['remain_to_pay']['checked'])) {
$html .= '<th scope="col">';
$html .= $langs->trans($arrayfields['remain_to_pay']['label']);;
$html .= $langs->trans($arrayfields['remain_to_pay']['label']);
$html .= '</th>';
$totalarray['nbfield']++;
}
// Download link
if (!empty($arrayfields['download_link']['checked'])) {
$html .= '<th scope="col">';
$html .= $langs->trans($arrayfields['download_link']['label']);;
$html .= $langs->trans($arrayfields['download_link']['label']);
$html .= '</th>';
$totalarray['nbfield']++;
}