fix phpstan (#37735)

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* Update pdf_cyan.modules.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Frédéric FRANCE 2026-04-03 22:00:38 +02:00 committed by GitHub
parent cc18af47b5
commit b5d78e8252
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 48 additions and 20 deletions

View file

@ -5,7 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Florian HENRY <florian.henry@scopen.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
@ -529,7 +529,7 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda'
$urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create';
$urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes'];
$urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''));
$urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$newparam);
$newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction);
}
@ -600,15 +600,15 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
}
// External calendars
if (is_array($showextcals) && count($showextcals) > 0) {
if (is_array($showextcals) && count($showextcals) > 0) { // @phpstan-ignore-line $showextcals is always an array
$s .= '<script type="text/javascript">'."\n";
$s .= 'jQuery(document).ready(function () {
jQuery("div input[name^=\"check_ext\"]").each(function(index, elem) {
var name = jQuery(elem).attr("name");
if (jQuery(elem).is(":checked")) {
jQuery(".family_ext" + name.replace("check_ext", "")).show();
jQuery(".family_ext" + name.replace("check_ext", "")).show();
} else {
jQuery(".family_ext" + name.replace("check_ext", "")).hide();
jQuery(".family_ext" + name.replace("check_ext", "")).hide();
}
});

View file

@ -686,6 +686,34 @@ class pdf_octopus extends ModelePDFFactures
$linePosition = $i + 1;
$curY = $nexY;
$sub_options = $object->lines[$i]->extraparams["subtotal"] ?? array();
if ($object->lines[$i]->special_code == SUBTOTALS_SPECIAL_CODE) {
$level = $object->lines[$i]->qty;
if ($sub_options) {
if (isset($sub_options['titleshowuponpdf'])) {
$pdf_sub_options['titleshowuponpdf'] = isset($pdf_sub_options['titleshowuponpdf']) && $pdf_sub_options['titleshowuponpdf'] < $level ? $pdf_sub_options['titleshowuponpdf'] : $level;
} elseif (isset($pdf_sub_options['titleshowuponpdf']) && abs($level) <= $pdf_sub_options['titleshowuponpdf']) {
unset($pdf_sub_options['titleshowuponpdf']);
}
if (isset($sub_options['titleshowtotalexludingvatonpdf'])) {
$pdf_sub_options['titleshowtotalexludingvatonpdf'] = isset($pdf_sub_options['titleshowtotalexludingvatonpdf']) && $pdf_sub_options['titleshowtotalexludingvatonpdf'] < $level ? $pdf_sub_options['titleshowtotalexludingvatonpdf'] : $level;
} elseif (isset($pdf_sub_options['titleshowtotalexludingvatonpdf']) && abs($level) <= $pdf_sub_options['titleshowtotalexludingvatonpdf']) {
unset($pdf_sub_options['titleshowtotalexludingvatonpdf']);
}
} else {
if (isset($pdf_sub_options['titleshowuponpdf']) && abs($level) <= $pdf_sub_options['titleshowuponpdf']) {
unset($pdf_sub_options['titleshowuponpdf']);
}
if (isset($pdf_sub_options['titleshowtotalexludingvatonpdf']) && abs($level) <= $pdf_sub_options['titleshowtotalexludingvatonpdf']) {
unset($pdf_sub_options['titleshowtotalexludingvatonpdf']);
}
}
}
if (($curY + 6) > ($this->page_hauteur - $this->heightforfooter) || isset($sub_options['titleforcepagebreak']) && !($pdf->getNumPages() == 1 && $curY == $this->tab_top + $this->tabTitleHeight)) {
$object->lines[$i]->pagebreak = true;
}
$posy = $nexY;
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0);
@ -2114,11 +2142,11 @@ class pdf_octopus extends ModelePDFFactures
if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
$object->fetchProject();
if (!empty($object->project->ref)) {
if (!empty($object->project->title)) {
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ". $object->project->title, '', 'R');
}
}
@ -2129,7 +2157,7 @@ class pdf_octopus extends ModelePDFFactures
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ". $object->project->ref, '', 'R');
}
}
@ -2238,7 +2266,7 @@ class pdf_octopus extends ModelePDFFactures
if (count($arrayidcontact) > 0) {
$object->fetch_user($arrayidcontact[0]);
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
$carac_emetteur .= $labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
$carac_emetteur .= "\n";
}

View file

@ -2320,11 +2320,11 @@ class pdf_sponge extends ModelePDFFactures
if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
$object->fetchProject();
if (!empty($object->project->ref)) {
if (!empty($object->project->title)) {
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".$object->project->title, '', 'R');
}
}
@ -2335,7 +2335,7 @@ class pdf_sponge extends ModelePDFFactures
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".$object->project->ref, '', 'R');
}
}
@ -2444,7 +2444,7 @@ class pdf_sponge extends ModelePDFFactures
if (count($arrayidcontact) > 0) {
$object->fetch_user($arrayidcontact[0]);
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
$carac_emetteur .= $labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
$carac_emetteur .= "\n";
}

View file

@ -1644,11 +1644,11 @@ class pdf_azur extends ModelePDFPropales
if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
$object->fetchProject();
if (!empty($object->project->ref)) {
if (!empty($object->project->title)) {
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ". $object->project->title, '', 'R');
}
}
@ -1659,7 +1659,7 @@ class pdf_azur extends ModelePDFPropales
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ". $object->project->ref, '', 'R');
}
}

View file

@ -8,7 +8,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-2024 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
@ -1775,11 +1775,11 @@ class pdf_cyan extends ModelePDFPropales
if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
$object->fetchProject();
if (!empty($object->project->ref)) {
if (!empty($object->project->title)) {
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ". $object->project->title, '', 'R');
}
}
@ -1790,7 +1790,7 @@ class pdf_cyan extends ModelePDFPropales
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ". $object->project->ref, '', 'R');
}
}