Qual: Fix phan notices

This commit is contained in:
MDW 2025-01-05 18:12:36 +01:00
parent 44944ac15a
commit 7aa845efd0
No known key found for this signature in database
23 changed files with 372 additions and 153 deletions

View File

@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2020-2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
@ -41,9 +42,9 @@
*/
// Initialise values
$search_xaxis = array();
$search_groupby = array();
$tabfamily = null;
$objecttype = null;
if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) {
require '../main.inc.php';
@ -70,7 +71,7 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) {
'@phan-var-force string[] $search_groupby';
$search_yaxis = GETPOST('search_yaxis', 'array');
$search_graph = GETPOST('search_graph', 'restricthtml');
$search_graph = (string) GETPOST('search_graph', 'restricthtml');
// Load variable for pagination
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
@ -113,12 +114,21 @@ if (empty($mode)) {
if (!isset($search_measures)) {
$search_measures = array(0 => 't.count');
}
if (!isset($search_xaxis)) {
// Ensure value is set and not null.
$search_xaxis = array();
}
if (!isset($search_graph)) {
// Ensure value is set and not null
$search_graph = '';
}
if (!empty($object)) {
$objecttype = $object->element.($object->module ? '@'.$object->module : '');
}
if (empty($objecttype)) {
if (!is_string($objecttype) || empty($objecttype)) {
$objecttype = 'thirdparty';
}
'@phan-var-force string $objecttype'; // Help phan that suggests $objecttype can be null
require_once DOL_DOCUMENT_ROOT."/core/class/extrafields.class.php";
require_once DOL_DOCUMENT_ROOT."/core/class/html.form.class.php";
@ -163,6 +173,7 @@ $arrayoftype = array(
// Complete $arrayoftype by external modules
$parameters = array('objecttype' => $objecttype, 'tabfamily' => $tabfamily);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('loadDataForCustomReports', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -191,9 +202,12 @@ if ($objecttype) {
} else {
$fileforclass = "/".$objecttype."/class/".$objecttype.".class.php";
}
dol_include_once($fileforclass);
$ObjectClassName = null;
$ObjectClassName = $arrayoftype[$objecttype]['ObjectClassName'];
if ($fileforclass !== null) {
dol_include_once($fileforclass);
$ObjectClassName = $arrayoftype[$objecttype]['ObjectClassName'];
}
if (!empty($ObjectClassName)) {
if (class_exists($ObjectClassName)) {
$object = new $ObjectClassName($db);
@ -369,7 +383,7 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) {
$newarrayoftype = array();
foreach ($arrayoftype as $key => $val) {
if (dol_eval($val['enabled'], 1, 1, '1')) {
if (dol_eval((string) $val['enabled'], 1, 1, '1')) {
$newarrayoftype[$key] = $arrayoftype[$key];
}
if (!empty($val['langs'])) {
@ -378,11 +392,15 @@ foreach ($arrayoftype as $key => $val) {
}
$count = 0;
$arrayoffilterfields = fillArrayOfFilterFields($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayoffilterfields, 0, $count);
$label = '';
if (array_key_exists($objecttype, $newarrayoftype)) {
$label = $langs->trans($newarrayoftype[$objecttype]['label']);
}
$arrayoffilterfields = fillArrayOfFilterFields($object, 't', $label, $arrayoffilterfields, 0, $count);
$arrayoffilterfields = dol_sort_array($arrayoffilterfields, 'position', 'asc', 0, 0, 1);
$count = 0;
$arrayofmesures = fillArrayOfMeasures($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayofmesures, 0, $count);
$arrayofmesures = fillArrayOfMeasures($object, 't', $label, $arrayofmesures, 0, $count);
$arrayofmesures = dol_sort_array($arrayofmesures, 'position', 'asc', 0, 0, 1);
$count = 0;
@ -396,17 +414,17 @@ $arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1);
// Check parameters
if ($action == 'viewgraph') {
if (is_array($search_measures) && !count($search_measures)) {
if (!count($search_measures)) {
setEventMessages($langs->trans("AtLeastOneMeasureIsRequired"), null, 'warnings');
} elseif ($mode == 'graph' && is_array($search_xaxis) && count($search_xaxis) > 1) {
setEventMessages($langs->trans("OnlyOneFieldForXAxisIsPossible"), null, 'warnings');
$search_xaxis = array(0 => $search_xaxis[0]);
}
if (is_array($search_groupby) && count($search_groupby) >= 2) {
if (count($search_groupby) >= 2) {
setEventMessages($langs->trans("ErrorOnlyOneFieldForGroupByIsPossible"), null, 'warnings');
$search_groupby = array(0 => $search_groupby[0]);
}
if (is_array($search_xaxis) && !count($search_xaxis)) {
if (!count($search_xaxis)) {
setEventMessages($langs->trans("AtLeastOneXAxisIsRequired"), null, 'warnings');
} elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > $MAXMEASURESINBARGRAPH) {
$langs->load("errors");
@ -417,7 +435,7 @@ if ($action == 'viewgraph') {
// Get all possible values of fields when a 'group by' is set, and save this into $arrayofvaluesforgroupby
// $arrayofvaluesforgroupby will be used to forge lael of each grouped series
if (is_array($search_groupby) && count($search_groupby)) {
if (count($search_groupby)) {
$fieldtocount = '';
foreach ($search_groupby as $gkey => $gval) {
$gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval);
@ -563,7 +581,7 @@ if (is_array($search_groupby) && count($search_groupby)) {
}
}
//var_dump($labeloffield);
setEventMessages($langs->transnoentitiesnoconv("ErrorTooManyDifferentValueForSelectedGroupBy", $MAXUNIQUEVALFORGROUP, $labeloffield), null, 'warnings');
setEventMessages($langs->transnoentitiesnoconv("ErrorTooManyDifferentValueForSelectedGroupBy", (string) $MAXUNIQUEVALFORGROUP, (string) $labeloffield), null, 'warnings');
$search_groupby = array();
}
@ -1064,7 +1082,7 @@ foreach ($search_measures as $key => $val) {
$legend[] = $langs->trans($arrayofmesures[$val]['label']);
}
$useagroupby = (is_array($search_groupby) && count($search_groupby));
$useagroupby = count($search_groupby);
//var_dump($useagroupby);
//var_dump($arrayofvaluesforgroupby);
@ -1221,7 +1239,7 @@ if ($mode == 'graph') {
$px1->SetLegend($legend);
$px1->setShowLegend($SHOWLEGEND);
$px1->SetMinValue($px1->GetFloorMinValue());
$px1->SetMinValue((int) $px1->GetFloorMinValue());
$px1->SetMaxValue($px1->GetCeilMaxValue());
$px1->SetWidth($WIDTH);
$px1->SetHeight($HEIGHT);

View File

@ -278,7 +278,7 @@ class pdf_eratosthene extends ModelePDFCommandes
if ($dir === null) {
dol_syslog(get_class($this).'::'.__METHOD__."Target directory should not be null.". getCallerInfoString(), LOG_ERR);
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", "Null dir");
return 0;
}

View File

@ -85,14 +85,14 @@ abstract class ModelePDFCommandes extends CommonDocGenerator
/**
* Local tax rates Array[tax_type][tax_rate]
*
* @var array<string,array<int,float>>
* @var array<int,array<string,float>>
*/
public $localtax1;
/**
* Local tax rates Array[tax_type][tax_rate]
*
* @var array<string,array<int,float>>
* @var array<int,array<string,float>>
*/
public $localtax2;

View File

@ -5,7 +5,7 @@
* Copyright (C) 2008 Chiptronik
* Copyright (C) 2011-2021 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Nick Fragoulis
*
@ -72,8 +72,17 @@ class pdf_typhon extends ModelePDFDeliveryOrder
*/
public $version = 'dolibarr';
/**
* @var float
*/
public $posxcomm; // For customer comment column
/**
* @var float
*/
public $posxweightvol; // For weight or volume
/**
* @var float
*/
public $posxremainingqty;

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Nick Fragoulis
*
@ -65,8 +65,17 @@ class pdf_merou extends ModelePdfExpedition
*/
public $type;
/**
* @var Contact
*/
public $destinataire;
/**
* @var ?Societe
*/
public $expediteur;
/**
* @var User
*/
public $livreur;
/**
@ -624,7 +633,7 @@ class pdf_merou extends ModelePdfExpedition
$label .= $object->tracking_url;
}
$pdf->SetFont('', 'B', $default_font_size - 3);
$pdf->writeHTMLCell(50, 8, '', '', $label, '', 'L');
$pdf->writeHTMLCell(50, 8, '', '', $label, 0, 1, false, true, 'L');
}
}
} else {

View File

@ -7,7 +7,7 @@
* Copyright (C) 2019 Markus Welters <markus@welters.de>
* Copyright (C) 2019 Rafael Ingenleuf <ingenleuf@welters.de>
* Copyright (C) 2020 Marc Guenneugues <marc.guenneugues@simicar.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@ -77,19 +77,46 @@ class pdf_standard_expensereport extends ModeleExpenseReport
*/
public $version = 'dolibarr';
/**
* @var float
*/
public $posxpiece;
/**
* @var float
*/
public $posxcomment;
/**
* @var float
*/
public $posxtva;
/**
* @var float
*/
public $posxup;
/**
* @var float
*/
public $posxqty;
/**
* @var float
*/
public $posxtype;
/**
* @var int posx date
*/
public $posxdate;
/**
* @var float
*/
public $posxprojet;
/**
* @var float
*/
public $postotalht;
/**
* @var float
*/
public $postotalttc;

View File

@ -11,7 +11,7 @@
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022-2024 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
@ -800,7 +800,7 @@ class pdf_crabe extends ModelePDFFactures
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'])) {
$this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['tot_ht'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht);
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht);
} else {
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
@ -901,7 +901,7 @@ class pdf_crabe extends ModelePDFFactures
$pagecount = $pdf->setSourceFile($termsofsale);
for ($i = 1; $i <= $pagecount; $i++) {
$tplIdx = $pdf->importPage($i);
if ($tplIdx!==false) {
if ($tplIdx !== false) {
$s = $pdf->getTemplatesize($tplIdx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplIdx);
@ -1884,7 +1884,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}
@ -1903,10 +1903,10 @@ class pdf_crabe extends ModelePDFFactures
if (getDolGlobalString('MAIN_GENERATE_INVOICES_WITH_PICTURE')) {
$pdf->line($this->posxpicture - 1, $tab_top, $this->posxpicture - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
//$pdf->SetXY($this->posxpicture-1, $tab_top+1);
//$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C');
}
//if (empty($hidetop)) {
//$pdf->SetXY($this->posxpicture-1, $tab_top+1);
//$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C');
//}
}
if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && !getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) {
@ -2338,7 +2338,7 @@ class pdf_crabe extends ModelePDFFactures
// Show shipping frame
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->MultiCell($widthrecbox, '', $outputlangs->transnoentities('ShippingTo'), 0, 'L', 0);
$pdf->MultiCell($widthrecbox, 0, $outputlangs->transnoentities('ShippingTo'), 0, 'L', 0);
$pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius, '1234', 'D');
// Show shipping name

View File

@ -12,7 +12,7 @@
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2022-2024 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@ -336,6 +336,7 @@ class pdf_octopus extends ModelePDFFactures
}
$arephoto = false;
$realpath = false;
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->entity != $objphoto->entity) {
@ -811,6 +812,7 @@ class pdf_octopus extends ModelePDFFactures
}
}
/** @phan-suppress-next-line PhanTypeMismatchProperty */
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $posy + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
// $pdf->Image does not increase value return by getY, so we save it manually
@ -1046,7 +1048,7 @@ class pdf_octopus extends ModelePDFFactures
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'])) {
$this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['tot_ht'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht);
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht);
} else {
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
@ -2077,7 +2079,7 @@ class pdf_octopus extends ModelePDFFactures
// MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
$tab_top += 4;
}
@ -2503,7 +2505,7 @@ class pdf_octopus extends ModelePDFFactures
// Show shipping frame
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->MultiCell($widthrecbox, '', $outputlangs->transnoentities('ShippingTo'), 0, 'L', 0);
$pdf->MultiCell($widthrecbox, 0, $outputlangs->transnoentities('ShippingTo'), 0, 'L', 0);
$pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius, '1234', 'D');
// Show shipping name
@ -2883,7 +2885,7 @@ class pdf_octopus extends ModelePDFFactures
//$pdf->Rect($this->posx_cumul_anterieur - 1, $tab_top, $width, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->posx_cumul_anterieur - 1, $tab_top, $width, 5, $this->corner_radius, '1001', 'F', explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
//$pdf->Rect($this->marge_gauche, $tab_top + 92.5, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top + 92.5, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top + 92.5, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}

View File

@ -11,7 +11,7 @@
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2024 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
* Copyright (C) 2024 Franck Moreau
*
@ -262,6 +262,7 @@ class pdf_sponge extends ModelePDFFactures
}
$arephoto = false;
$realpath = false;
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->entity != $objphoto->entity) {
@ -751,6 +752,7 @@ class pdf_sponge extends ModelePDFFactures
}
$pdf->setPageOrientation('', 0, $this->heightforfooter + $this->heightforfreetext); // The only function to edit the bottom margin of current page to set it.
// @phan-suppress-next-line PhanTypeMismatchProperty
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + $imageTopMargin, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
// $pdf->Image does not increase value return by getY, so we save it manually
@ -941,7 +943,7 @@ class pdf_sponge extends ModelePDFFactures
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'])) {
$this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['tot_ht'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht);
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht);
} else {
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
@ -979,7 +981,7 @@ class pdf_sponge extends ModelePDFFactures
// Draw table frames and columns borders
$drawTabNumbPage = $pdf->getNumPages();
for ($i=$pageposbeforeprintlines; $i<=$drawTabNumbPage; $i++) {
for ($i = $pageposbeforeprintlines; $i <= $drawTabNumbPage; $i++) {
$pdf->setPage($i);
// reset page orientation each loop to override it if it was changed
$pdf->setPageOrientation('', 0, 0); // The only function to edit the bottom margin of current page to set it.
@ -994,7 +996,7 @@ class pdf_sponge extends ModelePDFFactures
$drawTabTop = $this->tab_top;
} elseif (!$drawTabHideTop) {
if (getDolGlobalInt('MAIN_PDF_ENABLE_COL_HEAD_TITLE_REPEAT')) {
$drawTabTop-= $this->tabTitleHeight;
$drawTabTop -= $this->tabTitleHeight;
} else {
$drawTabHideTop = 1;
}
@ -1003,7 +1005,7 @@ class pdf_sponge extends ModelePDFFactures
// last page need to include document footer
if ($i == $pdf->getNumPages()) {
// remove document footer height to tab bottom position
$drawTabBottom-= $this->heightforfreetext + $this->heightforinfotot + $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs);
$drawTabBottom -= $this->heightforfreetext + $this->heightforinfotot + $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs);
}
$drawTabHeight = $drawTabBottom - $drawTabTop;
@ -1061,7 +1063,7 @@ class pdf_sponge extends ModelePDFFactures
$pagecount = $pdf->setSourceFile($termsofsale);
for ($i = 1; $i <= $pagecount; $i++) {
$tplIdx = $pdf->importPage($i);
if ($tplIdx!==false) {
if ($tplIdx !== false) {
$s = $pdf->getTemplatesize($tplIdx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplIdx);
@ -2190,7 +2192,7 @@ class pdf_sponge extends ModelePDFFactures
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}
@ -2586,7 +2588,7 @@ class pdf_sponge extends ModelePDFFactures
// Show shipping frame
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->MultiCell($widthrecbox, '', $outputlangs->transnoentities('ShippingTo'), 0, 'L', 0);
$pdf->MultiCell($widthrecbox, 0, $outputlangs->transnoentities('ShippingTo'), 0, 'L', 0);
$pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius, '1234', 'D');
// Show shipping name

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -42,21 +42,69 @@ use Sprain\SwissQrBill;
*/
abstract class ModelePDFFactures extends CommonDocGenerator
{
/**
* @var float
*/
public $posxpicture;
/**
* @var float
*/
public $posxtva;
/**
* @var float
*/
public $posxup;
/**
* @var float
*/
public $posxqty;
/**
* @var float
*/
public $posxunit;
/**
* @var float
*/
public $posxdesc;
/**
* @var float
*/
public $posxdiscount;
/**
* @var float
*/
public $postotalht;
/**
* @var array<string,float>
*/
public $tva;
/**
* @var array<string,array{amount:float}>
*/
public $tva_array;
/**
* Local tax rates Array[tax_type][tax_rate]
*
* @var array<int,array<string,float>>
*/
public $localtax1;
/**
* Local tax rates Array[tax_type][tax_rate]
*
* @var array<int,array<string,float>>
*/
public $localtax2;
/**
* @var int<0,1>
*/
public $atleastonediscount = 0;
/**
* @var int<0,1>
*/
public $atleastoneratenotnull = 0;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -140,13 +140,12 @@ class mod_pacific extends ModeleNumRefFicheinter
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql .= " AND entity = ".$conf->entity;
$max = 0;
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
$max = intval($obj->max);
} else {
$max = 0;
}
}

View File

@ -7,7 +7,7 @@
* Copyright (C) 2019 Markus Welters <markus@welters.de>
* Copyright (C) 2019 Rafael Ingenleuf <ingenleuf@welters.de>
* Copyright (C) 2020 Marc Guenneugues <marc.guenneugues@simicar.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -314,7 +314,7 @@ class mailing_contacts1 extends MailingTargets
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($this->db);
$s .= img_picto($langs->trans("DefaultLang"), 'language', 'class="pictofixedwidth"');
$s .= $formadmin->select_language(GETPOST('filter_lang', 'aZ09'), 'filter_lang', 0, null, $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, null, 1);
$s .= $formadmin->select_language(GETPOST('filter_lang', 'aZ09'), 'filter_lang', 0, array(), $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, array(), 1);
}
return $s;

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2018-2018 Andre Schild <a.schild@aarboard.ch>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This file is an example to follow to add your own email selector inside
@ -385,7 +385,7 @@ class mailing_thirdparties extends MailingTargets
$formadmin = new FormAdmin($this->db);
$s .= img_picto($langs->trans("DefaultLang"), 'language', 'class="pictofixedwidth"');
//$s .= '<span class="opacitymedium">'.$langs->trans("DefaultLang").':</span> ';
$s .= $formadmin->select_language(GETPOST('filter_lang_thirdparties', 'aZ09'), 'filter_lang_thirdparties', 0, null, $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, null, 1);
$s .= $formadmin->select_language(GETPOST('filter_lang_thirdparties', 'aZ09'), 'filter_lang_thirdparties', 0, array(), $langs->trans("DefaultLang"), 0, 0, '', 0, 0, 0, array(), 1);
}
return $s;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@stocks.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Nick Fragoulis
*
@ -45,16 +45,49 @@ class pdf_standard_movementstock extends ModelePDFMovement
*/
public $update_main_doc_field;
/**
* @var int
*/
public $wref;
/**
* @var float
*/
public $posxidref;
/**
* @var float
*/
public $posxdatemouv;
/**
* @var float
*/
public $posxdesc;
/**
* @var float
*/
public $posxlabel;
/**
* @var float
*/
public $posxtva;
/**
* @var float
*/
public $posxqty;
/**
* @var float
*/
public $posxup;
/**
* @var float
*/
public $posxunit;
/**
* @var float
*/
public $posxdiscount;
/**
* @var float
*/
public $postotalht;
@ -320,7 +353,7 @@ class pdf_standard_movementstock extends ModelePDFMovement
$resql = $this->db->query($sql);
$nbtotalofrecords = $this->db->num_rows($result);
$nbtotalofrecords = $this->db->num_rows($resql);
/*
* END TODO
@ -840,7 +873,7 @@ class pdf_standard_movementstock extends ModelePDFMovement
if (empty($hidetop)) {
//$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line takes a position y in 2nd parameter and 4th parameter
$pdf->SetXY($this->posxidref, $tab_top + 1);
$pdf->MultiCell($this->posxdatemouv - $this->posxdatemouv - 0.8, 3, $outputlangs->transnoentities("Ref"), '', 'L');
$pdf->MultiCell($this->posxdesc - $this->posxdatemouv - 0.8, 3, $outputlangs->transnoentities("Ref"), '', 'L');
}
//Date mouv
@ -1036,6 +1069,7 @@ class pdf_standard_movementstock extends ModelePDFMovement
$obj = $this->db->fetch_object($resqlbis);
$lastmovementdate = $this->db->jdate($obj->datem);
} else {
$lastmovementdate = 0;
dol_print_error($this->db);
}
@ -1088,39 +1122,39 @@ class pdf_standard_movementstock extends ModelePDFMovement
// $top_shift = $pdf->getY() - $current_y;
//}
if ($showaddress) {
/*
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
//if ($showaddress) {
/*
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
// Show sender
$posy=42;
$posx=$this->marge_gauche;
if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=40;
// Show sender
$posy=42;
$posx=$this->marge_gauche;
if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=40;
// Show sender frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
$pdf->SetXY($posx,$posy);
$pdf->SetFillColor(230,230,230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60);
// Show sender frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
$pdf->SetXY($posx,$posy);
$pdf->SetFillColor(230,230,230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60);
// Show sender name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy=$pdf->getY();
// Show sender name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy=$pdf->getY();
// Show sender information
$pdf->SetXY($posx+2,$posy);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
*/
}
// Show sender information
$pdf->SetXY($posx+2,$posy);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
*/
//}
$pdf->SetTextColor(0, 0, 0);

View File

@ -5,8 +5,8 @@
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2024 Nick Fragoulis
*
@ -944,7 +944,7 @@ class pdf_vinci extends ModelePDFMo
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}

View File

@ -1,7 +1,7 @@
<?php
/*
* Copyright (C) 2014-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -216,7 +216,7 @@ class printing_printgcp extends PrintingDriver
$html .= '<td>'.$langs->trans('GCP_Type').'</td>';
$html .= '<td class="center">'.$langs->trans("Select").'</td>';
$html .= '</tr>'."\n";
$list = $this->getlistAvailablePrinters();
$list = $this->getlistAvailableGcpPrinters();
//$html.= '<td><pre>'.print_r($list,true).'</pre></td>';
foreach ($list['available'] as $printer_det) {
$html .= '<tr class="oddeven">';
@ -245,9 +245,21 @@ class printing_printgcp extends PrintingDriver
/**
* Return list of available printers
*
* @return array{available:array{name:string,displayname:string,id:string,ownerName:string,status:string,connectionStatus:string,type:string}} list of printers
* @return array<array{name:string,displayName:string,id:string,ownerName:string,status:string,connectionStatus:string,type:string}> list of printers
*/
public function getlistAvailablePrinters()
{
/* Compatible with paretn class signature */
return $this->getlistAvailableGcpPrinters()['available'];
}
/**
* Return list of available printers (internal format)
*
* @return array{available:array<array{name:string,displayName:string,id:string,ownerName:string,status:string,connectionStatus:string,type:string}>} list of printers
*/
public function getlistAvailableGcpPrinters()
{
global $conf;
$ret = array();

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@products.sourceforge.net>
* Copyright (C) 2023 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Nick Fragoulis
*
@ -278,6 +278,7 @@ class pdf_standard extends ModelePDFProduct
}
// Define size of image if we need it
$imglinesize = array();
$nexyafterphoto = null;
if (!empty($realpath) && $arephoto) {
$imgsize = pdf_getSizeForImage($realpath);
$imgsizewidth = $imgsize['width'] + 20;
@ -832,39 +833,39 @@ class pdf_standard extends ModelePDFProduct
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($showaddress) {
/*
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
//if ($showaddress) {
/*
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
// Show sender
$posy=42;
$posx=$this->marge_gauche;
if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=40;
// Show sender
$posy=42;
$posx=$this->marge_gauche;
if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=40;
// Show sender frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
$pdf->SetXY($posx,$posy);
$pdf->SetFillColor(230,230,230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60);
// Show sender frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
$pdf->SetXY($posx,$posy);
$pdf->SetFillColor(230,230,230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60);
// Show sender name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy=$pdf->getY();
// Show sender name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy=$pdf->getY();
// Show sender information
$pdf->SetXY($posx+2,$posy);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
*/
}
// Show sender information
$pdf->SetXY($posx+2,$posy);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
*/
//}
$pdf->SetTextColor(0, 0, 0);

View File

@ -5,7 +5,7 @@
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -647,7 +647,7 @@ class doc_generic_task_odt extends ModelePDFTask
$soc->fetch($contact['socid']);
$contact['socname'] = $soc->name;
}
$contact['fullname'] = $objectdetail->getFullName($outputlangs, 1);
$contact['fullname'] = is_object($objectdetail) ? $objectdetail->getFullName($outputlangs, 1) : null;
$tmparray = $this->get_substitutionarray_tasksressource($contact, $outputlangs);

View File

@ -10,7 +10,7 @@
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019 Pierre Ardoin <mapiolca@me.com>
* Copyright (C) 2021-2024 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
@ -775,7 +775,7 @@ class pdf_azur extends ModelePDFPropales
$pagecount = $pdf->setSourceFile($termsofsale);
for ($i = 1; $i <= $pagecount; $i++) {
$tplIdx = $pdf->importPage($i);
if ($tplIdx!==false) {
if ($tplIdx !== false) {
$s = $pdf->getTemplatesize($tplIdx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplIdx);
@ -816,6 +816,7 @@ class pdf_azur extends ModelePDFPropales
// If PDF is selected and file is not empty
if (count($filetomerge->lines) > 0) {
foreach ($filetomerge->lines as $linefile) {
$filetomerge_dir = null;
if (!empty($linefile->id) && !empty($linefile->file_name)) {
if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
if (isModEnabled("product")) {
@ -831,7 +832,11 @@ class pdf_azur extends ModelePDFPropales
}
}
dol_syslog(get_class($this).':: upload_dir='.$filetomerge_dir, LOG_DEBUG);
dol_syslog(get_class($this).':: upload_dir='.$filetomerge_dir, $filetomerge_dir === null ? LOG_ERR : LOG_DEBUG);
if ($filetomerge_dir === null) {
// Skip loop
continue;
}
$infile = $filetomerge_dir.'/'.$linefile->file_name;
if (file_exists($infile) && is_readable($infile)) {
@ -1447,7 +1452,7 @@ class pdf_azur extends ModelePDFPropales
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}
@ -1466,10 +1471,10 @@ class pdf_azur extends ModelePDFPropales
if (getDolGlobalString('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
$pdf->line($this->posxpicture - 1, $tab_top, $this->posxpicture - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
//$pdf->SetXY($this->posxpicture-1, $tab_top+1);
//$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C');
}
//if (empty($hidetop)) {
//$pdf->SetXY($this->posxpicture-1, $tab_top+1);
//$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C');
//}
}
if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && !getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) {

View File

@ -9,7 +9,7 @@
* 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) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
@ -359,7 +359,7 @@ class pdf_cyan extends ModelePDFPropales
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
if (!$hidetop && getDolGlobalInt('MAIN_PDF_ENABLE_COL_HEAD_TITLE_REPEAT')) {
// TODO : make this hidden conf the default behavior for each PDF when each PDF managed this new Display
$tab_top_newpage+= $this->tabTitleHeight;
$tab_top_newpage += $this->tabTitleHeight;
}
$nexY = $tab_top;
@ -611,6 +611,7 @@ class pdf_cyan extends ModelePDFPropales
}
$pdf->setPageOrientation('', 0, $heightforfooter + $heightforfreetext); // The only function to edit the bottom margin of current page to set it.
// @phan-suppress-next-line PhanTypeMismatchProperty
if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + $imageTopMargin, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
// $pdf->Image does not increase value return by getY, so we save it manually
@ -804,7 +805,7 @@ class pdf_cyan extends ModelePDFPropales
// Add last page for document footer if there are not enough size left
$afterPosData = $this->getMaxAfterColsLinePositionsData();
if ($afterPosData['y'] > $this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot) ) {
if ($afterPosData['y'] > $this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot)) {
$pdf->AddPage();
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
@ -815,7 +816,7 @@ class pdf_cyan extends ModelePDFPropales
// Draw table frames and columns borders
$drawTabNumbPage = $pdf->getNumPages();
for ($i=$pageposbeforeprintlines; $i<=$drawTabNumbPage; $i++) {
for ($i = $pageposbeforeprintlines; $i <= $drawTabNumbPage; $i++) {
$pdf->setPage($i);
// reset page orientation each loop to override it if it was changed
$pdf->setPageOrientation('', 0, 0); // The only function to edit the bottom margin of current page to set it.
@ -830,7 +831,7 @@ class pdf_cyan extends ModelePDFPropales
$drawTabTop = $tab_top;
} elseif (!$drawTabHideTop) {
if (getDolGlobalInt('MAIN_PDF_ENABLE_COL_HEAD_TITLE_REPEAT')) {
$drawTabTop-= $this->tabTitleHeight;
$drawTabTop -= $this->tabTitleHeight;
} else {
$drawTabHideTop = 1;
}
@ -839,7 +840,7 @@ class pdf_cyan extends ModelePDFPropales
// last page need to include document footer
if ($i == $pdf->getNumPages()) {
// remove document footer height to tab bottom position
$drawTabBottom-= $heightforsignature + $heightforfreetext + $heightforinfotot;
$drawTabBottom -= $heightforsignature + $heightforfreetext + $heightforinfotot;
}
$drawTabHeight = $drawTabBottom - $drawTabTop;
@ -895,7 +896,7 @@ class pdf_cyan extends ModelePDFPropales
$pagecount = $pdf->setSourceFile($termsofsale);
for ($i = 1; $i <= $pagecount; $i++) {
$tplIdx = $pdf->importPage($i);
if ($tplIdx!==false) {
if ($tplIdx !== false) {
$s = $pdf->getTemplatesize($tplIdx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplIdx);
@ -937,6 +938,7 @@ class pdf_cyan extends ModelePDFPropales
if (count($filetomerge->lines) > 0) {
foreach ($filetomerge->lines as $linefile) {
if (!empty($linefile->id) && !empty($linefile->file_name)) {
$filetomerge_dir = null;
if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
if (isModEnabled("product")) {
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos";
@ -951,7 +953,11 @@ class pdf_cyan extends ModelePDFPropales
}
}
dol_syslog(get_class($this).':: upload_dir='.$filetomerge_dir, LOG_DEBUG);
dol_syslog(get_class($this).':: upload_dir='.$filetomerge_dir, $filetomerge_dir === null ? LOG_ERR : LOG_DEBUG);
if ($filetomerge_dir === null) {
// Skip loop
continue;
}
$infile = $filetomerge_dir.'/'.$linefile->file_name;
if (file_exists($infile) && is_readable($infile)) {
@ -1259,11 +1265,11 @@ class pdf_cyan extends ModelePDFPropales
// Total HT
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top+ $tab2_hl * $index);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1);
$total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top+ $tab2_hl * $index);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total
@ -1377,12 +1383,12 @@ class pdf_cyan extends ModelePDFPropales
foreach ($localtax_rate as $tvakey => $tvaval) {
if ($tvakey != 0) { // On affiche pas taux 0
//$this->atleastoneratenotnull++;
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
$tvacompl = '';
if (preg_match('/\*/', $tvakey)) {
$tvakey = str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
@ -1412,12 +1418,12 @@ class pdf_cyan extends ModelePDFPropales
foreach ($localtax_rate as $tvakey => $tvaval) {
// retrieve global local tax
if ($tvakey != 0) { // On affiche pas taux 0
//$this->atleastoneratenotnull++;
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
$tvacompl = '';
if (preg_match('/\*/', $tvakey)) {
$tvakey = str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
@ -1555,7 +1561,7 @@ class pdf_cyan extends ModelePDFPropales
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -38,21 +38,68 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis
*/
abstract class ModelePDFPropales extends CommonDocGenerator
{
/**
* @var float
*/
public $posxpicture;
/**
* @var float
*/
public $posxtva;
/**
* @var float
*/
public $posxup;
/**
* @var float
*/
public $posxqty;
/**
* @var float
*/
public $posxunit;
/**
* @var float
*/
public $posxdesc;
/**
* @var float
*/
public $posxdiscount;
/**
* @var float
*/
public $postotalht;
/**
* @var array<string,float>
*/
public $tva;
/**
* @var array<string,array{amount:float}>
*/
public $tva_array;
/**
* Local tax rates Array[tax_type][tax_rate]
*
* @var array<int,array<string,float>>
*/
public $localtax1;
/**
* Local tax rates Array[tax_type][tax_rate]
*
* @var array<int,array<string,float>>
*/
public $localtax2;
/**
* @var int<0,1>
*/
public $atleastonediscount = 0;
/**
* @var int<0,1>
*/
public $atleastoneratenotnull = 0;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
* Copyright (C) 2023-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@ -1029,7 +1029,7 @@ class pdf_squille extends ModelePdfReception
if (empty($arrayidcontact)) {
$arrayidcontact = $object->origin_object->getIdContact('internal', 'SHIPPING');
}
if (count($arrayidcontact) > 0) {
if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
$object->fetch_user(reset($arrayidcontact));
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));