Skip to content

Commit 65a1946

Browse files
committed
Merge branch '21.0' of [email protected]:Dolibarr/dolibarr.git into develop
2 parents 0b3d3c3 + 3a79a0b commit 65a1946

File tree

3 files changed

+61
-39
lines changed

3 files changed

+61
-39
lines changed

htdocs/compta/stats/supplier_turnover_by_thirdparty.php

+37-18
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (C) 2023 Ferran Marcet <[email protected]>
44
* Copyright (C) 2024 MDW <[email protected]>
55
* Copyright (C) 2024 Frédéric France <[email protected]>
6+
* Copyright (C) 2025 Alexandre Spangaro <[email protected]>
67
*
78
* This program is free software; you can redistribute it and/or modify
89
* it under the terms of the GNU General Public License as published by
@@ -66,11 +67,25 @@
6667

6768
// Category
6869
$selected_cat = GETPOSTINT('search_categ');
70+
if ($selected_cat == -1) {
71+
$selected_cat = 0;
72+
}
6973
$subcat = false;
7074
if (GETPOST('subcat', 'alpha') === 'yes') {
7175
$subcat = true;
7276
}
7377

78+
// Security check
79+
if ($user->socid > 0) {
80+
$socid = $user->socid;
81+
}
82+
if (isModEnabled('comptabilite')) {
83+
$result = restrictedArea($user, 'compta', '', '', 'resultat');
84+
}
85+
if (isModEnabled('accounting')) {
86+
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
87+
}
88+
7489
// Hook
7590
$hookmanager->initHooks(array('supplierturnoverbythirdpartylist'));
7691

@@ -158,12 +173,24 @@
158173
$commonparams['sortfield'] = $sortfield;
159174

160175
$headerparams = array();
161-
$headerparams['date_startyear'] = $date_startyear;
162-
$headerparams['date_startmonth'] = $date_startmonth;
163-
$headerparams['date_startday'] = $date_startday;
164-
$headerparams['date_endyear'] = $date_endyear;
165-
$headerparams['date_endmonth'] = $date_endmonth;
166-
$headerparams['date_endday'] = $date_endday;
176+
if (!empty($date_startyear)) {
177+
$headerparams['date_startyear'] = $date_startyear;
178+
}
179+
if (!empty($date_startmonth)) {
180+
$headerparams['date_startmonth'] = $date_startmonth;
181+
}
182+
if (!empty($date_startday)) {
183+
$headerparams['date_startday'] = $date_startday;
184+
}
185+
if (!empty($date_endyear)) {
186+
$headerparams['date_endyear'] = $date_endyear;
187+
}
188+
if (!empty($date_endmonth)) {
189+
$headerparams['date_endmonth'] = $date_endmonth;
190+
}
191+
if (!empty($date_endday)) {
192+
$headerparams['date_endday'] = $date_endday;
193+
}
167194

168195
$tableparams = array();
169196
$tableparams['search_categ'] = $selected_cat;
@@ -183,16 +210,7 @@
183210
$paramslink .= '&'.$key.'='.$value;
184211
}
185212

186-
// Security check
187-
if ($user->socid > 0) {
188-
$socid = $user->socid;
189-
}
190-
if (isModEnabled('comptabilite')) {
191-
$result = restrictedArea($user, 'compta', '', '', 'resultat');
192-
}
193-
if (isModEnabled('accounting')) {
194-
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
195-
}
213+
196214

197215

