From 66b91c43e79e2880a527fa6557d4608187008228 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 15 Aug 2024 16:47:22 +0200 Subject: [PATCH 1/7] Fix: Typo in property multicurrency_tx (was:mylti...) (#30641) # Fix: Typo in property multicurrency_tx (was:mylti...) Fixes typo whan copying multicurrency_tx, improved some typing at the same time. --- .../facture/doc/pdf_octopus.modules.php | 267 +++++++++--------- 1 file changed, 137 insertions(+), 130 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index c1cfb517f3b..ff76527981e 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -12,6 +12,7 @@ * Copyright (C) 2022 Anthony Berton * Copyright (C) 2022-2024 Alexandre Spangaro * Copyright (C) 2022-2024 Eric Seigne + * Copyright (C) 2024 MDW * * 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 @@ -416,7 +417,7 @@ class pdf_octopus extends ModelePDFFactures if ($nbprevsituation > 0) { $this->heightforinfotot += 4 * ($nbprevsituation + 3); } - $this->heightforfreetext= (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5)); // Height reserved to output the free text on last page + $this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5)); // Height reserved to output the free text on last page $this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) if (class_exists('TCPDF')) { @@ -578,7 +579,7 @@ class pdf_octopus extends ModelePDFFactures $this->_tableFirstPage($pdf, $tab_top, $this->page_hauteur - 100 - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); - $bottomlasttab=$this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -952,9 +953,9 @@ class pdf_octopus extends ModelePDFFactures $parameters = array( 'object' => $object, 'i' => $i, - 'pdf' =>& $pdf, - 'curY' =>& $posy, - 'nexY' =>& $nexY, + 'pdf' => & $pdf, + 'curY' => & $posy, + 'nexY' => & $nexY, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); @@ -1125,7 +1126,7 @@ class pdf_octopus extends ModelePDFFactures } $this->resumeLastPage($pdf, $object, 0, $tab_top, $outputlangs, $outputlangsbis); - $bottomlasttab=$this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; + $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; $this->_pagefoot($pdf, $object, $outputlangs, 1); $pdf->Close(); @@ -1161,7 +1162,7 @@ class pdf_octopus extends ModelePDFFactures /** * Show payments table * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object invoice * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output @@ -1305,7 +1306,7 @@ class pdf_octopus extends ModelePDFFactures /** * Show miscellaneous information (payment mode, payment term, ...) * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object @@ -1536,7 +1537,7 @@ class pdf_octopus extends ModelePDFFactures /** * Show total to pay * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Amount already paid (in the currency of invoice) * @param int $posy Position depart @@ -1562,7 +1563,7 @@ class pdf_octopus extends ModelePDFFactures $default_font_size--; } - $tab2_top = $posy-4; + $tab2_top = $posy - 4; $tab2_hl = 4; $pdf->SetFont('', '', $default_font_size - 1); @@ -1691,15 +1692,15 @@ class pdf_octopus extends ModelePDFFactures // VAT $tvas = array(); $nblines = count($object->lines); - for ($i=0; $i < $nblines; $i++) { + for ($i = 0; $i < $nblines; $i++) { $tvaligne = $object->lines[$i]->total_tva; - $vatrate=(string) $object->lines[$i]->tva_tx; + $vatrate = (string) $object->lines[$i]->tva_tx; if (($object->lines[$i]->info_bits & 0x01) == 0x01) { - $vatrate.='*'; + $vatrate .= '*'; } if (! isset($tvas[$vatrate])) { - $tvas[$vatrate]=0; + $tvas[$vatrate] = 0; } $tvas[$vatrate] += $tvaligne; } @@ -1937,7 +1938,7 @@ class pdf_octopus extends ModelePDFFactures /** * Show table for lines * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param int $tab_top Top position of table * @param int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -1953,8 +1954,8 @@ class pdf_octopus extends ModelePDFFactures global $conf; // Force to disable hidetop and hidebottom - $hidebottom=0; - $hidetop=0; + $hidebottom = 0; + $hidetop = 0; $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1977,16 +1978,16 @@ class pdf_octopus extends ModelePDFFactures // MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } - $tab_top+=4; + $tab_top += 4; } $pdf->SetDrawColor(128, 128, 128); $pdf->SetFont('', '', $default_font_size - 1); // Output Rect - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param // situation invoice $pdf->SetFont('', '', $default_font_size - 2); @@ -2019,14 +2020,14 @@ class pdf_octopus extends ModelePDFFactures if (empty($hidetop)) { $pdf->SetXY($xstartpos + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]); - $textWidth = $colDef['width'] - $colDef['title']['padding'][3] -$colDef['title']['padding'][1]; + $textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1]; $pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']); } } $pdf->SetFont('', '', $default_font_size - 1); if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param } } @@ -2034,7 +2035,7 @@ class pdf_octopus extends ModelePDFFactures /** * Show top header of page. This include the logo, ref and address blocks * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object to show * @param int $showaddress 0=no, 1=yes (usually set to 1 for first page, and 0 for next pages) * @param Translate $outputlangs Object lang for output @@ -2142,7 +2143,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->MultiCell($w, 3, $title, '', 'R'); if (!empty($subtitle)) { $pdf->SetFont('', 'B', $default_font_size); - $pdf->SetXY($posx, $posy+5); + $pdf->SetXY($posx, $posy + 5); $pdf->MultiCell($w, 6, $subtitle, '', 'R'); $posy += 2; } @@ -2424,7 +2425,7 @@ class pdf_octopus extends ModelePDFFactures /** * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text @@ -2624,7 +2625,7 @@ class pdf_octopus extends ModelePDFFactures 'textkey' => 'S'.$derniere_situation->situation_counter . ' - ' . dol_print_date($derniere_situation->date, "%d/%m/%Y"), 'align' => 'C', 'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left - 'width' => 10+15 //current width + amount cell width + 'width' => 10 + 15 //current width + amount cell width ), ); if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) { @@ -2660,7 +2661,7 @@ class pdf_octopus extends ModelePDFFactures 'textkey' => 'S'.$object->situation_counter . ' - ' . dol_print_date($object->date, "%d/%m/%Y"), 'align' => 'C', 'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left - 'width' => 10+15 + 'width' => 10 + 15 ), ); @@ -2727,7 +2728,7 @@ class pdf_octopus extends ModelePDFFactures /** * Show table for lines * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param int $tab_top Top position of table * @param int $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -2751,9 +2752,9 @@ class pdf_octopus extends ModelePDFFactures // Force to disable hidetop and hidebottom - $hidebottom=0; + $hidebottom = 0; if ($hidetop) { - $hidetop=-1; + $hidetop = -1; } $currency = !empty($currency) ? $currency : $conf->currency; @@ -2765,15 +2766,15 @@ class pdf_octopus extends ModelePDFFactures if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-8); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 8); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); - $width = $this->page_largeur-$this->marge_gauche-$this->marge_droite-83; + $width = $this->page_largeur - $this->marge_gauche - $this->marge_droite - 83; //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->posx_cumul_anterieur-1, $tab_top, $width, 5, 'F', null, 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->Rect($this->posx_cumul_anterieur - 1, $tab_top, $width, 5, 'F', null, 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'))); } } @@ -2782,47 +2783,47 @@ class pdf_octopus extends ModelePDFFactures // Output Rect // KEEPTHIS => Affiche les bords extérieurs - $this->printRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param + $this->printRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param - $pdf->line($this->posx_cumul_anterieur-1, $tab_top, $this->posx_cumul_anterieur-1, $tab_top + $tab_height); + $pdf->line($this->posx_cumul_anterieur - 1, $tab_top, $this->posx_cumul_anterieur - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posx_cumul_anterieur-1, $tab_top+0.5); + $pdf->SetXY($this->posx_cumul_anterieur - 1, $tab_top + 0.5); $pdf->MultiCell(35, 2, $outputlangs->transnoentities("SituationInvoiceOldCumulation"), '', 'C'); } // PRINT COLUMNS TITLES - $pdf->line($this->posx_new_cumul-1, $tab_top, $this->posx_new_cumul-1, $tab_top + $tab_height); + $pdf->line($this->posx_new_cumul - 1, $tab_top, $this->posx_new_cumul - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posx_new_cumul-1, $tab_top+0.5); + $pdf->SetXY($this->posx_new_cumul - 1, $tab_top + 0.5); $pdf->MultiCell(35, 2, $outputlangs->transnoentities("SituationInvoiceNewCumulation"), '', 'C'); } - $pdf->line($this->posx_current-1, $tab_top, $this->posx_current-1, $tab_top + $tab_height); + $pdf->line($this->posx_current - 1, $tab_top, $this->posx_current - 1, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posx_current-1, $tab_top+0.5); + $pdf->SetXY($this->posx_current - 1, $tab_top + 0.5); $pdf->MultiCell(36, 2, $outputlangs->transnoentities("CurrentSituationTotal", $object->situation_counter), '', 'C'); } // ADD HORIZONTAL LINES - $pdf->line($this->posx_cumul_anterieur-1, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); + $pdf->line($this->posx_cumul_anterieur - 1, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); - $pdf->line($this->posx_cumul_anterieur-1, $tab_top+24, $this->page_largeur-$this->marge_droite, $tab_top+24); + $pdf->line($this->posx_cumul_anterieur - 1, $tab_top + 24, $this->page_largeur - $this->marge_droite, $tab_top + 24); - $pdf->line($this->marge_gauche, $tab_top+55, $this->page_largeur-$this->marge_droite, $tab_top+55); + $pdf->line($this->marge_gauche, $tab_top + 55, $this->page_largeur - $this->marge_droite, $tab_top + 55); $pdf->line($this->marge_gauche, $tab_top + 65, $this->page_largeur - $this->marge_droite, $tab_top + 65); if ($displayWarranty) { - $pdf->line($this->marge_gauche, $tab_top+85, $this->page_largeur-$this->marge_droite, $tab_top+85); + $pdf->line($this->marge_gauche, $tab_top + 85, $this->page_largeur - $this->marge_droite, $tab_top + 85); } // ADD TEXT INTO CELL /********************** Titles ******************************/ - $pdf->SetXY($this->marge_gauche+2, $tab_top+8); + $pdf->SetXY($this->marge_gauche + 2, $tab_top + 8); $pdf->MultiCell(60, 2, $outputlangs->transnoentities("SituationInvoiceMainTask"), '', 'L'); - $pdf->SetXY($this->marge_gauche+2, $tab_top+12); + $pdf->SetXY($this->marge_gauche + 2, $tab_top + 12); $pdf->MultiCell(60, 2, $outputlangs->transnoentities("SituationInvoiceAdditionalTask"), '', 'L'); $form->load_cache_vatrates("'".$object->thirdparty->country_code."'"); @@ -2836,7 +2837,7 @@ class pdf_octopus extends ModelePDFFactures } $i += 8; - $pdf->SetXY($this->marge_gauche+10, $tab_top+24 + $i); + $pdf->SetXY($this->marge_gauche + 10, $tab_top + 24 + $i); $pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalHT").' '.$TVatInfo['label'], '', 'L'); if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) { @@ -2847,25 +2848,25 @@ class pdf_octopus extends ModelePDFFactures } } - $pdf->SetXY($this->marge_gauche+2, $tab_top+33+$i); + $pdf->SetXY($this->marge_gauche + 2, $tab_top + 33 + $i); $pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalTTC"), '', 'L'); $pdf->SetFont('', 'B', $default_font_size - 1); - $pdf->SetXY($this->marge_gauche+2, $tab_top+58); + $pdf->SetXY($this->marge_gauche + 2, $tab_top + 58); $pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalSituationInvoice"), '', 'L'); $pdf->SetFont('', '', $default_font_size - 2); if ($displayWarranty) { $pdf->SetXY($this->marge_gauche + 2, $tab_top + 74); $pdf->MultiCell(80, 2, $outputlangs->trans("TotalSituationInvoiceWithRetainedWarranty", $object->retained_warranty), '', 'L'); - $nextY = $tab_top+93; + $nextY = $tab_top + 93; } else { - $nextY = $tab_top+74; + $nextY = $tab_top + 74; } $pdf->SetFont('', 'B', $default_font_size - 1); - $pdf->SetXY($this->marge_gauche+2, $nextY); + $pdf->SetXY($this->marge_gauche + 2, $nextY); $pdf->MultiCell(80, 2, $outputlangs->transnoentities("SituationTotalRayToRest"), '', 'L'); $pdf->SetFont('', '', $default_font_size - 2); /***********************************************************/ @@ -2877,17 +2878,17 @@ class pdf_octopus extends ModelePDFFactures 'current' ); - $x = $this->marge_gauche+85; + $x = $this->marge_gauche + 85; // unset($this->TDataSituation['derniere_situation']); // print json_encode($object->lines);exit; // print json_encode($this->TDataSituation);exit; foreach ($TToDisplay as $col) { // Travaux principaux - $pdf->SetXY($x, $tab_top+8); + $pdf->SetXY($x, $tab_top + 8); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['HT'], 0, '', 1, -1, 2), '', 'R'); // Travaux supplémentaires - $pdf->SetXY($x, $tab_top+12); + $pdf->SetXY($x, $tab_top + 12); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['travaux_sup'], 0, '', 1, -1, 2), '', 'R'); $i = -8; @@ -2899,7 +2900,7 @@ class pdf_octopus extends ModelePDFFactures $i += 8; // Total HT - $pdf->SetXY($x, $tab_top+24+$i); + $pdf->SetXY($x, $tab_top + 24 + $i); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['HT'], 0, '', 1, -1, 2), '', 'R'); // Total TVA @@ -2912,23 +2913,23 @@ class pdf_octopus extends ModelePDFFactures } // Total TTC - $pdf->SetXY($x, $tab_top+33+$i); + $pdf->SetXY($x, $tab_top + 33 + $i); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['TTC'], 0, '', 1, -1, 2), '', 'R'); // Total situation $pdf->SetFont('', 'B', $default_font_size - 1); - $pdf->SetXY($x, $tab_top+58); + $pdf->SetXY($x, $tab_top + 58); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['TTC'], 0, '', 1, -1, 2), '', 'R'); $pdf->SetFont('', '', $default_font_size - 2); if ($displayWarranty) { // Retained warranty - $pdf->SetXY($x, $tab_top+74); + $pdf->SetXY($x, $tab_top + 74); $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['retenue_garantie'], 0, '', 1, -1, 2), '', 'R'); - $nextY = $tab_top+93; + $nextY = $tab_top + 93; } else { - $nextY = $tab_top+74; + $nextY = $tab_top + 74; } // Amount payable incl. VAT @@ -2937,7 +2938,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['total_a_payer'], 0, '', 1, -1, 2), '', 'R'); $pdf->SetFont('', '', $default_font_size - 2); - $x+=36; + $x += 36; } /************************************************************/ } @@ -3024,7 +3025,7 @@ class pdf_octopus extends ModelePDFFactures $isFirstSituation = false; if (!empty($l->fk_prev_id)) { $prevSituationPercent = $l->get_prev_progress($previousInvoice->id, true); - } elseif (! array_key_exists($i+1, $TPreviousInvoices)) { + } elseif (! array_key_exists($i + 1, $TPreviousInvoices)) { $isFirstSituation = true; } @@ -3033,7 +3034,7 @@ class pdf_octopus extends ModelePDFFactures $ltvatx = (float) sprintf("%01.3f", $l->tva_tx); //1ere ligne - $amounttva = $calc_ht * ($ltvatx/100); + $amounttva = $calc_ht * ($ltvatx / 100); if (! isset($TDataSituation['cumul_anterieur'][$ltvatx])) { $TDataSituation['cumul_anterieur'][$ltvatx]['HT'] = $calc_ht; $TDataSituation['cumul_anterieur'][$ltvatx]['TVA'] = $amounttva; @@ -3201,7 +3202,7 @@ class pdf_octopus extends ModelePDFFactures /** * Rect pdf * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param float $x Abscissa of first point * @param float $y Ordinate of first point * @param float $l ?? @@ -3212,14 +3213,14 @@ class pdf_octopus extends ModelePDFFactures */ public function printRectBtp(&$pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) { - if (empty($hidetop) || $hidetop==-1) { - $pdf->line($x, $y, $x+$l, $y); + if (empty($hidetop) || $hidetop == -1) { + $pdf->line($x, $y, $x + $l, $y); } - $pdf->line($x+$l, $y, $x+$l, $y+$h); + $pdf->line($x + $l, $y, $x + $l, $y + $h); if (empty($hidebottom)) { - $pdf->line($x+$l, $y+$h, $x, $y+$h); + $pdf->line($x + $l, $y + $h, $x, $y + $h); } - $pdf->line($x, $y+$h, $x, $y); + $pdf->line($x, $y + $h, $x, $y); } @@ -3235,7 +3236,7 @@ class pdf_octopus extends ModelePDFFactures { global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; - $object=new Facture($db); + $object = new Facture($db); $object->fetch($id); /* from dolibarr core @@ -3305,7 +3306,7 @@ class pdf_octopus extends ModelePDFFactures /** * Show last page with a resume of all invoices * - * @param TCPDF $pdf Object PDF + * @param TCPDI|TCPDF $pdf Object PDF * @param Facture $object Object invoice * @param int $deja_regle Amount already paid (in the currency of invoice) * @param int $posy Position depart @@ -3383,33 +3384,33 @@ class pdf_octopus extends ModelePDFFactures if (count($propals)) { $propal = array_pop($propals); - $total_ht = ($conf->multicurrency->enabled && $propal->mylticurrency_tx != 1) ? $propal->multicurrency_total_ht : $propal->total_ht; + $total_ht = ($conf->multicurrency->enabled && $propal->multicurrency_tx != 1) ? $propal->multicurrency_total_ht : $propal->total_ht; $remain_to_pay = $total_ht; $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', '', $default_font_size - 1); $label = $outputlangs->transnoentities("SituationInvoiceTotalProposal"); - $pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy+1); + $pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy + 1); - $amount = price($sign * ($total_ht + (! empty($propal->remise)?$propal->remise:0))); - $pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx+$width, $posy+1); + $amount = price($sign * ($total_ht + (! empty($propal->remise) ? $propal->remise : 0))); + $pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1); $pdf->SetFont('', '', $default_font_size - 1); // Output Rect $pdf->SetDrawColor(128, 128, 128); - $this->printRect($pdf, $posx, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 6); // Rect prend une longueur en 3eme param et 4eme param + $this->printRect($pdf, $posx, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 6); // Rect prend une longueur en 3eme param et 4eme param $posy += 4; } elseif (count($orders)) { $order = array_pop($orders); - $total_ht = ($conf->multicurrency->enabled && $order->mylticurrency_tx != 1 ? $order->multicurrency_total_ht : $order->total_ht); + $total_ht = ($conf->multicurrency->enabled && $order->multicurrency_tx != 1 ? $order->multicurrency_total_ht : $order->total_ht); $remain_to_pay = $total_ht; } - $useborder=0; + $useborder = 0; $index = 0; $height = 4; @@ -3425,7 +3426,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetXY($posx, $posy); - $depositsamount=$object->getSumDepositsUsed(); + $depositsamount = $object->getSumDepositsUsed(); $deja_regle = $object->getSommePaiement(); $tot_deja_regle = ($depositsamount + $deja_regle); @@ -3452,13 +3453,13 @@ class pdf_octopus extends ModelePDFFactures $ref = $outputlangs->transnoentities("InvoiceSituation").$outputlangs->convToOutputCharset(" n°".$invoice->situation_counter); if ($invoice->situation_final) { - $ref.= ' - DGD'; + $ref .= ' - DGD'; $force_to_zero = true; } - $ref.= ' - '. $invoice->ref; - $ref.= ' ('.dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs).')'; - $pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $ref, 0, 'L', 0); + $ref .= ' - '. $invoice->ref; + $ref .= ' ('.dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs).')'; + $pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $ref, 0, 'L', 0); $pdf->SetFont('', '', $default_font_size - 1); @@ -3473,21 +3474,21 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetXY($posx, $posy); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ($conf->multicurrency->enabled && $invoice->mylticurrency_tx != 1 ? $invoice->multicurrency_total_ht : $invoice->total_ht); - $pdf->SetXY($posx+$width, $posy); - $pdf->MultiCell($width2, $height, price($sign * ($total_ht + (!empty($invoice->remise)?$invoice->remise:0)), 0, $outputlangs), 0, 'R', 1); + $total_ht = ($conf->multicurrency->enabled && $invoice->multicurrency_tx != 1 ? $invoice->multicurrency_total_ht : $invoice->total_ht); + $pdf->SetXY($posx + $width, $posy); + $pdf->MultiCell($width2, $height, price($sign * ($total_ht + (!empty($invoice->remise) ? $invoice->remise : 0)), 0, $outputlangs), 0, 'R', 1); $tvas = array(); $nblines = count($invoice->lines); - for ($i=0; $i < $nblines; $i++) { + for ($i = 0; $i < $nblines; $i++) { $tvaligne = $invoice->lines[$i]->total_tva; $vatrate = (string) $invoice->lines[$i]->tva_tx; if (($invoice->lines[$i]->info_bits & 0x01) == 0x01) { - $vatrate.='*'; + $vatrate .= '*'; } if (! isset($tvas[$vatrate])) { - $tvas[$vatrate]=0; + $tvas[$vatrate] = 0; } $tvas[$vatrate] += $tvaligne; } @@ -3505,10 +3506,10 @@ class pdf_octopus extends ModelePDFFactures $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' '; - $totalvat.= vatrate($tvakey, 1).$tvacompl; + $totalvat .= vatrate($tvakey, 1).$tvacompl; $pdf->MultiCell($width, $height, $totalvat, 0, 'L', 1); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } @@ -3525,7 +3526,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1); $retainedWarrantyRate = (float) ($object->retained_warranty ? price2num($object->retained_warranty) : price2num(getDolGlobalString('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', 0))); @@ -3541,10 +3542,10 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetFillColor(241, 241, 241); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("RetainedWarrantyShort", $retainedWarrantyRate), $useborder, 'L', 1); - $total_ht_rg = (float) price2num(price($total_ht * $retainedWarrantyRate/100), 'MT'); - $total_ttc_rg = (float) price2num(price($total_ttc * $retainedWarrantyRate/100), 'MT'); + $total_ht_rg = (float) price2num(price($total_ht * $retainedWarrantyRate / 100), 'MT'); + $total_ttc_rg = (float) price2num(price($total_ttc * $retainedWarrantyRate / 100), 'MT'); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price(-$sign * $total_ht_rg, 0, $outputlangs), $useborder, 'R', 1); $total_ht_with_rg = $total_ht - $total_ht_rg; @@ -3558,7 +3559,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetFillColor(224, 224, 224); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalSituationInvoiceWithRetainedWarranty"), $useborder, 'L', 1); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($sign * $total_ttc_with_rg, 0, $outputlangs), $useborder, 'R', 1); } @@ -3573,7 +3574,9 @@ class pdf_octopus extends ModelePDFFactures $deja_regle = $invoice->getSommePaiement(); $resteapayer = price2num($invoice->total_ttc - $deja_regle - $total_ttc_rg - $creditnoteamount - $depositsamount, 'MT'); - if ($invoice->paye) $resteapayer = 0; + if ($invoice->paye) { + $resteapayer = 0; + } $y = 0; @@ -3583,7 +3586,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetXY($posx, $posy + $height * $index); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("Paid"), 0, 'L', 0); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($deja_regle + $depositsamount, 0, $outputlangs), 0, 'R', 0); // Credit note @@ -3591,7 +3594,7 @@ class pdf_octopus extends ModelePDFFactures $index++; $pdf->SetXY($posx, $posy + $height * $index); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0); } @@ -3602,10 +3605,10 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetXY($posx, $posy + $height * $index); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($invoice->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1); - $resteapayer=0; + $resteapayer = 0; } $index++; @@ -3613,7 +3616,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetFillColor(224, 224, 224); $pdf->SetXY($posx, $posy + $height * $index); $pdf->MultiCell($width, $height, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); - $pdf->SetXY($posx+$width, $posy + $height * $index); + $pdf->SetXY($posx + $width, $posy + $height * $index); $pdf->MultiCell($width2, $height, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1); $pdf->SetFont('', '', $default_font_size - 1); @@ -3622,8 +3625,10 @@ class pdf_octopus extends ModelePDFFactures $index++; if ($deja_regle > 0) { - $title=$outputlangs->transnoentities("PaymentsAlreadyDone"); - if ($invoice->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone"); + $title = $outputlangs->transnoentities("PaymentsAlreadyDone"); + if ($invoice->type == 2) { + $title = $outputlangs->transnoentities("PaymentsBackAlreadyDone"); + } $pdf->SetFont('', '', $default_font_size - 3); $pdf->SetXY($posx, $posy + $height * $index); @@ -3633,21 +3638,21 @@ class pdf_octopus extends ModelePDFFactures $index++; - $width4 = ($this->page_largeur - $this->marge_droite - $posx)/4; + $width4 = ($this->page_largeur - $this->marge_droite - $posx) / 4; $pdf->SetFont('', '', $default_font_size - 4); $pdf->SetXY($posx, $posy + $height * $index); - $pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Payment"), 0, 'L', 0); - $pdf->SetXY($posx+$width4, $posy + $height * $index); - $pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Amount"), 0, 'L', 0); - $pdf->SetXY($posx+$width4*2, $posy + $height * $index); - $pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Type"), 0, 'L', 0); - $pdf->SetXY($posx+$width4*3, $posy + $height * $index); - $pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Num"), 0, 'L', 0); + $pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Payment"), 0, 'L', 0); + $pdf->SetXY($posx + $width4, $posy + $height * $index); + $pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Amount"), 0, 'L', 0); + $pdf->SetXY($posx + $width4 * 2, $posy + $height * $index); + $pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Type"), 0, 'L', 0); + $pdf->SetXY($posx + $width4 * 3, $posy + $height * $index); + $pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Num"), 0, 'L', 0); //$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); - $y=$height-1; + $y = $height - 1; $pdf->SetFont('', '', $default_font_size - 4); /** @var Facture $invoice */ @@ -3656,15 +3661,15 @@ class pdf_octopus extends ModelePDFFactures if (count($payments)) { foreach ($payments as $payment) { $pdf->SetXY($posx, $posy + $height * $index + $y); - $pdf->MultiCell($width4, $height-1, dol_print_date($this->db->jdate($payment['date']), 'day', false, $outputlangs, true), 0, 'L', 0); - $pdf->SetXY($posx+$width4, $posy + $height * $index + $y); - $pdf->MultiCell($width4, $height-1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0); - $pdf->SetXY($posx+$width4*2, $posy + $height * $index + $y); + $pdf->MultiCell($width4, $height - 1, dol_print_date($this->db->jdate($payment['date']), 'day', false, $outputlangs, true), 0, 'L', 0); + $pdf->SetXY($posx + $width4, $posy + $height * $index + $y); + $pdf->MultiCell($width4, $height - 1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0); + $pdf->SetXY($posx + $width4 * 2, $posy + $height * $index + $y); $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $payment['type']); - $pdf->MultiCell($width4, $height-1, $oper, 0, 'L', 0); - $pdf->SetXY($posx+$width4*3, $posy + $height * $index + $y); - $pdf->MultiCell($width4, $height-1, $payment['num'], 0, 'L', 0); + $pdf->MultiCell($width4, $height - 1, $oper, 0, 'L', 0); + $pdf->SetXY($posx + $width4 * 3, $posy + $height * $index + $y); + $pdf->MultiCell($width4, $height - 1, $payment['num'], 0, 'L', 0); //$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3); $y += ($height - 1); @@ -3674,20 +3679,22 @@ class pdf_octopus extends ModelePDFFactures // Output Rect $pdf->SetDrawColor(128, 128, 128); - $this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height * $index + $y); + $this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height * $index + $y); $posy += $height * $index + $y; - $pageposafter=$pdf->getPage(); + $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) { // There is a pagebreak $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; + $pageposafter = $pageposbefore; $pdf->AddPage('', '', true); if (!empty($this->tplidx)) { $pdf->useTemplate($this->tplidx); } - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } + $pdf->setPage($pageposafter + 1); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $posy = $this->tab_top_newpage + 1; @@ -3726,12 +3733,12 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 1); $pdf->SetXY($this->marge_gauche, $posy + 1); $label = $outputlangs->transnoentities("SituationTotalRayToRest"); - $pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $label, 0, 'L', 0); + $pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0); $amount = price($remain_to_pay); - $pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx+$width, $posy+1); + $pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1); $pdf->SetDrawColor(128, 128, 128); - $this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 7); + $this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 7); } } From 4d3b83e625ff24fad5d07fab46beb1d38e036975 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut <1256948+FlorentPoinsaut@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:10:27 +0200 Subject: [PATCH 2/7] FIX #30523 An user with only user->rights->user->self->password can't update it's password (#30524) --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 1199ef5fe2c..32fbeac19cd 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -401,7 +401,7 @@ if (empty($reshook)) { } } - if ($action == 'update' && $canedituser) { + if ($action == 'update' && ($canedituser || $caneditpasswordandsee)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if ($caneditfield) { // Case we can edit all field From 65fd78cf1474f1005721f76fd4f7b662ec4ef594 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Aug 2024 15:54:07 +0200 Subject: [PATCH 3/7] Fix firstname not set --- htdocs/contact/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 5b096009eb8..30ae1e8fd18 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1401,7 +1401,7 @@ while ($i < $imaxinloop) { $arraysocialnetworks = (array) json_decode($obj->socialnetworks, true); $contactstatic->lastname = $obj->lastname; - $contactstatic->firstname = ''; + $contactstatic->firstname = $obj->firstname; $contactstatic->id = $obj->rowid; $contactstatic->statut = $obj->statut; $contactstatic->poste = $obj->poste; From c833415c1df36cbf1c1b5b2c17578e904f62ac62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Aug 2024 16:12:05 +0200 Subject: [PATCH 4/7] Fix css --- htdocs/admin/system/filecheck.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index d54fce80726..899480c3139 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -235,7 +235,7 @@ if (empty($error) && !empty($xml)) { } if ($i == 0) { - $out .= ''.$langs->trans("None").''; + $out .= ''.$langs->trans("None").''; } $out .= ''; $out .= ''; @@ -292,7 +292,7 @@ if (empty($error) && !empty($xml)) { $out .= "\n"; } } else { - $out .= ''.$langs->trans("None").''; + $out .= ''.$langs->trans("None").''; } $out .= ''; $out .= ''; @@ -345,7 +345,7 @@ if (empty($error) && !empty($xml)) { $out .= ''."\n"; $out .= "\n"; } else { - $out .= ''.$langs->trans("None").''; + $out .= ''.$langs->trans("None").''; } $out .= ''; $out .= ''; @@ -384,7 +384,7 @@ if (empty($error) && !empty($xml)) { $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; $out .= ''.dol_print_size($size).''."\n"; - $out .= ''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').''."\n"; + $out .= ''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').''."\n"; $out .= "\n"; } $out .= ''; @@ -396,7 +396,7 @@ if (empty($error) && !empty($xml)) { $out .= ''."\n"; $out .= "\n"; } else { - $out .= ''.$langs->trans("None").''; + $out .= ''.$langs->trans("None").''; } $out .= ''; $out .= ''; From d8e30f6e4ab177d9f94ba8ca023144d046210761 Mon Sep 17 00:00:00 2001 From: "Thomas C." <56068416+Thomas905@users.noreply.github.com> Date: Fri, 16 Aug 2024 20:35:21 +0200 Subject: [PATCH 5/7] fix (#30648) Co-authored-by: Laurent Destailleur --- htdocs/core/actions_massactions.inc.php | 28 ++++++++++++++----------- htdocs/fourn/facture/list.php | 6 ++++-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 54779d16536..fddfcd36e14 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -72,6 +72,7 @@ if (!$error && isset($toselect) && is_array($toselect) && count($toselect) > $ma if (!$error && $massaction == 'confirm_presend' && !GETPOST('sendmail')) { // If we do not choose button send (for example when we change template or limit), we must not send email, but keep on send email form $massaction = 'presend'; } + if (!$error && $massaction == 'confirm_presend') { $resaction = ''; $nbsent = 0; @@ -765,16 +766,18 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto // build list of files with full path $files = array(); - foreach ($listofobjectref as $basename) { - $basename = dol_sanitizeFileName($basename); - foreach ($listoffiles as $filefound) { - if (strstr($filefound["name"], $basename)) { - $files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"]; - break; - } - } - } + + foreach ($listofobjectref as $basename) { + $basename = dol_sanitizeFileName($basename); + foreach ($listoffiles as $filefound) { + if (strstr($filefound["name"], $basename)) { + $files[] = $filefound['fullname']; + break; + } + } + } + // Define output language (Here it is not used because we do only merging existing PDF) $outputlangs = $langs; $newlang = ''; @@ -798,7 +801,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $filename = preg_replace('/\s/', '_', $filename); // Save merged file - if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) { + if (in_array($objecttmp->element, array('facture', 'invoice_supplier')) && $search_status == Facture::STATUS_VALIDATED) { if ($option == 'late') { $filename .= '_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); } else { @@ -854,7 +857,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); } - + // Add all others foreach ($files as $file) { // Charge un document PDF depuis un fichier. @@ -873,9 +876,10 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto // Defined name of merged file $filename = strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); $filename = preg_replace('/\s/', '_', $filename); + // Save merged file - if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) { + if (in_array($objecttmp->element, array('facture', 'invoice_supplier')) && $search_status == Facture::STATUS_VALIDATED) { if ($option == 'late') { $filename .= '_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); } else { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 88c208111e0..8cfe3712cd3 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -313,7 +313,9 @@ if (empty($reshook)) { // Mass actions $objectclass = 'FactureFournisseur'; $objectlabel = 'SupplierInvoices'; - $uploaddir = $conf->fournisseur->facture->dir_output; + + $uploaddir = $conf->fournisseur->facture->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if ($massaction == 'banktransfertrequest') { @@ -959,7 +961,7 @@ $param .= $hookmanager->resPrint; $arrayofmassactions = array( 'validate' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), - //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); From 825a8602d33cab8cb5dabc4a84ebd85e1b10c214 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Aug 2024 20:37:42 +0200 Subject: [PATCH 6/7] Fix tab --- htdocs/core/actions_massactions.inc.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index fddfcd36e14..9c9c50a2e3e 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -767,17 +767,16 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto // build list of files with full path $files = array(); + foreach ($listofobjectref as $basename) { + $basename = dol_sanitizeFileName($basename); + foreach ($listoffiles as $filefound) { + if (strstr($filefound["name"], $basename)) { + $files[] = $filefound['fullname']; + break; + } + } + } - foreach ($listofobjectref as $basename) { - $basename = dol_sanitizeFileName($basename); - foreach ($listoffiles as $filefound) { - if (strstr($filefound["name"], $basename)) { - $files[] = $filefound['fullname']; - break; - } - } - } - // Define output language (Here it is not used because we do only merging existing PDF) $outputlangs = $langs; $newlang = ''; @@ -857,7 +856,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); } - + // Add all others foreach ($files as $file) { // Charge un document PDF depuis un fichier. @@ -876,7 +875,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto // Defined name of merged file $filename = strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); $filename = preg_replace('/\s/', '_', $filename); - + // Save merged file if (in_array($objecttmp->element, array('facture', 'invoice_supplier')) && $search_status == Facture::STATUS_VALIDATED) { From 92613751802244ac66dafc480f16ca011d6e0eda Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Aug 2024 21:21:11 +0200 Subject: [PATCH 7/7] Fix travis --- htdocs/fourn/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 8cfe3712cd3..4dd80889eb2 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -314,7 +314,7 @@ if (empty($reshook)) { $objectclass = 'FactureFournisseur'; $objectlabel = 'SupplierInvoices'; - $uploaddir = $conf->fournisseur->facture->dir_output; + $uploaddir = $conf->fournisseur->facture->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';