Merge pull request #28972 from mdeweerd/fix/PhanTypeMismatchInternal4

Fix PhanTypeMismatchInternal notifications (part 4)
This commit is contained in:
Laurent Destailleur
2024-03-20 01:00:45 +01:00
committed by GitHub
44 changed files with 159 additions and 141 deletions

View File

@@ -1385,7 +1385,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
if (!empty($yearoffsettype) && !is_numeric($yearoffsettype) && $yearoffsettype != '=') { // yearoffsettype is - or +, so we don't want current year
$numFinal = preg_replace('/\{yyyy\}/i', (string) ((int) date("Y", $date) + $yearoffset), $numFinal);
$numFinal = preg_replace('/\{yy\}/i', (string) ((int) date("y", $date) + $yearoffset), $numFinal);
$numFinal = preg_replace('/\{y\}/i', substr(date("y", $date), 1, 1) + $yearoffset, $numFinal);
$numFinal = preg_replace('/\{y\}/i', (string) ((int) substr((string) date("y", $date), 1, 1) + $yearoffset), $numFinal);
} else { // we want yyyy to be current year
$numFinal = preg_replace('/\{yyyy\}/i', date("Y", $date), $numFinal);
$numFinal = preg_replace('/\{yy\}/i', date("y", $date), $numFinal);

View File

@@ -43,7 +43,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false)
return false;
}
if ($centimes && strlen($num) == 1) {
if ($centimes && strlen((string) $num) == 1) {
$num = $num * 10;
}
@@ -105,7 +105,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false)
$langs->transnoentitiesnoconv('quadrillion')
);
$num_length = strlen($num);
$num_length = strlen((string) $num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00'.$num, -$max_length);

View File

@@ -123,7 +123,7 @@ function pdf_getFormat(Translate $outputlangs = null, $mode = 'setup')
* @param string $format Array(width,height). Keep empty to use default setup.
* @param string $metric Unit of format ('mm')
* @param string $pagetype 'P' or 'l'
* @return TCPDF PDF object
* @return TCPDF|TCPDI PDF object
*/
function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P')
{

View File

@@ -6,6 +6,7 @@
* 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>
* 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
@@ -37,7 +38,7 @@
* '5' : local tax apply on services without vat (localtax is calculated on amount without tax)
* '6' : local tax apply on services including vat (localtax is calculated on amount + tax)
*
* @param int $qty Quantity
* @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)

View File

@@ -204,7 +204,7 @@ function isValidTinForES($str)
for ($i = 1; $i < 8; $i += 2) {
$sum += intval(substr((string) (2 * $num[$i]), 0, 1)) + intval(substr((string) (2 * $num[$i]), 1, 1));
}
$n = 10 - substr((string) $sum, strlen($sum) - 1, 1);
$n = 10 - substr((string) $sum, strlen((string) $sum) - 1, 1);
//Check special NIF
if (preg_match('/^[KLM]{1}/', $str)) {
@@ -217,7 +217,7 @@ function isValidTinForES($str)
//Check CIF
if (preg_match('/^[ABCDEFGHJNPQRSUVW]{1}/', $str)) {
if ($num[8] == chr(64 + $n) || $num[8] == substr((string) $n, strlen($n) - 1, 1)) {
if ($num[8] == chr(64 + $n) || $num[8] == substr((string) $n, strlen((string) $n) - 1, 1)) {
return 2;
} else {
return -2;

View File

@@ -1097,7 +1097,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Budget task
if (count($arrayfields) > 0 && !empty($arrayfields['t.budget_amount']['checked'])) {
print '<td class="nowrap liste_total center">';
if (strcmp($total_budget_amount, '')) {
if (strcmp((string) $total_budget_amount, '')) {
print price($total_budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
}
print '</td>';
@@ -2527,7 +2527,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$project_year_filter = 0;
$title = $langs->trans("Projects");
if (strcmp($status, '') && $status >= 0) {
if (!strcmp((string) $status, '') && $status >= 0) {
$title = $langs->trans("Projects").' '.$langs->trans($projectstatic->labelStatus[$status]);
}

View File

@@ -376,7 +376,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
$objectid = 0;
}
if ($objectid) {
$objectid = preg_replace('/[^0-9\.\,]/', '', $objectid); // For the case value is coming from a non sanitized user input
$objectid = preg_replace('/[^0-9\.\,]/', '', (string) $objectid); // For the case value is coming from a non sanitized user input
}
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");