198216
/*
@@ -216,6 +234,8 @@
216234

217235
$calcmode = '';
218236
$name = '';
237+
$namelink = '';
238+
$builddate = dol_now();
219239

220240
// Show report header
221241
if ($modecompta == "CREANCES-DETTES") {
@@ -237,7 +257,6 @@
237257
// TODO
238258
}
239259

240-
$builddate = dol_now();
241260
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
242261
$period .= ' - ';
243262
$period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
@@ -249,7 +268,7 @@
249268

250269
$exportlink = '';
251270

252-
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
271+
report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
253272

254273
if (isModEnabled('accounting')) {
255274
if ($modecompta != 'BOOKKEEPING') {

htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide
19061906
$this->cols['position'] = array(
19071907
'rank' => $rank,
19081908
'width' => 10,
1909-
'status' => getDolGlobalInt('PDF_ERATOSHTENE_ADD_POSITION') ? true : ((bool) getDolGlobalInt('PDF_ADD_POSITION')),
1909+
'status' => (getDolGlobalInt('PDF_ERATOSTHENE_ADD_POSITION') || getDolGlobalInt('PDF_ERATOSHTENE_ADD_POSITION')) ? true : (getDolGlobalInt('PDF_ADD_POSITION') ? true : false),
19101910
'title' => array(
19111911
'textkey' => '#', // use lang key is useful in somme case with module
19121912
'align' => 'C',

htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php

+23-20
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,14 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
276276

277277
$pdf = pdf_getInstance($this->format);
278278
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
279-
$heightforinfotot = 50; // Height reserved to output the info and total part
279+
$pdf->SetAutoPageBreak(true, 0);
280+
281+
$heightforinfotot = 40; // Height reserved to output the info and total part
280282
$heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page
281283
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
282284
if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) {
283285
$heightforfooter += 6;
284286
}
285-
$pdf->setAutoPageBreak(true, 0);
286287

287288
if (class_exists('TCPDF')) {
288289
$pdf->setPrintHeader(false);
@@ -335,6 +336,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
335336

336337
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
337338

339+
$nexY = $tab_top - 1;
340+
338341
// Incoterm
339342
$height_incoterms = 0;
340343
if (isModEnabled('incoterm')) {
@@ -344,7 +347,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
344347

345348
$pdf->SetFont('', '', $default_font_size - 1);
346349
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
347-
$nexY = $pdf->GetY();
350+
$nexY = max($pdf->GetY(), $nexY);
348351
$height_incoterms = $nexY - $tab_top;
349352

350353
// Rect takes a length in 3rd parameter
@@ -367,6 +370,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
367370

368371
$pagenb = $pdf->getPage();
369372
if (!empty($notetoshow)) {
373+
$tab_top -= 2;
374+
370375
$tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
371376
$pageposbeforenote = $pagenb;
372377

@@ -375,8 +380,6 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
375380
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
376381
$notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
377382

378-
$tab_top -= 2;
379-
380383
$pdf->startTransaction();
381384

382385
$pdf->SetFont('', '', $default_font_size - 1);
@@ -492,21 +495,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
492495
// Use new auto column system
493496
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
494497

498+
$nexY = $tab_top + $this->tabTitleHeight;
495499

496500
$pageposbeforeprintlines = $pdf->getPage();
497501
$pagenb = $pageposbeforeprintlines;
498502

499-
// Show square
500-
if ($pagenb == $pageposbeforeprintlines) {
501-
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
502-
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
503-
} else {
504-
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
505-
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
506-
}
507-
508-
$nexY = $tab_top + $this->tabTitleHeight;
509-
510503
// Loop on each lines
511504
for ($i = 0; $i < $nblines; $i++) {
512505
$curY = $nexY;
@@ -555,20 +548,20 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
555548
}
556549

557550
// Description of product line
558-
$curX = $this->posxdesc - 1;
559551
$showpricebeforepagebreak = 1;
560552

561553
if ($this->getColumnStatus('desc')) {
562554
$pdf->startTransaction();
563555

564556
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
565-
566557
$pageposafter = $pdf->getPage();
558+
567559
if ($pageposafter > $pageposbefore) { // There is a pagebreak
568560
$pdf->rollbackTransaction(true);
561+
$pageposafter = $pageposbefore;
562+
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
569563

570564
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
571-
572565
$pageposafter = $pdf->getPage();
573566
$posyafter = $pdf->GetY();
574567
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
@@ -595,8 +588,10 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
595588
$posYAfterDescription = $pdf->GetY();
596589
}
597590

598-
$nexY = $pdf->GetY();
591+
$nexY = max($pdf->GetY(), $posYAfterImage);
592+
599593
$pageposafter = $pdf->getPage();
594+
600595
$pdf->setPage($pageposbefore);
601596
$pdf->setTopMargin($this->marge_haute);
602597
$pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it.
@@ -798,6 +793,14 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
798793
}
799794
}
800795

796+
// Show square
797+
if ($pagenb == $pageposbeforeprintlines) {
798+
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis);
799+
} else {
800+
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis);
801+
}
802+
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
803+
801804
// Affiche zone infos
802805
$posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
803806

0 commit comments

Comments
 (0)