Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix phpstan #28727

Merged
merged 5 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion htdocs/core/class/html.formcategory.class.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2020 Tobias Sekan <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
*
* 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
Expand Down Expand Up @@ -81,7 +82,7 @@ public function getFilterBox($type, array $preSelected, $morecss = "minwidth300i
$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";
Expand Down
14 changes: 5 additions & 9 deletions htdocs/core/lib/price.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Copyright (C) 2012 Christophe Battarel <[email protected]>
* Copyright (C) 2012 Cédric Salvador <[email protected]>
* Copyright (C) 2012-2014 Raphaël Doursenaud <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
*
* 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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
13 changes: 3 additions & 10 deletions htdocs/core/lib/website.lib.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
*
* 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
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/barcode/mod_barcode_product_standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ public function getExample($langs, $objproduct = 0)
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ public function getExample($langs, $objthirdparty = 0)
* @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) {
Expand Down
8 changes: 4 additions & 4 deletions htdocs/loan/class/loanschedule.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@ public function fetch($id)
/**
* 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;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/projet/class/task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc
*
* @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')
Expand Down Expand Up @@ -1595,7 +1595,7 @@ public function getSummaryOfTimeSpent($userobj = null, $morewherefilter = '')
/**
* 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')
Expand Down
4 changes: 2 additions & 2 deletions htdocs/public/webportal/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -142,4 +142,4 @@ Home Styles
*/
.home-links-card{

}
}
5 changes: 3 additions & 2 deletions htdocs/webportal/class/html.formlistwebportal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2023-2024 Laurent Destailleur <[email protected]>
* Copyright (C) 2023-2024 Lionel Vessiller <[email protected]>
* Copyright (C) 2023-2024 Patrice Andreani <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
*
* 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
Expand Down Expand Up @@ -539,14 +540,14 @@ public function elementList($context)
// 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']++;
}
Expand Down
Loading