-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
377 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/* Copyright (C) 2020-2024 Laurent Destailleur <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
|
@@ -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 @@ | |
'@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,10 +114,18 @@ | |
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'; | ||
} | ||
|
||
|
@@ -163,6 +172,7 @@ | |
|
||
// 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 +201,12 @@ | |
} 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 +382,7 @@ | |
|
||
$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 +391,15 @@ | |
} | ||
|
||
$count = 0; | ||
$arrayoffilterfields = fillArrayOfFilterFields($object, 't', $langs->trans($newarrayoftype[$objecttype]['label']), $arrayoffilterfields, 0, $count); | ||
$label = ''; | ||
if ($objecttype !== null && 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 +413,17 @@ | |
|
||
// 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 +434,7 @@ | |
|
||
// 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 +580,7 @@ | |
} | ||
} | ||
//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 +1081,7 @@ function (array $matches): string { | |
$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 +1238,7 @@ function (array $matches): string { | |
|
||
$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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* Copyright (C) 2008 Chiptronik | ||
* Copyright (C) 2011-2021 Philippe Grand <[email protected]> | ||
* Copyright (C) 2015 Marcos García <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
* 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; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Copyright (C) 2005-2011 Regis Houssin <[email protected]> | ||
* Copyright (C) 2013 Florian Henry <[email protected]> | ||
* Copyright (C) 2015 Marcos García <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
* 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 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) | |
$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 { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
* Copyright (C) 2019 Markus Welters <[email protected]> | ||
* Copyright (C) 2019 Rafael Ingenleuf <[email protected]> | ||
* Copyright (C) 2020 Marc Guenneugues <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* 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; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
* Copyright (C) 2018-2024 Frédéric France <[email protected]> | ||
* Copyright (C) 2022-2024 Anthony Berton <[email protected]> | ||
* Copyright (C) 2022 Charlene Benke <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* Copyright (C) 2024 Nick Fragoulis | ||
* Copyright (C) 2024 Alexandre Spangaro <[email protected]> | ||
* | ||
|
@@ -800,7 +800,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede | |
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 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede | |
$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 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $ | |
$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 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $ | |
|
||
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 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output | |
// 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 | ||
|
Oops, something went wrong.