clean code (#35510)

This commit is contained in:
Frédéric FRANCE
2025-09-26 23:52:29 +02:00
committed by GitHub
parent 680f4b6c31
commit 6b433afab1
2 changed files with 11 additions and 17 deletions

View File

@@ -7284,12 +7284,6 @@ parameters:
count: 1
path: ../../../htdocs/core/lib/order.lib.php
-
message: '#^Right side of && is always true\.$#'
identifier: booleanAnd.rightAlwaysTrue
count: 11
path: ../../../htdocs/core/lib/pdf.lib.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse

View File

@@ -1127,7 +1127,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
// Line 3 of company infos
// Juridical status
if (!empty($fromcompany->forme_juridique_code) && $fromcompany->forme_juridique_code) {
if (!empty($fromcompany->forme_juridique_code)) {
$line3 .= ($line3 ? " - " : "").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel((string) $fromcompany->forme_juridique_code));
}
// Capital
@@ -1140,7 +1140,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
}
}
// Prof Id 1
if (!empty($fromcompany->idprof1) && $fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
if (!empty($fromcompany->idprof1) && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
$field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@@ -1148,7 +1148,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line3 .= ($line3 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1);
}
// Prof Id 2
if (!empty($fromcompany->idprof2) && $fromcompany->idprof2) {
if (!empty($fromcompany->idprof2)) {
$field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@@ -1158,7 +1158,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
// Line 4 of company infos
// Prof Id 3
if (!empty($fromcompany->idprof3) && $fromcompany->idprof3) {
if (!empty($fromcompany->idprof3)) {
$field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@@ -1166,7 +1166,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3);
}
// Prof Id 4
if (!empty($fromcompany->idprof4) && $fromcompany->idprof4) {
if (!empty($fromcompany->idprof4)) {
$field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@@ -1174,7 +1174,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4);
}
// Prof Id 5
if (!empty($fromcompany->idprof5) && $fromcompany->idprof5) {
if (!empty($fromcompany->idprof5)) {
$field = $outputlangs->transcountrynoentities("ProfId5", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@@ -1182,7 +1182,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof5);
}
// Prof Id 6
if (!empty($fromcompany->idprof6) && $fromcompany->idprof6) {
if (!empty($fromcompany->idprof6)) {
$field = $outputlangs->transcountrynoentities("ProfId6", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@@ -1190,7 +1190,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof6);
}
// Prof Id 7
if (!empty($fromcompany->idprof7) && $fromcompany->idprof7) {
if (!empty($fromcompany->idprof7)) {
$field = $outputlangs->transcountrynoentities("ProfId7", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@@ -1198,7 +1198,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof7);
}
// Prof Id 8
if (!empty($fromcompany->idprof8) && $fromcompany->idprof8) {
if (!empty($fromcompany->idprof8)) {
$field = $outputlangs->transcountrynoentities("ProfId8", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@@ -1206,7 +1206,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof8);
}
// Prof Id 9
if (!empty($fromcompany->idprof9) && $fromcompany->idprof9) {
if (!empty($fromcompany->idprof9)) {
$field = $outputlangs->transcountrynoentities("ProfId9", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@@ -1214,7 +1214,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof9);
}
// Prof Id 10
if (!empty($fromcompany->idprof10) && $fromcompany->idprof10) {
if (!empty($fromcompany->idprof10)) {
$field = $outputlangs->transcountrynoentities("ProfId10", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];