From 6240246d1dd128f77313194adeb4262b02f2692c Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 4 Oct 2024 15:29:15 +0200 Subject: [PATCH 001/336] Fix space lost at bottom of page when PDF use product images --- .../modules/propale/doc/pdf_cyan.modules.php | 65 +++++++++++++------ 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 6b75bc4663a..a05f2dc285d 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -563,8 +563,11 @@ class pdf_cyan extends ModelePDFPropales $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore = $pdf->getPage(); + $curYBefore = $curY; + + // Allows data in the first page if description is long enough to break in multiples pages + $showpricebeforepagebreak = getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE'); - $showpricebeforepagebreak = 1; $posYAfterImage = 0; $posYAfterDescription = 0; @@ -572,10 +575,12 @@ class pdf_cyan extends ModelePDFPropales $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); } + $newPageAddedForPhoto = false; if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext))) { // If photo too high, we moved completely on new page $pdf->AddPage('', '', true); + $newPageAddedForPhoto = true; if (!empty($tplidx)) { $pdf->useTemplate($tplidx); } @@ -583,23 +588,28 @@ class pdf_cyan extends ModelePDFPropales $curY = $tab_top_newpage; - // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { - $showpricebeforepagebreak = 1; - } else { - $showpricebeforepagebreak = 0; - } + // disable MAIN_PDF_DATA_ON_FIRST_PAGE near page break limit to anticipate auto page break jump before add line due to padding + // (ex: description is on page 2 and price on page 1) + $showpricebeforepagebreak = 0; } - + $pdf->setPageOrientation('', 0, $heightforfooter + $heightforfreetext); // The only function to edit the bottom margin of current page to set it. if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; } + + $pageposafter = $pdf->getPage(); + if ($pageposafter > $pageposbefore) { // There is a pagebreak + $pdf->setPage($pageposbefore+1); + } + + // restore page bottom margin + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. } - // Description of product line + $newPageAddedForDescription = false; if ($this->getColumnStatus('desc')) { $pdf->startTransaction(); @@ -608,6 +618,7 @@ class pdf_cyan extends ModelePDFPropales if ($pageposafter > $pageposbefore) { // There is a pagebreak $pdf->rollbackTransaction(true); + $newPageAddedForDescription = true; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. @@ -624,14 +635,6 @@ class pdf_cyan extends ModelePDFPropales } $pdf->setPage($pageposafter + 1); } - } else { - // We found a page break - // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { - $showpricebeforepagebreak = 1; - } else { - $showpricebeforepagebreak = 0; - } } } else { // No pagebreak $pdf->commitTransaction(); @@ -640,6 +643,12 @@ class pdf_cyan extends ModelePDFPropales } $nexY = $pdf->GetY(); + + // check if image height is more than description height + if (!$newPageAddedForPhoto && $posYAfterImage) { + $nexY = max($posYAfterImage, $nexY); + } + $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); @@ -650,6 +659,8 @@ class pdf_cyan extends ModelePDFPropales if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + } else { + $curY = $curYBefore; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -794,8 +805,22 @@ class pdf_cyan extends ModelePDFPropales } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); - if ($posYAfterImage > $posYAfterDescription) { - $nexY = max($nexY, $posYAfterImage); + + // if new pages have been added, we need to check whether they were created by the image display script or the description display script + if ($pageposafter > $pageposbefore && !empty($showpricebeforepagebreak)) { + $pdf->setPage($pageposafter); + + if ($pageposafter - $pageposbefore > 2 && $newPageAddedForDescription) { + // photo can't add 2 pages, so it must be description who break others pages + $nexY = $posYAfterDescription; + } elseif ($newPageAddedForPhoto && $newPageAddedForDescription) { + // if break page is detect for photo and description we need to take the bigger Y + $nexY = max($posYAfterImage, $posYAfterDescription); + } elseif ($newPageAddedForPhoto) { + $nexY = $posYAfterImage; + } else { + $nexY = $posYAfterDescription; + } } // Add line From 498e1473aa1f113dda480a65e327bbc8d09ca424 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Tue, 8 Oct 2024 22:44:36 +0200 Subject: [PATCH 002/336] Rebuild Cyan PDF MODEL --- .../core/class/commondocgenerator.class.php | 64 +++++ .../modules/propale/doc/pdf_cyan.modules.php | 241 ++++++++---------- 2 files changed, 168 insertions(+), 137 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 43460e9e888..4d55e61a17b 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -158,6 +158,11 @@ abstract class CommonDocGenerator */ public $cols; + /** + * @var array Array of position data + */ + public $afterColsLinePositions; + /** * @var array{fullpath:string} Array with result of doc generation. content is array('fullpath'=>$file) */ @@ -1079,6 +1084,64 @@ abstract class CommonDocGenerator } + /** + * Get position in PDF after col display + * @return false|arrayafterColsLinePositions) || !is_array($this->afterColsLinePositions)) { + return false; + } + + $colId = ''; + $maxPage = $maxY = 0; + foreach ($this->afterColsLinePositions as $colKey => $value) { + if ($value['page'] > $maxPage) { + $colId = $colKey; + $maxPage = $value['page']; + $maxY = $value['y']; // if page is higher we need to reset y to new max page y + } elseif ($value['page'] == $maxPage) { + $maxY = max($value['y'], $maxY); + $colId = $colKey; + } + } + + return [ + 'col' => $colId, + 'y' => $maxY, + 'page' => $maxPage + ]; + } + + /** + * Used for reset afterColsLinePositions var in start of a new pdf draw line loop + * @param float $y the new $y position usually get by TCPDF::GetY() + * @param int $pageNumb the page number to reset at + * @return null + */ + public function resetAfterColsLinePositionsData(float $y, int $pageNumb) + { + $this->afterColsLinePositions = []; + return $this->setAfterColsLinePositionsData('startLine', $y, $pageNumb); + } + + /** + * Used for to set afterColsLinePositions var in a pdf draw line loop + * @param string $colId the column id used as key in $this->cols or an unique id code like startLine or separateLine .... + * @param float $y the $y position usually get by TCPDF::GetY() where print data ended + * @param int $pageNumb the page number where print data ended + * @return void + */ + public function setAfterColsLinePositionsData(string $colId, float $y, int $pageNumb) + { + $this->afterColsLinePositions[$colId] = [ + 'page' => $pageNumb, + 'y' => $y + ]; + } + + /** * uasort callback function to Sort columns fields * @@ -1292,6 +1355,7 @@ abstract class CommonDocGenerator // set cell padding with column content definition $pdf->setCellPaddings(isset($colDef['content']['padding'][3]) ? $colDef['content']['padding'][3] : 0, isset($colDef['content']['padding'][0]) ? $colDef['content']['padding'][0] : 0, isset($colDef['content']['padding'][1]) ? $colDef['content']['padding'][1] : 0, isset($colDef['content']['padding'][2]) ? $colDef['content']['padding'][2] : 0); $pdf->writeHTMLCell($colDef['width'], 2, isset($colDef['xStartPos']) ? $colDef['xStartPos'] : 0, $curY, $columnText, 0, 1, 0, true, $colDef['content']['align']); + $this->setAfterColsLinePositionsData($colKey, $pdf->GetY(), $pdf->getPage()); // restore cell padding $pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index a05f2dc285d..f2f69e53c1c 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -78,7 +78,6 @@ class pdf_cyan extends ModelePDFPropales */ public $cols; - /** * Constructor * @@ -185,10 +184,7 @@ class pdf_cyan extends ModelePDFPropales $nblines = count($object->lines); - $hidetop = 0; - if (getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE')) { - $hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE'); - } + $hidetop = getDolGlobalInt('MAIN_PDF_DISABLE_COL_HEAD_TITLE'); // Loop on each lines to detect if there is at least one image to show $realpatharray = array(); @@ -352,6 +348,10 @@ class pdf_cyan extends ModelePDFPropales $tab_top = 90 + $top_shift; $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; + } $nexY = $tab_top; @@ -549,8 +549,25 @@ class pdf_cyan extends ModelePDFPropales // Loop on each lines $pageposbeforeprintlines = $pdf->getPage(); $pagenb = $pageposbeforeprintlines; + for ($i = 0; $i < $nblines; $i++) { + $linePosition = $i + 1; $curY = $nexY; + + // in First Check line page break and add page if needed + if (isset($object->lines[$i]->pagebreak) && $object->lines[$i]->pagebreak) { + // New page + $pdf->AddPage(); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + + $pdf->setPage($pdf->getNumPages()); + $nexY = $tab_top_newpage; + } + + $this->resetAfterColsLinePositionsData($nexY, $pdf->getPage()); + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); @@ -561,7 +578,7 @@ class pdf_cyan extends ModelePDFPropales } $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pageposbefore = $pdf->getPage(); $curYBefore = $curY; @@ -569,28 +586,17 @@ class pdf_cyan extends ModelePDFPropales $showpricebeforepagebreak = getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE'); $posYAfterImage = 0; - $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); - } - - $newPageAddedForPhoto = false; if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext))) { // If photo too high, we moved completely on new page + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $heightforfooter)) { // If photo too high, we moved completely on new page $pdf->AddPage('', '', true); - $newPageAddedForPhoto = true; if (!empty($tplidx)) { $pdf->useTemplate($tplidx); } $pdf->setPage($pageposbefore + 1); - + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $curY = $tab_top_newpage; - - // disable MAIN_PDF_DATA_ON_FIRST_PAGE near page break limit to anticipate auto page break jump before add line due to padding - // (ex: description is on page 2 and price on page 1) - $showpricebeforepagebreak = 0; } $pdf->setPageOrientation('', 0, $heightforfooter + $heightforfreetext); // The only function to edit the bottom margin of current page to set it. @@ -598,85 +604,46 @@ class pdf_cyan extends ModelePDFPropales $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; - } - $pageposafter = $pdf->getPage(); - if ($pageposafter > $pageposbefore) { // There is a pagebreak - $pdf->setPage($pageposbefore+1); + $this->setAfterColsLinePositionsData('photo', $posYAfterImage, $pdf->getPage()); } - - // restore page bottom margin - $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. } - $newPageAddedForDescription = false; + if ($this->getColumnStatus('desc')) { - $pdf->startTransaction(); - $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); - $pageposafter = $pdf->getPage(); - - if ($pageposafter > $pageposbefore) { // There is a pagebreak - $pdf->rollbackTransaction(true); - $newPageAddedForDescription = true; - - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - - $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); - - $pageposafter = $pdf->getPage(); - $posyafter = $pdf->GetY(); - //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // There is no space left for total+free text - if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page - $pdf->AddPage('', '', true); - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } - $pdf->setPage($pageposafter + 1); - } - } - } else { // No pagebreak - $pdf->commitTransaction(); - } - $posYAfterDescription = $pdf->GetY(); + $this->setAfterColsLinePositionsData('desc', $pdf->GetY(), $pdf->getPage()); } - $nexY = $pdf->GetY(); - - // check if image height is more than description height - if (!$newPageAddedForPhoto && $posYAfterImage) { - $nexY = max($posYAfterImage, $nexY); - } - - $pageposafter = $pdf->getPage(); - + $afterPosData = $this->getMaxAfterColsLinePositionsData(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + // We suppose that a too long description or photo were moved completely on next page - if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); + if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak)) { + $pdf->setPage($afterPosData['page']); $curY = $tab_top_newpage; - } else { - $curY = $curYBefore; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // Line position + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $linePosition); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate); - $nexY = max($pdf->GetY(), $nexY); } // Unit price before discount if ($this->getColumnStatus('subprice')) { $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax); - $nexY = max($pdf->GetY(), $nexY); } // Quantity @@ -684,7 +651,6 @@ class pdf_cyan extends ModelePDFPropales if ($this->getColumnStatus('qty')) { $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'qty', $qty); - $nexY = max($pdf->GetY(), $nexY); } @@ -692,28 +658,24 @@ class pdf_cyan extends ModelePDFPropales if ($this->getColumnStatus('unit')) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'unit', $unit); - $nexY = max($pdf->GetY(), $nexY); } // Discount on line if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent) { $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent); - $nexY = max($pdf->GetY(), $nexY); } // Total excl tax line (HT) if ($this->getColumnStatus('totalexcltax')) { $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax); - $nexY = max($pdf->GetY(), $nexY); } // Total with tax line (TTC) if ($this->getColumnStatus('totalincltax')) { $total_incl_tax = pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'totalincltax', $total_incl_tax); - $nexY = max($pdf->GetY(), $nexY); } // Extrafields @@ -722,17 +684,19 @@ class pdf_cyan extends ModelePDFPropales if ($this->getColumnStatus($extrafieldColKey)) { $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); - $nexY = max($pdf->GetY(), $nexY); + + $this->setAfterColsLinePositionsData('options_'.$extrafieldColKey, $pdf->GetY(), $pdf->getPage()); } } } + $afterPosData = $this->getMaxAfterColsLinePositionsData(); $parameters = array( 'object' => $object, 'i' => $i, 'pdf' => & $pdf, 'curY' => & $curY, - 'nexY' => & $nexY, + 'nexY' => & $afterPosData['y'], // for backward module hook compatibility Y will be accessible by $object->getMaxAfterColsLinePositionsData() 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); @@ -768,7 +732,7 @@ class pdf_cyan extends ModelePDFPropales // Retrieve type from database for backward compatibility with old records if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined - && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax + && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : ''; $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : ''; @@ -806,26 +770,13 @@ class pdf_cyan extends ModelePDFPropales $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); - // if new pages have been added, we need to check whether they were created by the image display script or the description display script - if ($pageposafter > $pageposbefore && !empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); - if ($pageposafter - $pageposbefore > 2 && $newPageAddedForDescription) { - // photo can't add 2 pages, so it must be description who break others pages - $nexY = $posYAfterDescription; - } elseif ($newPageAddedForPhoto && $newPageAddedForDescription) { - // if break page is detect for photo and description we need to take the bigger Y - $nexY = max($posYAfterImage, $posYAfterDescription); - } elseif ($newPageAddedForPhoto) { - $nexY = $posYAfterImage; - } else { - $nexY = $posYAfterDescription; - } - } + $afterPosData = $this->getMaxAfterColsLinePositionsData(); + $pdf->setPage($afterPosData['page']); + $nexY = $afterPosData['y']; // Add line - if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { - $pdf->setPage($pageposafter); + if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1) && $afterPosData['y'] < $this->page_hauteur - $heightforfooter - 5) { $pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); @@ -833,54 +784,70 @@ class pdf_cyan extends ModelePDFPropales } $nexY += 2; // Add space between lines + } - // Detect if some page were added automatically and output _tableau for past pages - while ($pagenb < $pageposafter) { - $pdf->setPage($pagenb); - if ($pagenb == $pageposbeforeprintlines) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis); + // 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) ) { + $pdf->AddPage(); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + $pagenb++; + $pdf->setPage($pagenb); + } + + // Draw table frames and columns borders + $drawTabNumbPage = $pdf->getNumPages(); + for ($i=$pageposbeforeprintlines; $i<=$drawTabNumbPage; $i++) { + // reset page orientation each loop to override it if it was changed + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + + $pdf->setPage($i); + + $drawTabHideTop = $hidetop; + $drawTabTop = $tab_top_newpage; + $drawTabBottom = $this->page_hauteur - $heightforfooter;; + $hideBottom = 0; // TODO understand why it change to 1 or 0 during process + + if ($i == $pageposbeforeprintlines) { + // first page need to start after notes + $drawTabTop = $tab_top; + } elseif (!$drawTabHideTop) { + if (getDolGlobalInt('MAIN_PDF_ENABLE_COL_HEAD_TITLE_REPEAT')) { + $drawTabTop-= $this->tabTitleHeight; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis); - } - $this->_pagefoot($pdf, $object, $outputlangs, 1); - $pagenb++; - $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); - } - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); + $drawTabHideTop = 1; } } - if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { - if ($pagenb == $pageposafter) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis); - } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis); - } - $this->_pagefoot($pdf, $object, $outputlangs, 1); - // New page - $pdf->AddPage(); - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } - $pagenb++; - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); - } + // last page need to include document footer + if ($i == $pdf->getNumPages()) { + // remove document footer height to tab bottom position + $drawTabBottom-= $heightforsignature + $heightforfreetext + $heightforinfotot; + } + + $drawTabHeight = $drawTabBottom - $drawTabTop; + $this->_tableau($pdf, $drawTabTop, $drawTabHeight, 0, $outputlangs, $drawTabHideTop, $hideBottom, $object->multicurrency_code, $outputlangsbis); + + $this->_pagefoot($pdf, $object, $outputlangs, 1); + + $pdf->setPage($i); // in case of _pagefoot or _tableau change it + + // reset page orientation each loop to override it if it was changed by _pagefoot or _tableau change it + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); } } - // Show square - if ($pagenb == $pageposbeforeprintlines) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis); - $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1; - } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis); - $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1; - } + + $pdf->setPage($pdf->getNumPages()); + + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1; // Display infos area $posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); @@ -1105,8 +1072,8 @@ class pdf_cyan extends ModelePDFPropales if (!getDolGlobalString('PROPOSAL_PDF_HIDE_PAYMENTMODE')) { // Show payment mode if ($object->mode_reglement_code - && $object->mode_reglement_code != 'CHQ' - && $object->mode_reglement_code != 'VIR') { + && $object->mode_reglement_code != 'CHQ' + && $object->mode_reglement_code != 'VIR') { $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentMode").':'; From 9ace8042093963f72869edac48ccb5ccf97dadeb Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:06:24 +0200 Subject: [PATCH 003/336] Clean useless lines --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index f2f69e53c1c..3e48c9c93e7 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -618,7 +618,7 @@ class pdf_cyan extends ModelePDFPropales $afterPosData = $this->getMaxAfterColsLinePositionsData(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + // $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page @@ -800,10 +800,9 @@ class pdf_cyan extends ModelePDFPropales // Draw table frames and columns borders $drawTabNumbPage = $pdf->getNumPages(); for ($i=$pageposbeforeprintlines; $i<=$drawTabNumbPage; $i++) { - // reset page orientation each loop to override it if it was changed - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - $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. $drawTabHideTop = $hidetop; $drawTabTop = $tab_top_newpage; From 1a909f82f8c574a6c192c45fdeb825e1c4fa2889 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:12:31 +0200 Subject: [PATCH 004/336] Fix duplicate head print in first page of line loop display --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 3e48c9c93e7..a56c96b57fb 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -835,7 +835,9 @@ class pdf_cyan extends ModelePDFPropales // reset page orientation each loop to override it if it was changed by _pagefoot or _tableau change it $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + + // Don't print head on first page ($pageposbeforeprintlines) because already added previously + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') && $i != $pageposbeforeprintlines) { $this->_pagehead($pdf, $object, 0, $outputlangs); } if (!empty($tplidx)) { From b79fa55a9901e2f7a4d6aaab2397011bee99ac4b Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:22:26 +0200 Subject: [PATCH 005/336] fix phan --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 4d55e61a17b..de9a5cbc184 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1086,7 +1086,7 @@ abstract class CommonDocGenerator /** * Get position in PDF after col display - * @return false|array */ public function getMaxAfterColsLinePositionsData() { From 0dfda86cc0a7aa16e5aced15bb588faf8600709b Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:28:06 +0200 Subject: [PATCH 006/336] fix phan --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index de9a5cbc184..1b09217a041 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1086,7 +1086,7 @@ abstract class CommonDocGenerator /** * Get position in PDF after col display - * @return false|array + * @return false|array */ public function getMaxAfterColsLinePositionsData() { From ebc518271bcc99df0bc068d6023e3bc0ef0a00fd Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:29:58 +0200 Subject: [PATCH 007/336] fix phan --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 1b09217a041..bfcd8b03951 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1086,7 +1086,7 @@ abstract class CommonDocGenerator /** * Get position in PDF after col display - * @return false|array + * @return false|array{page:int,y:float|int,col:string} */ public function getMaxAfterColsLinePositionsData() { From 35ffdda5e46dd3bb29fa4eac40f23a2d957997ee Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:57:37 +0200 Subject: [PATCH 008/336] fix phan --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index bfcd8b03951..4a382e5bd82 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1118,7 +1118,7 @@ abstract class CommonDocGenerator * Used for reset afterColsLinePositions var in start of a new pdf draw line loop * @param float $y the new $y position usually get by TCPDF::GetY() * @param int $pageNumb the page number to reset at - * @return null + * @return void */ public function resetAfterColsLinePositionsData(float $y, int $pageNumb) { From 7c0e47ccda48f4ee315d9c686808698699000901 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:05:53 +0200 Subject: [PATCH 009/336] fix phan --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 4a382e5bd82..979516af098 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1123,7 +1123,7 @@ abstract class CommonDocGenerator public function resetAfterColsLinePositionsData(float $y, int $pageNumb) { $this->afterColsLinePositions = []; - return $this->setAfterColsLinePositionsData('startLine', $y, $pageNumb); + $this->setAfterColsLinePositionsData('startLine', $y, $pageNumb); } /** From 901ce66f482b490b3ac98bbec50827506897594e Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:51:36 +0200 Subject: [PATCH 010/336] Clean code and fix artifact --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index a56c96b57fb..51f81a31ec7 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -786,6 +786,7 @@ class pdf_cyan extends ModelePDFPropales $nexY += 2; // Add space between lines } + // 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) ) { @@ -829,7 +830,8 @@ class pdf_cyan extends ModelePDFPropales $drawTabHeight = $drawTabBottom - $drawTabTop; $this->_tableau($pdf, $drawTabTop, $drawTabHeight, 0, $outputlangs, $drawTabHideTop, $hideBottom, $object->multicurrency_code, $outputlangsbis); - $this->_pagefoot($pdf, $object, $outputlangs, 1); + $hideFreeText = $i != $pdf->getNumPages(); + $this->_pagefoot($pdf, $object, $outputlangs, $hideFreeText); $pdf->setPage($i); // in case of _pagefoot or _tableau change it @@ -845,6 +847,8 @@ class pdf_cyan extends ModelePDFPropales } } + // reset text color before print footers + $pdf->SetTextColor(0, 0, 0); $pdf->setPage($pdf->getNumPages()); @@ -861,8 +865,7 @@ class pdf_cyan extends ModelePDFPropales $posy = $this->drawSignatureArea($pdf, $object, $posy, $outputlangs); } - // Pagefoot - $this->_pagefoot($pdf, $object, $outputlangs); + // Add number of pages in footer if (method_exists($pdf, 'AliasNbPages')) { $pdf->AliasNbPages(); } From 42ce0321b1c35efcb1f48766270fb2021e739f73 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:53:26 +0200 Subject: [PATCH 011/336] Clean code and fix artifact --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 51f81a31ec7..962a6e0b94e 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -830,7 +830,7 @@ class pdf_cyan extends ModelePDFPropales $drawTabHeight = $drawTabBottom - $drawTabTop; $this->_tableau($pdf, $drawTabTop, $drawTabHeight, 0, $outputlangs, $drawTabHideTop, $hideBottom, $object->multicurrency_code, $outputlangsbis); - $hideFreeText = $i != $pdf->getNumPages(); + $hideFreeText = $i != $pdf->getNumPages(); // Display free text only in last page $this->_pagefoot($pdf, $object, $outputlangs, $hideFreeText); $pdf->setPage($i); // in case of _pagefoot or _tableau change it From 1852e1332075996377ec0e7cdac01623325b04ec Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:49:40 +0200 Subject: [PATCH 012/336] fix page orientation --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 962a6e0b94e..586e7040d79 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -609,6 +609,8 @@ class pdf_cyan extends ModelePDFPropales } } + // restore Page orientation for text + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. if ($this->getColumnStatus('desc')) { $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); From 9b35f083670c4a0d5f14b45c929a09004d4d1ee4 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:15:33 +0200 Subject: [PATCH 013/336] fix PDF space lost with images eratosthene --- .../commande/doc/pdf_eratosthene.modules.php | 238 +++++++++--------- 1 file changed, 115 insertions(+), 123 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index de6d3b05f39..1a5a9550885 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -191,10 +191,7 @@ class pdf_eratosthene extends ModelePDFCommandes $nblines = (is_array($object->lines) ? count($object->lines) : 0); - $hidetop = 0; - if (getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE')) { - $hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE'); - } + $hidetop = getDolGlobalInt('MAIN_PDF_DISABLE_COL_HEAD_TITLE'); // Loop on each lines to detect if there is at least one image to show $realpatharray = array(); @@ -355,6 +352,10 @@ class pdf_eratosthene extends ModelePDFCommandes $tab_top = 90 + $top_shift; $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_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; @@ -538,7 +539,24 @@ class pdf_eratosthene extends ModelePDFCommandes $pageposbeforeprintlines = $pdf->getPage(); $pagenb = $pageposbeforeprintlines; for ($i = 0; $i < $nblines; $i++) { + $linePosition = $i + 1; $curY = $nexY; + + // in First Check line page break and add page if needed + if (isset($object->lines[$i]->pagebreak) && $object->lines[$i]->pagebreak) { + // New page + $pdf->AddPage(); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + + $pdf->setPage($pdf->getNumPages()); + $nexY = $tab_top_newpage; + } + + $this->resetAfterColsLinePositionsData($nexY, $pdf->getPage()); + + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); @@ -549,113 +567,73 @@ class pdf_eratosthene extends ModelePDFCommandes } $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pageposbefore = $pdf->getPage(); + $curYBefore = $curY; - - $showpricebeforepagebreak = 1; + // Allows data in the first page if description is long enough to break in multiples pages + $showpricebeforepagebreak = getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE'); $posYAfterImage = 0; - $posYAfterDescription = 0; - - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); - } if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $heightforfooter)) { // If photo too high, we moved completely on new page $pdf->AddPage('', '', true); if (!empty($tplidx)) { $pdf->useTemplate($tplidx); } $pdf->setPage($pageposbefore + 1); - + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $curY = $tab_top_newpage; - - // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE')) { - $showpricebeforepagebreak = 1; - } else { - $showpricebeforepagebreak = 0; - } } + // I remove the line commented below because it probably uselesss (or bug source) no need to change bottom margin because we have checked image fit + //$pdf->setPageOrientation('', 0, $heightforfooter + $heightforfreetext); // The only function to edit the bottom margin of current page to set it. + if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; + $this->setAfterColsLinePositionsData('photo', $posYAfterImage, $pdf->getPage()); } } + // restore Page orientation for text + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + // Description of product line if ($this->getColumnStatus('desc')) { - $pdf->startTransaction(); - $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); - $pageposafter = $pdf->getPage(); - - if ($pageposafter > $pageposbefore) { // There is a pagebreak - $pdf->rollbackTransaction(true); - $pageposafter = $pageposbefore; - //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - - $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); - $pageposafter = $pdf->getPage(); - $posyafter = $pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text - if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page - $pdf->AddPage('', '', true); - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } - $pdf->setPage($pageposafter + 1); - } - } else { - // We found a page break - // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE')) { - $showpricebeforepagebreak = 1; - } else { - $showpricebeforepagebreak = 0; - } - } - } else { // No pagebreak - $pdf->commitTransaction(); - } - $posYAfterDescription = $pdf->GetY(); + $this->setAfterColsLinePositionsData('desc', $pdf->GetY(), $pdf->getPage()); } - - $nexY = max($pdf->GetY(), $posYAfterImage); - - - $pageposafter = $pdf->getPage(); - + $afterPosData = $this->getMaxAfterColsLinePositionsData(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page - if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); + if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak)) { + $pdf->setPage($afterPosData['page']); $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // Line position + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $linePosition); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate); - $nexY = max($pdf->GetY(), $nexY); } // Unit price before discount if ($this->getColumnStatus('subprice')) { $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax); - $nexY = max($pdf->GetY(), $nexY); } // Quantity @@ -663,7 +641,6 @@ class pdf_eratosthene extends ModelePDFCommandes if ($this->getColumnStatus('qty')) { $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'qty', $qty); - $nexY = max($pdf->GetY(), $nexY); } @@ -671,28 +648,24 @@ class pdf_eratosthene extends ModelePDFCommandes if ($this->getColumnStatus('unit')) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'unit', $unit); - $nexY = max($pdf->GetY(), $nexY); } // Discount on line if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent) { $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent); - $nexY = max($pdf->GetY(), $nexY); } // Total excl tax line (HT) if ($this->getColumnStatus('totalexcltax')) { $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax); - $nexY = max($pdf->GetY(), $nexY); } // Total with tax line (TTC) if ($this->getColumnStatus('totalincltax')) { $total_incl_tax = pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'totalincltax', $total_incl_tax); - $nexY = max($pdf->GetY(), $nexY); } // Extrafields @@ -701,17 +674,18 @@ class pdf_eratosthene extends ModelePDFCommandes if ($this->getColumnStatus($extrafieldColKey)) { $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); - $nexY = max($pdf->GetY(), $nexY); + $this->setAfterColsLinePositionsData('options_'.$extrafieldColKey, $pdf->GetY(), $pdf->getPage()); } } } + $afterPosData = $this->getMaxAfterColsLinePositionsData(); $parameters = array( 'object' => $object, 'i' => $i, 'pdf' => & $pdf, 'curY' => & $curY, - 'nexY' => & $nexY, + 'nexY' => & $afterPosData['y'], // for backward module hook compatibility Y will be accessible by $object->getMaxAfterColsLinePositionsData() 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); @@ -773,60 +747,86 @@ class pdf_eratosthene extends ModelePDFCommandes } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); + $afterPosData = $this->getMaxAfterColsLinePositionsData(); + $pdf->setPage($afterPosData['page']); + $nexY = $afterPosData['y']; + // Add line - if (getDolGlobalInt('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { - $pdf->setPage($pageposafter); + if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1) && $afterPosData['y'] < $this->page_hauteur - $heightforfooter - 5) { $pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash' => 0)); } + $nexY += 2; // Add space between lines + } - // Detect if some page were added automatically and output _tableau for past pages - while ($pagenb < $pageposafter) { - $pdf->setPage($pagenb); - if ($pagenb == $pageposbeforeprintlines) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis); + // Add last page for document footer if there are not enough size left + $afterPosData = $this->getMaxAfterColsLinePositionsData(); + if ($afterPosData['y'] > $this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot) ) { + $pdf->AddPage(); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + $pagenb++; + $pdf->setPage($pagenb); + } + + // Draw table frames and columns borders + $drawTabNumbPage = $pdf->getNumPages(); + 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. + + $drawTabHideTop = $hidetop; + $drawTabTop = $tab_top_newpage; + $drawTabBottom = $this->page_hauteur - $heightforfooter;; + $hideBottom = 0; // TODO understand why it change to 1 or 0 during process + + if ($i == $pageposbeforeprintlines) { + // first page need to start after notes + $drawTabTop = $tab_top; + } elseif (!$drawTabHideTop) { + if (getDolGlobalInt('MAIN_PDF_ENABLE_COL_HEAD_TITLE_REPEAT')) { + $drawTabTop-= $this->tabTitleHeight; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis); - } - $this->_pagefoot($pdf, $object, $outputlangs, 1); - $pagenb++; - $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); - } - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); + $drawTabHideTop = 1; } } - if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { - if ($pagenb == $pageposafter) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis); - } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis); - } - $this->_pagefoot($pdf, $object, $outputlangs, 1); - // New page - $pdf->AddPage(); - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } - $pagenb++; - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); - } + + // last page need to include document footer + if ($i == $pdf->getNumPages()) { + // remove document footer height to tab bottom position + $drawTabBottom-= $heightforfreetext + $heightforinfotot; + } + + $drawTabHeight = $drawTabBottom - $drawTabTop; + $this->_tableau($pdf, $drawTabTop, $drawTabHeight, 0, $outputlangs, $drawTabHideTop, $hideBottom, $object->multicurrency_code, $outputlangsbis); + + $hideFreeText = $i != $pdf->getNumPages(); // Display free text only in last page + $this->_pagefoot($pdf, $object, $outputlangs, $hideFreeText); + + $pdf->setPage($i); // in case of _pagefoot or _tableau change it + + // reset page orientation each loop to override it if it was changed by _pagefoot or _tableau change it + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + + // Don't print head on first page ($pageposbeforeprintlines) because already added previously + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') && $i != $pageposbeforeprintlines) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); } } - // Show square - if ($pagenb == $pageposbeforeprintlines) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis); - } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis); - } + // reset text color before print footers + $pdf->SetTextColor(0, 0, 0); + + $pdf->setPage($pdf->getNumPages()); + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; // Display infos area @@ -835,16 +835,8 @@ class pdf_eratosthene extends ModelePDFCommandes // Display total zone $posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); - // Display payment area - /* - if ($deja_regle) - { - $posy=$this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); - } - */ - // Pagefoot - $this->_pagefoot($pdf, $object, $outputlangs); + // Add number of pages in footer if (method_exists($pdf, 'AliasNbPages')) { $pdf->AliasNbPages(); } From 036bff18f3a03d36b687324acaf88a8edef8a8c4 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 18 Oct 2024 09:46:07 +0200 Subject: [PATCH 014/336] Fix sponge space lost with images --- .../facture/doc/pdf_sponge.modules.php | 240 +++++++++--------- 1 file changed, 118 insertions(+), 122 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 61d48504396..6f6d62a31fa 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -695,7 +695,23 @@ class pdf_sponge extends ModelePDFFactures $pageposbeforeprintlines = $pdf->getPage(); $pagenb = $pageposbeforeprintlines; for ($i = 0; $i < $nblines; $i++) { + $linePosition = $i + 1; $curY = $nexY; + + // in First Check line page break and add page if needed + if (isset($object->lines[$i]->pagebreak) && $object->lines[$i]->pagebreak) { + // New page + $pdf->AddPage(); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + + $pdf->setPage($pdf->getNumPages()); + $nexY = $this->tab_top_newpage; + } + + $this->resetAfterColsLinePositionsData($nexY, $pdf->getPage()); + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); @@ -706,111 +722,72 @@ class pdf_sponge extends ModelePDFFactures } $pdf->setTopMargin($this->tab_top_newpage); - $page_bottom_margin = $this->heightforfooter + $this->heightforfreetext + $this->heightforinfotot + $this->getHeightForQRInvoice($pdf->getPage(), $object, $langs); - $pdf->setPageOrientation('', 1, $page_bottom_margin); + $pdf->setPageOrientation('', 1, $this->heightforfooter); $pageposbefore = $pdf->getPage(); + $curYBefore = $curY; - $showpricebeforepagebreak = 1; - $posYAfterImage = 0; - $posYAfterDescription = 0; - - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); - } + // Allows data in the first page if description is long enough to break in multiples pages + $showpricebeforepagebreak = getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE'); if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $page_bottom_margin)) { // If photo too high, we moved completely on new page + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $this->heightforfooter)) { // If photo too high, we moved completely on new page $pdf->AddPage('', '', true); if (!empty($tplidx)) { $pdf->useTemplate($tplidx); } $pdf->setPage($pageposbefore + 1); - + $pdf->setPageOrientation('', 1, $this->heightforfooter); // The only function to edit the bottom margin of current page to set it. $curY = $this->tab_top_newpage; - - // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { - $showpricebeforepagebreak = 1; - } else { - $showpricebeforepagebreak = 0; - } } + $pdf->setPageOrientation('', 0, $this->heightforfooter + $this->heightforfreetext); // The only function to edit the bottom margin of current page to set it. if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi // $pdf->Image does not increase value return by getY, so we save it manually $posYAfterImage = $curY + $imglinesize['height']; + + $this->setAfterColsLinePositionsData('photo', $posYAfterImage, $pdf->getPage()); } } + // restore Page orientation for text + $pdf->setPageOrientation('', 1, $this->heightforfooter); // The only function to edit the bottom margin of current page to set it. + // Description of product line if ($this->getColumnStatus('desc')) { - $pdf->startTransaction(); - $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); - $pageposafter = $pdf->getPage(); - - if ($pageposafter > $pageposbefore) { // There is a pagebreak - $pdf->rollbackTransaction(true); - $pageposafter = $pageposbefore; - $pdf->setPageOrientation('', 1, $this->heightforfooter); // The only function to edit the bottom margin of current page to set it. - - $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); - - $pageposafter = $pdf->getPage(); - $posyafter = $pdf->GetY(); - //var_dump($posyafter); var_dump(($this->page_hauteur - ($this->heightforfooter+$this->heightforfreetext+$this->heightforinfotot))); exit; - if ($posyafter > ($this->page_hauteur - $page_bottom_margin)) { // There is no space left for total+free text - if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page - $pdf->AddPage('', '', true); - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } - $pdf->setPage($pageposafter + 1); - } - } else { - // We found a page break - // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { - $showpricebeforepagebreak = 1; - } else { - $showpricebeforepagebreak = 0; - } - } - } else { // No pagebreak - $pdf->commitTransaction(); - } - $posYAfterDescription = $pdf->GetY(); + $this->setAfterColsLinePositionsData('desc', $pdf->GetY(), $pdf->getPage()); } - $nexY = max($pdf->GetY(), $posYAfterImage, $posYAfterDescription); - - $pageposafter = $pdf->getPage(); + $afterPosData = $this->getMaxAfterColsLinePositionsData(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page - if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); + if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak)) { + $pdf->setPage($afterPosData['page']); $curY = $this->tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // Line position + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $linePosition); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate); - $nexY = max($pdf->GetY(), $nexY); } // Unit price before discount if ($this->getColumnStatus('subprice')) { $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax); - $nexY = max($pdf->GetY(), $nexY); } // Quantity @@ -818,42 +795,36 @@ class pdf_sponge extends ModelePDFFactures if ($this->getColumnStatus('qty')) { $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'qty', $qty); - $nexY = max($pdf->GetY(), $nexY); } // Situation progress if ($this->getColumnStatus('progress')) { $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'progress', $progress); - $nexY = max($pdf->GetY(), $nexY); } // Unit if ($this->getColumnStatus('unit')) { $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'unit', $unit); - $nexY = max($pdf->GetY(), $nexY); } // Discount on line if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent) { $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent); - $nexY = max($pdf->GetY(), $nexY); } // Total excl tax line (HT) if ($this->getColumnStatus('totalexcltax')) { $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax); - $nexY = max($pdf->GetY(), $nexY); } // Total with tax line (TTC) if ($this->getColumnStatus('totalincltax')) { $total_incl_tax = pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails); $this->printStdColumnContent($pdf, $curY, 'totalincltax', $total_incl_tax); - $nexY = max($pdf->GetY(), $nexY); } // Extrafields @@ -862,18 +833,19 @@ class pdf_sponge extends ModelePDFFactures if ($this->getColumnStatus($extrafieldColKey)) { $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); - $nexY = max($pdf->GetY(), $nexY); + + $this->setAfterColsLinePositionsData('options_' . $extrafieldColKey, $pdf->GetY(), $pdf->getPage()); } } } - + $afterPosData = $this->getMaxAfterColsLinePositionsData(); $parameters = array( 'object' => $object, 'i' => $i, 'pdf' => & $pdf, 'curY' => & $curY, - 'nexY' => & $nexY, + 'nexY' => & $afterPosData['y'], // for backward module hook compatibility Y will be accessible by $object->getMaxAfterColsLinePositionsData() 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); @@ -952,74 +924,99 @@ class pdf_sponge extends ModelePDFFactures if (!isset($this->tva[$vatrate])) { $this->tva[$vatrate] = 0; } - $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete + $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete $vatcode = $object->lines[$i]->vat_src_code; - if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { - $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; + if (empty($this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['amount'])) { + $this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['amount'] = 0; } - $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); + $this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['amount'] + $tvaligne); - $nexY = max($nexY, $posYAfterImage); + + $afterPosData = $this->getMaxAfterColsLinePositionsData(); + $pdf->setPage($afterPosData['page']); + $nexY = $afterPosData['y']; // Add line - if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { - $pdf->setPage($pageposafter); + if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1) && $afterPosData['y'] < $this->page_hauteur - $this->heightforfooter - 5) { $pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY); + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); $pdf->SetLineStyle(array('dash' => 0)); } - // Detect if some page were added automatically and output _tableau for past pages - while ($pagenb < $pageposafter) { - $pdf->setPage($pagenb); - $heightforqrinvoice = $this->getHeightForQRInvoice($pagenb, $object, $langs); - if ($pagenb == $pageposbeforeprintlines) { - $this->_tableau($pdf, $this->tab_top, $this->page_hauteur - $this->tab_top - $this->heightforfooter - $heightforqrinvoice, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis); + $nexY += 2; // Add space between lines + } + + // Add last page for document footer if there are not enough size left + $afterPosData = $this->getMaxAfterColsLinePositionsData(); + $page_bottom_margin = $this->heightforfooter + $this->heightforfreetext + $this->heightforinfotot + $this->getHeightForQRInvoice($pdf->getPage(), $object, $langs); + + if ($afterPosData['y'] > $this->page_hauteur - $page_bottom_margin) { + $pdf->AddPage(); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + $pagenb++; + $pdf->setPage($pagenb); + } + + // Draw table frames and columns borders + $drawTabNumbPage = $pdf->getNumPages(); + 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. + + $drawTabHideTop = $hidetop; + $drawTabTop = $this->tab_top_newpage; + $drawTabBottom = $this->page_hauteur - $this->heightforfooter;; + $hideBottom = 0; // TODO understand why it change to 1 or 0 during process + + if ($i == $pageposbeforeprintlines) { + // first page need to start after notes + $drawTabTop = $this->tab_top; + } elseif (!$drawTabHideTop) { + if (getDolGlobalInt('MAIN_PDF_ENABLE_COL_HEAD_TITLE_REPEAT')) { + $drawTabTop-= $this->tabTitleHeight; } else { - $this->_tableau($pdf, $this->tab_top_newpage, $this->page_hauteur - $this->tab_top_newpage - $this->heightforfooter - $heightforqrinvoice, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis); - } - $this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs)); - $pagenb++; - $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); - } - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); + $drawTabHideTop = 1; } } - if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { - $heightforqrinvoice = $this->getHeightForQRInvoice($pagenb, $object, $langs); - if ($pagenb == $pageposafter) { - $this->_tableau($pdf, $this->tab_top, $this->page_hauteur - $this->tab_top - $this->heightforfooter - $heightforqrinvoice, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis); - } else { - $this->_tableau($pdf, $this->tab_top_newpage, $this->page_hauteur - $this->tab_top_newpage - $this->heightforfooter - $heightforqrinvoice, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis); - } - $this->_pagefoot($pdf, $object, $outputlangs, 1, $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs)); - // New page - $pdf->AddPage(); - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } - $pagenb++; - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); - } + // 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); + } + + $drawTabHeight = $drawTabBottom - $drawTabTop; + $this->_tableau($pdf, $drawTabTop, $drawTabHeight, 0, $outputlangs, $drawTabHideTop, $hideBottom, $object->multicurrency_code, $outputlangsbis); + + $hideFreeText = $i != $pdf->getNumPages(); // Display free text only in last page + + $this->_pagefoot($pdf, $object, $outputlangs, $hideFreeText, $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs)); + + $pdf->setPage($i); // in case of _pagefoot or _tableau change it + + // reset page orientation each loop to override it if it was changed by _pagefoot or _tableau change it + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + + // Don't print head on first page ($pageposbeforeprintlines) because already added previously + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') && $i != $pageposbeforeprintlines) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); } } - // Show square - $heightforqrinvoice = $this->getHeightForQRInvoice($pagenb, $object, $langs); - if ($pagenb == $pageposbeforeprintlines) { - $this->_tableau($pdf, $this->tab_top, $this->page_hauteur - $this->tab_top - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter - $heightforqrinvoice, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis); - $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter - $heightforqrinvoice + 1; - } else { - $this->_tableau($pdf, $this->tab_top_newpage, $this->page_hauteur - $this->tab_top_newpage - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter - $heightforqrinvoice, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis); - $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter - $heightforqrinvoice + 1; - } + + // reset text color before print footers + $pdf->SetTextColor(0, 0, 0); + + $pdf->setPage($pdf->getNumPages()); + + $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter - $heightforqrinvoice + 1; // Display infos area $posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs, $outputlangsbis); @@ -1032,8 +1029,7 @@ class pdf_sponge extends ModelePDFFactures $posy = $this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); } - // Pagefoot - $this->_pagefoot($pdf, $object, $outputlangs, 0, $this->getHeightForQRInvoice($pdf->getPage(), $object, $langs)); + // Add number of pages in footer if (method_exists($pdf, 'AliasNbPages')) { $pdf->AliasNbPages(); } From 702ff5a865ee738bac6c7fb9e76c5a2a0505ace0 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:12:28 +0200 Subject: [PATCH 015/336] fix usage of on bottom --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 7cf5d1c0e61..98c1e45630f 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -620,11 +620,12 @@ class pdf_cyan extends ModelePDFPropales $afterPosData = $this->getMaxAfterColsLinePositionsData(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - // $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $curY = $curYBefore; + $pdf->setPageOrientation('', 0, $heightforfooter); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page - if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak)) { + if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak) || ($curY + 9) > ($this->page_hauteur - $heightforfooter)) { $pdf->setPage($afterPosData['page']); $curY = $tab_top_newpage; } From 6eb59e5dc1023598caa87c18013ca9321425450d Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:14:41 +0200 Subject: [PATCH 016/336] fix usage of on bottom --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 1a5a9550885..436dd4c1f70 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -610,9 +610,10 @@ class pdf_eratosthene extends ModelePDFCommandes $afterPosData = $this->getMaxAfterColsLinePositionsData(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); + $pdf->setPageOrientation('', 0, $heightforfooter); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page - if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak)) { + if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak) || ($curY + 9) > ($this->page_hauteur - $heightforfooter)) { $pdf->setPage($afterPosData['page']); $curY = $tab_top_newpage; } From d0d59141af57f8d0affa59e3cd822bc2c9b5767e Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:31:18 +0200 Subject: [PATCH 017/336] fix usage of on bottom --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 6f6d62a31fa..1b92b5e284d 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -731,7 +731,7 @@ class pdf_sponge extends ModelePDFFactures if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $this->heightforfooter)) { // If photo too high, we moved completely on new page + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY+ 1 + $imglinesize['height']) > ($this->page_hauteur - $this->heightforfooter)) { // If photo too high, we moved completely on new page $pdf->AddPage('', '', true); if (!empty($tplidx)) { $pdf->useTemplate($tplidx); @@ -739,6 +739,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->setPage($pageposbefore + 1); $pdf->setPageOrientation('', 1, $this->heightforfooter); // The only function to edit the bottom margin of current page to set it. $curY = $this->tab_top_newpage; + $showpricebeforepagebreak = 0; } $pdf->setPageOrientation('', 0, $this->heightforfooter + $this->heightforfreetext); // The only function to edit the bottom margin of current page to set it. @@ -760,13 +761,15 @@ class pdf_sponge extends ModelePDFFactures $this->setAfterColsLinePositionsData('desc', $pdf->GetY(), $pdf->getPage()); } + $afterPosData = $this->getMaxAfterColsLinePositionsData(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $curY = $curYBefore; + $pdf->setPageOrientation('', 0, $this->heightforfooter); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page - if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak)) { + if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak) || ($curY + 9) > ($this->page_hauteur - $this->heightforfooter)) { $pdf->setPage($afterPosData['page']); $curY = $this->tab_top_newpage; } From e53858a735dc08e3cfa4615f10eaa3b7c85bed4f Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:33:34 +0200 Subject: [PATCH 018/336] fix usage of on bottom --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 98c1e45630f..bcebdad50d1 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -597,6 +597,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->setPage($pageposbefore + 1); $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $curY = $tab_top_newpage; + $showpricebeforepagebreak = 0; } $pdf->setPageOrientation('', 0, $heightforfooter + $heightforfreetext); // The only function to edit the bottom margin of current page to set it. From dd4536b7bdd1846b7591ee7f072272e8891863ee Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:34:54 +0200 Subject: [PATCH 019/336] fix usage of on bottom --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 436dd4c1f70..3ad55bcf3fc 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -585,6 +585,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->setPage($pageposbefore + 1); $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $curY = $tab_top_newpage; + $showpricebeforepagebreak = 0; } // I remove the line commented below because it probably uselesss (or bug source) no need to change bottom margin because we have checked image fit From a1a2d2f99e24a95a86cc60cdfe7926b7fb17d70e Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Mon, 21 Oct 2024 08:59:27 +0200 Subject: [PATCH 020/336] Fix breaks on edge --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 1b92b5e284d..72fcd028342 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -769,7 +769,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->setPageOrientation('', 0, $this->heightforfooter); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page - if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak) || ($curY + 9) > ($this->page_hauteur - $this->heightforfooter)) { + if ($afterPosData['page'] > $pageposbefore && (empty($showpricebeforepagebreak) || ($curY + 4) > ($this->page_hauteur - $this->heightforfooter))) { $pdf->setPage($afterPosData['page']); $curY = $this->tab_top_newpage; } From 2b85f401afd209e102b86b99262db164d4cffb6d Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:03:49 +0200 Subject: [PATCH 021/336] Fix breaks on edge --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index bcebdad50d1..968db0a2e34 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -626,7 +626,7 @@ class pdf_cyan extends ModelePDFPropales // We suppose that a too long description or photo were moved completely on next page - if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak) || ($curY + 9) > ($this->page_hauteur - $heightforfooter)) { + if ($afterPosData['page'] > $pageposbefore && (empty($showpricebeforepagebreak) || ($curY + 4) > ($this->page_hauteur - $heightforfooter))) { $pdf->setPage($afterPosData['page']); $curY = $tab_top_newpage; } From 9ee4f2bd0377e758b99ba7d6c16612a6529feff9 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:05:28 +0200 Subject: [PATCH 022/336] Fix breaks on edge --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 3ad55bcf3fc..89493ae6416 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -614,7 +614,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->setPageOrientation('', 0, $heightforfooter); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description or photo were moved completely on next page - if ($afterPosData['page'] > $pageposbefore && empty($showpricebeforepagebreak) || ($curY + 9) > ($this->page_hauteur - $heightforfooter)) { + if ($afterPosData['page'] > $pageposbefore && (empty($showpricebeforepagebreak) || ($curY + 4) > ($this->page_hauteur - $heightforfooter))) { $pdf->setPage($afterPosData['page']); $curY = $tab_top_newpage; } From 8a6119b1b0bfd9d71c3528494ff2c5f51f440962 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 10:21:41 +0200 Subject: [PATCH 023/336] Image top margin --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index b0ddff8afad..41957beb760 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -589,7 +589,8 @@ class pdf_cyan extends ModelePDFPropales if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $heightforfooter)) { // If photo too high, we moved completely on new page + $imageTopMargin = 1; + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imageTopMargin + $imglinesize['height']) > ($this->page_hauteur - $heightforfooter)) { // If photo too high, we moved completely on new page $pdf->AddPage('', '', true); if (!empty($tplidx)) { $pdf->useTemplate($tplidx); @@ -602,7 +603,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. if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $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 $posYAfterImage = $curY + $imglinesize['height']; From af7bcaa31affefb494e2ab30dc74f2b66f5e4faf Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 10:25:37 +0200 Subject: [PATCH 024/336] Image top margin --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index f7fd0b17f57..f6bed76b5a6 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -579,7 +579,8 @@ class pdf_eratosthene extends ModelePDFCommandes if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $heightforfooter)) { // If photo too high, we moved completely on new page + $imageTopMargin = 1; + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imageTopMargin + $imglinesize['height']) > ($this->page_hauteur - $heightforfooter)) { // If photo too high, we moved completely on new page $pdf->AddPage('', '', true); if (!empty($tplidx)) { $pdf->useTemplate($tplidx); @@ -594,7 +595,7 @@ class pdf_eratosthene extends ModelePDFCommandes //$pdf->setPageOrientation('', 0, $heightforfooter + $heightforfreetext); // The only function to edit the bottom margin of current page to set it. if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $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 $posYAfterImage = $curY + $imglinesize['height']; $this->setAfterColsLinePositionsData('photo', $posYAfterImage, $pdf->getPage()); From e469c602e68ce34a4def107769ddabb339bfcde7 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 10:27:06 +0200 Subject: [PATCH 025/336] Image top margin --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 91343d9bf63..4554f3a2a30 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -731,7 +731,8 @@ class pdf_sponge extends ModelePDFFactures if ($this->getColumnStatus('photo')) { // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY+ 1 + $imglinesize['height']) > ($this->page_hauteur - $this->heightforfooter)) { // If photo too high, we moved completely on new page + $imageTopMargin = 1; + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imageTopMargin + $imglinesize['height']) > ($this->page_hauteur - $this->heightforfooter)) { // If photo too high, we moved completely on new page $pdf->AddPage('', '', true); if (!empty($tplidx)) { $pdf->useTemplate($tplidx); @@ -744,7 +745,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. if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { - $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $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 $posYAfterImage = $curY + $imglinesize['height']; From b7f85ffbc65651b1c610076bc3109d8cfb2bc165 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:44:37 +0200 Subject: [PATCH 026/336] fix precommit hook --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 7ba923f0efb..d6f2a40f084 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -877,7 +877,6 @@ class pdf_cyan extends ModelePDFPropales $posy = $this->drawSignatureArea($pdf, $object, $posy, $outputlangs); } - // Add number of pages in footer if (method_exists($pdf, 'AliasNbPages')) { $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod From d8be14bc2b2e22a0ad65829de4331bf613b47874 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:54:34 +0200 Subject: [PATCH 027/336] fix merge conflict --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 530c0b112d5..e783cddecaa 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -850,7 +850,7 @@ class pdf_eratosthene extends ModelePDFCommandes // Add number of pages in footer if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); + $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod } $pdf->Close(); From aea4f2c069e6def9d44d8e7100d62a3da8e45ab1 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:15:22 +0200 Subject: [PATCH 028/336] fix php stan --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index d6f2a40f084..052c6830f97 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -842,7 +842,7 @@ class pdf_cyan extends ModelePDFPropales $drawTabHeight = $drawTabBottom - $drawTabTop; $this->_tableau($pdf, $drawTabTop, $drawTabHeight, 0, $outputlangs, $drawTabHideTop, $hideBottom, $object->multicurrency_code, $outputlangsbis); - $hideFreeText = $i != $pdf->getNumPages(); // Display free text only in last page + $hideFreeText = $i != $pdf->getNumPages() ? 1 : 0; // Display free text only in last page $this->_pagefoot($pdf, $object, $outputlangs, $hideFreeText); $pdf->setPage($i); // in case of _pagefoot or _tableau change it From 387a83f47162ec5557d6f8ad664fb12c6ad1b549 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:16:29 +0200 Subject: [PATCH 029/336] fix php stan --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index e783cddecaa..731d2449aab 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -817,7 +817,7 @@ class pdf_eratosthene extends ModelePDFCommandes $drawTabHeight = $drawTabBottom - $drawTabTop; $this->_tableau($pdf, $drawTabTop, $drawTabHeight, 0, $outputlangs, $drawTabHideTop, $hideBottom, $object->multicurrency_code, $outputlangsbis); - $hideFreeText = $i != $pdf->getNumPages(); // Display free text only in last page + $hideFreeText = $i != $pdf->getNumPages() ? 1 : 0; // Display free text only in last page $this->_pagefoot($pdf, $object, $outputlangs, $hideFreeText); $pdf->setPage($i); // in case of _pagefoot or _tableau change it From 659c1f23ba516b749093f8dd04407c82a8890b09 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:19:37 +0200 Subject: [PATCH 030/336] fix php stan --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index a72c832e7ac..1df44f1adbf 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1002,7 +1002,7 @@ class pdf_sponge extends ModelePDFFactures $drawTabHeight = $drawTabBottom - $drawTabTop; $this->_tableau($pdf, $drawTabTop, $drawTabHeight, 0, $outputlangs, $drawTabHideTop, $hideBottom, $object->multicurrency_code, $outputlangsbis); - $hideFreeText = $i != $pdf->getNumPages(); // Display free text only in last page + $hideFreeText = $i != $pdf->getNumPages() ? 1 : 0; // Display free text only in last page $this->_pagefoot($pdf, $object, $outputlangs, $hideFreeText, $this->getHeightForQRInvoice($pdf->getPage(), $object, $outputlangs)); From 8423c2a4466b609a46bdef2d328890a5fcde4b6d Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:23:14 +0200 Subject: [PATCH 031/336] fix php stan --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 1df44f1adbf..3e34c8090a0 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -785,7 +785,7 @@ class pdf_sponge extends ModelePDFFactures // Line position if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $linePosition); + $this->printStdColumnContent($pdf, $curY, 'position', strval($linePosition)); } // VAT Rate From 5fc526b6444dd7d8d9b8268dc1008c3637871db6 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:24:39 +0200 Subject: [PATCH 032/336] fix php stan --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 052c6830f97..634535c6b52 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -643,7 +643,7 @@ class pdf_cyan extends ModelePDFPropales // # of line if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $linePosition); + $this->printStdColumnContent($pdf, $curY, 'position', strval($linePosition)); } // VAT Rate From f8543991179e68b905ad58bb53141a2fa91ffb1e Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:27:02 +0200 Subject: [PATCH 033/336] fix php stan --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 731d2449aab..65ac034616e 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -633,7 +633,7 @@ class pdf_eratosthene extends ModelePDFCommandes // Line position if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $linePosition); + $this->printStdColumnContent($pdf, $curY, 'position', strval($linePosition)); } // VAT Rate From 29a7a410c8c79ca0cc0e49af5df2f013b21d2480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 28 Nov 2024 13:28:34 +0100 Subject: [PATCH 034/336] backport of https://github.com/Dolibarr/dolibarr/pull/32080 backport of fix part --- htdocs/ticket/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 704fa880adc..9e69271f09c 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -375,6 +375,7 @@ if ($socid > 0) { } foreach ($search as $key => $val) { + $tmpkey = 't.' . $key; if ($key == 'fk_statut' && !empty($search['fk_statut'])) { $newarrayofstatus = array(); foreach ($search['fk_statut'] as $key2 => $val2) { @@ -396,18 +397,18 @@ foreach ($search as $key => $val) { $newarrayofstatus[] = Ticket::STATUS_CANCELED; } if (count($newarrayofstatus)) { - $sql .= natural_search($key, join(',', $newarrayofstatus), 2); + $sql .= natural_search($tmpkey, join(',', $newarrayofstatus), 2); } continue; } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project') { if ($search[$key] > 0) { - $sql .= natural_search($key, $search[$key], 2); + $sql .= natural_search($tmpkey, $search[$key], 2); } continue; } elseif ($key == 'type_code') { $newarrayoftypecodes = is_array($search[$key]) ? $search[$key] : (!empty($search[$key]) ? explode(',', $search[$key]) : array()); if (count($newarrayoftypecodes)) { - $sql .= natural_search($key, join(',', $newarrayoftypecodes), 3); + $sql .= natural_search($tmpkey, join(',', $newarrayoftypecodes), 3); } continue; } @@ -415,7 +416,7 @@ foreach ($search as $key => $val) { $mode_search = ((!empty($object->fields[$key]) && ($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))) ? 1 : 0); // $search[$key] can be an array of values, or a string. We add filter if array not empty or if it is a string. if ((is_array($search[$key]) && !empty($search[$key])) || (!is_array($search[$key]) && $search[$key] != '')) { - $sql .= natural_search($key, $search[$key], $mode_search); + $sql .= natural_search($tmpkey, $search[$key], $mode_search); } } if ($search_all) { @@ -425,7 +426,7 @@ if ($search_societe) { $sql .= natural_search('s.nom', $search_societe); } if ($search_fk_project > 0) { - $sql .= natural_search('fk_project', $search_fk_project, 2); + $sql .= natural_search('t.fk_project', $search_fk_project, 2); } if ($search_date_start) { $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'"; From 9dcabdbab6ea8a42408bc73278a1df52c5e8b6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Sat, 30 Nov 2024 10:05:48 +0100 Subject: [PATCH 035/336] Fix #32158 --- htdocs/comm/propal/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 2b5f8dcc5bf..0c468349f88 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1766,6 +1766,7 @@ if ($action == 'create') { $fk_account = GETPOST('fk_account', 'int'); // Load objectsrc + $objectsrc = NULL; if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; From fe3fb72e5eea18a5853bccb925cdbc04f1a4f192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Sat, 30 Nov 2024 10:54:32 +0100 Subject: [PATCH 036/336] Fix #32161 --- htdocs/comm/propal/card.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 2b5f8dcc5bf..d4d969c0a07 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1766,6 +1766,7 @@ if ($action == 'create') { $fk_account = GETPOST('fk_account', 'int'); // Load objectsrc + $soc = NULL; if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; @@ -1777,6 +1778,14 @@ if ($action == 'create') { if ($element == 'project') { $projectid = $originid; + + // Fetch project and thirdparty + $project = new Project($db); + $project->fetch($projectid); + if ($project->socid > 0) { + $soc = new Societe($db); + $soc->fetch($project->socid); + } } else { // For compatibility if ($element == 'order' || $element == 'commande') { @@ -1808,9 +1817,9 @@ if ($action == 'create') { $soc = $objectsrc->thirdparty; - $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); - $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); - $warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0)); + $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); + $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); + $warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0)); // Replicate extrafields $objectsrc->fetch_optionals(); @@ -1825,7 +1834,10 @@ if ($action == 'create') { } } } - } else { + } + + // Load default values from thirdparty + if (!empty($soc)) { $cond_reglement_id = empty($soc->cond_reglement_id) ? $cond_reglement_id : $soc->cond_reglement_id; $deposit_percent = empty($soc->deposit_percent) ? $deposit_percent : $soc->deposit_percent; $mode_reglement_id = empty($soc->mode_reglement_id) ? $mode_reglement_id : $soc->mode_reglement_id; @@ -1838,7 +1850,7 @@ if ($action == 'create') { $currency_code = $soc->multicurrency_code; } } - + // If form was posted (but error returned), we must reuse the value posted in priority (standard Dolibarr behaviour) if (!GETPOST('changecompany')) { if (GETPOSTISSET('cond_reglement_id')) { From f5d639b8416474a245dc5094f073a9792a16978e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Sat, 30 Nov 2024 11:04:35 +0100 Subject: [PATCH 037/336] Update card.php --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d4d969c0a07..b5f287fdbe7 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1766,7 +1766,7 @@ if ($action == 'create') { $fk_account = GETPOST('fk_account', 'int'); // Load objectsrc - $soc = NULL; + $soc = null; if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; From 677525a663d55fbf6a248bf2f5b66d75ec762f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Sat, 30 Nov 2024 11:08:17 +0100 Subject: [PATCH 038/336] Update card.php --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b5f287fdbe7..828b96311e9 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1850,7 +1850,7 @@ if ($action == 'create') { $currency_code = $soc->multicurrency_code; } } - + // If form was posted (but error returned), we must reuse the value posted in priority (standard Dolibarr behaviour) if (!GETPOST('changecompany')) { if (GETPOSTISSET('cond_reglement_id')) { From 23617a11fc556cc45affb42f32b82f3fc168833b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Sat, 30 Nov 2024 13:34:17 +0100 Subject: [PATCH 039/336] Update card.php --- htdocs/comm/propal/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 828b96311e9..3ab1b2bf2b9 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1766,7 +1766,6 @@ if ($action == 'create') { $fk_account = GETPOST('fk_account', 'int'); // Load objectsrc - $soc = null; if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; From c01ab2b7ea4f67c1936f553814bb7eed278fc112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Sat, 30 Nov 2024 13:36:13 +0100 Subject: [PATCH 040/336] Update card.php --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 0c468349f88..de3c52f5308 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1766,7 +1766,7 @@ if ($action == 'create') { $fk_account = GETPOST('fk_account', 'int'); // Load objectsrc - $objectsrc = NULL; + $objectsrc = null; if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; From 0e1744a6ec6757b5402f15d5f46ba0899accc558 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Sun, 1 Dec 2024 10:24:25 +0100 Subject: [PATCH 041/336] throw RestException(500) if update of invoice fails #32134 --- htdocs/compta/facture/class/api_invoices.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index d48740ea68d..9a9320e4897 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -632,8 +632,10 @@ class Invoices extends DolibarrApi } } - if ($this->invoice->update(DolibarrApiAccess::$user)) { + if ($this->invoice->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); + } else { + throw new RestException(500, $this->invoice->error); } return false; From 89fc9ac8eafa2e34c6aa52e747ceed8e0c08c5c9 Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Sun, 1 Dec 2024 18:55:31 +0100 Subject: [PATCH 042/336] FIX Accounting Closure Duplicates and more Update bookkeeping.class.php FIX I did further testing and investigation and I fixed the following issues that stop doing a full closure without duplicate lines generated by an unclean database : - different label_compte with same account number - removing label_compte is raising an issue and the code in the line around 2770 $bookkeeping->label_compte = $obj->label_compte; - different subledger_label with same subledger_account - empty versus null values for subledger_label and subledger_account - opening_balance is 0 as it creates a bookkeeping entry for now. FIX - Update Accounting closure with missing too many A-Nouveau #30039) --- .../accountancy/class/bookkeeping.class.php | 56 ++++++++++++++----- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index be140363e3c..834df5b690c 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2692,10 +2692,8 @@ class BookKeeping extends CommonObject $sql = 'SELECT'; $sql .= " t.numero_compte,"; - $sql .= " t.label_compte,"; if ($separate_auxiliary_account) { - $sql .= " t.subledger_account,"; - $sql .= " t.subledger_label,"; + $sql .= " NULLIF(t.subledger_account, '') as subledger_account,"; // fix db issues with Null or "" values } $sql .= " aa.pcg_type,"; $sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance"; @@ -2707,10 +2705,11 @@ class BookKeeping extends CommonObject $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; - $sql .= ' GROUP BY t.numero_compte, t.label_compte, aa.pcg_type'; + $sql .= ' GROUP BY t.numero_compte, aa.pcg_type'; if ($separate_auxiliary_account) { - $sql .= ' ,t.subledger_account, t.subledger_label'; + $sql .= " , NULLIF(t.subledger_account, '')"; } + $sql .= ' HAVING (SUM(t.credit) - SUM(t.debit)) != 0 '; // Exclude rows with opening_balance = 0 $sql .= $this->db->order("t.numero_compte", "ASC"); $resql = $this->db->query($sql); @@ -2732,23 +2731,38 @@ class BookKeeping extends CommonObject $bookkeeping = new BookKeeping($this->db); $bookkeeping->doc_date = $new_fiscal_period->date_start; $bookkeeping->date_lim_reglement = ''; - $bookkeeping->doc_ref = $new_fiscal_period->label; + $bookkeeping->doc_ref = $fiscal_period->label; $bookkeeping->date_creation = $now; $bookkeeping->doc_type = 'closure'; - $bookkeeping->fk_doc = $new_fiscal_period->id; + $bookkeeping->fk_doc = $fiscal_period->id; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = ''; if ($separate_auxiliary_account) { $bookkeeping->subledger_account = $obj->subledger_account; - $bookkeeping->subledger_label = $obj->subledger_label; + $sql = 'SELECT'; + $sql .= " subledger_label"; + $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; + $sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'"; + $sql .= " ORDER BY doc_date DESC"; + $sql .= " LIMIT 1"; + $result = $this->db->query($sql); + if (!$result) { + $this->errors[] = 'Error: ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + $error++; + } + $objtmp = $this->db->fetch_object($result); + $bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used } else { - $bookkeeping->subledger_account = ''; - $bookkeeping->subledger_label = ''; + $bookkeeping->subledger_account = null; + $bookkeeping->subledger_label = null; } $bookkeeping->numero_compte = $obj->numero_compte; - $bookkeeping->label_compte = $obj->label_compte; + $accountingaccount = new AccountingAccount($this->db); + $accountingaccount->fetch('', $obj->numero_compte); + $bookkeeping->label_compte = $accountingaccount->label; // latest account label used $bookkeeping->label_operation = $new_fiscal_period->label; $bookkeeping->montant = $mt; @@ -2787,12 +2801,24 @@ class BookKeeping extends CommonObject $bookkeeping->thirdparty_code = ''; if ($separate_auxiliary_account) { - $bookkeeping->subledger_label = ''; $bookkeeping->subledger_account = $obj->subledger_account; - $bookkeeping->subledger_label = $obj->subledger_label; + $sql = 'SELECT'; + $sql .= " subledger_label"; + $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; + $sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'"; + $sql .= " ORDER BY doc_date DESC"; + $sql .= " LIMIT 1"; + $result = $this->db->query($sql); + if (!$result) { + $this->errors[] = 'Error: ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + $error++; + } + $objtmp = $this->db->fetch_object($result); + $bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used } else { - $bookkeeping->subledger_account = ''; - $bookkeeping->subledger_label = ''; + $bookkeeping->subledger_account = null; + $bookkeeping->subledger_label = null; } $bookkeeping->numero_compte = $accountingaccount->account_number; From 7e3624ee27f4b3db157d8a1391cc98125b2f1fd0 Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Sun, 1 Dec 2024 19:08:53 +0100 Subject: [PATCH 043/336] Clean Spaces versu tab --- htdocs/accountancy/class/bookkeeping.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 834df5b690c..527049ea06b 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2015-2022 Alexandre Spangaro * Copyright (C) 2015-2020 Florian Henry * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2024 Jose MARTINEZ * * 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 @@ -2748,9 +2749,9 @@ class BookKeeping extends CommonObject $sql .= " LIMIT 1"; $result = $this->db->query($sql); if (!$result) { - $this->errors[] = 'Error: ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); - $error++; + $this->errors[] = 'Error: ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + $error++; } $objtmp = $this->db->fetch_object($result); $bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used @@ -2810,9 +2811,9 @@ class BookKeeping extends CommonObject $sql .= " LIMIT 1"; $result = $this->db->query($sql); if (!$result) { - $this->errors[] = 'Error: ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); - $error++; + $this->errors[] = 'Error: ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + $error++; } $objtmp = $this->db->fetch_object($result); $bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used From e6712300d544dac04dd4c95a075cf8e0b9d33727 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Mon, 2 Dec 2024 07:29:18 +0100 Subject: [PATCH 044/336] phan fix, remove code never reached --- htdocs/compta/facture/class/api_invoices.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 4f8dfbd04e6..26a609da09b 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -637,8 +637,6 @@ class Invoices extends DolibarrApi } else { throw new RestException(500, $this->invoice->error); } - - return false; } /** From 3a523ffd44ad722561cd8b18adc45c536831d116 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 2 Dec 2024 18:39:32 +0100 Subject: [PATCH 045/336] Update .gitignore Ignore .htaccess files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 2964b1ead0f..fb62ffeaf22 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,6 @@ phpstan_custom.neon /.php-cs-fixer.cache /.php_cs.cache /.cache + +# ignore .htaccess files +.htaccess From d8fecc1522a4c094162ef6b4d745c9048c48a9aa Mon Sep 17 00:00:00 2001 From: Quentin VIAL--GOUTEYRON Date: Tue, 3 Dec 2024 08:39:34 +0100 Subject: [PATCH 046/336] FIX : in projet/element.php total_time is always back to 0 --- htdocs/projet/element.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index ed14a6791bf..52b82e5756d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1193,6 +1193,7 @@ foreach ($listofreferent as $key => $value) { } $num = count($elementarray); + $total_time = 0; for ($i = 0; $i < $num; $i++) { $tmp = explode('_', $elementarray[$i]); $idofelement = $tmp[0]; @@ -1310,7 +1311,7 @@ foreach ($listofreferent as $key => $value) { print "\n"; // Date or TimeSpent - $date = ''; $total_time_by_line = null; $total_time = 0; + $date = ''; $total_time_by_line = null; if ($tablename == 'expensereport_det') { $date = $element->date; // No draft status on lines } elseif ($tablename == 'stock_mouvement') { From f5c715c6a79a787cef811d92163f66310a38a047 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 3 Dec 2024 15:05:39 +0100 Subject: [PATCH 047/336] Ticket : don't autofill search field for ticket type on multiselect --- htdocs/core/class/html.formticket.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index f30da8bc8b0..8920b259489 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -716,7 +716,7 @@ class FormTicket $ticketstat->loadCacheTypesTickets(); print ''; + $useDefaultColor = false; + if (!$color && !empty($this->defaultFieldValue)) { + $color = $this->defaultFieldValue; + $useDefaultColor = true; } - return $langs->trans("Default"); + if ($color) { + $out.= ''; + } + + if ($useDefaultColor) $out.= ' '.$langs->trans("Default"); + + return $out; } /** * generateInputFieldColor From 9477b68e0d781d62bb177720d88715c104b7c613 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:15:29 +0100 Subject: [PATCH 070/336] add color ref --- htdocs/core/class/html.formsetup.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 21d026aecb5..efc97ad63f2 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -1329,7 +1329,11 @@ class FormSetupItem $out.= ''; } - if ($useDefaultColor) $out.= ' '.$langs->trans("Default"); + if ($useDefaultColor) { + $out.= ' '.$langs->trans("Default"); + } else { + $out.= ' #'.$color; + } return $out; } From 68518a87177973f91231ab16c87d2c6ecabc586b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 5 Dec 2024 16:14:45 +0100 Subject: [PATCH 071/336] fix: missing error return on invoice created when lines array is filled --- htdocs/compta/facture/class/facture.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 364b22cfe4c..932ed33010d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -862,17 +862,18 @@ class Facture extends CommonInvoice 1 ); + if ($result < 0) { + $this->error = $this->db->lasterror(); + $this->errors = array_merge($this->errors, $newinvoiceline->errors); + $error++; + break; + } + // Defined the new fk_parent_line if ($result > 0 && $newinvoiceline->product_type == 9) { $fk_parent_line = $result; } } - if ($result < 0) { - $this->error = $newinvoiceline->error; - $this->errors = $newinvoiceline->errors; - $error++; - break; - } } } elseif (!$error && empty($this->fac_rec)) { // If this->lines is an array of invoice line arrays $fk_parent_line = 0; From de2e9f5ea53cfc183ac07a836efedefc39af5566 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 5 Dec 2024 16:20:53 +0100 Subject: [PATCH 072/336] fix: missing error return on invoice created when lines array is filled --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 932ed33010d..156cfee46ef 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -863,8 +863,8 @@ class Facture extends CommonInvoice ); if ($result < 0) { - $this->error = $this->db->lasterror(); - $this->errors = array_merge($this->errors, $newinvoiceline->errors); + $this->error = $newinvoiceline->error; + $this->errors = $newinvoiceline->errors; $error++; break; } From ad5285bd7e43b04f361b0467dc246023ad10c3ce Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 5 Dec 2024 17:28:00 +0100 Subject: [PATCH 073/336] fix: missing error return on invoice created when lines array is filled --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 156cfee46ef..b451a9307ae 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -864,7 +864,7 @@ class Facture extends CommonInvoice if ($result < 0) { $this->error = $newinvoiceline->error; - $this->errors = $newinvoiceline->errors; + $this->errors = array_merge($this->errors, $newinvoiceline->errors); $error++; break; } From 4ebb0a121a4bccaddb2f6b2e6edf6bc8b61cedd1 Mon Sep 17 00:00:00 2001 From: Maximilien Valenzano Date: Fri, 6 Dec 2024 19:16:00 +0100 Subject: [PATCH 074/336] fix(invoice): mutlicurrency_tx correct value --- htdocs/compta/facture/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 1fbe7c56502..e6296d0860f 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1093,7 +1093,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOST('originmulticurrency_tx'); // Special properties of replacement invoice $object->fk_facture_source = GETPOSTINT('fac_replacement'); @@ -1154,7 +1154,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOST('originmulticurrency_tx'); // Special properties of replacement invoice $object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : ''; @@ -1393,7 +1393,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOST('originmulticurrency_tx'); // Source facture $object->fac_rec = GETPOSTINT('fac_rec'); @@ -1480,7 +1480,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOST('originmulticurrency_tx'); if (GETPOST('type') == Facture::TYPE_SITUATION) { $object->situation_counter = 1; From de00de16dec0cad277834ba2da72e87b445fb531 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 7 Dec 2024 08:46:56 +0100 Subject: [PATCH 075/336] FIX avoid php warning --- htdocs/user/group/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 6a1030ab8c6..fdcfe655bc4 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -77,7 +77,7 @@ $hookmanager->initHooks(array('groupcard', 'globalcard')); $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', $feature2); // Users/Groups management only in master entity if transverse mode -if (isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) { +if (isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { accessforbidden(); } From f04b68cbb5788754e55fdbe73aeee7e11a405a99 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 7 Dec 2024 12:50:57 +0100 Subject: [PATCH 076/336] FIX missing saving MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH --- htdocs/admin/security_other.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index d1f9b2049b1..6991a9f1a86 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -67,6 +67,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { $res3 = 1; $res4 = 1; $res5 = 1; + $res6 = 1; if (GETPOSTISSET('MAIN_APPLICATION_TITLE')) { $res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity); } @@ -82,7 +83,10 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { if (GETPOSTISSET('MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS')) { $res5 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", GETPOST("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 'alphanohtml'), 'int', 0, '', $conf->entity); } - if ($res1 && $res2 && $res3 && $res4 && $res5) { + if (GETPOSTISSET('MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH')) { + $res6 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH", GETPOST("MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH", 'alphanohtml'), 'int', 0, '', $conf->entity); + } + if ($res1 && $res2 && $res3 && $res4 && $res5 && $res6) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } } From fde5d6fdeaea9689cde183b29b7f3ad274452090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 7 Dec 2024 14:34:01 +0100 Subject: [PATCH 077/336] fix include bad path --- htdocs/takepos/public/auto_order.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/public/auto_order.php b/htdocs/takepos/public/auto_order.php index 970044e2773..d726c6221d0 100644 --- a/htdocs/takepos/public/auto_order.php +++ b/htdocs/takepos/public/auto_order.php @@ -43,9 +43,9 @@ $_SESSION["takeposterminal"] = getDolGlobalInt('TAKEPOS_TERMINAL_NB_FOR_PUBLIC', define('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE', 1); if (GETPOSTISSET("mobilepage")) { - require DOL_URL_ROOT.'/takepos/invoice.php'; + require DOL_DOCUMENT_ROOT.'/takepos/invoice.php'; } elseif (GETPOSTISSET("genimg")) { require DOL_DOCUMENT_ROOT.'/takepos/genimg/index.php'; } else { - require DOL_URL_ROOT.'/takepos/phone.php'; + require DOL_DOCUMENT_ROOT.'/takepos/phone.php'; } From aefde2bbd837bb96ce8a2ccd9302ac0de2dd65af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 7 Dec 2024 14:37:40 +0100 Subject: [PATCH 078/336] Update auto_order.php --- htdocs/takepos/public/auto_order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/public/auto_order.php b/htdocs/takepos/public/auto_order.php index d726c6221d0..bb8472f5cab 100644 --- a/htdocs/takepos/public/auto_order.php +++ b/htdocs/takepos/public/auto_order.php @@ -35,7 +35,7 @@ if (!defined('NOBROWSERNOTIF')) { require '../../main.inc.php'; if (!getDolGlobalString('TAKEPOS_AUTO_ORDER')) { - accessforbidden('Auto order is not allwed'); // If Auto Order is disabled never allow access to this page (that is a NO LOGIN access) + accessforbidden('Auto order is not allowed'); // If Auto Order is disabled never allow access to this page (that is a NO LOGIN access) } $_SESSION["basiclayout"] = 1; // For the simple layout for public submission From 3593ccf0f49b13d780785c7703e76453cbdef5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 7 Dec 2024 15:49:00 +0100 Subject: [PATCH 079/336] FIX: #32259 --- htdocs/fourn/class/fournisseur.facture.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 8392718beb1..79b345dab2c 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -722,6 +722,7 @@ class FactureFournisseur extends CommonInvoice */ if (! $error && $this->fac_rec > 0 && $_facrec instanceof FactureFournisseurRec) { foreach ($_facrec->lines as $i => $val) { + $product_type = $_facrec->lines[$i]->product_type; if ($_facrec->lines[$i]->fk_product) { $prod = new Product($this->db); $res = $prod->fetch($_facrec->lines[$i]->fk_product); @@ -782,7 +783,7 @@ class FactureFournisseur extends CommonInvoice 0, $_facrec->lines[$i]->info_bits, 'HT', - 0, + $product_type, $_facrec->lines[$i]->rang, false, $_facrec->lines[$i]->array_options, From 413115dfe8a20565065310c0e7ecad1384df26bf Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sat, 7 Dec 2024 18:04:06 +0100 Subject: [PATCH 080/336] Fix position of column --- htdocs/fourn/commande/list.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 5a80dc98f81..e07c71b5b27 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1769,6 +1769,9 @@ if ($resql) { print ''; } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Ref if (!empty($arrayfields['cf.ref']['checked'])) { @@ -2086,9 +2089,9 @@ if ($resql) { print ''; } print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print "\n"; From 5890837e03324d4d907d809b7f69d3abb3c4eb42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2024 10:17:51 +0100 Subject: [PATCH 081/336] Update dict.php close #32271 --- htdocs/admin/dict.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7e345f36035..12332c91d83 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1316,7 +1316,26 @@ if ($id > 0) { $tablecode = 't.code'; $tableprefix = ''; - $tableprefixarray = array(DICT_FORME_JURIDIQUE => 'f.code', DICT_DEPARTEMENTS => 'd.code_departement', DICT_REGIONS => 'r.code_region', DICT_COUNTRY => 'c.code', DICT_CIVILITY => 'c.code', DICT_ACTIONCOMM => 'a.code', DICT_CURRENCIES => 'code_iso', DICT_ECOTAXE => 'e.code', DICT_HOLIDAY_TYPES => 'h.code', DICT_CHARGESOCIALES => 'a.code', DICT_HRM_PUBLIC_HOLIDAY => 'a.code', DICT_UNITS => 'r.code', DICT_SOCIALNETWORKS => 's.code', 45 => 'f.code', 46 => 'f.code', 47 => 'f.code', 48 => 'f.code'); + $tableprefixarray = array( + DICT_FORME_JURIDIQUE => 'f.code', + DICT_DEPARTEMENTS => 'd.code_departement', + DICT_REGIONS => 'r.code_region', + DICT_COUNTRY => 'c.code', + DICT_CIVILITY => 'c.code', + DICT_ACTIONCOMM => 'a.code', + DICT_CHARGESOCIALES => 'a.code', + DICT_TYPENT => 't.code', + DICT_CURRENCIES => 'code_iso', + DICT_ECOTAXE => 'e.code', + DICT_HOLIDAY_TYPES => 'h.code', + DICT_HRM_PUBLIC_HOLIDAY => 'a.code', + DICT_UNITS => 'r.code', + DICT_SOCIALNETWORKS => 's.code', + 45 => 'f.code', + 46 => 'f.code', + 47 => 'f.code', + 48 => 'f.code', + ); if (!empty($tableprefixarray[$id])) { $tablecode = $tableprefixarray[$id]; $tableprefix = preg_replace('/\..*$/', '.', $tablecode); From defc8dc8d513e2adcc69c9331045963d97b87fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2024 10:24:07 +0100 Subject: [PATCH 082/336] Update dict.php --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 12332c91d83..d40c143e0ed 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1325,7 +1325,7 @@ if ($id > 0) { DICT_ACTIONCOMM => 'a.code', DICT_CHARGESOCIALES => 'a.code', DICT_TYPENT => 't.code', - DICT_CURRENCIES => 'code_iso', + DICT_CURRENCIES => 'c.code_iso', DICT_ECOTAXE => 'e.code', DICT_HOLIDAY_TYPES => 'h.code', DICT_HRM_PUBLIC_HOLIDAY => 'a.code', From 25e32241218341fc8f34763342a4fa8fb7774b9b Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Sun, 8 Dec 2024 11:36:26 +0100 Subject: [PATCH 083/336] Close #30039 and port code on this one This will help to better and understand and follow this fix --- htdocs/accountancy/class/bookkeeping.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 527049ea06b..bb6d102843d 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -27,6 +27,7 @@ // Class require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; @@ -328,7 +329,7 @@ class BookKeeping extends CommonObject $this->piece_num = 0; // First check if line not yet already in bookkeeping. - // Note that we must include 'doc_type - fk_doc - numero_compte - label' to be sure to have unicity of line (because we may have several lines + // Note that we must include 'doc_type - fk_doc - numero_compte - label - subledger_account (if not empty)' to be sure to have unicity of line (because we may have several lines // with same doc_type, fk_doc, numero_compte for 1 invoice line when using localtaxes with same account) // WARNING: This is not reliable, label may have been modified. This is just a small protection. // The page that make transfer make the test on couple (doc_type - fk_doc) only. @@ -342,6 +343,9 @@ class BookKeeping extends CommonObject } $sql .= " AND numero_compte = '".$this->db->escape($this->numero_compte)."'"; $sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'"; + if (!empty($this->subledger_account)) { + $sql .= " AND subledger_account = '".$this->db->escape($this->subledger_account)."'"; + } $sql .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features $resql = $this->db->query($sql); From c7329a723eb8f55c96e9b61a53625f6bb9267559 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 8 Dec 2024 12:23:06 +0100 Subject: [PATCH 084/336] fix: fatal error php 8, invoice situation --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 29e5c0f369e..52ca49863c3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2742,7 +2742,7 @@ if (empty($reshook)) { // Invoice situation if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { $previousprogress = $line->get_allprev_progress($line->fk_facture); - $fullprogress = price2num(GETPOST('progress', 'alpha'), 'MU'); + $fullprogress = price2num(GETPOST('progress', 'alpha'), 2); if ($fullprogress < $previousprogress) { $error++; From a08a5692055803f3e5753a3ca5c1f5cf25c25ba0 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 12:32:21 +0100 Subject: [PATCH 085/336] Add test --- .github/workflows/test.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index cf263dd0b57..3db528b17db 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,3 +1,4 @@ +name: Test on: workflow_dispatch: pull_request: @@ -5,7 +6,8 @@ on: branches: - "18.0" -permissions: write-all +#permissions: write-all +#permissions: {} # none jobs: testjob: From 7cd11140a0965100568ce863c7aee451adcc0bb5 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 12:46:54 +0100 Subject: [PATCH 086/336] Test --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3db528b17db..e0f55166a46 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,6 +15,7 @@ jobs: steps: - name: Log run: | + echo "repo-token: ${{ secrets.GITHUB_TOKEN }}" echo "variable org: ${{vars.AAA}}" echo "env prg: ${{env.AAA}}" echo "secret org: ${{secrets.BBB}}" From 2c4b3bf6ad32d77658be1a30e698d62b2360d372 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 12:52:44 +0100 Subject: [PATCH 087/336] Test --- .../changed-lines-count-labeler.yml | 3 +++ .github/workflows/pr-18-autolabel.yaml | 20 +++++++++++++++++++ .github/workflows/pr-18.yaml | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/changed-lines-count-labeler.yml create mode 100644 .github/workflows/pr-18-autolabel.yaml diff --git a/.github/workflows/changed-lines-count-labeler.yml b/.github/workflows/changed-lines-count-labeler.yml new file mode 100644 index 00000000000..39e663821fb --- /dev/null +++ b/.github/workflows/changed-lines-count-labeler.yml @@ -0,0 +1,3 @@ +# Add this tag for any changes for more than 1 line +"Pending analysis of PR (maintenance team)": + min: 1 diff --git a/.github/workflows/pr-18-autolabel.yaml b/.github/workflows/pr-18-autolabel.yaml new file mode 100644 index 00000000000..4524d02815b --- /dev/null +++ b/.github/workflows/pr-18-autolabel.yaml @@ -0,0 +1,20 @@ +name: "Set label for v18" +on: + pull_request: + types: [opened, synchronize, reopened] + branches: + - "18.0" + push: + branches: + - "18.0" + +jobs: + changed-lines-count-labeler: + runs-on: ubuntu-latest + name: An action for automatically labelling pull requests based on the changed lines count + steps: + - name: Set a label + uses: vkirilichev/changed-lines-count-labeler@v0.2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/changed-lines-count-labeler.yml diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 2682e99df38..be36aa8b246 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -7,7 +7,7 @@ on: branches: - "18.0" -permissions: write-all +#permissions: write-all jobs: run: From d3d534efeef6f599cdc87a44b9ee375351fd2c87 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 12:54:25 +0100 Subject: [PATCH 088/336] Test --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index cf263dd0b57..062de38b3a3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,6 +13,7 @@ jobs: steps: - name: Log run: | + echo "repo-token: ${{ secrets.GITHUB_TOKEN }}" echo "variable org: ${{vars.AAA}}" echo "env prg: ${{env.AAA}}" echo "secret org: ${{secrets.BBB}}" From a0864dfb3fcdeb11c175bb5d1959532af40c5406 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 13:05:24 +0100 Subject: [PATCH 089/336] Fix test --- .github/{workflows => }/changed-lines-count-labeler.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflows => }/changed-lines-count-labeler.yml (100%) diff --git a/.github/workflows/changed-lines-count-labeler.yml b/.github/changed-lines-count-labeler.yml similarity index 100% rename from .github/workflows/changed-lines-count-labeler.yml rename to .github/changed-lines-count-labeler.yml From e09f2fa15b500cd87a87cde4a6cce607c20c7fbe Mon Sep 17 00:00:00 2001 From: Dolibot Date: Sun, 8 Dec 2024 12:06:48 +0000 Subject: [PATCH 090/336] PHPStan > Update baseline --- build/phpstan/phpstan-baseline.neon | 66 ----------------------------- 1 file changed, 66 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 0cc40cf71d2..014b1ef249e 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -28332,12 +28332,6 @@ parameters: count: 1 path: ../../htdocs/public/bookcal/index.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 9 - path: ../../htdocs/public/clicktodial/cidlookup.php - - message: '#^Variable \$langs might not be defined\.$#' identifier: variable.undefined @@ -28350,12 +28344,6 @@ parameters: count: 1 path: ../../htdocs/public/cron/cron_run_jobs_by_url.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../htdocs/public/cron/cron_run_jobs_by_url.php - - message: '#^Comparison operation "\>\=" between ''0''\|''1'' and 0 is always true\.$#' identifier: greaterOrEqual.alwaysTrue @@ -28380,30 +28368,6 @@ parameters: count: 1 path: ../../htdocs/public/demo/index.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 21 - path: ../../htdocs/public/demo/index.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/demo/index.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/public/demo/index.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 8 - path: ../../htdocs/public/demo/index.php - - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined @@ -28428,18 +28392,6 @@ parameters: count: 7 path: ../../htdocs/public/donations/donateurs_code.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 9 - path: ../../htdocs/public/emailing/mailing-read.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 12 - path: ../../htdocs/public/emailing/mailing-unsubscribe.php - - message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -28530,12 +28482,6 @@ parameters: count: 2 path: ../../htdocs/public/fichinter/agendaexport.php - - - message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/public/members/new.php - - message: '#^Call to preg_quote\(\) is missing delimiter / to be effective\.$#' identifier: argument.invalidPregQuote @@ -28554,12 +28500,6 @@ parameters: count: 1 path: ../../htdocs/public/members/new.php - - - message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/public/members/public_card.php - - message: '#^Property Adherent\:\:\$photo \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -28578,12 +28518,6 @@ parameters: count: 17 path: ../../htdocs/public/members/public_card.php - - - message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/public/members/public_list.php - - message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#' identifier: function.alreadyNarrowedType From 4bb2b9f97115a10cc32bfffebbd7d8575f2e0569 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 13:51:23 +0100 Subject: [PATCH 091/336] Test --- .github/workflows/pr-18.yaml | 8 ++++++-- .github/workflows/test.yaml | 38 +++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index be36aa8b246..8a4c916809f 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -10,12 +10,15 @@ on: #permissions: write-all jobs: - run: + pr18: + permissions: + issues: write + pull-requests: write runs-on: ubuntu-latest env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} GH_TOKEN: ${{ github.token }} + GH_TOKENS: ${{ secrets.GH_TOKEN }} steps: - name: Checkout repository @@ -37,6 +40,7 @@ jobs: REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | echo "GH_TOKEN=$GH_TOKEN" + echo "GH_TOKENS=$GH_TOKENS" pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 062de38b3a3..a70171db729 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,12 +9,48 @@ permissions: write-all jobs: testjob: + permissions: + issues: write + pull-requests: write runs-on: ubuntu-latest + env: + ENVGHT: ${{ secrets.GH_TOKEN }} + ENVGHU: ${{ github.token }} + VARAAA: ${{ vars.AAA }} + ENVAAA: ${{ env.AAA }} + SECBBB: ${{ secrets.BBB }} + VARREPORGCCC: ${{ vars.CCC }} steps: - name: Log run: | - echo "repo-token: ${{ secrets.GITHUB_TOKEN }}" + echo "repo-token: ${{secrets.GITHUB_TOKEN}}" echo "variable org: ${{vars.AAA}}" echo "env prg: ${{env.AAA}}" echo "secret org: ${{secrets.BBB}}" echo "variable repository of orga: ${{vars.CCC}}" + echo "ENVGHT: ${{ENVGHT}}" + echo "ENVGHT: $ENVGHT" + echo "ENVGHU: ${{ENVGHU}}" + echo "ENVGHU: $ENVGHU" + echo "VARAAA: ${{VARAAA}}" + echo "VARAAA: $VARAAA" + echo "ENVAAA: ${{VARAAA}}" + echo "ENVAAA: $VARAAA" + echo "VARREPORGCCC: ${{VARREPORGCCC}}" + echo "VARREPORGCCC: $VARREPORGCCC" + echo "ENVGHTWITH: ${{ENVGHTWITH}}" + echo "ENVGHT: $ENVGHTWITH" + echo "ENVGHUWITH: ${{ENVGHUWITH}}" + echo "ENVGHU: $ENVGHUWITH" + echo "VARAAAWITH: ${{VARAAAWITH}}" + echo "VARAAAWITH: $VARAAAWITH" + echo "SECBBBWITH: ${{SECBBBWITH}}" + echo "SECBBBWITH: $SECBBBWITH" + with: + ENVGHW: $GH_TOKEN + ENVGHTWITH: $ENVGHT + ENVGHUWITH: $ENVGHU + VARAAAWITH: $VARAAA + SECBBBWITH: $SECBBB + VARREPORGCCCWITH: $VARREPORGCCC + From da6f1fbc9aa91b62ba5b411f3d32cfe0ab1fa34f Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:04:10 +0100 Subject: [PATCH 092/336] Test --- .github/workflows/test.yaml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a70171db729..2ac953064f9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,19 +7,20 @@ on: permissions: write-all +env: + ENVGHT: ${{ secrets.GH_TOKEN }} + ENVGHU: ${{ github.token }} + VARAAA: ${{ vars.AAA }} + ENVAAA: ${{ env.AAA }} + SECBBB: ${{ secrets.BBB }} + VARREPORGCCC: ${{ vars.CCC }} + jobs: testjob: permissions: issues: write pull-requests: write runs-on: ubuntu-latest - env: - ENVGHT: ${{ secrets.GH_TOKEN }} - ENVGHU: ${{ github.token }} - VARAAA: ${{ vars.AAA }} - ENVAAA: ${{ env.AAA }} - SECBBB: ${{ secrets.BBB }} - VARREPORGCCC: ${{ vars.CCC }} steps: - name: Log run: | From d9035eecdab96f893d83240c96a3a9d97dcec2fd Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:04:10 +0100 Subject: [PATCH 093/336] Test --- .github/workflows/test.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a70171db729..bf06e4fe065 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,19 +7,19 @@ on: permissions: write-all +env: + ENVGHT: ${{ secrets.GH_TOKEN }} + ENVGHU: ${{ github.token }} + VARAAA: ${{ vars.AAA }} + SECBBB: ${{ secrets.BBB }} + VARREPORGCCC: ${{ vars.CCC }} + jobs: testjob: permissions: issues: write pull-requests: write runs-on: ubuntu-latest - env: - ENVGHT: ${{ secrets.GH_TOKEN }} - ENVGHU: ${{ github.token }} - VARAAA: ${{ vars.AAA }} - ENVAAA: ${{ env.AAA }} - SECBBB: ${{ secrets.BBB }} - VARREPORGCCC: ${{ vars.CCC }} steps: - name: Log run: | From 6f2d8b23b43ebd71fefecc85c7cdf4306678dbf0 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:09:47 +0100 Subject: [PATCH 094/336] Test --- .github/workflows/test.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bf06e4fe065..414f0f1e035 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -46,11 +46,11 @@ jobs: echo "VARAAAWITH: $VARAAAWITH" echo "SECBBBWITH: ${{SECBBBWITH}}" echo "SECBBBWITH: $SECBBBWITH" - with: - ENVGHW: $GH_TOKEN - ENVGHTWITH: $ENVGHT - ENVGHUWITH: $ENVGHU - VARAAAWITH: $VARAAA - SECBBBWITH: $SECBBB - VARREPORGCCCWITH: $VARREPORGCCC +# with: +# ENVGHW: $GH_TOKEN +# ENVGHTWITH: $ENVGHT +# ENVGHUWITH: $ENVGHU +# VARAAAWITH: $VARAAA +# SECBBBWITH: $SECBBB +# VARREPORGCCCWITH: $VARREPORGCCC From 3877f257b4f561ed138af7e4056b7f207b40c595 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:13:13 +0100 Subject: [PATCH 095/336] Test --- .github/workflows/test.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 414f0f1e035..96356ebb387 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,10 +26,11 @@ jobs: echo "repo-token: ${{secrets.GITHUB_TOKEN}}" echo "variable org: ${{vars.AAA}}" echo "env prg: ${{env.AAA}}" + echo "env prg: ${{env.VARAAA}}" echo "secret org: ${{secrets.BBB}}" echo "variable repository of orga: ${{vars.CCC}}" - echo "ENVGHT: ${{ENVGHT}}" - echo "ENVGHT: $ENVGHT" + #echo "ENVGHT: ${{ENVGHT}}" + #echo "ENVGHT: $ENVGHT" echo "ENVGHU: ${{ENVGHU}}" echo "ENVGHU: $ENVGHU" echo "VARAAA: ${{VARAAA}}" From 75e504ffbcd5dc7806a3153eee483c6be434015f Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:20:15 +0100 Subject: [PATCH 096/336] Test --- .github/workflows/test.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 96356ebb387..379426d8d66 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -29,8 +29,7 @@ jobs: echo "env prg: ${{env.VARAAA}}" echo "secret org: ${{secrets.BBB}}" echo "variable repository of orga: ${{vars.CCC}}" - #echo "ENVGHT: ${{ENVGHT}}" - #echo "ENVGHT: $ENVGHT" + echo "ENVGHT: ${{env.ENVGHT}}" echo "ENVGHU: ${{ENVGHU}}" echo "ENVGHU: $ENVGHU" echo "VARAAA: ${{VARAAA}}" From b4ece8d1543c542a0f04b03706e076a461c681f1 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:25:10 +0100 Subject: [PATCH 097/336] Fix --- .github/workflows/test.yaml | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 379426d8d66..0e9a823705b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,6 +13,7 @@ env: VARAAA: ${{ vars.AAA }} SECBBB: ${{ secrets.BBB }} VARREPORGCCC: ${{ vars.CCC }} + ENVFIX: "abc" jobs: testjob: @@ -30,27 +31,8 @@ jobs: echo "secret org: ${{secrets.BBB}}" echo "variable repository of orga: ${{vars.CCC}}" echo "ENVGHT: ${{env.ENVGHT}}" - echo "ENVGHU: ${{ENVGHU}}" - echo "ENVGHU: $ENVGHU" - echo "VARAAA: ${{VARAAA}}" - echo "VARAAA: $VARAAA" - echo "ENVAAA: ${{VARAAA}}" - echo "ENVAAA: $VARAAA" - echo "VARREPORGCCC: ${{VARREPORGCCC}}" - echo "VARREPORGCCC: $VARREPORGCCC" - echo "ENVGHTWITH: ${{ENVGHTWITH}}" - echo "ENVGHT: $ENVGHTWITH" - echo "ENVGHUWITH: ${{ENVGHUWITH}}" - echo "ENVGHU: $ENVGHUWITH" - echo "VARAAAWITH: ${{VARAAAWITH}}" - echo "VARAAAWITH: $VARAAAWITH" - echo "SECBBBWITH: ${{SECBBBWITH}}" - echo "SECBBBWITH: $SECBBBWITH" -# with: -# ENVGHW: $GH_TOKEN -# ENVGHTWITH: $ENVGHT -# ENVGHUWITH: $ENVGHU -# VARAAAWITH: $VARAAA -# SECBBBWITH: $SECBBB -# VARREPORGCCCWITH: $VARREPORGCCC - + echo "ENVGHU: ${{env.ENVGHU}}" + echo "VARAAA: ${{env.VARAAA}}" + echo "ENVAAA: ${{env.VARAAA}}" + echo "VARREPORGCCC: ${{env.VARREPORGCCC}}" + echo "ENVFIX: ${{env.abc}}" From ab5f9a0884ddef171b3afb6e8171f1513951762f Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:31:00 +0100 Subject: [PATCH 098/336] Tst --- .github/workflows/test.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0e9a823705b..8b056039f30 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,3 +1,4 @@ +name: Test github actions on: workflow_dispatch: pull_request: @@ -5,8 +6,6 @@ on: branches: - "18.0" -permissions: write-all - env: ENVGHT: ${{ secrets.GH_TOKEN }} ENVGHU: ${{ github.token }} From eb2b35e3b1e5d21a64b593d8fb1127e1efd51d64 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:32:16 +0100 Subject: [PATCH 099/336] Test --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8b056039f30..1ce087caeea 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,7 +7,7 @@ on: - "18.0" env: - ENVGHT: ${{ secrets.GH_TOKEN }} + ENVGHT: ${{ secrets.GITHUB_TOKEN }} ENVGHU: ${{ github.token }} VARAAA: ${{ vars.AAA }} SECBBB: ${{ secrets.BBB }} From 9411ac2144d64f8ac0f509b439c1f35172cc32c4 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:35:30 +0100 Subject: [PATCH 100/336] Test --- .github/workflows/pr-18.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 8a4c916809f..c2ced3dede7 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -18,7 +18,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} - GH_TOKENS: ${{ secrets.GH_TOKEN }} + GH_TOKENS: ${{ secrets.GH_TOKEN }} steps: - name: Checkout repository @@ -40,7 +40,7 @@ jobs: REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | echo "GH_TOKEN=$GH_TOKEN" - echo "GH_TOKENS=$GH_TOKENS" + echo "GH_TOKENS=$GH_TOKENS" pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true From d055b1fb29913c92b387ab68ebe54425eca5016b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:36:07 +0100 Subject: [PATCH 101/336] Test --- .github/workflows/pr-18.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index c2ced3dede7..91c3951c813 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -1,3 +1,4 @@ +name: Set reviewer for v18 on: pull_request: types: [opened, synchronize, reopened] From 9b46ed9c2d638635cabfbe6630b45c8ac0342330 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 14:57:17 +0100 Subject: [PATCH 102/336] Test --- .github/workflows/pr-18-autolabel.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr-18-autolabel.yaml b/.github/workflows/pr-18-autolabel.yaml index 4524d02815b..c5a2d32b5db 100644 --- a/.github/workflows/pr-18-autolabel.yaml +++ b/.github/workflows/pr-18-autolabel.yaml @@ -8,6 +8,10 @@ on: branches: - "18.0" +permissions: + issues: write + pull-requests: write + jobs: changed-lines-count-labeler: runs-on: ubuntu-latest From 0960fcba2a8310bf1ce37e9c3a4147aae36e700c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 15:02:43 +0100 Subject: [PATCH 103/336] Test --- .github/workflows/pr-18-autolabel.yaml | 7 ++++--- .github/workflows/stale-issues-safe.yml | 2 +- .github/workflows/test.yaml | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-18-autolabel.yaml b/.github/workflows/pr-18-autolabel.yaml index c5a2d32b5db..47a0edc4cbf 100644 --- a/.github/workflows/pr-18-autolabel.yaml +++ b/.github/workflows/pr-18-autolabel.yaml @@ -8,9 +8,10 @@ on: branches: - "18.0" -permissions: - issues: write - pull-requests: write +#permissions: +# issues: write +# pull-requests: write +permissions: {} # no restriction on permissions jobs: changed-lines-count-labeler: diff --git a/.github/workflows/stale-issues-safe.yml b/.github/workflows/stale-issues-safe.yml index af04675d48d..97d2992e2dd 100644 --- a/.github/workflows/stale-issues-safe.yml +++ b/.github/workflows/stale-issues-safe.yml @@ -8,7 +8,7 @@ on: types: [created] workflow_dispatch: -permissions: {} # none +permissions: {} # no restriction on permissions jobs: stale: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1ce087caeea..15c7e194b89 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,6 +6,8 @@ on: branches: - "18.0" +permissions: {} # no restriction on permissions + env: ENVGHT: ${{ secrets.GITHUB_TOKEN }} ENVGHU: ${{ github.token }} From 9a9602f41855403d9430ffc0cac2bdec57b43659 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 15:09:08 +0100 Subject: [PATCH 104/336] Test --- .github/workflows/pr-18-autolabel.yaml | 5 ----- .github/workflows/pr-18.yaml | 5 ----- .github/workflows/test.yaml | 5 ----- 3 files changed, 15 deletions(-) diff --git a/.github/workflows/pr-18-autolabel.yaml b/.github/workflows/pr-18-autolabel.yaml index 47a0edc4cbf..4524d02815b 100644 --- a/.github/workflows/pr-18-autolabel.yaml +++ b/.github/workflows/pr-18-autolabel.yaml @@ -8,11 +8,6 @@ on: branches: - "18.0" -#permissions: -# issues: write -# pull-requests: write -permissions: {} # no restriction on permissions - jobs: changed-lines-count-labeler: runs-on: ubuntu-latest diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 91c3951c813..718a7c40d0a 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -8,13 +8,8 @@ on: branches: - "18.0" -#permissions: write-all - jobs: pr18: - permissions: - issues: write - pull-requests: write runs-on: ubuntu-latest env: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 15c7e194b89..78c29dd9388 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,8 +6,6 @@ on: branches: - "18.0" -permissions: {} # no restriction on permissions - env: ENVGHT: ${{ secrets.GITHUB_TOKEN }} ENVGHU: ${{ github.token }} @@ -18,9 +16,6 @@ env: jobs: testjob: - permissions: - issues: write - pull-requests: write runs-on: ubuntu-latest steps: - name: Log From 6920b72cf4bd2394ead8515d32e9b370c9f38a96 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 15:35:03 +0100 Subject: [PATCH 105/336] Test --- .github/workflows/pr-18.yaml | 9 +++++---- .github/workflows/stale-issues-safe.yml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 718a7c40d0a..8f7ae78409a 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -25,10 +25,10 @@ jobs: sudo apt update sudo apt install gh -y - #- name: Authenticate GitHub CLI - # run: | - # echo "GH_TOKEN=$GH_TOKEN" - # gh auth login --with-token <<< "$GH_TOKEN" + - name: Authenticate GitHub CLI + run: | + echo "GH_TOKEN=$GH_TOKEN" + gh auth login --with-token <<< "$GH_TOKEN" - name: Assign reviewer env: @@ -38,5 +38,6 @@ jobs: echo "GH_TOKEN=$GH_TOKEN" echo "GH_TOKENS=$GH_TOKENS" pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) + echo "pr_numer=$pr_number" gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true diff --git a/.github/workflows/stale-issues-safe.yml b/.github/workflows/stale-issues-safe.yml index 97d2992e2dd..1b0f78c2c21 100644 --- a/.github/workflows/stale-issues-safe.yml +++ b/.github/workflows/stale-issues-safe.yml @@ -8,7 +8,7 @@ on: types: [created] workflow_dispatch: -permissions: {} # no restriction on permissions +permissions: {} # no restriction by default jobs: stale: From 3d9b7ed7d3aa25501e431c6ac804af51cb5a68f5 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 15:40:35 +0100 Subject: [PATCH 106/336] Test --- .github/workflows/pr-18.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 8f7ae78409a..f1ef3fcea20 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -14,7 +14,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} - GH_TOKENS: ${{ secrets.GH_TOKEN }} + GH_TOKENS: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout repository @@ -25,11 +25,6 @@ jobs: sudo apt update sudo apt install gh -y - - name: Authenticate GitHub CLI - run: | - echo "GH_TOKEN=$GH_TOKEN" - gh auth login --with-token <<< "$GH_TOKEN" - - name: Assign reviewer env: #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer @@ -37,7 +32,10 @@ jobs: run: | echo "GH_TOKEN=$GH_TOKEN" echo "GH_TOKENS=$GH_TOKENS" + echo Get the pr_number pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) + echo authenticatenv + gh auth login --with-token <<< "$GH_TOKEN" echo "pr_numer=$pr_number" gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true From f9eb6b69f5a4f1232c0cf58ec29a9a3d38c431b1 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 15:40:35 +0100 Subject: [PATCH 107/336] Test --- .github/workflows/pr-18.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 8f7ae78409a..049b2ce0133 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -14,7 +14,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} - GH_TOKENS: ${{ secrets.GH_TOKEN }} + GH_TOKENS: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout repository @@ -25,11 +25,6 @@ jobs: sudo apt update sudo apt install gh -y - - name: Authenticate GitHub CLI - run: | - echo "GH_TOKEN=$GH_TOKEN" - gh auth login --with-token <<< "$GH_TOKEN" - - name: Assign reviewer env: #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer @@ -37,7 +32,11 @@ jobs: run: | echo "GH_TOKEN=$GH_TOKEN" echo "GH_TOKENS=$GH_TOKENS" + echo Get the pr_number pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) echo "pr_numer=$pr_number" + echo Authenticate login gh + gh auth login --with-token <<< "$GH_TOKEN" + echo Set the PR gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true From ee7201fc6186d3b0d6104f352d32471aa6a765e0 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 15:43:42 +0100 Subject: [PATCH 108/336] Test --- .github/workflows/pr-18.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 95d45a1ed8b..9633e3e05d3 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -30,6 +30,7 @@ jobs: #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | + echo "Run action by ${{ github.actor }}" echo "GH_TOKEN=$GH_TOKEN" echo "GH_TOKENS=$GH_TOKENS" echo Get the pr_number From 127b9701ff903ef0996ffd108cf07d17e31da5fc Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 15:43:42 +0100 Subject: [PATCH 109/336] Test --- .github/workflows/pr-18.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 95d45a1ed8b..f89d29c68b3 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -12,9 +12,9 @@ jobs: pr18: runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ github.token }} - GH_TOKENS: ${{ secrets.GITHUB_TOKEN }} + #env: + # GH_TOKEN: ${{ github.token }} + # GH_TOKENS: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout repository @@ -30,15 +30,15 @@ jobs: #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | - echo "GH_TOKEN=$GH_TOKEN" - echo "GH_TOKENS=$GH_TOKENS" + echo "Run action by ${{ github.actor }}" + echo "github.token=${{ github.token }}" + echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" + echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" echo Get the pr_number pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) - echo authenticatenv - gh auth login --with-token <<< "$GH_TOKEN" echo "pr_numer=$pr_number" echo Authenticate login gh - gh auth login --with-token <<< "$GH_TOKEN" + gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" echo Set the PR gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true From c3ede4413d70988e7432626f807f62321db84ff0 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 8 Dec 2024 16:01:45 +0100 Subject: [PATCH 110/336] Test --- .github/workflows/pr-18.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index f89d29c68b3..015b7b25694 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -36,9 +36,9 @@ jobs: echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" echo Get the pr_number pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) - echo "pr_numer=$pr_number" + echo "pr_number=$pr_number" echo Authenticate login gh gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" - echo Set the PR + echo Set the reviewere gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true From e2db3d213bb8fcb65fa5bf08cb1717faa69f1bc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 00:03:09 +0100 Subject: [PATCH 111/336] Fix phpunit --- .../class/recruitmentcandidature.class.php | 12 +----------- htdocs/recruitment/recruitmentcandidature_card.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index da8f3cd8f7f..43a1660efe8 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -160,7 +160,7 @@ class RecruitmentCandidature extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs; + global $langs; $this->db = $db; @@ -197,16 +197,6 @@ class RecruitmentCandidature extends CommonObject } } } - - if (GETPOST("action", "aZ09") == 'create') { - $reg = array(); - preg_match('/^(integer|link):(.*):(.*):(.*):(.*)/i', $this->fields['fk_recruitmentjobposition']['type'], $reg); - if (!empty($reg)) { - $this->fields['fk_recruitmentjobposition']['type'] .= " AND (t.status:=:1)"; - } else { - $this->fields['fk_recruitmentjobposition']['type'] .= ":(t.status:=:1)"; - } - } } /** diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 0c1d222e5c1..623170a50ef 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -87,6 +87,17 @@ $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'recruitment', $object->id, 'recruitment_recruitmentcandidature', 'recruitmentjobposition', '', 'rowid', $isdraft); +if (GETPOST("action", "aZ09") == 'create') { + $reg = array(); + preg_match('/^(integer|link):(.*):(.*):(.*):(.*)/i', $object->fields['fk_recruitmentjobposition']['type'], $reg); + if (!empty($reg)) { + $object->fields['fk_recruitmentjobposition']['type'] .= " AND (t.status:=:1)"; + } else { + $object->fields['fk_recruitmentjobposition']['type'] .= ":(t.status:=:1)"; + } +} + + /* * Actions */ From 0b3c15b7fa992cea3234e1b8a14e660d1a46fee4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 00:24:28 +0100 Subject: [PATCH 112/336] Fix phpunit --- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/compta/stats/index.php | 6 ++++-- htdocs/user/card.php | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fd25e728574..9a47f6eaa3b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -134,7 +134,7 @@ class Facture extends CommonInvoice public $ref_client; /** - * @var string customer ref + * @var ?string customer ref */ public $ref_customer; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 3a609b2a118..c2ebd13181e 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -501,9 +501,11 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { if ($modecompta=='CREANCES-DETTES') { $cumulative_previous_year = (!empty($cumulative_ht[$caseprev])?$cumulative_ht[$caseprev]:0); $cumulative_year = (!empty($cumulative_ht[$case])?$cumulative_ht[$case]:0); + $isset_cumulative_previous_year = isset($cumulative_ht[$caseprev]); } else { $cumulative_previous_year = (!empty($cumulative[$caseprev])?$cumulative[$caseprev]:0); $cumulative_year = (!empty($cumulative[$case])?$cumulative[$case]:0); + $isset_cumulative_previous_year = isset($cumulative_ht[$caseprev]); } if (!empty($cumulative_previous_year) && !empty($cumulative_year)) { $percent = (round(($cumulative_year - $cumulative_previous_year) / $cumulative_previous_year, 4) * 100); @@ -517,10 +519,10 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { //print '+Inf%'; print '-'; } - if (isset($cumulative_previous_year) && empty($cumulative_previous_year) && empty($cumulative_year)) { + if ($isset_cumulative_previous_year && empty($cumulative_previous_year) && empty($cumulative_year)) { print '+0%'; } - if (!isset($cumulative_previous_year) && empty($cumulative_year)) { + if (!$isset_cumulative_previous_year && empty($cumulative_year)) { print '-'; } } else { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3fbb42ad89f..b3d02e0d72d 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1217,7 +1217,7 @@ if ($action == 'create' || $action == 'adduserldap') { } // Other form for user password - $parameters = array('valuetoshow' => $valuetoshow, 'password' => $password, 'caneditpasswordandsee' => $caneditpasswordandsee, 'caneditpasswordandsend' => $caneditpasswordandsend); + $parameters = array('valuetoshow' => $valuetoshow, 'password' => $password, 'caneditpasswordandsee' => $permissiontoeditpasswordandsee, 'caneditpasswordandsend' => $permissiontoeditpasswordandsend); $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook > 0) { $valuetoshow = $hookmanager->resPrint; // to replace @@ -2041,7 +2041,7 @@ if ($action == 'create' || $action == 'adduserldap') { */ // Other form for user password - $parameters = array('valuetoshow' => $valuetoshow, 'caneditpasswordandsee' => $caneditpasswordandsee, 'caneditpasswordandsend' => $caneditpasswordandsend); + $parameters = array('valuetoshow' => $valuetoshow, 'caneditpasswordandsee' => $permissiontoeditpasswordandsee, 'caneditpasswordandsend' => $permissiontoeditpasswordandsend); $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook > 0) { $valuetoshow = $hookmanager->resPrint; // to replace From fe4823d9ad4cbaa12ba13bbba7a5ef6651c1aa7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 00:43:37 +0100 Subject: [PATCH 113/336] Fix phpunit --- htdocs/compta/facture/class/facture.class.php | 6 +++--- htdocs/core/class/commonobject.class.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9a47f6eaa3b..3413603f4e7 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -134,7 +134,7 @@ class Facture extends CommonInvoice public $ref_client; /** - * @var ?string customer ref + * @var string customer ref */ public $ref_customer; @@ -2517,10 +2517,10 @@ class Facture extends CommonInvoice $this->ref_ext = trim($this->ref_ext); } // deprecated - if (isset($this->ref_client)) { + if (!empty($this->ref_client)) { $this->ref_client = trim($this->ref_client); } - if (isset($this->ref_customer)) { + if (!empty($this->ref_customer)) { $this->ref_customer = trim($this->ref_customer); } if (isset($this->increment)) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c8561ea36f8..36d18936065 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6611,7 +6611,7 @@ abstract class CommonObject */ public function insertExtraFields($trigger = '', $userused = null) { - global $conf, $langs, $user; + global $langs, $user; if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { return 0; From bdaa0a005822ff4690a87c2ea58951223343cebd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 00:58:38 +0100 Subject: [PATCH 114/336] Fix phpstan --- htdocs/compta/facture/class/facture.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3413603f4e7..3ccd5441aa1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2551,7 +2551,6 @@ class Facture extends CommonInvoice $this->retained_warranty = (float) $this->retained_warranty; } - // Check parameters // Put here code to add control on parameters values @@ -2561,7 +2560,7 @@ class Facture extends CommonInvoice $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").","; $sql .= " type=".(isset($this->type) ? $this->db->escape($this->type) : "null").","; $sql .= " subtype=".(isset($this->subtype) ? $this->db->escape($this->subtype) : "null").","; - $sql .= " ref_client=".(isset($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : (isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null")).","; + $sql .= " ref_client=".(!empty($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : (isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null")).","; $sql .= " increment=".(isset($this->increment) ? "'".$this->db->escape($this->increment)."'" : "null").","; $sql .= " fk_soc=".(isset($this->socid) ? $this->db->escape($this->socid) : "null").","; $sql .= " datec=".(strval($this->date_creation) != '' ? "'".$this->db->idate($this->date_creation)."'" : 'null').","; From 30893bf6760101bca7e42c2a55c9ae6ad6947b8c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 08:36:07 +0100 Subject: [PATCH 115/336] Test --- .github/workflows/pr-18.yaml | 3 ++- .github/workflows/test.yaml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 015b7b25694..692faf4ad2d 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -39,6 +39,7 @@ jobs: echo "pr_number=$pr_number" echo Authenticate login gh gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" - echo Set the reviewere + gh auth setup-git + echo Set the reviewer gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 78c29dd9388..86e2e445339 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,6 +20,10 @@ jobs: steps: - name: Log run: | + echo "Run action by ${{ github.actor }}" + echo "github.token=${{ github.token }}" + echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" + echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" echo "repo-token: ${{secrets.GITHUB_TOKEN}}" echo "variable org: ${{vars.AAA}}" echo "env prg: ${{env.AAA}}" From cfd491982902f0b78db51362d1af94394477a5c2 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 08:40:25 +0100 Subject: [PATCH 116/336] Test --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 86e2e445339..30ccca5b0e9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,7 +32,7 @@ jobs: echo "variable repository of orga: ${{vars.CCC}}" echo "ENVGHT: ${{env.ENVGHT}}" echo "ENVGHU: ${{env.ENVGHU}}" - echo "VARAAA: ${{env.VARAAA}}" + echo "VARAAA: ${{vars.AAA}}" echo "ENVAAA: ${{env.VARAAA}}" echo "VARREPORGCCC: ${{env.VARREPORGCCC}}" - echo "ENVFIX: ${{env.abc}}" + echo "ENVFIX: ${{env.ENVFIX}}" From 25d0d4e851b881bafbf28880e7afe6c4cc5235fe Mon Sep 17 00:00:00 2001 From: Maximilien Valenzano Date: Mon, 9 Dec 2024 09:47:37 +0100 Subject: [PATCH 117/336] fix(invoice): mutlicurrency_tx correct value by float on compta & fourn --- htdocs/compta/facture/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e6296d0860f..b4e8128ffaa 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1093,7 +1093,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOST('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx'); // Special properties of replacement invoice $object->fk_facture_source = GETPOSTINT('fac_replacement'); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index ed924373e5e..16bc4adf788 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -836,7 +836,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx'); $object->transport_mode_id = GETPOSTINT('transport_mode_id'); // Proprietes particulieres a facture de replacement From 5c2b0b432106be9d3479fba8810474fc7bca2e10 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 11:20:35 +0100 Subject: [PATCH 118/336] Debug v21 --- htdocs/takepos/invoice.php | 4 +++- htdocs/takepos/pay.php | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index e557d95de02..26ad8eaa9ef 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -308,10 +308,11 @@ if (empty($reshook)) { if ($pay != "delayed") { $payment->create($user); + $res = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); if ($res < 0) { $error++; - dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined'), $payment->errors, 1); + dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined').' '.$payment->error, $payment->errors, 1); } $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded } elseif (getDolGlobalInt("TAKEPOS_DELAYED_TERMS")) { @@ -324,6 +325,7 @@ if (empty($reshook)) { $result = $invoice->setPaid($user); if ($result > 0) { $invoice->paye = 1; + $invoice->status = $invoice::STATUS_CLOSED; } // set payment method $invoice->setPaymentMethods($paiementid); diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index f60e08dd546..4bc6cf0d0b3 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -539,6 +539,7 @@ if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) { currency = '.$conf->currency.' - sessioncurrency = '.$sessioncurrency.' -->'."\n"; if (isModEnabled('multicurrency') && $sessioncurrency != "" && $conf->currency != $sessioncurrency) { // Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency $showothercurrency = 1; @@ -560,7 +561,7 @@ if (isModEnabled('multicurrency') && $sessioncurrency != "" && $conf->currency ! total_ttc) { ?>
trans('RemainToPay'); ?>: multicurrency_code); + echo price($remaintopay, 1, '', 1, -1, -1, $conf->currency); if ($showothercurrency) { print '   (' . price($remaintopay * $multicurrency->rate->rate) . ' ' . $sessioncurrency . ')'; } @@ -569,7 +570,7 @@ if (isModEnabled('multicurrency') && $sessioncurrency != "" && $conf->currency !
trans("Received"); ?>: multicurrency_code); + echo price(0, 1, '', 1, -1, -1, $conf->currency); if ($showothercurrency) { print '   (' . price(0 * $multicurrency->rate->rate) . ' ' . $sessioncurrency . ')'; } @@ -577,7 +578,7 @@ if (isModEnabled('multicurrency') && $sessioncurrency != "" && $conf->currency !
trans("Change"); ?>: multicurrency_code); + echo price(0, 1, '', 1, -1, -1, $conf->currency); if ($showothercurrency) { print '   (' . price(0 * $multicurrency->rate->rate) . ' ' . $sessioncurrency . ')'; } From cd2ea4e66f564ab07526aad93df7c805378d79b1 Mon Sep 17 00:00:00 2001 From: Leonardo Pedroza Date: Mon, 9 Dec 2024 11:37:46 +0100 Subject: [PATCH 119/336] Fix: accountancy import for FEC files to avoid double escaped values in query ( '\'D\'') --- htdocs/accountancy/class/accountancyimport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index bcf7905f223..a35235e0218 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -136,7 +136,7 @@ class AccountancyImport $sens = 'C'; } - return "'" . $this->db->escape($sens) . "'"; + return $sens; } return "''"; From b86c1b22f4d4a120619f5a33d02f9a6b3a498afe Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:46:47 +0100 Subject: [PATCH 120/336] Update Closure Income Labels --- htdocs/accountancy/class/bookkeeping.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index bb6d102843d..c93a8e47b57 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2798,10 +2798,10 @@ class BookKeeping extends CommonObject $bookkeeping = new BookKeeping($this->db); $bookkeeping->doc_date = $new_fiscal_period->date_start; $bookkeeping->date_lim_reglement = ''; - $bookkeeping->doc_ref = $new_fiscal_period->label; + $bookkeeping->doc_ref = $fiscal_period->label; $bookkeeping->date_creation = $now; $bookkeeping->doc_type = 'closure'; - $bookkeeping->fk_doc = $new_fiscal_period->id; + $bookkeeping->fk_doc = $fiscal_period->id; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = ''; From 9de5e7aa517309302e77a875fb8a5e372a7bb35a Mon Sep 17 00:00:00 2001 From: Dolibot Date: Mon, 9 Dec 2024 12:07:43 +0000 Subject: [PATCH 121/336] PHPStan > Update baseline --- build/phpstan/phpstan-baseline.neon | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 014b1ef249e..0863ab2d843 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -6075,7 +6075,7 @@ parameters: - message: '#^Property Facture\:\:\$ref_client \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property - count: 2 + count: 1 path: ../../htdocs/compta/facture/class/facture.class.php - @@ -32058,18 +32058,6 @@ parameters: count: 1 path: ../../htdocs/takepos/printbox.php - - - message: '#^Path in require\(\) "//takepos/invoice\.php" is not a file or it does not exist\.$#' - identifier: require.fileNotFound - count: 1 - path: ../../htdocs/takepos/public/auto_order.php - - - - message: '#^Path in require\(\) "//takepos/phone\.php" is not a file or it does not exist\.$#' - identifier: require.fileNotFound - count: 1 - path: ../../htdocs/takepos/public/auto_order.php - - message: '#^Parameter \#2 \$addpercent of function vatrate expects bool, int given\.$#' identifier: argument.type From 5fa3881f644431aa0a756422da9ba18558404dc3 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 14:07:37 +0100 Subject: [PATCH 122/336] Debug v21 --- .../compta/paiement/class/paiement.class.php | 26 ++++++++++++++----- htdocs/langs/en_US/errors.lang | 1 + .../class/multicurrency.class.php | 13 +++++----- htdocs/takepos/invoice.php | 10 +++++-- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 900a9b16101..8aafb996656 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -334,8 +334,22 @@ class Paiement extends CommonObject if (empty($value)) { continue; } - // $key is id of invoice, $value is amount, $way is a 'dolibarr' if amount is in main currency, 'customer' if in foreign currency - $value_converted = MultiCurrency::getAmountConversionFromInvoiceRate($key, $value, $way); + + $tmparray = MultiCurrency::getInvoiceRate($key, 'facture'); + $invoice_multicurrency_tx = $tmparray['invoice_multicurrency_tx']; + $invoice_multicurrency_code = $tmparray['invoice_multicurrency_code']; + + // $key is id of invoice, $value is amount, $way is 'dolibarr' if amount is in main currency, 'customer' if in foreign currency + if ($invoice_multicurrency_tx) { + if ($way == 'dolibarr') { + $value_converted = (float) price2num($value * $invoice_multicurrency_tx, 'MU'); + } else { + $value_converted = (float) price2num($value / $invoice_multicurrency_tx, 'MU'); + } + } else { + $invoice_multicurrency_tx = false; + } + // Add controls of input validity if ($value_converted === false) { // We failed to find the conversion for one invoice @@ -344,8 +358,8 @@ class Paiement extends CommonObject } // Set the currency of the invoice - $currencyofinvoiceforthisline = empty($this->multicurrency_code[$key]) ? $conf->currency : $this->multicurrency_code[$key]; - // If a payment was enter into section of foreign currency of invoice, we want to pay in the currency if invoice + $currencyofinvoiceforthisline = empty($this->multicurrency_code[$key]) ? $invoice_multicurrency_code : $this->multicurrency_code[$key]; + // If a payment was entered into the section of the foreign currency of invoice, we want to pay in the currency of invoice $currencyofpaymentforthisline = empty($this->multicurrency_amounts[$key]) ? $conf->currency : $this->multicurrency_code[$key]; //var_dump("Invoice ID: ".$key.", amount in company cur:".$this->amounts[$key]." amount in invoice cur:".$this->multicurrency_amounts[$key]." => currencyofinvoice= ".$currencyofinvoiceforthisline." - currencyofpaymentforthisline =".$currencyofpaymentforthisline); @@ -1310,12 +1324,10 @@ class Paiement extends CommonObject */ public function getWay() { - global $conf; - $way = 'dolibarr'; if (isModEnabled('multicurrency')) { foreach ($this->multicurrency_amounts as $value) { - if (!empty($value)) { // one value found then payment is in invoice currency + if (!empty($value)) { // one value found into multicurrency_amounts so payment is in invoice currency $way = 'customer'; break; } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 1c6073a0189..0e6576f3176 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -349,6 +349,7 @@ ErrorUserClone=Error when clone categories user ErrorQtyOrderedLessQtyShipped = The quantity ordered cannot be less than the quantity shipped. ErrorVariousPaymentOnBankAccountWithADifferentCurrencyNotYetSupported=Error, creating a various payment on a bank account with a currency different than the currency of the company is not yet supported. ErrorStreamMustBeEnabled=The PHP stream %s is not available. Check your PHP modules and Dolibarr parameter $dolibarr_main_stream_to_disable. +ErrorYouTryToPayInvoicesWithDifferentCurrenciesInSamePayment=Error, you try to pay different invoices with different currencies in the same payment # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index b02c662f514..e749b7c0647 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -528,8 +528,6 @@ class MultiCurrency extends CommonObject */ public static function getIdAndTxFromCode($dbs, $code, $date_document = '') { - global $conf; - $sql1 = "SELECT m.rowid, mc.rate FROM ".MAIN_DB_PREFIX."multicurrency m"; $sql1 .= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)'; @@ -574,7 +572,8 @@ class MultiCurrency extends CommonObject if (!is_null($invoice_rate)) { $multicurrency_tx = $invoice_rate; } else { - $multicurrency_tx = self::getInvoiceRate($fk_facture, $table); + $tmparray = self::getInvoiceRate($fk_facture, $table); + $multicurrency_tx = $tmparray['invoice_multicurrency_tx']; } if ($multicurrency_tx) { @@ -593,18 +592,20 @@ class MultiCurrency extends CommonObject * * @param int $fk_facture id of facture * @param string $table facture or facture_fourn - * @return float|bool Rate of currency or false if error + * @return array|bool Rate and code of currency or false if error */ public static function getInvoiceRate($fk_facture, $table = 'facture') { global $db; - $sql = "SELECT multicurrency_tx FROM ".MAIN_DB_PREFIX.$table." WHERE rowid = ".((int) $fk_facture); + $sql = "SELECT multicurrency_tx, multicurrency_code"; + $sql .= " FROM ".MAIN_DB_PREFIX.$db->sanitize($table); + $sql .= " WHERE rowid = ".((int) $fk_facture); dol_syslog(__METHOD__, LOG_DEBUG); $resql = $db->query($sql); if ($resql && ($line = $db->fetch_object($resql))) { - return $line->multicurrency_tx; + return array('invoice_multicurrency_tx' => $line->multicurrency_tx, 'invoice_multicurrency_code' => $line->multicurrency_code); } return false; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 26ad8eaa9ef..604fb1dd176 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -290,24 +290,30 @@ if (empty($reshook)) { $remaintopay = $invoice->getRemainToPay(); if ($remaintopay > 0) { $payment = new Paiement($db); + $payment->datepaye = $now; $payment->fk_account = $bankaccount; - $payment->amounts[$invoice->id] = $amountofpayment; if ($pay == 'LIQ') { $payment->pos_change = GETPOSTFLOAT('excess'); } + $payment->amounts[$invoice->id] = $amountofpayment; // If user has not used change control, add total invoice payment // Or if user has used change control and the amount of payment is higher than remain to pay, add the remain to pay if ($amountofpayment <= 0 || $amountofpayment > $remaintopay) { $payment->amounts[$invoice->id] = $remaintopay; } + // We do not set $payments->multicurrency_amounts because we want payment to be in main currency. $payment->paiementid = $paiementid; $payment->num_payment = $invoice->ref; if ($pay != "delayed") { - $payment->create($user); + $res = $payment->create($user); + if ($res < 0) { + $error++; + dol_htmloutput_errors($langs->trans('Error').' '.$payment->error, $payment->errors, 1); + } $res = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); if ($res < 0) { From 20b85af7eebef5ea8e0d3d71a3cd95182987d570 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 14:19:47 +0100 Subject: [PATCH 123/336] Rename file --- ...d-lines-count-labeler.yml => changed-lines-count-labeler.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{changed-lines-count-labeler.yml => changed-lines-count-labeler.yml} (100%) diff --git a/.github/changed-lines-count-labeler.yml b/.github/changed-lines-count-labeler.yml similarity index 100% rename from .github/changed-lines-count-labeler.yml rename to .github/changed-lines-count-labeler.yml From 3c22179183b44f991b7437afbcdd57c44ab22881 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 14:20:28 +0100 Subject: [PATCH 124/336] Rename file --- ...d-lines-count-labeler.yml => changed-lines-count-labeler.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{changed-lines-count-labeler.yml => changed-lines-count-labeler.yml} (100%) diff --git a/.github/changed-lines-count-labeler.yml b/.github/changed-lines-count-labeler.yml similarity index 100% rename from .github/changed-lines-count-labeler.yml rename to .github/changed-lines-count-labeler.yml From 5c936ca953841eb462dd070ebf1f04362130fb9e Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 14:21:07 +0100 Subject: [PATCH 125/336] Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0 From 505449451b21d23300c6824d9b6f3e6e22a3203f Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:41:57 +0100 Subject: [PATCH 126/336] fix hook result --- htdocs/core/lib/pdf.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 92b538c5824..5358fa5af52 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2618,8 +2618,9 @@ function pdf_getLinkedObjects(&$object, $outputlangs) if (is_object($hookmanager)) { $parameters = array('linkedobjects' => $linkedobjects, 'outputlangs' => $outputlangs); $action = ''; - $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if (!empty($hookmanager->resArray)) { + $reshook = $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook>0) { + // The array must be reinserted even if it is empty because clearing the array could be one of the actions performed by the hook. $linkedobjects = $hookmanager->resArray; } } From 46931f2ef68a5d09671717c70f6fa786c4646c30 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 14:50:21 +0100 Subject: [PATCH 127/336] Doc --- htdocs/core/modules/import/import_csv.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 10b889aa345..6d9e7c32e22 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -830,7 +830,7 @@ class ImportCsv extends ModeleImports $tmp = explode('-', $tmpval, 2); $listfields[] = $keyfield; $listvalues[] = "'".$this->db->escape($tmp[1])."'"; - } elseif (preg_match('/^rule-/', $tmpval)) { + } elseif (preg_match('/^rule-/', $tmpval)) { // Example: rule-computeAmount, rule-computeDirection, ... $fieldname = $tmpkey; if (!empty($objimport->array_import_convertvalue[0][$fieldname])) { if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') { From 26149e5936535cc81e356b72fba332f19ab761f2 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 14:52:59 +0100 Subject: [PATCH 128/336] Fix comment --- htdocs/admin/stock.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 258fd52e511..7e87218c977 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -371,7 +371,7 @@ print "\n\n"; $found++; if (isModEnabled("reception")) { - print ''; + print ''; print ''; print ''.$langs->trans("StockOnReception").''; print ''; @@ -386,7 +386,7 @@ if (isModEnabled("reception")) { print "\n\n"; $found++; - + print ''; print ''; print ''.$langs->trans("StockOnReceptionOnClosing").''; print ''; From 15d953643b3498ccc2746757a56debbc5fdcd4b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 15:00:49 +0100 Subject: [PATCH 129/336] Update card.php --- htdocs/compta/facture/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b4e8128ffaa..58879c7a831 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1154,7 +1154,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOST('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx'); // Special properties of replacement invoice $object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : ''; @@ -1393,7 +1393,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOST('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx'); // Source facture $object->fac_rec = GETPOSTINT('fac_rec'); @@ -1480,7 +1480,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOSTINT('incoterm_id'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOST('originmulticurrency_tx'); + $object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx'); if (GETPOST('type') == Facture::TYPE_SITUATION) { $object->situation_counter = 1; From 8eb71ace1407ed133baebb344331bc057a16f864 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 15:10:49 +0100 Subject: [PATCH 130/336] Doc --- htdocs/core/class/hookmanager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 8a7022106be..8cef23ff282 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -232,7 +232,7 @@ class HookManager // Define type of hook ('output' or 'addreplace'). $hooktype = 'addreplace'; - // TODO Remove hooks with type 'output' (example createFrom). All hooks must be converted into 'addreplace' hooks. + // TODO Remove hooks with type 'output' (example createFrom). All these hooks must be converted into 'addreplace' hooks. if (in_array($method, array( 'createFrom', 'dashboardAccountancy', From cceccabc9c61a457aa81107821d22a3b22ae6968 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 16:00:47 +0100 Subject: [PATCH 131/336] Fix missing $notrigger param --- htdocs/contrat/class/contrat.class.php | 23 ++++++++++------------- htdocs/core/class/commonobject.class.php | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 5df75ee1c28..0f83d2dc1f4 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1006,12 +1006,13 @@ class Contrat extends CommonObject /** * Create a contract into database * - * @param User $user User that create - * @return int Return integer <0 if KO, id of contract if OK + * @param User $user User that create + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int Return integer <0 if KO, id of contract if OK */ - public function create($user) + public function create($user, $notrigger = 0) { - global $conf, $langs, $mysoc; + global $conf, $langs; // Check parameters $paramsok = 1; @@ -1167,22 +1168,18 @@ class Contrat extends CommonObject } } - if (!$error) { + if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('CONTRACT_CREATE', $user); if ($result < 0) { $error++; } // End call triggers + } - if (!$error) { - $this->db->commit(); - return $this->id; - } else { - dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR); - $this->db->rollback(); - return -3; - } + if (!$error) { + $this->db->commit(); + return $this->id; } else { $this->error = "Failed to add contract"; dol_syslog(get_class($this)."::create - 20 - ".$this->error, LOG_ERR); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 36d18936065..caa1db00df2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6604,7 +6604,7 @@ abstract class CommonObject * Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...) * This function delete record with all extrafields and insert them again from the array $this->array_options. * - * @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY) + * @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY). Must be used for action 'update_extras'. For other actions, trigger is called explicitly by caller. * @param User $userused Object user * @return int<-1,1> -1=error, O=did nothing, 1=OK * @see insertExtraLanguages(), updateExtraField(), deleteExtraField(), setValueFrom() From 98ba156c25b807bef7787db9a910ae655774824c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:07:03 +0100 Subject: [PATCH 132/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/comm/recap-client.php | 5 +++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 0863ab2d843..b5270503279 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -4638,12 +4638,6 @@ parameters: count: 1 path: ../../htdocs/comm/propal/tpl/linkedobjectblock.tpl.php - - - message: '#^Variable \$id might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/comm/recap-client.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php index 550baca1931..f50a69286ed 100644 --- a/htdocs/comm/recap-client.php +++ b/htdocs/comm/recap-client.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -44,6 +44,7 @@ if (isModEnabled('invoice')) { // Security check $socid = GETPOSTINT("socid"); +$id = 0; if ($user->socid > 0) { $action = ''; $id = $user->socid; From 6295abe93796b158abe56b44ee51bd9af54ce98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:07:42 +0100 Subject: [PATCH 133/336] fix phpstan --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 30ccca5b0e9..dc0bfbdf63c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: steps: - name: Log run: | - echo "Run action by ${{ github.actor }}" + echo "Run action by ${{ github.actor }}" echo "github.token=${{ github.token }}" echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" From be58d54709876b1fc47766c0f695016aeec846dd Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 9 Dec 2024 16:16:32 +0100 Subject: [PATCH 134/336] Fix CI --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 30ccca5b0e9..dc0bfbdf63c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: steps: - name: Log run: | - echo "Run action by ${{ github.actor }}" + echo "Run action by ${{ github.actor }}" echo "github.token=${{ github.token }}" echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" From a2d51a8ae56624fd6f640057ae9f325d89cd2d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:24:01 +0100 Subject: [PATCH 135/336] fix phpstan --- .github/workflows/test.yaml | 2 +- build/phpstan/phpstan-baseline.neon | 30 --------------------- htdocs/compta/bank/various_payment/list.php | 13 ++++----- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 30ccca5b0e9..dc0bfbdf63c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: steps: - name: Log run: | - echo "Run action by ${{ github.actor }}" + echo "Run action by ${{ github.actor }}" echo "github.token=${{ github.token }}" echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 0863ab2d843..fd515408bf0 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -5496,42 +5496,12 @@ parameters: count: 1 path: ../../htdocs/compta/bank/various_payment/list.php - - - message: '#^Variable \$accountingaccount might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../htdocs/compta/bank/various_payment/list.php - - - - message: '#^Variable \$accountingjournal might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/compta/bank/various_payment/list.php - - - - message: '#^Variable \$accountstatic might not be defined\.$#' - identifier: variable.undefined - count: 7 - path: ../../htdocs/compta/bank/various_payment/list.php - - - - message: '#^Variable \$bankline might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/compta/bank/various_payment/list.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable count: 1 path: ../../htdocs/compta/bank/various_payment/list.php - - - message: '#^Variable \$variousstatic might not be defined\.$#' - identifier: variable.undefined - count: 12 - path: ../../htdocs/compta/bank/various_payment/list.php - - message: '#^Loose comparison using \=\= between ''card'' and ''card'' will always evaluate to true\.$#' identifier: equal.alwaysTrue diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index bfb4a783c65..a9abe660819 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -239,24 +239,21 @@ if (empty($reshook)) { $form = new Form($db); $proj = null; +$bankline = new AccountLine($db); +$variousstatic = new PaymentVarious($db); +$accountstatic = null; if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) { $formaccounting = new FormAccounting($db); } if ($arrayfields['bank']['checked'] && isModEnabled('accounting')) { $accountingjournal = new AccountingJournal($db); } -if ($arrayfields['ref']['checked']) { - $variousstatic = new PaymentVarious($db); -} if ($arrayfields['bank']['checked']) { - $accountstatic = new Account($db); + $accountstatic = new Account($db); } if ($arrayfields['project']['checked']) { $proj = new Project($db); } -if ($arrayfields['entry']['checked']) { - $bankline = new AccountLine($db); -} if ($arrayfields['account']['checked']) { $accountingaccount = new AccountingAccount($db); } @@ -817,7 +814,7 @@ while ($i < $imaxinloop) { } // Bank account - if ($arrayfields['bank']['checked']) { + if ($arrayfields['bank']['checked'] && is_object($accountstatic)) { print ''; if ($obj->bid > 0) { $accountstatic->id = $obj->bid; From 88f71557d6c1d587513b330d247ba12b4a6d099d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:24:24 +0100 Subject: [PATCH 136/336] fix phpstan --- htdocs/compta/bank/various_payment/list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index a9abe660819..3efe6c3e0c0 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -239,6 +239,7 @@ if (empty($reshook)) { $form = new Form($db); $proj = null; +$accountingaccount = new AccountingAccount($db); $bankline = new AccountLine($db); $variousstatic = new PaymentVarious($db); $accountstatic = null; @@ -254,9 +255,6 @@ if ($arrayfields['bank']['checked']) { if ($arrayfields['project']['checked']) { $proj = new Project($db); } -if ($arrayfields['account']['checked']) { - $accountingaccount = new AccountingAccount($db); -} $title = $langs->trans("VariousPayments"); //$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject"; From 956cea11674f36c8079d03b6277734f0221bb032 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:24:57 +0100 Subject: [PATCH 137/336] fix missing concat --- htdocs/core/lib/pdf.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 5358fa5af52..92f2c55aa73 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2619,7 +2619,9 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $parameters = array('linkedobjects' => $linkedobjects, 'outputlangs' => $outputlangs); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook>0) { + if (empty($reshook)) { + $linkedobjects = array_replace($linkedobjects, $hookmanager->resArray); // array_replace is used to preserve keys + } elseif ($reshook>0) { // The array must be reinserted even if it is empty because clearing the array could be one of the actions performed by the hook. $linkedobjects = $hookmanager->resArray; } From b10dc8e141637c1f5613bda7555b23da279ef274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:34:26 +0100 Subject: [PATCH 138/336] fix --- htdocs/multicurrency/class/multicurrency.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index e749b7c0647..8f4af567800 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -592,7 +592,7 @@ class MultiCurrency extends CommonObject * * @param int $fk_facture id of facture * @param string $table facture or facture_fourn - * @return array|bool Rate and code of currency or false if error + * @return array{invoice_multicurrency_tx: float,invoice_multicurrency_code: string}|bool Rate and code of currency or false if error */ public static function getInvoiceRate($fk_facture, $table = 'facture') { From 34f2546120098f2b42b89327f6fd44aec0f7ade1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2024 16:43:50 +0100 Subject: [PATCH 139/336] fix --- htdocs/compta/paiement/class/paiement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 8aafb996656..cbe1c9b4111 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -334,7 +334,7 @@ class Paiement extends CommonObject if (empty($value)) { continue; } - + $value_converted = false; $tmparray = MultiCurrency::getInvoiceRate($key, 'facture'); $invoice_multicurrency_tx = $tmparray['invoice_multicurrency_tx']; $invoice_multicurrency_code = $tmparray['invoice_multicurrency_code']; From f8bd644b58b6a6d25b6bc0c1aed83e7acbdbf267 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 9 Dec 2024 17:41:56 +0100 Subject: [PATCH 140/336] fix: Variant with multiprice, on creation of variant, percent variation is not save --- htdocs/product/class/product.class.php | 4 ++-- htdocs/variants/class/ProductCombination.class.php | 12 ++++++------ htdocs/variants/combinations.php | 11 ++++++----- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 271f08be9d0..faa655b9bdc 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2668,7 +2668,7 @@ class Product extends CommonObject // Load multiprices array if (getDolGlobalString('PRODUIT_MULTIPRICES') && empty($ignore_price_load)) { // prices per segment - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { + for ($i = 1; $i <= getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); $i++) { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly"; $sql .= " FROM ".$this->db->prefix()."product_price"; @@ -2778,7 +2778,7 @@ class Product extends CommonObject return -1; } } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') && empty($ignore_price_load)) { // prices per customer and quantity - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { + for ($i = 1; $i <= getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); $i++) { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly"; $sql .= " FROM ".$this->db->prefix()."product_price"; diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 7a2212ca55b..cc2c56c8f1b 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -526,12 +526,12 @@ class ProductCombination // MultiPrix if (getDolGlobalString('PRODUIT_MULTIPRICES')) { - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { + for ($i = 1; $i <= getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); $i++) { if ($parent->multiprices[$i] != '' || isset($this->combination_price_levels[$i]->variation_price)) { $new_type = empty($parent->multiprices_base_type[$i]) ? 'HT' : $parent->multiprices_base_type[$i]; $new_min_price = $parent->multiprices_min[$i]; $variation_price = (float) (!isset($this->combination_price_levels[$i]->variation_price) ? $this->variation_price : $this->combination_price_levels[$i]->variation_price); - $variation_price_percentage = (float) (!isset($this->combination_price_levels[$i]->variation_price_percentage) ? $this->variation_price_percentage : $this->combination_price_levels[$i]->variation_price_percentage); + $variation_price_percentage = (bool) (!isset($this->combination_price_levels[$i]->variation_price_percentage) ? $this->variation_price_percentage : $this->combination_price_levels[$i]->variation_price_percentage); if ($parent->prices_by_qty_list[$i]) { $new_psq = 1; @@ -828,21 +828,21 @@ class ProductCombination $newproduct->description .= ''.$prodattr->label.': '.$prodattrval->value; } - $newcomb->variation_price_percentage = $price_var_percent[1]; + $newcomb->variation_price_percentage = (bool) $price_var_percent[1]; $newcomb->variation_price = $price_impact[1]; $newcomb->variation_weight = $weight_impact; $newcomb->variation_ref_ext = $this->db->escape($ref_ext); // Init price level - if ($conf->global->PRODUIT_MULTIPRICES) { - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { + if (getDolGlobalString('PRODUIT_MULTIPRICES')) { + for ($i = 1; $i <= getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); $i++) { $productCombinationLevel = new ProductCombinationLevel($this->db); $productCombinationLevel->fk_product_attribute_combination = $newcomb->id; $productCombinationLevel->fk_price_level = $i; $productCombinationLevel->variation_price = $price_impact[$i]; if (is_array($price_var_percent)) { - $productCombinationLevel->variation_price_percentage = (empty($price_var_percent[$i]) ? false : $price_var_percent[$i]); + $productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i] ; } else { $productCombinationLevel->variation_price_percentage = $price_var_percent; } diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index cad40bcf1e5..663a567c31a 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -295,7 +295,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( if (getDolGlobalString('PRODUIT_MULTIPRICES')) { $prodcomb->combination_price_levels = array(); - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { + for ($i = 1; $i <= getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); $i++) { $productCombinationLevel = new ProductCombinationLevel($db); $productCombinationLevel->fk_product_attribute_combination = $prodcomb->id; $productCombinationLevel->fk_price_level = $i; @@ -717,14 +717,15 @@ if (!empty($id) || !empty($ref)) { - > + + > fetchCombinationPriceLevels(); - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { + for ($i = 1; $i <= getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); $i++) { $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$i; $text = $langs->trans('ImpactOnPriceLevel', $i).' - '.getDolGlobalString($keyforlabel); print ''; @@ -734,7 +735,7 @@ if (!empty($id) || !empty($ref)) { } print ''; print ''; - print 'combination_price_levels[$i]->variation_price_percentage) ? ' checked' : '').'> '; + print 'combination_price_levels[$i]->variation_price_percentage ? ' checked' : '').'> '; print ''; print ''; @@ -761,7 +762,7 @@ if (!empty($id) || !empty($ref)) { let priceImpact = $( "#level_price_impact_1" ).val(); let priceImpactPrecent = $( "#level_price_impact_percent_1" ).prop("checked"); - var multipricelimit = global->PRODUIT_MULTIPRICES_LIMIT); ?> + let multipricelimit = for (let i = 2; i <= multipricelimit; i++) { $( "#level_price_impact_" + i ).val(priceImpact); From ea935b5978deb425145a9fbd8c6615098a780002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 9 Dec 2024 18:22:03 +0100 Subject: [PATCH 141/336] fix phpstan --- scripts/emailings/reset-invalid-emails.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/emailings/reset-invalid-emails.php b/scripts/emailings/reset-invalid-emails.php index cb78837d1bd..0c466bd2182 100755 --- a/scripts/emailings/reset-invalid-emails.php +++ b/scripts/emailings/reset-invalid-emails.php @@ -1,6 +1,7 @@ #!/usr/bin/env php + * Copyright (C) 2024 Frédéric France * * 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 @@ -53,7 +54,12 @@ require_once $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; require_once DOL_DOCUMENT_ROOT."/comm/mailing/class/mailing.class.php"; - +/** + * @var DoliDB $db + * @var HookManager $hookmanager + * + * @var int $dolibarr_main_db_readonly + */ // Global variables $version = DOL_VERSION; $error = 0; From 981c13c788369df700b29e3e9229a7b0d08e1ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 9 Dec 2024 18:24:16 +0100 Subject: [PATCH 142/336] fix phpstan --- scripts/bank/export-bank-receipts.php | 12 +++++++++--- scripts/emailings/reset-invalid-emails.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index 5bea3fe5f34..e25a7c03b3c 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -1,8 +1,9 @@ #!/usr/bin/env php - * Copyright (C) 2024 MDW + * Copyright (C) 2013 Laurent Destailleur + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -53,7 +54,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php'; - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + */ // Global variables $version = DOL_VERSION; $error = 0; diff --git a/scripts/emailings/reset-invalid-emails.php b/scripts/emailings/reset-invalid-emails.php index 0c466bd2182..317c40abc16 100755 --- a/scripts/emailings/reset-invalid-emails.php +++ b/scripts/emailings/reset-invalid-emails.php @@ -1,6 +1,6 @@ #!/usr/bin/env php +/* Copyright (C) 2020 Laurent Destailleur * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify From 5d88c2251e580600563a1033614c78a55a6ae349 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 21:29:15 +0100 Subject: [PATCH 143/336] Debug v21 --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- htdocs/fourn/facture/card.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 8b58ba7879b..be49279b2ef 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -206,7 +206,7 @@ if ($nolinesbefore) { // Free line $labelforempty = 1; - print ''; + print ''; // Show radio for the non predefined product if ($forceall >= 0 && (isModEnabled("product") || isModEnabled("service"))) { print ''; } // Predefined product/service diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 1a4ec0045d0..d306837e053 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3595,7 +3595,7 @@ if ($action == 'create') { print ''; - // List of payments + // List of payments already done $totalpaid = 0; @@ -3649,8 +3649,8 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; if (isModEnabled("bank")) { print ''; } From f667a85f292a5b66000b35de2936f9a8eb8ecd0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 9 Dec 2024 21:53:06 +0100 Subject: [PATCH 144/336] clean baseline --- build/phpstan/phpstan-baseline.neon | 36 ----------------------------- 1 file changed, 36 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b5270503279..ad391a528f5 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -34218,30 +34218,6 @@ parameters: count: 1 path: ../../htdocs/zapier/class/api_zapier.class.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/bank/export-bank-receipts.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 27 - path: ../../scripts/bank/export-bank-receipts.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/bank/export-bank-receipts.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 9 - path: ../../scripts/bank/export-bank-receipts.php - - message: '#^Variable \$num in isset\(\) always exists and is not nullable\.$#' identifier: isset.variable @@ -34296,18 +34272,6 @@ parameters: count: 1 path: ../../scripts/emailings/reset-invalid-emails.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 21 - path: ../../scripts/emailings/reset-invalid-emails.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/emailings/reset-invalid-emails.php - - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined From c7c8542039e03d7927dc83e13e4b5aa61355f9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 9 Dec 2024 22:02:52 +0100 Subject: [PATCH 145/336] clean baseline --- htdocs/compta/bank/various_payment/list.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 3efe6c3e0c0..e3b95c2ddba 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -243,6 +243,7 @@ $accountingaccount = new AccountingAccount($db); $bankline = new AccountLine($db); $variousstatic = new PaymentVarious($db); $accountstatic = null; +$accountingjournal = null; if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) { $formaccounting = new FormAccounting($db); } @@ -716,7 +717,8 @@ while ($i < $imaxinloop) { $variousstatic->datep = $obj->datep; $variousstatic->type_payment = $obj->payment_code; $bankline->fetch($obj->fk_bank); - $variousstatic->fk_bank = $bankline->getNomUrl(1); + // @phpstan-ignore-next-line + $variousstatic->fk_bank = $bankline->getNomUrl(1); // hack for kanban view TODO to remove $variousstatic->amount = $obj->amount; $accountingaccount->fetch(0, $obj->accountancy_code, 1); @@ -819,7 +821,7 @@ while ($i < $imaxinloop) { $accountstatic->ref = $obj->bref; $accountstatic->number = $obj->bnumber; - if (isModEnabled('accounting')) { + if (isModEnabled('accounting') && is_object($accountingjournal)) { $accountstatic->account_number = $obj->bank_account_number; $accountingjournal->fetch($obj->accountancy_journal); $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); From 7ff227bafe270430dac452e50900543a0346ab0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 22:26:56 +0100 Subject: [PATCH 146/336] Debug v21 --- htdocs/core/class/html.formfile.class.php | 33 ----------------------- htdocs/ecm/class/ecmfiles.class.php | 9 ++++++- htdocs/fourn/facture/card.php | 2 +- 3 files changed, 9 insertions(+), 35 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 52d4519caea..8c7524cd1a2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -840,39 +840,6 @@ class FormFile $morecss = 'maxwidth100'; } $out .= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1, '', 0, 0); - // script for select the separator - /* TODO This must appear on export feature only - $out .= ''; - $out .= ''; - $out .= ''; - - $out .= ''; - */ if ($conf->use_javascript_ajax) { $out .= ajax_combobox('model'); } diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index df8f9ff436d..b282e6ebe5d 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -1008,7 +1008,14 @@ class EcmFiles extends CommonObject } if ($option) { - $url = DOL_URL_ROOT.'/document.php?modulepart='.$option.'&file='.urlencode(preg_replace('/^[^\/]+\//', '', $this->filepath).'/'.$this->filename).'&entity='.$this->entity; + if ($option == 'facture_fournisseur') { + $tmppath = preg_replace('/^fournisseur\/facture\//', '', $this->filepath); + } elseif ($option == 'commande_fournisseur') { + $tmppath = preg_replace('/^fournisseur\/commande\//', '', $this->filepath); + } else { + $tmppath = preg_replace('/^[^\/]+\//', '', $this->filepath); + } + $url = DOL_URL_ROOT.'/document.php?modulepart='.urlencode($option).'&file='.urlencode($tmppath.'/'.$this->filename).'&entity='.$this->entity; } else { $url = DOL_URL_ROOT.'/ecm/file_card.php?id='.$this->id; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index d306837e053..34349e99a91 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -4172,7 +4172,7 @@ if ($action == 'create') { $urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id; $genallowed = $usercanread; $delallowed = $usercancreate; - $modelpdf = (!empty($object->model_pdf) ? $object->model_pdf : (!getDolGlobalString('INVOICE_SUPPLIER_ADDON_PDF') ? '' : $conf->global->INVOICE_SUPPLIER_ADDON_PDF)); + $modelpdf = (empty($object->model_pdf) ? getDolGlobalString('INVOICE_SUPPLIER_ADDON_PDF') : $object->model_pdf); print $formfile->showdocuments('facture_fournisseur', $subdir, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 40, 0, '', '', '', $societe->default_lang); $somethingshown = $formfile->numoffiles; From 973dab622ff05ba387378c6cc1bb31bfbc29058c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Dec 2024 23:26:37 +0100 Subject: [PATCH 147/336] Debug v21 --- .../compta/bank/class/paymentvarious.class.php | 5 +++-- htdocs/compta/bank/various_payment/list.php | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 3db06e726d6..d5f006e609c 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -833,6 +833,7 @@ class PaymentVarious extends CommonObject global $langs; $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); + $bankline = ((empty($arraydata['bankline']) || empty($arraydata['bankline']->id)) ? 0 : $arraydata['bankline']); $return = '
'; $return .= '
'; @@ -844,8 +845,8 @@ class PaymentVarious extends CommonObject if ($selected >= 0) { $return .= ''; } - if (property_exists($this, 'fk_bank')) { - $return .= ' | '.$this->fk_bank.''; + if (!empty($bankline)) { + $return .= ' | '.$bankline->getNomUrl(1).''; } if (property_exists($this, 'datep')) { $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->datep), 'day').''; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index e3b95c2ddba..195d635d8d5 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -716,21 +716,25 @@ while ($i < $imaxinloop) { $variousstatic->label = $obj->label; $variousstatic->datep = $obj->datep; $variousstatic->type_payment = $obj->payment_code; - $bankline->fetch($obj->fk_bank); - // @phpstan-ignore-next-line - $variousstatic->fk_bank = $bankline->getNomUrl(1); // hack for kanban view TODO to remove + $variousstatic->amount = $obj->amount; $accountingaccount->fetch(0, $obj->accountancy_code, 1); $variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1); if ($mode == 'kanban') { + if ($obj->fk_bank > 0) { + $bankline->fetch($obj->fk_bank); + } else { + $bankline->id = 0; + } + if ($i == 0) { print '
'; @@ -814,9 +818,9 @@ while ($i < $imaxinloop) { } // Bank account - if ($arrayfields['bank']['checked'] && is_object($accountstatic)) { + if ($arrayfields['bank']['checked']) { print ''; if (!$i) { From 78ece8355f5810f0b14e07798a7f01a32aae4403 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Dec 2024 00:01:37 +0100 Subject: [PATCH 148/336] Debug v21 --- htdocs/admin/mails_senderprofile_list.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 29887bba770..bddeb8ffd1e 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -55,7 +55,6 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $id = GETPOSTINT('id'); -$rowid = GETPOST('rowid', 'alpha'); // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; @@ -83,8 +82,8 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { - reset($object->fields); // Reset is required to avoid key() to return null. - $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. + reset($object->fields); // Reset is required to avoid key() to return null. + $sortfield = "t.position"; // Set here default search field. By default 1st field in definition. } if (!$sortorder) { $sortorder = "ASC"; From 76c9b25569e97a805a922fcdf045cf86e4e38f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= <142790847+clementgde@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:13:38 +0100 Subject: [PATCH 149/336] Add doActions on project documents --- htdocs/projet/document.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 83c5416ceea..6fd7fd80717 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -101,6 +101,12 @@ $permissiontoadd = $user->hasRight('projet', 'creer'); * Actions */ +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; From 2c58bcc0b355f9cec623a273fd0f6b61c5cedadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= <142790847+clementgde@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:16:02 +0100 Subject: [PATCH 150/336] FIX To avoid sending an empty object to doActions --- htdocs/projet/messaging.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 065985317fa..68dc434f4a1 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -93,6 +93,17 @@ if (!$user->hasRight('projet', 'lire')) { * Actions */ +$object = new Project($db); + +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); + $object->fetch_thirdparty(); + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { + $object->fetchComments(); + } + $object->info($object->id); +} + $parameters = array('id' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -112,16 +123,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' */ $form = new Form($db); -$object = new Project($db); - -if ($id > 0 || !empty($ref)) { - $object->fetch($id, $ref); - $object->fetch_thirdparty(); - if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { - $object->fetchComments(); - } - $object->info($object->id); -} $agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/'.$langs->trans("Agenda") : ''; $title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name; if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { From 0b0ea7dd7c9b32ff0cb8830bd122d88e81415331 Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:36:29 +0100 Subject: [PATCH 151/336] Update card.php with gmt --- htdocs/asset/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 9531347d580..9b6e857f8fa 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -132,7 +132,7 @@ if (empty($reshook)) { // Action dispose object if ($action == 'confirm_disposal' && $confirm == 'yes' && $permissiontoadd) { - $object->disposal_date = dol_mktime(12, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear')); // for date without hour, we use gmt + $object->disposal_date = dol_mktime(0, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear'), 'gmt'); // for date without hour, we use gmt $object->disposal_amount_ht = GETPOSTINT('disposal_amount'); $object->fk_disposal_type = GETPOSTINT('fk_disposal_type'); $disposal_invoice_id = GETPOSTINT('disposal_invoice_id'); @@ -273,7 +273,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Disposal $langs->load('bills'); - $disposal_date = dol_mktime(12, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear')); // for date without hour, we use gmt + $disposal_date = dol_mktime(0, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear'), 'gmt'); // for date without hour, we use gmt $disposal_amount = GETPOSTINT('disposal_amount'); $fk_disposal_type = GETPOSTINT('fk_disposal_type'); $disposal_invoice_id = GETPOSTINT('disposal_invoice_id'); From 855b609e43983d23c5c83137e58a65db3f7a033b Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Tue, 10 Dec 2024 00:52:04 +0100 Subject: [PATCH 152/336] Update assetdepreciationoptions.class.php --- htdocs/asset/class/assetdepreciationoptions.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index 33bbb0f28cb..ecd6d276726 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -262,7 +262,7 @@ class AssetDepreciationOptions extends CommonObject if (in_array($field_info['type'], array('text', 'html'))) { $value = GETPOST($html_name, 'restricthtml'); } elseif ($field_info['type'] == 'date') { - $value = dol_mktime(12, 0, 0, GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year')); // for date without hour, we use gmt + $value = dol_mktime(0, 0, 0, GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year'), 'gmt'); // for date without hour, we use gmt } elseif ($field_info['type'] == 'datetime') { $value = dol_mktime(GETPOSTINT($html_name . 'hour'), GETPOSTINT($html_name . 'min'), GETPOSTINT($html_name . 'sec'), GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year'), 'tzuserrel'); } elseif ($field_info['type'] == 'duration') { From cf83ff70ef8abc3cfddd6e12630c767cecbffc46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Dec 2024 09:47:42 +0100 Subject: [PATCH 153/336] fix CI --- htdocs/compta/bank/class/paymentvarious.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index d5f006e609c..836390e4188 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * 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 @@ -845,7 +845,7 @@ class PaymentVarious extends CommonObject if ($selected >= 0) { $return .= ''; } - if (!empty($bankline)) { + if (!empty($bankline) && $bankline instanceof AccountLine) { $return .= ' | '.$bankline->getNomUrl(1).''; } if (property_exists($this, 'datep')) { From 0983b8f2e62aecc283895e2af55583ad6502e5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Dec 2024 09:57:54 +0100 Subject: [PATCH 154/336] Update mails_senderprofile_list.php --- htdocs/admin/mails_senderprofile_list.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index bddeb8ffd1e..9858633014c 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -1,8 +1,8 @@ - * Copyright (C) 2018 Ferran Marcet +/* Copyright (C) 2007-2017 Laurent Destailleur + * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * 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 @@ -805,12 +805,9 @@ while ($i < $imaxinloop) { if ($page) { $url .= '&page='.urlencode((string) ($page)); } - if ($sortfield) { - $url .= '&sortfield='.urlencode($sortfield); - } - if ($sortorder) { - $url .= '&page='.urlencode($sortorder); - } + $url .= '&sortfield='.urlencode($sortfield); + $url .= '&page='.urlencode($sortorder); + print ''.img_edit().''; //print '   '; print ''.img_delete().'   '; From 79570abbd4f12234f30debd5a2748fcdfe933829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Dec 2024 10:17:17 +0100 Subject: [PATCH 155/336] Update mails_senderprofile_list.php --- htdocs/admin/mails_senderprofile_list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 9858633014c..b49a9c78017 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -803,10 +803,10 @@ while ($i < $imaxinloop) { $url .= '&limit='.((int) $limit); } if ($page) { - $url .= '&page='.urlencode((string) ($page)); + $url .= '&page='.urlencode((string) $page); } - $url .= '&sortfield='.urlencode($sortfield); - $url .= '&page='.urlencode($sortorder); + $url .= '&sortfield='.urlencode((string) $sortfield); + $url .= '&page='.urlencode((string) $sortorder); print ''.img_edit().''; //print '   '; From 573a7b36c6ea46a9b7d8ba9803be69f0281c33f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Dec 2024 10:31:06 +0100 Subject: [PATCH 156/336] Update mails_senderprofile_list.php --- htdocs/admin/mails_senderprofile_list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index b49a9c78017..a586d8407bb 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -824,7 +824,6 @@ while ($i < $imaxinloop) { } } - print ''."\n"; } From d542b21244631b7e2826445d7202fa6b3a35edf7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 10 Dec 2024 11:54:33 +0100 Subject: [PATCH 157/336] Debug v2 fix ufs for next_prev_filter --- htdocs/eventorganization/conferenceorbooth_card.php | 2 +- htdocs/eventorganization/conferenceorbooth_contact.php | 2 +- htdocs/eventorganization/conferenceorbooth_document.php | 2 +- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +- htdocs/projet/agenda.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/projet/comment.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/messaging.php | 2 +- htdocs/projet/note.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/comment.php | 4 ++-- htdocs/projet/tasks/contact.php | 4 ++-- htdocs/projet/tasks/document.php | 4 ++-- htdocs/projet/tasks/note.php | 4 ++-- htdocs/projet/tasks/task.php | 4 ++-- htdocs/projet/tasks/time.php | 4 ++-- htdocs/societe/class/client.class.php | 2 +- htdocs/ticket/card.php | 2 +- htdocs/ticket/list.php | 2 +- test/other/test_dol_escape_htmltag.php | 2 ++ 26 files changed, 33 insertions(+), 31 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 6df36447088..69162c5fca8 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -228,7 +228,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index 8748ea0d15d..dd8d9b6aa3f 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -206,7 +206,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index efd21894b7d..e561ae99265 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -180,7 +180,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index d03ffe9ed1b..46bb260a6be 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -342,7 +342,7 @@ if ($projectid > 0) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', 'all', 'lire')) { $objectsListId = $project->getProjectsAuthorizedForUser($user, 0, 0); - $project->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $project->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($project, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 3014cab7a8d..b7010dadaf5 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -256,7 +256,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 1474a71eef6..c5934e13ecd 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -441,7 +441,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index 3aa654d4a65..256cf2d74a2 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -157,7 +157,7 @@ $morehtmlref .= ''; // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 74f93c4505e..0eb947f56a6 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1365,7 +1365,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index e02404f9838..f116b941dcc 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -128,7 +128,7 @@ $morehtmlref .= ''; // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index ce89643f847..4f2dde28a50 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -380,7 +380,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 83c5416ceea..2830d46fa42 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -161,7 +161,7 @@ if ($object->id > 0) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 9c23e556c57..6f3e138c587 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -267,7 +267,7 @@ $morehtmlref .= ''; // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "te.rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "te.rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 12c99a354dc..33f7122723b 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -139,7 +139,7 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 065985317fa..a39534ef57c 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -157,7 +157,7 @@ $morehtmlref .= ''; // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index e80fb0ff9a6..6130564e2da 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -126,7 +126,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 40217eded88..6df3685b01a 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -616,7 +616,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 4359afad90f..beac0f4cbb2 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -155,7 +155,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -308,7 +308,7 @@ if ($id > 0 || !empty($ref)) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId); } else { $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 495d4bb5712..f829533062a 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -212,7 +212,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -335,7 +335,7 @@ if ($id > 0 || !empty($ref)) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId); } else { $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index c4cf270b6a7..8f091a04a5e 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -169,7 +169,7 @@ if ($object->id > 0) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -293,7 +293,7 @@ if ($object->id > 0) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId); } else { $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 77861e2f681..673c820368b 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -159,7 +159,7 @@ if ($object->id > 0) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -277,7 +277,7 @@ if ($object->id > 0) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = " fk_projet:IN:(".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = " fk_projet:IN:".$db->sanitize($projectsListId); } else { $object->next_prev_filter = " fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 68ff3707182..45811e74f5c 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -316,7 +316,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); @@ -597,7 +597,7 @@ if ($id > 0 || !empty($ref)) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId); } else { $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index aad0471027b..1002df365a2 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -959,7 +959,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid:IN:(" . $db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0') . ")"; + $projectstatic->next_prev_filter = "rowid:IN:" . $db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); @@ -1143,7 +1143,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet:IN:(" . $db->sanitize($projectsListId) . ")"; + $object->next_prev_filter = "fk_projet:IN:" . $db->sanitize($projectsListId); } else { $object->next_prev_filter = "fk_projet:=:" . ((int) $projectstatic->id); } diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 45e47ab21b2..81187942d6e 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -34,7 +34,7 @@ class Client extends Societe /** * @var string Used to add a filter in Form::showrefnav method */ - public $next_prev_filter = "te.client:in:(1,2,3)"; + public $next_prev_filter = "te.client:in:1,2,3"; /** * @var array diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index f885e2fe1d7..e62e78d332a 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -855,7 +855,7 @@ if ($action == 'create' || $action == 'presend') { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0); - $projectstat->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstat->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } print $form->showrefnav($projectstat, 'ref', $linkback, 1, 'ref', 'ref', ''); print ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index d9c82030344..c54ebd897f0 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -620,7 +620,7 @@ if ($projectid > 0 || $project_ref) { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } dol_banner_tab($object, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/test/other/test_dol_escape_htmltag.php b/test/other/test_dol_escape_htmltag.php index ab0c913d882..ad85469be68 100755 --- a/test/other/test_dol_escape_htmltag.php +++ b/test/other/test_dol_escape_htmltag.php @@ -50,6 +50,8 @@ print "\n\n\n"; //print dolGetFirstLineOfText($a, 7); print dol_escape_htmltag($a, 1, 1); +print forgeSQLFromUniversalSearchCriteria("te.client:IN:1,2"); + print "\n"; //print print_r(unserialize(serialize($object))); From 5398ba82235ea93910f351d83f593aa9567110f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Tue, 10 Dec 2024 13:16:57 +0100 Subject: [PATCH 158/336] Force the sales representative if they don't have permissions Force the sales representative if they don't have permissions --- htdocs/societe/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index a8167de49da..33a7e038248 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -611,6 +611,11 @@ $sql .= " WHERE s.entity IN (".getEntity('societe').")"; if (!$user->hasRight('fournisseur', 'lire')) { $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible } + +//Force the sales representative if they don't have permissions +if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { + $search_sale = $user->id; +} // Search on sale representative if (!empty($search_sale) && $search_sale != '-1') { $search_sale_req = array_filter($search_sale, function (string $value): bool { From 11602243f7984a011fbe3242be5725780a264f59 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 10 Dec 2024 13:38:50 +0100 Subject: [PATCH 159/336] Add class constants: DiscountAbsolute::TYPE_CUSTOMER and DiscountAbsolute::TYPE_SUPPLIER --- htdocs/core/class/discount.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 7d90b55bfad..3a695df5e97 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -181,6 +181,12 @@ class DiscountAbsolute extends CommonObject */ public $type_invoice_supplier_source; + /* Customer Discount */ + const TYPE_CUSTOMER = 0; + + /* Supplier Discount */ + const TYPE_SUPPLIER = 1; + /** * Constructor * From 082e6a7676fe517a6fd1f9e56af2e02086587477 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 10 Dec 2024 13:57:03 +0100 Subject: [PATCH 160/336] Debug v21 --- htdocs/compta/prelevement/class/bonprelevement.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 24ce4487aed..376a958ee6a 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1090,6 +1090,7 @@ class BonPrelevement extends CommonObject // Pre-store some values into variables to simplify following sql requests if ($sourcetype != 'salary') { $entities = $type != 'bank-transfer' ? getEntity('invoice') : getEntity('supplier_invoice'); + $sqlTable = $type != 'bank-transfer' ? "facture" : "facture_fourn"; $socOrUser = 'fk_soc'; $societeOrUser = 'societe'; } else { @@ -1099,8 +1100,6 @@ class BonPrelevement extends CommonObject $societeOrUser = 'user'; } - $sqlTable = $type != 'bank-transfer' ? "facture" : "facture_fourn"; - $thirdpartyBANId = 0; // Check if there is an iban associated to the bank transfer request or if we take the default @@ -1160,7 +1159,7 @@ class BonPrelevement extends CommonObject $sql .= ", CONCAT(s.firstname,' ',s.lastname) as name"; $sql .= ", f.ref, sr.bic, sr.iban_prefix, 'FRST' as frstrecur"; } - $sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f"; + $sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f"; // f is salary, facture or facture_fourn $sql .= " LEFT JOIN " . $this->db->prefix() . "prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable); $sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser)." as s ON s.rowid = f.".$this->db->sanitize($socOrUser); $sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser); From 860f89cc442125c04ba5f6411e0766a126f3f31e Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 10 Dec 2024 17:14:33 +0100 Subject: [PATCH 161/336] Debug v21 --- .../modules/facture/doc/pdf_crabe.modules.php | 22 ++++++++------- .../facture/doc/pdf_octopus.modules.php | 27 +++++++++---------- .../facture/doc/pdf_sponge.modules.php | 11 +++++--- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0fdcf740020..5297f1839cb 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -102,7 +102,7 @@ class pdf_crabe extends ModelePDFFactures */ public function __construct($db) { - global $conf, $langs, $mysoc; + global $langs, $mysoc; // Translations $langs->loadLangs(array("main", "bills")); @@ -359,10 +359,10 @@ class pdf_crabe extends ModelePDFFactures $certprivate = empty($user->conf->CERTIFICATE_CRT_PRIVATE) ? '' : $user->conf->CERTIFICATE_CRT_PRIVATE; // If user has no certificate, we try to take the company one if (!$cert) { - $cert = !getDolGlobalString('CERTIFICATE_CRT') ? '' : $conf->global->CERTIFICATE_CRT; + $cert = getDolGlobalString('CERTIFICATE_CRT'); } if (!$certprivate) { - $certprivate = !getDolGlobalString('CERTIFICATE_CRT_PRIVATE') ? '' : $conf->global->CERTIFICATE_CRT_PRIVATE; + $certprivate = getDolGlobalString('CERTIFICATE_CRT_PRIVATE'); } // If a certificate is found if ($cert) { @@ -1162,7 +1162,7 @@ class pdf_crabe extends ModelePDFFactures protected function _tableau_info(&$pdf, $object, $posy, $outputlangs, $outputlangsbis) { // phpcs:enable - global $conf, $mysoc, $hookmanager; + global $mysoc, $hookmanager; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1170,6 +1170,9 @@ class pdf_crabe extends ModelePDFFactures krsort($this->tva_array); + // Clean data type + $object->total_tva = (float) $object->total_tva; + // Show VAT details if ($object->total_tva != 0 && getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { $pdf->SetFillColor(224, 224, 224); @@ -1227,7 +1230,7 @@ class pdf_crabe extends ModelePDFFactures } } - // If France, show VAT mention if not applicable + // If France, show VAT mention if applicable if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -1367,7 +1370,7 @@ class pdf_crabe extends ModelePDFFactures if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // If payment mode unregulated or payment mode forced to CHQ if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) { - $diffsizetitle = (!getDolGlobalString('PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + $diffsizetitle = getDolGlobalInt('PDF_DIFFSIZE_TITLE', 3); if (getDolGlobalInt('FACTURE_CHQ_NUMBER') > 0) { $account = new Account($this->db); @@ -1385,7 +1388,7 @@ class pdf_crabe extends ModelePDFFactures $posy = $pdf->GetY() + 2; } } - if ($conf->global->FACTURE_CHQ_NUMBER == -1) { + if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); @@ -1404,7 +1407,7 @@ class pdf_crabe extends ModelePDFFactures // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { - $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); + $bankid = ($object->fk_account <= 0 ? getDolGlobalString('FACTURE_RIB_NUMBER') : $object->fk_account); if ($object->fk_bank > 0) { $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } @@ -1828,7 +1831,7 @@ class pdf_crabe extends ModelePDFFactures $index++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $conf->global->BILL_TEXT_TOTAL_FOOTER, 0, 'L', 0); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, getDolGlobalString('BILL_TEXT_TOTAL_FOOTER'), 0, 'L', 0); } return ($tab2_top + ($tab2_hl * $index)); @@ -1877,7 +1880,6 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); - //$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'))); } diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 06fa8d0c9d5..b59ecd85c04 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1329,7 +1329,7 @@ class pdf_octopus extends ModelePDFFactures */ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlangsbis) { - global $conf, $mysoc, $hookmanager; + global $mysoc, $hookmanager; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1337,6 +1337,9 @@ class pdf_octopus extends ModelePDFFactures krsort($this->tva_array); + // Clean data type + $object->total_tva = (float) $object->total_tva; + // Show VAT details if ($object->total_tva != 0 && getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { $pdf->SetFillColor(224, 224, 224); @@ -1394,7 +1397,7 @@ class pdf_octopus extends ModelePDFFactures } } - // If France, show VAT mention if not applicable + // If France, show VAT mention if applicable if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -1664,7 +1667,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled('multicurrency') && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1); @@ -2549,7 +2552,7 @@ class pdf_octopus extends ModelePDFFactures */ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { - global $conf, $hookmanager; + global $hookmanager; // Default field style for content $this->defaultContentsFieldsStyle = array( @@ -2871,7 +2874,6 @@ class pdf_octopus extends ModelePDFFactures $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->RoundedRect($this->posx_cumul_anterieur - 1, $tab_top, $width, 5, $this->corner_radius, '1001', 'F', explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); @@ -3069,8 +3071,6 @@ class pdf_octopus extends ModelePDFFactures */ public function getDataSituation(&$object) { - global $conf, $db; - // Fetch previous and next situations invoices. // Return all previous and next invoices (both standard and credit notes) $object->fetchPreviousNextSituationInvoice(); @@ -3233,7 +3233,6 @@ class pdf_octopus extends ModelePDFFactures return $object->displayRetainedWarranty(); } else { // FOR RETROCOMPATIBILITY - global $conf; // TODO : add a flag on invoices to store this conf USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL @@ -3365,7 +3364,7 @@ class pdf_octopus extends ModelePDFFactures */ public function btpGetInvoiceAmounts($id, $forceReadFromDB = false) { - global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; + global $user, $langs, $mysoc, $db, $hookmanager, $nblignes; $object = new Facture($db); $object->fetch($id); @@ -3517,7 +3516,7 @@ class pdf_octopus extends ModelePDFFactures if (count($propals)) { $propal = array_pop($propals); - $total_ht = ($conf->multicurrency->enabled && $propal->multicurrency_tx != 1) ? $propal->multicurrency_total_ht : $propal->total_ht; + $total_ht = (isModEnabled('multicurrency') && $propal->multicurrency_tx != 1) ? $propal->multicurrency_total_ht : $propal->total_ht; $remain_to_pay = $total_ht; $pdf->SetTextColor(0, 0, 60); @@ -3540,7 +3539,7 @@ class pdf_octopus extends ModelePDFFactures } elseif (count($orders)) { $order = array_pop($orders); - $total_ht = ($conf->multicurrency->enabled && $order->multicurrency_tx != 1 ? $order->multicurrency_total_ht : $order->total_ht); + $total_ht = (isModEnabled('multicurrency') && $order->multicurrency_tx != 1 ? $order->multicurrency_total_ht : $order->total_ht); $remain_to_pay = $total_ht; } @@ -3608,7 +3607,7 @@ 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->multicurrency_tx != 1 ? $invoice->multicurrency_total_ht : $invoice->total_ht); + $total_ht = (isModEnabled('multicurrency') && $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); @@ -3651,8 +3650,8 @@ class pdf_octopus extends ModelePDFFactures $index++; - $total_ht = ($conf->multicurrency->enabled && $invoice->multicurrency_tx != 1) ? $invoice->multicurrency_total_ht : $invoice->total_ht; - $total_ttc = ($conf->multicurrency->enabled && $invoice->multicurrency_tx != 1) ? $invoice->multicurrency_total_ttc : $invoice->total_ttc; + $total_ht = (isModEnabled('multicurrency') && $invoice->multicurrency_tx != 1) ? $invoice->multicurrency_total_ht : $invoice->total_ht; + $total_ttc = (isModEnabled('multicurrency') && $invoice->multicurrency_tx != 1) ? $invoice->multicurrency_total_ttc : $invoice->total_ttc; // Total TTC $pdf->SetXY($posx, $posy + $height * $index); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index f2e54f08d90..908d9d2f328 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1268,6 +1268,9 @@ class pdf_sponge extends ModelePDFFactures krsort($this->tva_array); + // Clean data type + $object->total_tva = (float) $object->total_tva; + // Show VAT details if ($object->total_tva != 0 && getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { $pdf->SetFillColor(224, 224, 224); @@ -1325,7 +1328,7 @@ class pdf_sponge extends ModelePDFFactures } } - // If France, show VAT mention if not applicable + // If France, show VAT mention if applicable if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -1468,7 +1471,7 @@ class pdf_sponge extends ModelePDFFactures if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // If payment mode unregulated or payment mode forced to CHQ if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) { - $diffsizetitle = (!getDolGlobalString('PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + $diffsizetitle = getDolGlobalInt('PDF_DIFFSIZE_TITLE', 3); if (getDolGlobalInt('FACTURE_CHQ_NUMBER') > 0) { $account = new Account($this->db); @@ -1486,7 +1489,7 @@ class pdf_sponge extends ModelePDFFactures $posy = $pdf->GetY() + 2; } } - if ($conf->global->FACTURE_CHQ_NUMBER == -1) { + if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->MultiCell($posxend - $this->marge_gauche, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); @@ -1570,7 +1573,7 @@ class pdf_sponge extends ModelePDFFactures */ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis) { - global $conf, $mysoc, $hookmanager; + global $mysoc, $hookmanager; $sign = 1; if ($object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) { From 99bf3064f175761f3491e7b455ada2214cf3519b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 20:07:37 +0100 Subject: [PATCH 162/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 48 ------------------- .../email_unpaid_invoices_to_customers.php | 7 ++- ...ail_unpaid_invoices_to_representatives.php | 7 ++- 3 files changed, 12 insertions(+), 50 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 838f6d2cb1b..1b4b21e8aa1 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -5280,12 +5280,6 @@ parameters: count: 1 path: ../../htdocs/compta/bank/class/paymentvarious.class.php - - - message: '#^Call to function property_exists\(\) with \$this\(PaymentVarious\) and ''fk_bank'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/compta/bank/class/paymentvarious.class.php - - message: '#^Property PaymentVarious\:\:\$accountid \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -34242,48 +34236,6 @@ parameters: count: 1 path: ../../scripts/emailings/reset-invalid-emails.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/invoices/email_unpaid_invoices_to_customers.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/invoices/email_unpaid_invoices_to_customers.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/invoices/email_unpaid_invoices_to_customers.php - - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 6 - path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/invoices/email_unpaid_invoices_to_representatives.php - - message: '#^Variable \$conf might not be defined\.$#' identifier: variable.undefined diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index 0a1bfa90d60..8a0534cc5c1 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -57,7 +57,12 @@ $targettype = $argv[2]; require $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + */ $langs->load('main'); // Global variables diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index ce4347d8ebc..42433c0fea0 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -55,7 +55,12 @@ $mode = $argv[1]; require $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + */ $langs->load('main'); // Global variables From 89121307ac4d747d76821616a93ad1b6478b795b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 20:09:39 +0100 Subject: [PATCH 163/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 24 ------------------------ scripts/invoices/rebuild_merge_pdf.php | 8 +++++++- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 1b4b21e8aa1..2b04af2eb8b 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -34236,30 +34236,6 @@ parameters: count: 1 path: ../../scripts/emailings/reset-invalid-emails.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/invoices/rebuild_merge_pdf.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/invoices/rebuild_merge_pdf.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/invoices/rebuild_merge_pdf.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/invoices/rebuild_merge_pdf.php - - message: '#^Variable \$user might not be defined\.$#' identifier: variable.undefined diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index 774d5a78754..d7ee2915281 100755 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -47,6 +47,12 @@ require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; require_once DOL_DOCUMENT_ROOT."/core/modules/facture/modules_facture.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice2.lib.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + */ // Load main language strings $langs->load("main"); @@ -77,7 +83,7 @@ if (!empty($dolibarr_main_db_readonly)) { exit(1); } -$diroutputpdf = $conf->facture->dir_output.'/temp'; +$diroutputpdf = $conf->invoice->dir_output.'/temp'; $newlangid = 'en_EN'; // To force a new lang id $filter = array(); $regenerate = ''; // Ask regenerate (contains name of model to use) From 0e85534a2d6c4380eab13e2626cec8f556e32c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 20:22:52 +0100 Subject: [PATCH 164/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 54 ------------------- .../default/tpl/adherentcard_create.tpl.php | 3 ++ .../default/tpl/adherentcard_edit.tpl.php | 7 ++- .../default/tpl/adherentcard_view.tpl.php | 7 ++- 4 files changed, 13 insertions(+), 58 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 2b04af2eb8b..a0712df2731 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -882,60 +882,6 @@ parameters: count: 1 path: ../../htdocs/adherents/admin/member.php - - - message: '#^Cannot access property \$control on mixed\.$#' - identifier: property.nonObject - count: 23 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php - - - - message: '#^Variable \$canvas might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 23 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php - - - - message: '#^Cannot access property \$control on mixed\.$#' - identifier: property.nonObject - count: 27 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php - - - - message: '#^Variable \$canvas might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 26 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php - - - - message: '#^Cannot access property \$control on mixed\.$#' - identifier: property.nonObject - count: 30 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php - - - - message: '#^Variable \$canvas might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 28 - path: ../../htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php index e80c263c78e..630205413d3 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php @@ -19,8 +19,11 @@ /** * @var Adherent $object + * @var Canvas $this * @var Conf $conf * @var Translate $langs + * + * @var string $canvas */ // Protection to avoid direct call of template diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php index 0b19fcb851a..626833d8385 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2012 Philippe Grand +/* Copyright (C) 2010 Regis Houssin + * Copyright (C) 2012 Philippe Grand * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -19,8 +19,11 @@ /** * @var Adherent $object + * @var Canvas $this * @var Conf $conf * @var Translate $langs + * + * @var string $canvas */ // Protection to avoid direct call of template diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php index 30bd5eded83..54c3acafa6a 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2012-2022 Philippe Grand +/* Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2012-2022 Philippe Grand * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -19,9 +19,12 @@ /** * @var Adherent $object + * @var Canvas $this * @var Conf $conf * @var Translate $langs * @var User $user + * + * @var string $canvas */ // Protection to avoid direct call of template From ad40c290a3ee49e2273c7ea98381504111ea2afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 20:33:20 +0100 Subject: [PATCH 165/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 18 ------------- htdocs/admin/openid_connect.php | 40 +++++++++++------------------ 2 files changed, 15 insertions(+), 43 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index a0712df2731..3343254563d 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -1584,24 +1584,6 @@ parameters: count: 1 path: ../../htdocs/admin/oauthlogintokens.php - - - message: '#^Negated boolean expression is always false\.$#' - identifier: booleanNot.alwaysFalse - count: 5 - path: ../../htdocs/admin/openid_connect.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 5 - path: ../../htdocs/admin/openid_connect.php - - - - message: '#^Variable \$bc might not be defined\.$#' - identifier: variable.undefined - count: 10 - path: ../../htdocs/admin/openid_connect.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue diff --git a/htdocs/admin/openid_connect.php b/htdocs/admin/openid_connect.php index 7a42c90369d..c5f80897c5e 100644 --- a/htdocs/admin/openid_connect.php +++ b/htdocs/admin/openid_connect.php @@ -37,10 +37,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/openid_connect.lib.php'; * @var User $user */ -$langs->load("admin"); -$langs->load("openidconnect"); +$langs->loadLangs(["admin", "openidconnect"]); -if (!$user->admin) accessforbidden(); +if (!$user->admin) { + accessforbidden(); +} $action = GETPOST('action', 'alpha'); @@ -143,8 +144,6 @@ print '
'; print ''; print ''; -$var=true; - print '
'.($object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('BankAccount').'
'; print '
'; } // Output Kanban - print $variousstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected))); + print $variousstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected), 'bankline' => $bankline)); if ($i == ($imaxinloop) - 1) { print '
'; print '
'; - if ($obj->bid > 0) { + if (is_object($accountstatic) && $obj->bid > 0) { $accountstatic->id = $obj->bid; $accountstatic->ref = $obj->bref; $accountstatic->number = $obj->bnumber; @@ -829,8 +833,6 @@ while ($i < $imaxinloop) { $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } else { - print ' '; } print '
'; print ''; print ''."\n"; @@ -153,8 +152,7 @@ print ''."\n"; print "\n"; // MAIN_AUTHENTICATION_OIDC_LOGIN_CLAIM -$var = !$var; -print '' . "\n"; +print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print '' . "\n"; print ''."\n"; print ''."\n"; print ''; // ThirdParty Type print ''; // Status print ''; From 4ec1b7a5465441ab951db4948a806ae9b194d2ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 21:03:15 +0100 Subject: [PATCH 195/336] fix phpstan --- htdocs/paypal/admin/paypal.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index fab3c789429..0c3f08e241d 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -374,17 +374,19 @@ print 'Your API authentication information can be found with following steps. We print ''; if (!empty($conf->use_javascript_ajax)) { - print "\n".''; + print ' + + '; } print '

'; From f2430b0d7f31945fc1abcc203e2070957aa900ee Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:42:03 +0200 Subject: [PATCH 196/336] Fix space --- htdocs/langs/en_US/mails.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index c2a7d07b030..b7ca6c62f19 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -32,7 +32,7 @@ NewMailing=New mass Email NewSMSing=New smsing EditMailing=Edit mass Email ResetMailing=Resend mass Email -ConfirmResetMailingTargetMassaction=Confirmation of the reset of targets statusin error +ConfirmResetMailingTargetMassaction=Confirmation of the reset of targets status in error ResetMailingTargetMassaction=Reset status in error DeleteMailing=Delete mass Email PreviewMailing=Preview mass Email From 2ccc6f71ae249808f1a28514eef1de882fd60b19 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 12 Dec 2024 11:58:52 +0100 Subject: [PATCH 197/336] FIX wrong trigger name (MODIFY instead UPDATE) --- ...face_95_modZapier_ZapierTriggers.class.php | 20 +++++++++---------- ..._99_modMyModule_MyModuleTriggers.class.php | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php index ea846616096..6665242aba2 100644 --- a/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modZapier_ZapierTriggers.class.php @@ -224,7 +224,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers case 'ORDER_CLASSIFY_BILLED': case 'ORDER_SETDRAFT': case 'LINEORDER_INSERT': - case 'LINEORDER_UPDATE': + case 'LINEORDER_MODIFY': case 'LINEORDER_DELETE': break; // Supplier orders @@ -239,7 +239,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers // case 'ORDER_SUPPLIER_RECEIVE': // case 'LINEORDER_SUPPLIER_DISPATCH': // case 'LINEORDER_SUPPLIER_CREATE': - // case 'LINEORDER_SUPPLIER_UPDATE': + // case 'LINEORDER_SUPPLIER_MODIFY': // Proposals // case 'PROPAL_CREATE': @@ -251,7 +251,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers // case 'PROPAL_CLOSE_REFUSED': // case 'PROPAL_DELETE': // case 'LINEPROPAL_INSERT': - // case 'LINEPROPAL_UPDATE': + // case 'LINEPROPAL_MODIFY': // case 'LINEPROPAL_DELETE': // SupplierProposal @@ -264,7 +264,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers // case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED': // case 'SUPPLIER_PROPOSAL_DELETE': // case 'LINESUPPLIER_PROPOSAL_INSERT': - // case 'LINESUPPLIER_PROPOSAL_UPDATE': + // case 'LINESUPPLIER_PROPOSAL_MODIFY': // case 'LINESUPPLIER_PROPOSAL_DELETE': // Contracts @@ -274,7 +274,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers // case 'CONTRACT_CLOSE': // case 'CONTRACT_DELETE': // case 'LINECONTRACT_INSERT': - // case 'LINECONTRACT_UPDATE': + // case 'LINECONTRACT_MODIFY': // case 'LINECONTRACT_DELETE': // Bills @@ -288,19 +288,19 @@ class InterfaceZapierTriggers extends DolibarrTriggers // case 'BILL_DELETE': // case 'BILL_PAYED': // case 'LINEBILL_INSERT': - // case 'LINEBILL_UPDATE': + // case 'LINEBILL_MODIFY': // case 'LINEBILL_DELETE': //Supplier Bill // case 'BILL_SUPPLIER_CREATE': - // case 'BILL_SUPPLIER_UPDATE': + // case 'BILL_SUPPLIER_MODIFY': // case 'BILL_SUPPLIER_DELETE': // case 'BILL_SUPPLIER_PAYED': // case 'BILL_SUPPLIER_UNPAYED': // case 'BILL_SUPPLIER_VALIDATE': // case 'BILL_SUPPLIER_UNVALIDATE': // case 'LINEBILL_SUPPLIER_CREATE': - // case 'LINEBILL_SUPPLIER_UPDATE': + // case 'LINEBILL_SUPPLIER_MODIFY': // case 'LINEBILL_SUPPLIER_DELETE': // Payments @@ -316,7 +316,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers // Donation // case 'DON_CREATE': - // case 'DON_UPDATE': + // case 'DON_MODIFY': // case 'DON_DELETE': // Interventions @@ -325,7 +325,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers // case 'FICHINTER_VALIDATE': // case 'FICHINTER_DELETE': // case 'LINEFICHINTER_CREATE': - // case 'LINEFICHINTER_UPDATE': + // case 'LINEFICHINTER_MODIFY': // case 'LINEFICHINTER_DELETE': // Members diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index 392addd84d0..ff435dbf4be 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -165,7 +165,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ORDER_CLASSIFY_BILLED': //case 'ORDER_SETDRAFT': //case 'LINEORDER_INSERT': - //case 'LINEORDER_UPDATE': + //case 'LINEORDER_MODIFY': //case 'LINEORDER_DELETE': // Supplier orders @@ -180,7 +180,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ORDER_SUPPLIER_RECEIVE': //case 'LINEORDER_SUPPLIER_DISPATCH': //case 'LINEORDER_SUPPLIER_CREATE': - //case 'LINEORDER_SUPPLIER_UPDATE': + //case 'LINEORDER_SUPPLIER_MODIFY': //case 'LINEORDER_SUPPLIER_DELETE': // Proposals @@ -192,7 +192,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'PROPAL_CLOSE_REFUSED': //case 'PROPAL_DELETE': //case 'LINEPROPAL_INSERT': - //case 'LINEPROPAL_UPDATE': + //case 'LINEPROPAL_MODIFY': //case 'LINEPROPAL_DELETE': // SupplierProposal @@ -204,7 +204,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED': //case 'SUPPLIER_PROPOSAL_DELETE': //case 'LINESUPPLIER_PROPOSAL_INSERT': - //case 'LINESUPPLIER_PROPOSAL_UPDATE': + //case 'LINESUPPLIER_PROPOSAL_MODIFY': //case 'LINESUPPLIER_PROPOSAL_DELETE': // Contracts @@ -215,7 +215,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'CONTRACT_CLOSE': //case 'CONTRACT_DELETE': //case 'LINECONTRACT_INSERT': - //case 'LINECONTRACT_UPDATE': + //case 'LINECONTRACT_MODIFY': //case 'LINECONTRACT_DELETE': // Bills @@ -228,19 +228,19 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'BILL_DELETE': //case 'BILL_PAYED': //case 'LINEBILL_INSERT': - //case 'LINEBILL_UPDATE': + //case 'LINEBILL_MODIFY': //case 'LINEBILL_DELETE': //Supplier Bill //case 'BILL_SUPPLIER_CREATE': - //case 'BILL_SUPPLIER_UPDATE': + //case 'BILL_SUPPLIER_MODIFY': //case 'BILL_SUPPLIER_DELETE': //case 'BILL_SUPPLIER_PAYED': //case 'BILL_SUPPLIER_UNPAYED': //case 'BILL_SUPPLIER_VALIDATE': //case 'BILL_SUPPLIER_UNVALIDATE': //case 'LINEBILL_SUPPLIER_CREATE': - //case 'LINEBILL_SUPPLIER_UPDATE': + //case 'LINEBILL_SUPPLIER_MODIFY': //case 'LINEBILL_SUPPLIER_DELETE': // Payments @@ -256,7 +256,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers // Donation //case 'DON_CREATE': - //case 'DON_UPDATE': + //case 'DON_MODIFY': //case 'DON_DELETE': // Interventions @@ -265,7 +265,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'FICHINTER_VALIDATE': //case 'FICHINTER_DELETE': //case 'LINEFICHINTER_CREATE': - //case 'LINEFICHINTER_UPDATE': + //case 'LINEFICHINTER_MODIFY': //case 'LINEFICHINTER_DELETE': // Members From f07ca2a9141d0aa39ceba2995ffba7e79e2c36a8 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 14:39:49 +0100 Subject: [PATCH 198/336] css --- htdocs/theme/eldy/global.inc.php | 5 ++--- htdocs/theme/md/style.css.php | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 15558ad11d7..88adc86552b 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4695,12 +4695,11 @@ table.hidepaginationnext .paginationnext { } - /* Set the color for hover lines */ -.oddeven:hover, .evenodd:hover, .oddevenimport:hover, .evenoddimport:hover, .impair:hover, .pair:hover -{ +.oddeven:hover:not(.nohover), .evenodd:hover:not(.nohover), .oddevenimport:hover:not(.nohover), .evenoddimport:hover:not(.nohover), .impair:hover:not(.nohover), .pair:hover:not(.nohover) { background: var(--colorbacklinepairhover) !important; /* Must be background to be stronger than background of odd or even */ } + .tredited, .tredited td { background: var(--colorbacklinepairchecked) !important; /* Must be background to be stronger than background of odd or even */ border-bottom: 0 !important; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index fcdc79aeb95..8dbb46a008d 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4761,7 +4761,6 @@ ul.noborder li:nth-child(odd):not(.liste_titre) { /* Set the color for hover lines */ - .tmenucompanylogo.nohover, .tmenucompanylogo.nohover:hover { opacity: unset !important; } @@ -4770,11 +4769,11 @@ ul.noborder li:nth-child(odd):not(.liste_titre) { box-shadow: unset; -webkit-box-shadow: unset; } - -.oddeven:hover, .evenodd:hover, .oddevenimport:hover, .evenoddimport:hover, .impair:hover, .pair:hover +.oddeven:hover:not(.nohover), .evenodd:hover:not(.nohover), .oddevenimport:hover:not(.nohover), .evenoddimport:hover:not(.nohover), .impair:hover:not(.nohover), .pair:hover:not(.nohover) { { background: rgb() !important; } + .tredited { background: rgb() !important; /* Must be background to be stronger than background of odd or even */ } From f5206566904279370f8ae3ead1e6077c2b970f3e Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 14:47:48 +0100 Subject: [PATCH 199/336] Fix warning --- htdocs/admin/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 2fe24da05e9..0aa392a0c52 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -61,16 +61,16 @@ print load_fiche_titre($langs->trans("SetupArea"), '', 'tools'); if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) { - $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('//i', '
', $conf->global->MAIN_MOTD_SETUPPAGE); + $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('//i', '
', getDolGlobalString('MAIN_MOTD_SETUPPAGE')); if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) { $i = 0; $reg = array(); - while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) { + while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', getDolGlobalString('MAIN_MOTD_SETUPPAGE'), $reg) && $i < 100) { $tmp = explode('|', $reg[1]); if (!empty($tmp[1])) { $langs->load($tmp[1]); } - $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE); + $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), getDolGlobalString('MAIN_MOTD_SETUPPAGE')); $i++; } From 32924c1811383f9ac93290ee1e483c3f3fd0a0c9 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 14:59:47 +0100 Subject: [PATCH 200/336] Debug v21 --- htdocs/core/class/extrafields.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ecb4ada7f88..752a1527f5b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2011,7 +2011,6 @@ class ExtraFields } //if ($computed) $value = // $value is already calculated into $value before calling this method - $showsize = 0; if ($type == 'date') { $showsize = 10; @@ -2039,9 +2038,9 @@ class ExtraFields } elseif ($type == 'double') { if (!empty($value)) { //$value=price($value); - $sizeparts = explode(",", $size); - $number_decimals = array_key_exists(1, $sizeparts) ? $sizeparts[1] : 0; - $value = price($value, 0, $outputlangs, 0, 0, $number_decimals, ''); + //$sizeparts = explode(",", $size); + //$number_decimals = array_key_exists(1, $sizeparts) ? $sizeparts[1] : 0; + $value = price($value, 0, $outputlangs, 0, 0, -2, ''); } } elseif ($type == 'boolean') { $checked = ''; From 02ae579a3f864943d17e3c9d6622579bce378b11 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 15:42:14 +0100 Subject: [PATCH 201/336] Add information to help debug --- htdocs/core/lib/functions.lib.php | 21 ++++++++++++++++++++- htdocs/core/tpl/objectline_view.tpl.php | 17 +++++++++++++++-- htdocs/langs/en_US/main.lang | 3 +++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dac7bfdc92f..a3849578d8b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11733,7 +11733,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) */ function showDirectDownloadLink($object) { - global $conf, $langs; + global $langs; $out = ''; $url = $object->getLastMainDocLink($object->element); @@ -11845,6 +11845,25 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param } } +/** + * Make content of an input box selected when we click into input field. + * + * @param int $idcode Id of special code + * @return string + */ +function getLabelSpecialCode($idcode) +{ + global $langs; + + $arrayspecialines = array(1 => 'Transport', 2 => 'EcoTax', 3 => 'Option'); + if ($idcode > 10) { + return 'Module ID '.$idcode; + } + if (!empty($arrayspecialines[$idcode])) { + return $langs->trans($arrayspecialines[$idcode]); + } + return ''; +} /** * Make content of an input box selected when we click into input field. diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index e50370f4c45..1d9e118cee3 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -312,8 +312,8 @@ $tooltiponpricemultiprice = ''; $tooltiponpriceend = ''; $tooltiponpriceendmultiprice = ''; if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht, 0, '', 0, 0); - $tooltiponpricemultiprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->multicurrency_total_ht, 0, '', 0, 0); + $tooltiponprice .= $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht, 0, '', 0, 0); + $tooltiponpricemultiprice .= $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->multicurrency_total_ht, 0, '', 0, 0); $tooltiponprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva, 0, '', 0, 0); $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->multicurrency_total_tva, 0, '', 0, 0); if (is_object($object->thirdparty)) { @@ -347,6 +347,19 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc, 0, '', 0, 0); $tooltiponpricemultiprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->multicurrency_total_ttc, 0, '', 0, 0); + if (!empty($line->special_code) || $line->product_type == 9) { + $tooltiponprice .= '
'; + $tooltiponpricemultiprice .= '
'; + if (!empty($line->special_code)) { + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + } + if ($line->product_type == 9) { + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); + } + } + $tooltiponprice = ''; $tooltiponpricemultiprice = ''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 4b451e58c72..744d4dfed24 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1341,3 +1341,6 @@ Operator=Operator AllFieldsRequired=All fields are required. IsDefined=Is defined IsNotDefined=Is not defined +SpecialLine=Special Line +EcoTax=Eco-Tax +GroupingLine=Grouping line From c7eb63f41f490c90557ac7f17ddd6cbcf6cf5edd Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 12 Dec 2024 16:44:06 +0100 Subject: [PATCH 202/336] Try to close a TODO --- htdocs/admin/mails.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index b4e9267eec0..afda0e31733 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -1059,9 +1059,24 @@ if ($action == 'edit') { $text .= /* ($text ? '

' : ''). */$langs->trans("WarningPHPMailSPF", getDolGlobalString('MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD')); } if (getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')) { // Not defined by default. Depend on platform. + $ipstoshow = ''; // List of IP shown as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]' - // TODO Add a key to allow to show the IP/name of server detected dynamically - $text .= ($text ? '

' : '').$langs->trans("WarningPHPMail2", getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')); + $arrayipstoshow = explode(',', getDolGlobalString('MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS')); + foreach ($arrayipstoshow as $iptoshow) { + // If MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is an URL to get/show the public IP/name of server detected dynamically + if (preg_match('/^http/i', $iptoshow)) { + $tmpresult = getURLContent($iptoshow, 'GET', '', 1, array(), array('http', 'https'), 0); + if (!empty($tmpresult['content'])) { + $iptoshow = $tmpresult['content']; + } else { + $iptoshow = ''; // Failed to get IP + } + } + $ipstoshow .= ($ipstoshow ? ', ' : '').trim($iptoshow); + } + if ($ipstoshow) { + $text .= ($text ? '

' : '').$langs->trans("WarningPHPMail2", $ipstoshow); + } } } From c2c3f2ff45687e0e9ecdf7ce1d723c59d81bba08 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 12 Dec 2024 16:47:31 +0100 Subject: [PATCH 203/336] FIX to have two lists with total on same screen --- htdocs/core/tpl/list_print_total.tpl.php | 77 ++++++++++++------------ 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index 3e6af0c8a20..d79d844484c 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -23,6 +23,46 @@ */ '@phan-var-force array{nbfield:int,type?:array,pos?:array,val?:array} $totalarray'; +if (!function_exists('printTotalValCell')) { // allow two list with total on same screen + + /** print a total cell value according to its type + * + * @param string $type of field (duration, string..) + * @param string $val the value to display + * + * @return void (direct print) + */ + function printTotalValCell($type, $val) + { + // if $totalarray['type'] not present we consider it as number + if (empty($type)) { + $type = 'real'; + } + switch ($type) { + case 'duration': + print '
'; + break; + case 'string': // This type is no more used. type is now varchar(x) + print ''; + break; + case 'stock': + print ''; + break; + default: + print ''; + break; + } + } +} + // Move fields of totalizable into the common array pos and val if (!empty($totalarray['totalizable']) && is_array($totalarray['totalizable'])) { foreach ($totalarray['totalizable'] as $keytotalizable => $valtotalizable) { @@ -107,40 +147,3 @@ if (isset($totalarray['pos'])) { } //print ''; } - -/** print a total cell value according to its type - * - * @param string $type of field (duration, string..) - * @param string $val the value to display - * - * @return void (direct print) - */ -function printTotalValCell($type, $val) -{ - // if $totalarray['type'] not present we consider it as number - if (empty($type)) { - $type = 'real'; - } - switch ($type) { - case 'duration': - print ''; - break; - case 'string': // This type is no more used. type is now varchar(x) - print ''; - break; - case 'stock': - print ''; - break; - default: - print ''; - break; - } -} From 3d02e406d82acb3009cc77737015b3c56680fc7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Thu, 12 Dec 2024 17:05:21 +0100 Subject: [PATCH 204/336] FIX: camelcase for getLabelSpecialCode() calling --- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1d9e118cee3..9e34f4ba39f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -351,8 +351,8 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'; $tooltiponpricemultiprice .= '
'; if (!empty($line->special_code)) { - $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); - $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); } if ($line->product_type == 9) { $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); From b4bf92018ec6f87d4269df6843c8b89877bc1fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 12 Dec 2024 20:46:16 +0100 Subject: [PATCH 205/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 12 ------------ htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- htdocs/cron/class/cronjob.class.php | 4 ++-- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b436d3ce5d3..d64771c69b9 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17394,18 +17394,6 @@ parameters: count: 4 path: ../../htdocs/cron/class/cronjob.class.php - - - message: '#^Variable \$ExecTimeLimit in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/cron/class/cronjob.class.php - - - - message: '#^Variable \$MemoryLimit in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/cron/class/cronjob.class.php - - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1d9e118cee3..9e34f4ba39f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -351,8 +351,8 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'; $tooltiponpricemultiprice .= '
'; if (!empty($line->special_code)) { - $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); - $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); } if ($line->product_type == 9) { $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index f7bb85395c8..455002b097a 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1223,7 +1223,7 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs jobtype=".$this->jobtype." userlogin=".$userlogin, LOG_DEBUG); // Increase limit of time. Works only if we are not in safe mode - $ExecTimeLimit = 600; + $ExecTimeLimit = getDolGlobalInt('MAIN_CRON_EXEC_TIME_LIMIT', 600); if (!empty($ExecTimeLimit)) { $err = error_reporting(); error_reporting(0); // Disable all errors @@ -1231,7 +1231,7 @@ class Cronjob extends CommonObject @set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64 error_reporting($err); } - $MemoryLimit = 0; + $MemoryLimit = getDolGlobalString('MAIN_CRON_EXEC_TIME_LIMIT'); if (!empty($MemoryLimit)) { @ini_set('memory_limit', $MemoryLimit); } From 923e85f0a811e061174d141b8da31f2acdee2c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 12 Dec 2024 20:55:03 +0100 Subject: [PATCH 206/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/projet/tasks.php | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index d64771c69b9..58850605ffd 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -27804,12 +27804,6 @@ parameters: count: 2 path: ../../htdocs/projet/tasks.php - - - message: '#^Variable \$param might not be defined\.$#' - identifier: variable.undefined - count: 17 - path: ../../htdocs/projet/tasks.php - - message: '#^Variable \$permissiontodelete might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 6df3685b01a..7d41c983205 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -448,6 +448,7 @@ $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-project page-card_tasks'); $arrayofselected = is_array($toselect) ? $toselect : array(); +$param = ''; if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); From f5f4e500bdfe176612b34b6ee61371df02b2d076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 12 Dec 2024 21:06:51 +0100 Subject: [PATCH 207/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 18 ------------------ htdocs/core/actions_massactions.inc.php | 3 +++ htdocs/cron/class/cronjob.class.php | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 58850605ffd..36791e8dce0 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -8196,12 +8196,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 14 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$from might not be defined\.$#' identifier: variable.undefined @@ -8220,12 +8214,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$month might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable @@ -8256,12 +8244,6 @@ parameters: count: 1 path: ../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$year might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$classfile might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 94964dfae8e..82a25fd2678 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -55,10 +55,13 @@ * @var ?string $objectlabel * @var ?string $option * @var ?int $deliveryreceipt + * @var string $action * @var string $massaction * @var string $objectclass * @var string $uploaddir * @var string $confirm + * @var string $month + * @var string $year * @var int $error */ ' diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 455002b097a..b814567f710 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1231,7 +1231,7 @@ class Cronjob extends CommonObject @set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64 error_reporting($err); } - $MemoryLimit = getDolGlobalString('MAIN_CRON_EXEC_TIME_LIMIT'); + $MemoryLimit = getDolGlobalString('MAIN_CRON_MEMORY_LIMIT'); if (!empty($MemoryLimit)) { @ini_set('memory_limit', $MemoryLimit); } From 064846f4c99f5ced9f047d7c6867097643d3a059 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 00:53:18 +0100 Subject: [PATCH 208/336] Trans --- htdocs/langs/en_US/main.lang | 2 +- htdocs/langs/fr_FR/main.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 744d4dfed24..16db52a9770 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -498,7 +498,7 @@ ActionRunningNotStarted=To start ActionRunningShort=In progress ActionDoneShort=Finished ActionUncomplete=Incomplete -LatestLinkedEvents=Latest %s linked events +LatestLinkedEvents=The last %s events CompanyFoundation=Company/Organization Accountant=Accountant ContactsForCompany=Contacts for this third party diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 22a9411997d..3c45a60d556 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -496,7 +496,7 @@ ActionRunningNotStarted=A réaliser ActionRunningShort=En cours ActionDoneShort=Terminé ActionUncomplete=Incomplet -LatestLinkedEvents=Les %s derniers événements liés +LatestLinkedEvents=Les %s derniers événements CompanyFoundation=Société/Organisation Accountant=Comptable ContactsForCompany=Contacts de ce tiers From 1443e48a309e6356543010905ffdedc38ad357d8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Dec 2024 07:34:49 +0100 Subject: [PATCH 209/336] FIX missing init function to create accounting table --- htdocs/core/modules/modAccounting.class.php | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 1dc084ee7cd..a630b1f9fd3 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -400,4 +400,37 @@ class modAccounting extends DolibarrModules 'b.multicurrency_code'=>"US (Necessary if devise is different than EUR)", ); } + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + $result = $this->_load_tables('/install/mysql/', 'accounting'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + + $sql = array(); + return $this->_init($sql, $options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function remove($options = '') + { + $sql = array(); + return $this->_remove($sql, $options); + } } From 977aa546f1f24c29651df2994a4c726a10e2ba51 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Dec 2024 07:43:15 +0100 Subject: [PATCH 210/336] FIX phpstan error --- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1d9e118cee3..9e34f4ba39f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -351,8 +351,8 @@ if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $tooltiponprice .= '
'; $tooltiponpricemultiprice .= '
'; if (!empty($line->special_code)) { - $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); - $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialcode($line->special_code); + $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); + $tooltiponpricemultiprice .= '
'.$langs->trans("SpecialLine").' : '.getLabelSpecialCode($line->special_code); } if ($line->product_type == 9) { $tooltiponprice .= '
'.$langs->trans("SpecialLine").' : '.$langs->trans("GroupingLine"); From 2b3bd3d6dc2e48751de92cb7adcdeda03e72133c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Dec 2024 09:19:10 +0100 Subject: [PATCH 211/336] FIX can not convert to reduc if draft status --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 4270d723959..3a9f7d1c310 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -4064,7 +4064,7 @@ if ($action == 'create') { } // Reverse back money or convert to reduction - if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_STANDARD) { + if ($object->status == FactureFournisseur::STATUS_VALIDATED && ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_STANDARD)) { // For credit note only if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0) { if ($resteapayer == 0) { From dd918323cf9fca2c1a286e1ee8dd07a6da193ccd Mon Sep 17 00:00:00 2001 From: Hystepik Date: Fri, 13 Dec 2024 09:50:29 +0100 Subject: [PATCH 212/336] Fix #32352 upload file and URL form on firefox --- htdocs/core/class/html.formfile.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8c7524cd1a2..8623377e7ad 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1387,7 +1387,7 @@ class FormFile // Show title of list of existing files $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); }'; + $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); void(0);}'; $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $permtoeditline); } @@ -2221,7 +2221,7 @@ class FormFile $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'javascript:console.log("open addlink form"); jQuery(".divlinkfile").toggle();', '', $permissiontoedit); + $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'javascript:console.log("open addlink form"); jQuery(".divlinkfile").toggle(); void(0);', '', $permissiontoedit); } // Show list of associated links From a5d4be4a66a0c6e94c4786a60927a4a628334c39 Mon Sep 17 00:00:00 2001 From: Hystepik Date: Fri, 13 Dec 2024 09:55:50 +0100 Subject: [PATCH 213/336] better fix for file --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8623377e7ad..b7f6f705ece 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1387,7 +1387,7 @@ class FormFile // Show title of list of existing files $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); void(0);}'; + $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click();}void(0);'; $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $permtoeditline); } From 9c5d76cbd9d494a9d7b5fe0ab4114df3f78a6dd5 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 12:00:57 +0100 Subject: [PATCH 214/336] FIX #32355 Add mising POS ID in unalterable log --- htdocs/blockedlog/class/blockedlog.class.php | 5 +++-- htdocs/compta/facture/list.php | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index ef209ae6b85..00a158952f0 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -169,7 +169,7 @@ class BlockedLog // Customer Invoice/Facture / Payment if (isModEnabled('invoice')) { $this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE'; - $this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE'; + //$this->trackedevents['BILL_UPDATE'] = 'logBILL_UPDATE'; $this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL'; $this->trackedevents['DOC_DOWNLOAD'] = 'BlockedLogBillDownload'; $this->trackedevents['DOC_PREVIEW'] = 'BlockedLogBillPreview'; @@ -532,7 +532,8 @@ class BlockedLog continue; // Discard some properties } if (!in_array($key, array( - 'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines' + 'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines', + 'module_source', 'pos_source' ))) { continue; // Discard if not into a dedicated list } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 33f8026d589..a13fce05ea5 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2343,10 +2343,10 @@ if ($num > 0) { } // Type ent if (!empty($arrayfields['typent.code']['checked'])) { - print '
'; if (!$i) { @@ -2532,8 +2532,6 @@ if ($num > 0) { } } //else print $langs->trans("NoSalesRepresentativeAffected"); - } else { - print ' '; } print ''; if (!$i) { From 48336356524a063b91f89e0c7790916935a38156 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 12:40:05 +0100 Subject: [PATCH 215/336] Debug v21 --- htdocs/blockedlog/admin/blockedlog_list.php | 28 +++++++++++--------- htdocs/blockedlog/class/blockedlog.class.php | 8 +++--- htdocs/langs/en_US/blockedlog.lang | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 95da9f8f9ee..71178aff819 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -502,9 +502,6 @@ print ''; // Ref print ''; -// Link to ref -print ''; - // Amount print ''; @@ -521,6 +518,9 @@ print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors print ''; // Status note +//print ''; + +// Link to original ref into business software print ''; // Action column @@ -543,12 +543,12 @@ print getTitleFieldOfList($langs->trans('Date'), 0, $_SERVER["PHP_SELF"], 'date_ print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"], 'user_fullname', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"], 'ref_object', '', $param, '', $sortfield, $sortorder, '')."\n"; -print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ')."\n"; print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp').'
'.$langs->trans('DataOfArchivedEventHelp2'), 1)."\n"; print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Status'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; -print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; +//print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; +print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, 'class="center"', $sortfield, $sortorder, '')."\n"; @@ -633,12 +633,6 @@ if (is_array($blocks)) { print dol_escape_htmltag($block->ref_object); print ''; - // Link to source object - print ''; @@ -666,13 +660,15 @@ if (is_array($blocks)) { } else { print 'OK'; } - print ''; + //print ''; // Note - print ''; + // Link to source object + print ''; // Actions code print ''; // Ref diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index dda8647e791..b970612e1c5 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1141,17 +1141,17 @@ class BlockedLog /** * Return array of log objects (with criteria) * - * @param string $element element to search - * @param int $fk_object id of object to search - * @param int<0,max> $limit max number of element, 0 for all - * @param string $sortfield sort field - * @param string $sortorder sort order - * @param int $search_fk_user id of user(s) - * @param int $search_start start time limit - * @param int $search_end end time limit - * @param string $search_ref search ref - * @param string $search_amount search amount - * @param string $search_code search code + * @param string $element element to search + * @param int $fk_object id of object to search + * @param int<0,max> $limit max number of element, 0 for all + * @param string $sortfield sort field + * @param string $sortorder sort order + * @param int $search_fk_user id of user(s) + * @param int $search_start start time limit + * @param int $search_end end time limit + * @param string $search_ref search ref + * @param string $search_amount search amount + * @param string|array $search_code search code * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error */ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') @@ -1194,8 +1194,14 @@ class BlockedLog if ($search_amount != '') { $sql .= natural_search("amounts", $search_amount, 1); } - if ($search_code != '' && $search_code != '-1') { - $sql .= natural_search("action", $search_code, 3); + if (is_array($search_code)) { + if (!empty($search_code)) { + $sql .= natural_search("action", implode(',', $search_code), 3); + } + } else { + if ($search_code != '' && $search_code != '-1') { + $sql .= natural_search("action", $search_code, 3); + } } $sql .= $this->db->order($sortfield, $sortorder); From 738abd9d5cb2ec7e1a1efc4bae8a1f25167533c8 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 13:03:26 +0100 Subject: [PATCH 217/336] Fix missing unit price in the unalterable log --- htdocs/blockedlog/class/blockedlog.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index b970612e1c5..eafe04365f7 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -543,7 +543,13 @@ class BlockedLog $lineid++; foreach ($tmpline as $keyline => $valueline) { if (!in_array($keyline, array( - 'ref', 'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', 'qty', 'product_type', 'product_label', 'vat_src_code', 'tva_tx', 'info_bits', 'localtax1_tx', 'localtax2_tx', 'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2' + 'ref', 'product_type', 'product_label', + 'qty', + 'subprice', + 'vat_src_code', 'tva_tx', 'localtax1_tx', 'localtax2_tx', + 'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2', + 'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', + 'info_bits', 'special_code', ))) { continue; // Discard if not into a dedicated list } From 6d7350541a1a39fb101025562f0f92c041ad08b0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Dec 2024 13:14:22 +0100 Subject: [PATCH 218/336] FIX prepare the possibility of having different payment methods per entity (eg RUM/SEPA) --- .../install/mysql/migration/20.0.0-21.0.0.sql | 5 + .../mysql/tables/llx_societe_rib.key.sql | 5 +- .../install/mysql/tables/llx_societe_rib.sql | 111 +++++++++--------- 3 files changed, 64 insertions(+), 57 deletions(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 47cc3f8d6c0..1b84473354c 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -385,3 +385,8 @@ ALTER TABLE llx_facture_rec ADD COLUMN fk_societe_rib integer DEFAULT NULL; ALTER TABLE llx_facture ADD COLUMN is_also_delivery_note tinyint DEFAULT 0 NOT NULL; ALTER TABLE llx_user MODIFY COLUMN signature LONGTEXT; + +-- Add entity field +ALTER TABLE llx_societe_rib DROP INDEX uk_societe_rib; +ALTER TABLE llx_societe_rib ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; +ALTER TABLE llx_societe_rib ADD UNIQUE INDEX uk_societe_rib(entity, label, fk_soc); diff --git a/htdocs/install/mysql/tables/llx_societe_rib.key.sql b/htdocs/install/mysql/tables/llx_societe_rib.key.sql index 23be102c418..8bdab216fa4 100644 --- a/htdocs/install/mysql/tables/llx_societe_rib.key.sql +++ b/htdocs/install/mysql/tables/llx_societe_rib.key.sql @@ -1,5 +1,6 @@ -- =================================================================== --- Copyright (C) 2016 Laurent Destailleur +-- Copyright (C) 2016 Laurent Destailleur +-- Copyright (C) 2024 Regis Houssin -- -- 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 @@ -17,6 +18,6 @@ -- =================================================================== -ALTER TABLE llx_societe_rib ADD UNIQUE INDEX uk_societe_rib(label, fk_soc); +ALTER TABLE llx_societe_rib ADD UNIQUE INDEX uk_societe_rib(entity, label, fk_soc); ALTER TABLE llx_societe_rib ADD CONSTRAINT llx_societe_rib_fk_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); diff --git a/htdocs/install/mysql/tables/llx_societe_rib.sql b/htdocs/install/mysql/tables/llx_societe_rib.sql index 9fb4370c243..e5ef25a45b3 100644 --- a/htdocs/install/mysql/tables/llx_societe_rib.sql +++ b/htdocs/install/mysql/tables/llx_societe_rib.sql @@ -1,9 +1,9 @@ -- ============================================================================= --- Copyright (C) 2000-2004 Rodolphe Quiedeville --- Copyright (C) 2005-2009 Regis Houssin --- Copyright (C) 2012 Juanjo Menent --- Copyright (C) 2013 Peter Fontaine --- Copyright (C) 2023 Alexandre Spangaro +-- Copyright (C) 2000-2004 Rodolphe Quiedeville +-- Copyright (C) 2005-2024 Regis Houssin +-- Copyright (C) 2012 Juanjo Menent +-- Copyright (C) 2013 Peter Fontaine +-- Copyright (C) 2023 Alexandre Spangaro -- -- 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 @@ -23,72 +23,73 @@ create table llx_societe_rib ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - type varchar(32) DEFAULT 'ban' NOT NULL, -- 'ban' or 'paypal' or 'card' or 'stripe' - label varchar(200), - fk_soc integer NOT NULL, - datec datetime, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- multi company id + type varchar(32) DEFAULT 'ban' NOT NULL, -- 'ban' or 'paypal' or 'card' or 'stripe' + label varchar(200), + fk_soc integer NOT NULL, + datec datetime, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- For BAN - bank varchar(255), -- bank name - code_banque varchar(128), -- bank code - code_guichet varchar(6), -- desk code - number varchar(255), -- account number - cle_rib varchar(5), -- key of bank account + bank varchar(255), -- bank name + code_banque varchar(128), -- bank code + code_guichet varchar(6), -- desk code + number varchar(255), -- account number + cle_rib varchar(5), -- key of bank account - bic varchar(20), -- 11 according to ISO 9362 (we keep 20 for backward compatibility) - bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank - iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information + bic varchar(20), -- 11 according to ISO 9362 (we keep 20 for backward compatibility) + bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank + iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information - domiciliation varchar(255), - proprio varchar(60), - owner_address varchar(255), - default_rib smallint NOT NULL DEFAULT 0, - state_id integer, - fk_country integer, - currency_code varchar(3), + domiciliation varchar(255), + proprio varchar(60), + owner_address varchar(255), + default_rib smallint NOT NULL DEFAULT 0, + state_id integer, + fk_country integer, + currency_code varchar(3), - model_pdf varchar(255), -- last template used to generate main document - last_main_doc varchar(255), -- relative filepath+filename of last main generated document + model_pdf varchar(255), -- last template used to generate main document + last_main_doc varchar(255), -- relative filepath+filename of last main generated document -- For BAN direct debit feature - rum varchar(32), -- RUM value to use for SEPA generation - date_rum date, -- Date of mandate - frstrecur varchar(16) DEFAULT 'FRST', -- 'FRST' or 'RECUR' + rum varchar(32), -- RUM value to use for SEPA generation + date_rum date, -- Date of mandate + frstrecur varchar(16) DEFAULT 'FRST', -- 'FRST' or 'RECUR' -- For credit card - last_four varchar(4), -- last 4 - card_type varchar(255), -- card type 'VISA', 'MC' , ... - cvn varchar(255), - exp_date_month integer, - exp_date_year integer, - country_code varchar(10), + last_four varchar(4), -- last 4 + card_type varchar(255), -- card type 'VISA', 'MC' , ... + cvn varchar(255), + exp_date_month integer, + exp_date_year integer, + country_code varchar(10), -- For Paypal - approved integer DEFAULT 0, - email varchar(255), - ending_date date, - max_total_amount_of_all_payments double(24,8), - preapproval_key varchar(255), - starting_date date, - total_amount_of_all_payments double(24,8), + approved integer DEFAULT 0, + email varchar(255), + ending_date date, + max_total_amount_of_all_payments double(24,8), + preapproval_key varchar(255), + starting_date date, + total_amount_of_all_payments double(24,8), --For Stripe, Stancer, ... - stripe_card_ref varchar(128), -- card_...' - stripe_account varchar(128), -- 'pk_live_...' + stripe_card_ref varchar(128), -- card_...' + stripe_account varchar(128), -- 'pk_live_...' - ext_payment_site varchar(128), -- name of external paymentmode (for example 'StripeLive') + ext_payment_site varchar(128), -- name of external paymentmode (for example 'StripeLive') - extraparams varchar(255), -- for other parameters with json format + extraparams varchar(255), -- for other parameters with json format -- For Online Sign - date_signature datetime, - online_sign_ip varchar(48), - online_sign_name varchar(64), + date_signature datetime, + online_sign_ip varchar(48), + online_sign_name varchar(64), - comment varchar(255), - ipaddress varchar(68), - status integer NOT NULL DEFAULT 1, -- 1=ACTIVE, 0=IN_TRASH - import_key varchar(14) -- import key + comment varchar(255), + ipaddress varchar(68), + status integer NOT NULL DEFAULT 1, -- 1=ACTIVE, 0=IN_TRASH + import_key varchar(14) -- import key )ENGINE=innodb; From 5da555e7eb1764bf11cb4fb3935a4d8ecb8f702c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 13:05:42 +0100 Subject: [PATCH 219/336] Trans --- htdocs/blockedlog/admin/blockedlog_list.php | 6 ++++-- htdocs/langs/en_US/blockedlog.lang | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 376120d7981..01cb2c58f1c 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -545,9 +545,9 @@ print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"], 'use print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"], 'ref_object', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ')."\n"; -print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp').'
'.$langs->trans('DataOfArchivedEventHelp2'), 1)."\n"; +print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ', 0, $langs->trans('DataOfArchivedEventHelp'), 1)."\n"; print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; -print getTitleFieldOfList($langs->trans('Status'), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; +print getTitleFieldOfList($form->textwithpicto($langs->trans('Status'), $langs->trans('DataOfArchivedEventHelp2')), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; //print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '')."\n"; // Action column @@ -671,6 +671,8 @@ if (is_array($blocks)) { } else { //print $form->textwithpicto('', $langs->trans('KoCheckFingerprintValidity')); } + } else { + //print $form->textwithpicto('', $langs->trans('DataOfArchivedEventHelp2')); } if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY') && getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL')) { diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 9b74b8a787c..3b399063ad2 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -18,9 +18,9 @@ BlockedlogInfoDialog=Log Details ListOfTrackedEvents=List of tracked events Fingerprint=Fingerprint DownloadLogCSV=Export archived logs (CSV) -DataOfArchivedEvent=Full data of archived event -DataOfArchivedEventHelp=This field contains the unalterable and structured data that was archived on real time. Even if some parent business event could have been purged or modified, the data archived here is the original data, and it can't be modified. -DataOfArchivedEventHelp2=Its integrity is guaranteed if the status of the line is OK +DataOfArchivedEvent=Complementary data of archived event +DataOfArchivedEventHelp=This field contains the complementary data that was archived on real time. Even if some parent business event could have been purged or modified, the data archived here is the original data, and it can't be modified. +DataOfArchivedEventHelp2=The integrity of data on each lines is guaranteed if the status of the line is OK ImpossibleToReloadObject=Original object (type %s, id %s) not linked (see 'Full datas' column to get unalterable saved data) BlockedLogAreRequiredByYourCountryLegislation=Unalterable Logs module may be required by the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit. BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable Logs module was activated because of the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they cannot be validated by a tax audit. From 33ca018120e561bf24fd82a75a44d3264447765b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:03:20 +0100 Subject: [PATCH 220/336] fix CI --- htdocs/blockedlog/class/blockedlog.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index eafe04365f7..c539f2774a9 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1157,7 +1157,7 @@ class BlockedLog * @param int $search_end end time limit * @param string $search_ref search ref * @param string $search_amount search amount - * @param string|array $search_code search code + * @param string|string[] $search_code search code * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error */ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') From 62c1d500e8db181ba99312c4eaa349be9c317f85 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 14:05:04 +0100 Subject: [PATCH 221/336] Avoid errors --- .github/workflows/pr-18-autolabel.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-18-autolabel.yaml b/.github/workflows/pr-18-autolabel.yaml index 4524d02815b..4f7b08ea725 100644 --- a/.github/workflows/pr-18-autolabel.yaml +++ b/.github/workflows/pr-18-autolabel.yaml @@ -18,3 +18,4 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} configuration-path: .github/changed-lines-count-labeler.yml + continue-on-error: true \ No newline at end of file From 426e12a5cae1e8a0c12c336b3c63740ff4ac2d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:08:13 +0100 Subject: [PATCH 222/336] fix CI --- build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/blockedlog/class/blockedlog.class.php | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 36791e8dce0..9783c4edad9 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -2652,12 +2652,6 @@ parameters: count: 1 path: ../../htdocs/blockedlog/class/blockedlog.class.php - - - message: '#^Variable \$aaa might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/blockedlog/class/blockedlog.class.php - - message: '#^Property BOM\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index c539f2774a9..30bd80915b4 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -853,12 +853,12 @@ class BlockedLog */ public function dolEncodeBlockedData($data, $mode = 0) { + $aaa = ''; try { $aaa = json_encode($data); } catch (Exception $e) { - //print $e->getErrs); + // print $e->getErrs); } - //var_dump($aaa); return $aaa; } @@ -873,12 +873,12 @@ class BlockedLog */ public function dolDecodeBlockedData($data, $mode = 0) { + $aaa = null; try { $aaa = (object) jsonOrUnserialize($data); } catch (Exception $e) { - //print $e->getErrs); + // print $e->getErrs); } - //var_dump($aaa); return $aaa; } From 10698ebf2a49e6b88685dc3c0f2186caf62e5309 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 14:13:17 +0100 Subject: [PATCH 223/336] Doc --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index ffe840e9483..26833536fee 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -374,7 +374,7 @@ class Adherent extends CommonObject */ const STATUS_VALIDATED = 1; /** - * Resiliated + * Resiliated (membership end and was not renew) */ const STATUS_RESILIATED = 0; /** From c403fc901b1918d747febe6fb5d3091b23c15600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:17:46 +0100 Subject: [PATCH 224/336] fix CI --- htdocs/blockedlog/class/blockedlog.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 30bd80915b4..f80cca3d489 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -873,7 +873,6 @@ class BlockedLog */ public function dolDecodeBlockedData($data, $mode = 0) { - $aaa = null; try { $aaa = (object) jsonOrUnserialize($data); } catch (Exception $e) { From 532435f6e100062583d37f559787fb20a5faff29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Dec 2024 14:22:35 +0100 Subject: [PATCH 225/336] fix CI --- htdocs/blockedlog/class/blockedlog.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index f80cca3d489..30bd80915b4 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -873,6 +873,7 @@ class BlockedLog */ public function dolDecodeBlockedData($data, $mode = 0) { + $aaa = null; try { $aaa = (object) jsonOrUnserialize($data); } catch (Exception $e) { From 3bb56e6dd11e87e63d3c8be8da50e39f9cd378af Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 14:25:44 +0100 Subject: [PATCH 226/336] Fix phpunit --- htdocs/blockedlog/class/blockedlog.class.php | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index eafe04365f7..f5b1f9ce64d 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1147,18 +1147,18 @@ class BlockedLog /** * Return array of log objects (with criteria) * - * @param string $element element to search - * @param int $fk_object id of object to search - * @param int<0,max> $limit max number of element, 0 for all - * @param string $sortfield sort field - * @param string $sortorder sort order - * @param int $search_fk_user id of user(s) - * @param int $search_start start time limit - * @param int $search_end end time limit - * @param string $search_ref search ref - * @param string $search_amount search amount - * @param string|array $search_code search code - * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error + * @param string $element element to search + * @param int $fk_object id of object to search + * @param int<0,max> $limit max number of element, 0 for all + * @param string $sortfield sort field + * @param string $sortorder sort order + * @param int $search_fk_user id of user(s) + * @param int $search_start start time limit + * @param int $search_end end time limit + * @param string $search_ref search ref + * @param string $search_amount search amount + * @param string|array $search_code search code + * @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error */ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') { From 03b560d6886afee3baa0bb05f4ceb5cf4424708a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Dec 2024 14:51:46 +0100 Subject: [PATCH 227/336] FIX wrong check --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 3a9f7d1c310..01f43d6dc45 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -4064,7 +4064,7 @@ if ($action == 'create') { } // Reverse back money or convert to reduction - if ($object->status == FactureFournisseur::STATUS_VALIDATED && ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_STANDARD)) { + if ($object->status != FactureFournisseur::STATUS_DRAFT && ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_STANDARD)) { // For credit note only if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0) { if ($resteapayer == 0) { From 6ed584e425a17bb4a1bf3cb6283c9f6e33aee36b Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Fri, 13 Dec 2024 14:53:05 +0100 Subject: [PATCH 228/336] fix phpstan --- htdocs/public/payment/paymentok.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 180f0390336..ed3954c0598 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -180,6 +180,7 @@ $error = 0; // Check if we have redirtodomain to do. if ($ws) { + $ws_virtuelhost = null; $doactionsthenredirect = 1; include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; $website = new Website($db); From d48be543416f425d52acf26a120706a0c5111763 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Fri, 13 Dec 2024 15:00:11 +0100 Subject: [PATCH 229/336] fix phpstan --- htdocs/public/payment/paymentok.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index ed3954c0598..eacf879e404 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -2131,7 +2131,7 @@ if (!empty($doactionsthenredirect)) { if ($ispaymentok) { // Redirect to a success page // Paymentok page must be created for the specific website - if (!defined('USEDOLIBARRSERVER') && $ws_virtuelhost) { + if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) { $ext_urlok = $ws_virtuelhost . '/paymentok.php?fulltag='.$FULLTAG; } else { $ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG; @@ -2140,7 +2140,7 @@ if (!empty($doactionsthenredirect)) { } else { // Redirect to an error page // Paymentko page must be created for the specific website - if (!defined('USEDOLIBARRSERVER') && $ws_virtuelhost) { + if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) { $ext_urlko = $ws_virtuelhost . '/paymentko.php?fulltag='.$FULLTAG; } else { $ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG; From 480f2e34443edd98ce7e076d1b0f971816078413 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Fri, 13 Dec 2024 15:38:37 +0100 Subject: [PATCH 230/336] fix phpstan --- htdocs/public/payment/paymentok.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index eacf879e404..4cc55e8b4f7 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -285,11 +285,11 @@ if (empty($doactionsthenredirect)) { // Another step to validate the payment (for payment modes like Paypal that need another step after the callback return for this). if (isModEnabled('paypal') && $paymentmethod === 'paypal') { // We call this page only if payment is ok on payment system - if ($PAYPALTOKEN) { + if (!empty($PAYPALTOKEN)) { // Get on url call $onlinetoken = $PAYPALTOKEN; $fulltag = $FULLTAG; - $payerID = $PAYPALPAYERID; + $payerID = !empty($PAYPALPAYERID) ? $PAYPALPAYERID : ''; // Set by newpayment.php $currencyCodeType = $_SESSION['currencyCodeType']; $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; From bf59577fc6a9578b0c7dc8f5a82d875e911e1c89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Dec 2024 15:49:58 +0100 Subject: [PATCH 231/336] Update list.php --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 33a7e038248..6a81aeede43 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -612,7 +612,7 @@ if (!$user->hasRight('fournisseur', 'lire')) { $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible } -//Force the sales representative if they don't have permissions +// Force the sales representative if they don't have permissions if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { $search_sale = $user->id; } From eeb3e812114658383c097eb356c5a8299dbb9761 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Dec 2024 15:57:44 +0100 Subject: [PATCH 232/336] Update paymentok.php --- htdocs/public/payment/paymentok.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 4cc55e8b4f7..01741876f4d 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -173,14 +173,9 @@ $object = new stdClass(); // For triggers $error = 0; - -/* - * Actions and view - */ - // Check if we have redirtodomain to do. +$ws_virtuelhost = null; if ($ws) { - $ws_virtuelhost = null; $doactionsthenredirect = 1; include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; $website = new Website($db); @@ -191,6 +186,10 @@ if ($ws) { } +/* + * Actions and view + */ + $now = dol_now(); dol_syslog("Callback url when a payment was done. query_string=".(empty($_SERVER["QUERY_STRING"]) ? '' : dol_escape_htmltag($_SERVER["QUERY_STRING"]))." script_uri=".(empty($_SERVER["SCRIPT_URI"]) ? '' : dol_escape_htmltag($_SERVER["SCRIPT_URI"])), LOG_DEBUG, 0, '_payment'); From 778b07dabd4a8251649d258a01be2264f9308d77 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 17:22:48 +0100 Subject: [PATCH 233/336] Debug v21 Fix tooltip on setup pages --- htdocs/core/modules/asset/mod_asset_advanced.php | 4 ++-- .../core/modules/barcode/mod_barcode_product_standard.php | 2 +- .../modules/barcode/mod_barcode_thirdparty_standard.php | 2 +- htdocs/core/modules/bom/mod_bom_advanced.php | 2 +- htdocs/core/modules/cheque/mod_chequereceipt_thyme.php | 2 +- htdocs/core/modules/commande/mod_commande_saphir.php | 2 +- htdocs/core/modules/contract/mod_contract_magre.php | 2 +- htdocs/core/modules/delivery/mod_delivery_saphir.php | 2 +- htdocs/core/modules/expedition/mod_expedition_ribera.php | 2 +- .../core/modules/expensereport/mod_expensereport_sand.php | 2 +- htdocs/core/modules/facture/mod_facture_mercure.php | 8 ++++---- htdocs/core/modules/fichinter/mod_arctic.php | 2 +- htdocs/core/modules/holiday/mod_holiday_immaculate.php | 2 +- htdocs/core/modules/hrm/mod_evaluation_advanced.php | 2 +- htdocs/core/modules/mrp/mod_mo_advanced.php | 2 +- htdocs/core/modules/payment/mod_payment_ant.php | 2 +- htdocs/core/modules/product/mod_codeproduct_elephant.php | 4 ++-- htdocs/core/modules/product_batch/mod_lot_advanced.php | 2 +- htdocs/core/modules/product_batch/mod_sn_advanced.php | 2 +- htdocs/core/modules/project/mod_project_universal.php | 2 +- htdocs/core/modules/project/task/mod_task_universal.php | 2 +- htdocs/core/modules/propale/mod_propale_saphir.php | 2 +- htdocs/core/modules/reception/mod_reception_moonstone.php | 2 +- htdocs/core/modules/societe/mod_codeclient_elephant.php | 4 ++-- htdocs/core/modules/societe/mod_codecompta_aquarium.php | 5 ++--- htdocs/core/modules/societe/mod_codecompta_digitaria.php | 8 ++++---- .../modules/stocktransfer/mod_stocktransfer_advanced.php | 2 +- .../supplier_invoice/mod_facture_fournisseur_tulip.php | 8 ++++---- .../supplier_order/mod_commande_fournisseur_orchidee.php | 2 +- .../supplier_payment/mod_supplier_payment_brodator.php | 2 +- .../supplier_proposal/mod_supplier_proposal_saphir.php | 2 +- htdocs/core/modules/takepos/mod_takepos_ref_universal.php | 2 +- htdocs/core/modules/ticket/mod_ticket_universal.php | 2 +- .../core/modules/workstation/mod_workstation_advanced.php | 2 +- .../recruitment/mod_recruitmentcandidature_advanced.php | 2 +- .../recruitment/mod_recruitmentjobposition_advanced.php | 2 +- 36 files changed, 49 insertions(+), 50 deletions(-) diff --git a/htdocs/core/modules/asset/mod_asset_advanced.php b/htdocs/core/modules/asset/mod_asset_advanced.php index 129e5c55ea6..969abdefbe9 100644 --- a/htdocs/core/modules/asset/mod_asset_advanced.php +++ b/htdocs/core/modules/asset/mod_asset_advanced.php @@ -70,7 +70,7 @@ class mod_asset_advanced extends ModeleNumRefAsset $text .= ''; $text .= ''; $text .= ''; - $text .= '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("MainAuthenticationOidcLoginClaimName").''.$langs->trans("MainAuthenticationOidcLoginClaimDesc").'' . "\n"; @@ -162,8 +160,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcClientIdName").''.$langs->trans("MainAuthenticationOidcClientIdDesc").'' . "\n"; @@ -171,8 +168,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcClientSecretName").''.$langs->trans("MainAuthenticationOidcClientSecretDesc").'' . "\n"; @@ -180,8 +176,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcScopesName").''.$langs->trans("MainAuthenticationOidcScopesDesc").'' . "\n"; @@ -189,8 +184,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcAuthorizeUrlName").''.$langs->trans("MainAuthenticationOidcAuthorizeUrlDesc").'' . "\n"; @@ -198,8 +192,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcTokenUrlName").''.$langs->trans("MainAuthenticationOidcTokenUrlDesc").'' . "\n"; @@ -207,8 +200,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcUserinfoUrlName").''.$langs->trans("MainAuthenticationOidcUserinfoUrlDesc").'' . "\n"; @@ -216,8 +208,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcLogoutUrlName").''.$langs->trans("MainAuthenticationOidcLogoutUrlDesc").'' . "\n"; @@ -225,8 +216,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcRedirectUrlName").''.$langs->trans("MainAuthenticationOidcRedirectUrlDesc").'' . "\n"; @@ -234,8 +224,7 @@ print '' . "\n"; +print '
'.$langs->trans("MainAuthenticationOidcLogoutRedirectUrlName").''.$langs->trans("MainAuthenticationOidcLogoutRedirectUrlDesc").'' . "\n"; @@ -256,3 +245,4 @@ print '
'; print dol_get_fiche_end(); llxFooter(); +$db->close(); From 20d98ed4fa9fd45d2e01ab9b4b078b8c24c2aa0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 20:55:49 +0100 Subject: [PATCH 166/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 24 ------------------------ htdocs/admin/sms.php | 14 +++++++------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 3343254563d..b436d3ce5d3 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -1614,30 +1614,6 @@ parameters: count: 1 path: ../../htdocs/admin/security_file.php - - - message: '#^Parameter \#4 \$deliveryreceipt of class CSMSFile constructor expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/admin/sms.php - - - - message: '#^Parameter \#5 \$deferred of class CSMSFile constructor expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/admin/sms.php - - - - message: '#^Parameter \#6 \$priority of class CSMSFile constructor expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/admin/sms.php - - - - message: '#^Parameter \#7 \$class of class CSMSFile constructor expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/admin/sms.php - - message: '#^Variable \$smsfile might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index dbfb0e7a8e9..ad815dc5bc8 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -1,7 +1,7 @@ - * Copyright (C) 2009 Regis Houssin - * Copyright (C) 2013 Juanjo Menent +/* Copyright (C) 2007-2011 Laurent Destailleur + * Copyright (C) 2009 Regis Houssin + * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2020-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -83,10 +83,10 @@ if ($action == 'send' && !$cancel) { } $sendto = GETPOST("sendto", 'alphanohtml'); $body = GETPOST('message', 'alphanohtml'); - $deliveryreceipt = GETPOST("deliveryreceipt", 'alphanohtml'); - $deferred = GETPOST('deferred', 'alphanohtml'); - $priority = GETPOST('priority', 'alphanohtml'); - $class = GETPOST('class', 'alphanohtml'); + $deliveryreceipt = GETPOSTINT("deliveryreceipt"); + $deferred = GETPOSTINT('deferred'); + $priority = GETPOSTINT('priority'); + $class = GETPOSTINT('class'); $errors_to = GETPOST("errorstosms", 'alphanohtml'); // Create form object From 14a341fb8c7edb5650efca3a3f8524b1c79993ab Mon Sep 17 00:00:00 2001 From: Ronan Pozzi Date: Tue, 10 Dec 2024 21:20:53 +0100 Subject: [PATCH 167/336] Enhance regex patterns to support underscores in keys Updated regular expressions in `translate.class.php` to allow underscores in key matches for civility, sending methods, payment types, opportunity status, and order source. This improves compatibility with broader key naming conventions. --- htdocs/core/class/translate.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 4de285710c3..ec0900a8ae7 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -629,17 +629,17 @@ class Translate $newstr = $key; $reg = array(); - if (preg_match('/^Civility([0-9A-Z]+)$/i', $key, $reg)) { + if (preg_match('/^Civility([0-9A-Z_]+)$/i', $key, $reg)) { $newstr = $this->getLabelFromKey($db, $reg[1], 'c_civility', 'code', 'label'); } elseif (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i', $key, $reg)) { $newstr = $this->getLabelFromKey($db, $reg[1], 'c_currencies', 'code_iso', 'label'); - } elseif (preg_match('/^SendingMethod([0-9A-Z]+)$/i', $key, $reg)) { + } elseif (preg_match('/^SendingMethod([0-9A-Z_]+)$/i', $key, $reg)) { $newstr = $this->getLabelFromKey($db, $reg[1], 'c_shipment_mode', 'code', 'libelle'); - } elseif (preg_match('/^PaymentType(?:Short)?([0-9A-Z]+)$/i', $key, $reg)) { + } elseif (preg_match('/^PaymentType(?:Short)?([0-9A-Z_]+)$/i', $key, $reg)) { $newstr = $this->getLabelFromKey($db, $reg[1], 'c_paiement', 'code', 'libelle', '', 1); - } elseif (preg_match('/^OppStatus([0-9A-Z]+)$/i', $key, $reg)) { + } elseif (preg_match('/^OppStatus([0-9A-Z_]+)$/i', $key, $reg)) { $newstr = $this->getLabelFromKey($db, $reg[1], 'c_lead_status', 'code', 'label'); - } elseif (preg_match('/^OrderSource([0-9A-Z]+)$/i', $key, $reg)) { + } elseif (preg_match('/^OrderSource([0-9A-Z_]+)$/i', $key, $reg)) { // TODO OrderSourceX must be replaced with content of table llx_c_input_reason or llx_c_input_method //$newstr=$this->getLabelFromKey($db,$reg[1],'llx_c_input_reason','code','label'); } From aa133f8facd6af139b27b87e5cb903d91d687429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 10 Dec 2024 21:28:21 +0100 Subject: [PATCH 168/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 54 ------------------- .../default/tpl/contactcard_create.tpl.php | 5 +- .../default/tpl/contactcard_edit.tpl.php | 5 +- .../default/tpl/contactcard_view.tpl.php | 5 +- 4 files changed, 12 insertions(+), 57 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 838f6d2cb1b..b0d24bdcbaf 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -7518,60 +7518,6 @@ parameters: count: 1 path: ../../htdocs/contact/ajax/contact.php - - - message: '#^Cannot access property \$control on mixed\.$#' - identifier: property.nonObject - count: 24 - path: ../../htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php - - - - message: '#^Variable \$canvas might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 24 - path: ../../htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php - - - - message: '#^Cannot access property \$control on mixed\.$#' - identifier: property.nonObject - count: 31 - path: ../../htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php - - - - message: '#^Variable \$canvas might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 29 - path: ../../htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php - - - - message: '#^Cannot access property \$control on mixed\.$#' - identifier: property.nonObject - count: 34 - path: ../../htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php - - - - message: '#^Variable \$canvas might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 32 - path: ../../htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue diff --git a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php index 2e7e1cf2859..19e6d028968 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010 Regis Houssin * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -17,9 +17,12 @@ */ /** + * @var Canvas $this * @var Conf $conf * @var Contact $object * @var Translate $langs + * + * @var string $canvas */ // Protection to avoid direct call of template diff --git a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php index 4003d80a0b9..f96d10a93bd 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010 Regis Houssin * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -17,9 +17,12 @@ */ /** + * @var Canvas $this * @var Conf $conf * @var Contact $object * @var Translate $langs + * + * @var string $canvas */ // Protection to avoid direct call of template diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php index 3af33672398..d408c0fbdf8 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -17,10 +17,13 @@ */ /** + * @var Canvas $this * @var Conf $conf * @var Contact $object * @var Translate $langs * @var User $user + * + * @var string $canvas */ // Protection to avoid direct call of template From 33a2be35fbcb28fdd2595abcd56a7a5f003419e8 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:16:05 +0200 Subject: [PATCH 169/336] Fix trans --- htdocs/langs/en_US/admin.lang | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 90e30555733..3a7196da08f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2144,10 +2144,10 @@ MAIN_PDF_NO_RECIPENT_FRAME=Hide borders on recipient address frame MAIN_PDF_HIDE_CUSTOMER_CODE=Hide customer code MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE=Hide customer accounting code MAIN_PDF_HIDE_SENDER_NAME=Hide sender/company name in address block -TERMSOFSALE=Conditions de vente -MAIN_PDF_ADD_TERMSOFSALE_PROPAL=Add the conditions of sale after the proposal -MAIN_PDF_ADD_TERMSOFSALE_ORDER=Add the conditions of sale after the order -MAIN_PDF_ADD_TERMSOFSALE_INVOICE=Add the conditions of sale after the invoice +TERMSOFSALE=Terms and conditions of sale +MAIN_PDF_ADD_TERMSOFSALE_PROPAL=Add the terms and conditions of sale after the proposal +MAIN_PDF_ADD_TERMSOFSALE_ORDER=Add the terms and conditions of sale after the order +MAIN_PDF_ADD_TERMSOFSALE_INVOICE=Add the terms and conditions of sale after the invoice PROPOSAL_PDF_HIDE_PAYMENTTERM=Hide payments conditions PROPOSAL_PDF_HIDE_PAYMENTMODE=Hide payment mode MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING=Add a hidden markup into the signature area to allow electronic signature tool to reuse it. May be used by external tools or in the future by the online signature feature. @@ -2582,7 +2582,7 @@ DolibarrStandardCaptcha=A native captcha generated by Dolibarr SALES_ORDER_SHOW_SHIPPING_ADDRESS=Show shipping address SALES_ORDER_SHOW_SHIPPING_ADDRESSMore=Compulsory indication in some countries (France, ...) PDF_INVOICE_SHOW_VAT_ANALYSIS=Show vat analysis per rate -MaxNbOfRecordOnListIsOk=You have a max size for lists is set to %s lines. This is a good value. +MaxNbOfRecordOnListIsOk=You have a max size for lists set to %s lines. This is a good value. YouHaveALargeAmountOfRecordOnLists=You have a default max size for lists set to %s lines. This is a large value that need scrolling to see all answers. It is better to have a value lower than %s and use pagination to see record over this number. Change this in menu Home - Setup - Display. RoundBorders=Round borders CheckIfModuleIsNotBlackListed=Block install for modules found into the Remote blacklist @@ -2593,7 +2593,7 @@ SensitiveData=Sensitive data ToolToDecryptAString=Tool to decrypt a string Decrypt=Decrypt FilesIntegrityDesc=If you want to check the integrity of files instead of database, you can do it by using this tool. -AttributeCodeHelp=A code of your choice (without special char and space) to identify the property.
Note that if an object B is created from an existing object A that has a different type (for example creation of an invoice from an order), the value of the complementary attributes of A are also copied into the complementary attributes of B when the code of the attribute is the same. +AttributeCodeHelp=A code of your choice (without special chars and spaces) to identify the property.
Note that if an object B is created from an existing object A that has a different type (for example creation of an invoice from an order), the value of the complementary attributes of A are also copied into the complementary attributes of B when the code of the attribute is the same. ThereIsMoreThanXAnswers=There is more than %s answers with your filter. Please add more filters... -PdfAddTermOfSaleHelp=Upload the condition of sales from file input at the bottom of this setup page -WarningOnlineSignature=Please note that this function allows a person (customer, supplier...) to insert, online, the image of his signature in the PDF document. As for a handwritten signature, such a signature can be made by anyone and does not have the same legal value as a legal electronic signature system going through a paying trusted third party. If you need this level of security, you can contact an integrator for more information or check for addons on www.dolistore.org. +PdfAddTermOfSaleHelp=You can upload the terms and conditions of sale file at the bottom of this setup page +WarningOnlineSignature=Please note that this function allows a person (customer, supplier...) to insert, online, the image of his signature in the PDF document. As for a handwritten signature, such a signature can be made by anyone and might not have the same legal value as a legal electronic signature system going through an authorized trusted third party. If you need this level of security, you can contact an integrator for more information or check for addons on www.dolistore.org. From ef5acbbd74fd8be80f3ad90da3358b2a2cdb04cd Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Wed, 11 Dec 2024 12:00:18 +0100 Subject: [PATCH 170/336] redirect to virtualhost after paymentok --- htdocs/public/payment/paymentok.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 8fa92e88b89..180f0390336 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -181,6 +181,12 @@ $error = 0; // Check if we have redirtodomain to do. if ($ws) { $doactionsthenredirect = 1; + include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; + $website = new Website($db); + $result = $website->fetch(0, $ws); + if ($result > 0) { + $ws_virtuelhost = $website->virtualhost; + } } @@ -2124,12 +2130,20 @@ if (!empty($doactionsthenredirect)) { if ($ispaymentok) { // Redirect to a success page // Paymentok page must be created for the specific website - $ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG; + if (!defined('USEDOLIBARRSERVER') && $ws_virtuelhost) { + $ext_urlok = $ws_virtuelhost . '/paymentok.php?fulltag='.$FULLTAG; + } else { + $ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG; + } print ""; } else { // Redirect to an error page // Paymentko page must be created for the specific website - $ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG; + if (!defined('USEDOLIBARRSERVER') && $ws_virtuelhost) { + $ext_urlko = $ws_virtuelhost . '/paymentko.php?fulltag='.$FULLTAG; + } else { + $ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG; + } print ""; } } From 0c2086936ddcf405d56d40e1f3292882969ca627 Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:06:24 +0100 Subject: [PATCH 171/336] Best buy price on a product should be including discounts --- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 5edfa06eae1..7c5854ecdfb 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -976,7 +976,7 @@ class ProductFournisseur extends Product } } - if ($fourn_unitprice < $min || $min == -1) { + if ($fourn_unitprice_with_discount < $min || $min == -1) { $this->id = $prodid; $this->product_fourn_price_id = $record["product_fourn_price_id"]; $this->ref_supplier = $record["ref_fourn"]; @@ -1000,7 +1000,7 @@ class ProductFournisseur extends Product $this->fourn_multicurrency_id = $record["fk_multicurrency"]; $this->fourn_multicurrency_code = $record["multicurrency_code"]; - $min = $fourn_unitprice; + $min = $fourn_unitprice_with_discount; } } } From 5591e3a8c0e3c3c91dacac139e4c6dbd3c381b01 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:19:22 +0200 Subject: [PATCH 172/336] Fix trans --- htdocs/langs/en_US/errors.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 0e6576f3176..485917e7d86 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -344,8 +344,8 @@ ErrorStartHourIsNull=Start date field cannot be empty ErrorTooManyLinesToProcessPleaseUseAMoreSelectiveFilter=Too many lines to process. Please use a more selective filter. ErrorEmptyValueForQty=Quantity cannot be zero. ErrorNoCloneWithoutName=The new user must have a name -ErrorNoCloneWithoutEmail=The new user must have a email -ErrorUserClone=Error when clone categories user +ErrorNoCloneWithoutEmail=The new user must have an email +ErrorUserClone=Error in user clone categories ErrorQtyOrderedLessQtyShipped = The quantity ordered cannot be less than the quantity shipped. ErrorVariousPaymentOnBankAccountWithADifferentCurrencyNotYetSupported=Error, creating a various payment on a bank account with a currency different than the currency of the company is not yet supported. ErrorStreamMustBeEnabled=The PHP stream %s is not available. Check your PHP modules and Dolibarr parameter $dolibarr_main_stream_to_disable. From 2c988d28c9455bb76f0da30a134a956f0b128c29 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 14:05:28 +0100 Subject: [PATCH 173/336] Debug v21 - fix multiselect --- htdocs/modulebuilder/template/myobject_list.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 6bde6bf10d1..864ad8adf9d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -343,8 +343,14 @@ foreach ($search as $key => $val) { } $mode_search = 2; } - if ($search[$key] != '') { - $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); + if (empty($object->fields[$key]['searchmulti'])) { + if (!is_array($search[$key]) && $search[$key] != '') { + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); + } + } else { + if (is_array($search[$key]) && !empty($search[$key])) { + $sql .= natural_search("t.".$db->escape($key), implode(',', $search[$key]), (($key == 'status') ? 2 : $mode_search)); + } } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { @@ -632,7 +638,11 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '
'; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + if (empty($val['searchmulti'])) { + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + } else { + print $form->multiselectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 0, 0, 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + } } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { From ba6bbdda0e84f3bff2b35ec11831127844ebec87 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 15:05:03 +0100 Subject: [PATCH 174/336] Fix legal mention of VAT intra europe --- .../modules/facture/doc/pdf_crabe.modules.php | 17 ++++++++++------- .../modules/facture/doc/pdf_octopus.modules.php | 17 ++++++++++------- .../modules/facture/doc/pdf_sponge.modules.php | 15 +++++++++------ htdocs/langs/en_US/bills.lang | 1 + 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 5297f1839cb..a5c514576e1 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1231,15 +1231,18 @@ class pdf_crabe extends ModelePDFFactures } // If France, show VAT mention if applicable - if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { - $pdf->SetFont('', 'B', $default_font_size - 2); + if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) { + $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); - if ($mysoc->forme_juridique_code == 92) { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); - } else { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + if (empty($mysoc->tva_assuj)) { + if ($mysoc->forme_juridique_code == 92) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); + } else { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + } + } elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', 0); } - $posy = $pdf->GetY() + 4; } diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index b59ecd85c04..6c75e61ae9c 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -1398,15 +1398,18 @@ class pdf_octopus extends ModelePDFFactures } // If France, show VAT mention if applicable - if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { - $pdf->SetFont('', 'B', $default_font_size - 2); + if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) { + $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); - if ($mysoc->forme_juridique_code == 92) { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); - } else { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + if (empty($mysoc->tva_assuj)) { + if ($mysoc->forme_juridique_code == 92) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); + } else { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + } + } elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', 0); } - $posy = $pdf->GetY() + 4; } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 908d9d2f328..7fa776dff12 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1329,15 +1329,18 @@ class pdf_sponge extends ModelePDFFactures } // If France, show VAT mention if applicable - if ($this->emetteur->country_code == 'FR' && empty($object->total_tva) && (empty($mysoc->tva_assuj) || ($this->emetteur->isInEEC() && $object->thirdparty->isInEEC()))) { + if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) { $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); - if ($mysoc->forme_juridique_code == 92) { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); - } else { - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + if (empty($mysoc->tva_assuj)) { + if ($mysoc->forme_juridique_code == 92) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); + } else { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); + } + } elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', 0); } - $posy = $pdf->GetY() + 4; } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 8e2381466f8..e6f04f74572 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -523,6 +523,7 @@ SendTo=sent to PaymentByTransferOnThisBankAccount=Payment by transfer to the following bank account VATIsNotUsedForInvoice=* Non applicable VAT art-293B of CGI VATIsNotUsedForInvoiceAsso=* Non applicable VAT art-261-7 of CGI +VATIsNotUsedReverseChargeProcedure=* Non applicable VAT art-259-1 of CGI LawApplicationPart1=By application of the law 80.335 of 12/05/80 LawApplicationPart2=the goods remain the property of LawApplicationPart3=the seller until full payment of From 88465b7b422fbd5e8e42b64db3416c747e944a3c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 17:51:16 +0100 Subject: [PATCH 175/336] Add TODO --- htdocs/core/modules/modStock.class.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index c9bc793fb36..1531a9245ae 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -44,7 +44,7 @@ class modStock extends DolibarrModules */ public function __construct($db) { - global $conf, $langs; + global $langs; $this->db = $db; $this->numero = 52; @@ -156,6 +156,17 @@ class modStock extends DolibarrModules $this->rights[$r][4] = 'mouvement'; $this->rights[$r][5] = 'creer'; + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + // Not yet implemented. TODO + $r++; + $this->rights[$r][0] = 1008; + $this->rights[$r][1] = 'Read stock value'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'value_advance'; + $this->rights[$r][5] = 'read'; + } + $r++; $this->rights[$r][0] = 1011; $this->rights[$r][1] = 'inventoryReadPermission'; // Permission label From 19e4b8f269beb9ab036f32d1da5d1701eeb806e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 17:55:20 +0100 Subject: [PATCH 176/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b436d3ce5d3..3c007cca51a 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -25470,12 +25470,6 @@ parameters: count: 2 path: ../../htdocs/product/class/product.class.php - - - message: '#^Ternary operator condition is always true\.$#' - identifier: ternary.alwaysTrue - count: 1 - path: ../../htdocs/product/class/product.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue From bf46df80d4aedc730453cadd6687553dd3477907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:04:05 +0100 Subject: [PATCH 177/336] fix phpstan --- htdocs/product/class/product.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c5ab3793d34..f555e133299 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -646,6 +646,10 @@ class Product extends CommonObject * @var array{}|array{customers_toconsume:int,nb_toconsume:int,qty_toconsume:float,customers_consumed:int,nb_consumed:int,qty_consumed:float,customers_toproduce:int,nb_toproduce:int,qty_toproduce:float,customers_produced:int,nb_produced:int,qty_produced:float} stats by role toconsume, consumed, toproduce, produced */ public $stats_mo = array(); + + /** + * @var array{}|array{nb_toproduce:int,nb_toconsume:int,qty_toproduce:float,qty_toconsume:float} + */ public $stats_bom = array(); public $stats_mrptoconsume = array(); public $stats_mrptoproduce = array(); From eea5f2342b1ea543dff2611546f6d9f66c37cd79 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 18:04:28 +0100 Subject: [PATCH 178/336] FIX default user in stat page --- htdocs/compta/facture/stats/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index b4386092f5f..da137d063a1 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -299,7 +299,7 @@ print '
'.$langs->trans("ThirdPartyType").''; -$sortparam_typent = (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. +$sortparam_typent = getDolGlobalString('SOCIETE_SORT_ON_TYPEENT', 'ASC'); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1); if ($user->admin) { print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); @@ -327,7 +327,7 @@ if (isModEnabled('category')) { // User print '
'.$langs->trans("CreatedBy").''; print img_picto('', 'user', 'class="pictofixedwidth"'); -print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); +print $form->select_dolusers($userid ? $userid : -1, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); print '
'.$langs->trans("Status").''; From 45fa431092c6a3728e4fa079a306b7cb2c411709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:07:16 +0100 Subject: [PATCH 179/336] fix phpstan --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f555e133299..e987b88377e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3083,7 +3083,7 @@ class Product extends CommonObject $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null; $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null; // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on - $this->multiprices_tva_tx[$i] = $result ? $result["tva_tx"].($result ? ' ('.$result['default_vat_code'].')' : '') : null; + $this->multiprices_tva_tx[$i] = $result ? $result["tva_tx"].(!empty($result['default_vat_code']) ? ' ('.$result['default_vat_code'].')' : '') : null; $this->multiprices_recuperableonly[$i] = $result ? $result["recuperableonly"] : null; // Price by quantity From 3bb34cbf24f548d023a62b28b2b2e515929138fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:12:08 +0100 Subject: [PATCH 180/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 30 -------------------------- htdocs/product/class/product.class.php | 8 +++---- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 3c007cca51a..6fd43263efc 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -25410,36 +25410,6 @@ parameters: count: 1 path: ../../htdocs/product/class/product.class.php - - - message: '#^Property Product\:\:\$stats_bom has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_facture_fournisseur has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_facturerec has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_mrptoconsume has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - - - message: '#^Property Product\:\:\$stats_mrptoproduce has no type specified\.$#' - identifier: missingType.property - count: 1 - path: ../../htdocs/product/class/product.class.php - - message: '#^Property Product\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e987b88377e..3b34af84ed5 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1141,10 +1141,10 @@ class Product extends CommonObject if ($id > 0) { $this->id = $id; - $this->price = $price_ht; - $this->price_ttc = $price_ttc; - $this->price_min = $price_min_ht; - $this->price_min_ttc = $price_min_ttc; + $this->price = $price_ht; + $this->price_ttc = $price_ttc; + $this->price_min = $price_min_ht; + $this->price_min_ttc = $price_min_ttc; $result = $this->_log_price($user); if ($result > 0) { From a97ffa85537e7aeba782440ed006a1cc1fef18d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:16:28 +0100 Subject: [PATCH 181/336] fix phpstan --- htdocs/product/class/product.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3b34af84ed5..580983d03c0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -651,9 +651,25 @@ class Product extends CommonObject * @var array{}|array{nb_toproduce:int,nb_toconsume:int,qty_toproduce:float,qty_toconsume:float} */ public $stats_bom = array(); + + /** + * @var array{} + */ public $stats_mrptoconsume = array(); + + /** + * @var array{} + */ public $stats_mrptoproduce = array(); + + /** + * @var array{} + */ public $stats_facturerec = array(); + + /** + * @var array{} + */ public $stats_facture_fournisseur = array(); /** From 9738afbab532ba04d3932955f7ed9cca4439e3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:29:46 +0100 Subject: [PATCH 182/336] fix phpstan --- htdocs/product/class/product.class.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 580983d03c0..4b9d61e6b44 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -653,12 +653,12 @@ class Product extends CommonObject public $stats_bom = array(); /** - * @var array{} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} */ public $stats_mrptoconsume = array(); /** - * @var array{} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} */ public $stats_mrptoproduce = array(); @@ -3940,25 +3940,25 @@ class Product extends CommonObject if ($result) { while ($obj = $this->db->fetch_object($result)) { if ($obj->role == 'toconsume' && empty($warehouseid)) { - $this->stats_mrptoconsume['customers'] += $obj->nb_customers; - $this->stats_mrptoconsume['nb'] += $obj->nb; - $this->stats_mrptoconsume['rows'] += $obj->nb_rows; - $this->stats_mrptoconsume['qty'] += ($obj->qty ? $obj->qty : 0); + $this->stats_mrptoconsume['customers'] += (int) $obj->nb_customers; + $this->stats_mrptoconsume['nb'] += (int) $obj->nb; + $this->stats_mrptoconsume['rows'] += (int) $obj->nb_rows; + $this->stats_mrptoconsume['qty'] += ($obj->qty ? (float) $obj->qty : 0.0); } if ($obj->role == 'consumed' && empty($warehouseid)) { //$this->stats_mrptoconsume['customers'] += $obj->nb_customers; //$this->stats_mrptoconsume['nb'] += $obj->nb; //$this->stats_mrptoconsume['rows'] += $obj->nb_rows; - $this->stats_mrptoconsume['qty'] -= ($obj->qty ? $obj->qty : 0); + $this->stats_mrptoconsume['qty'] -= ($obj->qty ? (float) $obj->qty : 0.0); } if ($obj->role == 'toproduce') { if ($warehouseid) { - $this->stock_warehouse[$warehouseid]->stats_mrptoproduce['qty'] += ($obj->qty ? $obj->qty : 0); + $this->stock_warehouse[$warehouseid]->stats_mrptoproduce['qty'] += ($obj->qty ? (float) $obj->qty : 0.0); } else { - $this->stats_mrptoproduce['customers'] += $obj->nb_customers; - $this->stats_mrptoproduce['nb'] += $obj->nb; - $this->stats_mrptoproduce['rows'] += $obj->nb_rows; - $this->stats_mrptoproduce['qty'] += ($obj->qty ? $obj->qty : 0); + $this->stats_mrptoproduce['customers'] += (int) $obj->nb_customers; + $this->stats_mrptoproduce['nb'] += (int) $obj->nb; + $this->stats_mrptoproduce['rows'] += (int) $obj->nb_rows; + $this->stats_mrptoproduce['qty'] += ($obj->qty ? (float) $obj->qty : 0.0); } } if ($obj->role == 'produced') { From a30e367b9d96e92d88b0ba8990e11e6a726e713d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:40:48 +0100 Subject: [PATCH 183/336] fix phpstan --- htdocs/product/class/product.class.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4b9d61e6b44..66d3bbe97c6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -663,12 +663,12 @@ class Product extends CommonObject public $stats_mrptoproduce = array(); /** - * @var array{} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats facture rec */ public $stats_facturerec = array(); /** - * @var array{} + * @var array{}|array{suppliers:int,nb:int,rows:int,qty:float} stats supplier invoices */ public $stats_facture_fournisseur = array(); @@ -3929,11 +3929,11 @@ class Product extends CommonObject $this->stats_mrptoconsume['customers'] = 0; $this->stats_mrptoconsume['nb'] = 0; $this->stats_mrptoconsume['rows'] = 0; - $this->stats_mrptoconsume['qty'] = 0; + $this->stats_mrptoconsume['qty'] = 0.0; $this->stats_mrptoproduce['customers'] = 0; $this->stats_mrptoproduce['nb'] = 0; $this->stats_mrptoproduce['rows'] = 0; - $this->stats_mrptoproduce['qty'] = 0; + $this->stats_mrptoproduce['qty'] = 0.0; } $result = $this->db->query($sql); @@ -4184,10 +4184,10 @@ class Product extends CommonObject $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - $this->stats_facturerec['customers'] = $obj->nb_customers; - $this->stats_facturerec['nb'] = $obj->nb; - $this->stats_facturerec['rows'] = $obj->nb_rows; - $this->stats_facturerec['qty'] = $obj->qty ? $obj->qty : 0; + $this->stats_facturerec['customers'] = (int) $obj->nb_customers; + $this->stats_facturerec['nb'] = (int) $obj->nb; + $this->stats_facturerec['rows'] = (int) $obj->nb_rows; + $this->stats_facturerec['qty'] = $obj->qty ? (float) $obj->qty : 0.0; // if it's a virtual product, maybe it is in invoice by extension if (getDolGlobalString('PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC')) { @@ -4258,10 +4258,10 @@ class Product extends CommonObject $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - $this->stats_facture_fournisseur['suppliers'] = $obj->nb_suppliers; - $this->stats_facture_fournisseur['nb'] = $obj->nb; - $this->stats_facture_fournisseur['rows'] = $obj->nb_rows; - $this->stats_facture_fournisseur['qty'] = $obj->qty ? $obj->qty : 0; + $this->stats_facture_fournisseur['suppliers'] = (int) $obj->nb_suppliers; + $this->stats_facture_fournisseur['nb'] = (int) $obj->nb; + $this->stats_facture_fournisseur['rows'] = (int) $obj->nb_rows; + $this->stats_facture_fournisseur['qty'] = $obj->qty ? (float) $obj->qty : 0.0; $parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('loadStatsSupplierInvoice', $parameters, $this, $action); From e5449c7a67c7251f526a7e5a6b361c35a4a6457c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 18:53:16 +0100 Subject: [PATCH 184/336] fix phpstan --- htdocs/core/modules/modStock.class.php | 2 +- htdocs/product/class/product.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 1531a9245ae..bd6f23aeb9d 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -44,7 +44,7 @@ class modStock extends DolibarrModules */ public function __construct($db) { - global $langs; + global $conf, $langs; // do not remove $conf $this->db = $db; $this->numero = 52; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 66d3bbe97c6..a94aa6d490a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -653,12 +653,12 @@ class Product extends CommonObject public $stats_bom = array(); /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:float} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats mrp to consume */ public $stats_mrptoconsume = array(); /** - * @var array{}|array{customers:int,nb:int,rows:int,qty:float} + * @var array{}|array{customers:int,nb:int,rows:int,qty:float} stats mrp to produce */ public $stats_mrptoproduce = array(); From e72f23895b5a609f2088fc851120893ee4fa2bc2 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 11 Dec 2024 19:40:39 +0100 Subject: [PATCH 185/336] Fix regression --- htdocs/core/modules/modStock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 1531a9245ae..62b15d2116e 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -44,7 +44,7 @@ class modStock extends DolibarrModules */ public function __construct($db) { - global $langs; + global $conf, $langs; // $conf is used by inc.php $this->db = $db; $this->numero = 52; From 9733ac1f591defae61eeefa1b36875573bf90d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:03:59 +0100 Subject: [PATCH 186/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 36 ----------------------------- htdocs/public/payment/paymentok.php | 26 ++++++++------------- 2 files changed, 10 insertions(+), 52 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b436d3ce5d3..dd84a15d6e4 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -28482,42 +28482,6 @@ parameters: count: 1 path: ../../htdocs/public/payment/newpayment.php - - - message: '#^Variable \$PAYPAL_API_KO might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_OK might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_PASSWORD might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_SANDBOX might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_SIGNATURE might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - - - message: '#^Variable \$PAYPAL_API_USER might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/payment/newpayment.php - - message: '#^Variable \$attendee might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 8fa92e88b89..2abb3b01311 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -77,23 +77,17 @@ $hookmanager->initHooks(array('newpayment')); $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe")); // Clean parameters +$PAYPAL_API_USER = ""; +$PAYPAL_API_PASSWORD = ""; +$PAYPAL_API_SIGNATURE = ""; +$PAYPAL_API_SANDBOX = ""; +$PAYPALTOKEN = ""; +$PAYPALPAYERID = ""; if (isModEnabled('paypal')) { - $PAYPAL_API_USER = ""; - if (getDolGlobalString('PAYPAL_API_USER')) { - $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); - } - $PAYPAL_API_PASSWORD = ""; - if (getDolGlobalString('PAYPAL_API_PASSWORD')) { - $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); - } - $PAYPAL_API_SIGNATURE = ""; - if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { - $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); - } - $PAYPAL_API_SANDBOX = ""; - if (getDolGlobalString('PAYPAL_API_SANDBOX')) { - $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); - } + $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); + $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); + $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); + $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); /*$PAYPAL_API_OK = ""; if ($urlok) { $PAYPAL_API_OK = $urlok; From 0f3098689038bed1d79e296ee984b3b3f34a9d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:07:27 +0100 Subject: [PATCH 187/336] fix phpstan --- htdocs/public/payment/paymentko.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index f99deda6845..a8ae18fb64d 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -71,7 +71,8 @@ if (isModEnabled('paypal')) { */ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe")); - +$PAYPALTOKEN = ""; +$PAYPALPAYERID = ""; if (isModEnabled('paypal')) { $PAYPALTOKEN = GETPOST('TOKEN'); if (empty($PAYPALTOKEN)) { From 58e2cd6afdc465ef9c22a6d142bd1273028560a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:12:03 +0100 Subject: [PATCH 188/336] fix phpstan --- htdocs/public/payment/newpayment.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 54af1723370..048f523bc08 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -231,6 +231,8 @@ $ref = $REF = GETPOST('ref', 'alpha'); $TAG = GETPOST("tag", 'alpha'); $FULLTAG = GETPOST("fulltag", 'alpha'); // fulltag is tag with more information $SECUREKEY = GETPOST("securekey"); // Secure key +$PAYPAL_API_OK = ""; +$PAYPAL_API_KO = ""; if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) { $FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod; From 8716550a9a2e878214c5ce7558343148482431c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:14:49 +0100 Subject: [PATCH 189/336] fix phpstan --- htdocs/public/payment/newpayment.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 048f523bc08..b7da4eded52 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -233,6 +233,7 @@ $FULLTAG = GETPOST("fulltag", 'alpha'); // fulltag is tag with more information $SECUREKEY = GETPOST("securekey"); // Secure key $PAYPAL_API_OK = ""; $PAYPAL_API_KO = ""; +$PAYPAL_API_SANDBOX = ""; if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) { $FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod; @@ -286,7 +287,11 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @phan-var-force string $PAYPAL_API_OK @phan-var-force string $PAYPAL_API_KO '; - +/** +* @var string $PAYPAL_API_SANDBOX +* @var string $PAYPAL_API_OK +* @var string $PAYPAL_API_KO +*/ if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From d2754efbe4d87166d2f928986a9752c2c0e193ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:23:04 +0100 Subject: [PATCH 190/336] fix phpstan --- htdocs/public/payment/newpayment.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index b7da4eded52..78a4b96e72e 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -234,6 +234,9 @@ $SECUREKEY = GETPOST("securekey"); // Secure key $PAYPAL_API_OK = ""; $PAYPAL_API_KO = ""; $PAYPAL_API_SANDBOX = ""; +$PAYPAL_API_USER = ""; +$PAYPAL_API_PASSWORD = ""; +$PAYPAL_API_SIGNATURE = ""; if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) { $FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod; @@ -288,10 +291,12 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @phan-var-force string $PAYPAL_API_KO '; /** -* @var string $PAYPAL_API_SANDBOX -* @var string $PAYPAL_API_OK -* @var string $PAYPAL_API_KO -*/ + * @var string $PAYPAL_API_SANDBOX + * @var string $PAYPAL_API_OK + * @var string $PAYPAL_API_KO + * @var string $PAYPAL_API_PASSWORD + * @var string $PAYPAL_API_SIGNATURE + */ if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From 69ecc4c74368ea3b8bde08e21f3f9787c17d71c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:28:56 +0100 Subject: [PATCH 191/336] fix phpstan --- htdocs/public/payment/newpayment.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 78a4b96e72e..7b1f8ab4226 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -290,14 +290,9 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & @phan-var-force string $PAYPAL_API_OK @phan-var-force string $PAYPAL_API_KO '; -/** - * @var string $PAYPAL_API_SANDBOX - * @var string $PAYPAL_API_OK - * @var string $PAYPAL_API_KO - * @var string $PAYPAL_API_PASSWORD - * @var string $PAYPAL_API_SIGNATURE - */ + if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { + global $PAYPAL_API_SANDBOX, $PAYPAL_API_OK, $PAYPAL_API_KO, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From a7614342cd041473db3d5019db3e870f8001b030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:38:48 +0100 Subject: [PATCH 192/336] fix phpstan --- htdocs/paypal/lib/paypalfunctions.lib.php | 27 +++++++---------------- htdocs/public/payment/newpayment.php | 2 +- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/htdocs/paypal/lib/paypalfunctions.lib.php b/htdocs/paypal/lib/paypalfunctions.lib.php index b3a714489a2..eba524caab4 100644 --- a/htdocs/paypal/lib/paypalfunctions.lib.php +++ b/htdocs/paypal/lib/paypalfunctions.lib.php @@ -1,7 +1,8 @@ - * Copyright (C) 2011 Regis Houssin - * Copyright (C) 2024 MDW +/* Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2011 Regis Houssin + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -57,22 +58,10 @@ if (getDolGlobalString('PAYPAL_API_SANDBOX') || GETPOST('forcesandbox', 'alpha') } // Clean parameters -$PAYPAL_API_USER = ""; -if (getDolGlobalString('PAYPAL_API_USER')) { - $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); -} -$PAYPAL_API_PASSWORD = ""; -if (getDolGlobalString('PAYPAL_API_PASSWORD')) { - $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); -} -$PAYPAL_API_SIGNATURE = ""; -if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { - $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); -} -$PAYPAL_API_SANDBOX = ""; -if (getDolGlobalString('PAYPAL_API_SANDBOX')) { - $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); -} +$PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); +$PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); +$PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); +$PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); // Proxy $PROXY_HOST = getDolGlobalString('MAIN_PROXY_HOST'); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 7b1f8ab4226..3ad6cbb59fa 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -292,7 +292,7 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & '; if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) { - global $PAYPAL_API_SANDBOX, $PAYPAL_API_OK, $PAYPAL_API_KO, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; + global $PAYPAL_API_SANDBOX, $PAYPAL_API_OK, $PAYPAL_API_KO, $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; From a85bb16de514d6ed8376a1d003dfc782db7c6978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:44:48 +0100 Subject: [PATCH 193/336] fix phpstan --- htdocs/paypal/lib/paypal.lib.php | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 15ed29f8d9f..cd942116585 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -1,7 +1,8 @@ - * Copyright (C) 2011-2012 Regis Houssin - * Copyright (C) 2024 MDW +/* Copyright (C) 2008-2012 Laurent Destailleur + * Copyright (C) 2011-2012 Regis Houssin + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * 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 @@ -467,22 +468,10 @@ function hash_call($methodName, $nvpStr) } // Clean parameters - $PAYPAL_API_USER = ""; - if (getDolGlobalString('PAYPAL_API_USER')) { - $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); - } - $PAYPAL_API_PASSWORD = ""; - if (getDolGlobalString('PAYPAL_API_PASSWORD')) { - $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); - } - $PAYPAL_API_SIGNATURE = ""; - if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { - $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); - } - $PAYPAL_API_SANDBOX = ""; - if (getDolGlobalString('PAYPAL_API_SANDBOX')) { - $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); - } + $PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER'); + $PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD'); + $PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE'); + $PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX'); // TODO END problem with triggers dol_syslog("Paypal API endpoint ".$API_Endpoint); @@ -514,8 +503,8 @@ function hash_call($methodName, $nvpStr) curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ($ssl_verifypeer ? true : false)); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($ssl_verifypeer ? true : false)); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, !getDolGlobalString('MAIN_USE_CONNECT_TIMEOUT') ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); - curl_setopt($ch, CURLOPT_TIMEOUT, !getDolGlobalString('MAIN_USE_RESPONSE_TIMEOUT') ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, getDolGlobalInt('MAIN_USE_CONNECT_TIMEOUT', 5)); + curl_setopt($ch, CURLOPT_TIMEOUT, getDolGlobalInt('MAIN_USE_RESPONSE_TIMEOUT', 30)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); From d01d63da0b99c514323c5d8bfd384bac91100634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 11 Dec 2024 20:53:45 +0100 Subject: [PATCH 194/336] fix phpstan --- htdocs/paypal/admin/paypal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 22a53c5d1ef..fab3c789429 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -267,7 +267,7 @@ if (isModEnabled("bank")) { print '
'; print $langs->trans("CSSUrlForPaymentForm").''; print ''; -print '   '.$langs->trans("Example").': http://mysite/mycss.css'; +print '   '.$langs->trans("Example").': https://mysite/mycss.css'; print '
'; + print(!empty($val) ? convertSecondToTime((int) $val, 'allhourmin') : 0); + print ''; + print(!empty($val) ? $val : ''); + print ''; + print price2num(!empty($val) ? $val : 0, 'MS'); + print ''; + print price(!empty($val) ? $val : 0); + print ''; - print(!empty($val) ? convertSecondToTime((int) $val, 'allhourmin') : 0); - print ''; - print(!empty($val) ? $val : ''); - print ''; - print price2num(!empty($val) ? $val : 0, 'MS'); - print ''; - print price(!empty($val) ? $val : 0); - print ''; if (!is_array($typenArray) || count($typenArray) == 0) { $typenArray = $formcompany->typent_array(1); } + print ''; if (!empty($obj->typent_code)) { print $typenArray[$obj->typent_code]; } @@ -2357,10 +2357,10 @@ if ($num > 0) { } // Staff if (!empty($arrayfields['staff.code']['checked'])) { - print ''; if (!is_array($conf->cache['staff']) || count($conf->cache['staff']) == 0) { $conf->cache['staff'] = $formcompany->effectif_array(1); } + print ''; print $conf->cache['staff'][$obj->staff_code]; print ''; - print ''; // $object_link can be a ''; - // Amount print ''.price($block->amounts).''; + //print ''; if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) { // If error if ($checkresult[$block->id]) { print $form->textwithpicto('', $langs->trans('OkCheckFingerprintValidityButChainIsKo')); + } else { + //print $form->textwithpicto('', $langs->trans('KoCheckFingerprintValidity')); } } @@ -681,6 +677,12 @@ if (is_array($blocks)) { } print ''; + print ''; // $object_link can be a ''; + // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 00a158952f0..dda8647e791 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -902,12 +902,10 @@ class BlockedLog */ public function create($user, $forcesignature = '') { - global $conf, $langs, $hookmanager; + global $conf, $langs; $langs->load('blockedlog'); - $error = 0; - // Clean data $this->amounts = (float) $this->amounts; @@ -942,9 +940,9 @@ class BlockedLog $this->db->begin(); - $previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done + $previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done and transaction closed - $keyforsignature = $this->buildKeyForSignature(); + $keyforsignature = $this->buildKeyForSignature(); // All the information for the has (meta data + data saved) include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 75ab23f6b73..9b74b8a787c 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -7,7 +7,7 @@ BrowseBlockedLog=Unalterable logs ShowAllFingerPrintsMightBeTooLong=Show all archived logs (might be long) ShowAllFingerPrintsErrorsMightBeTooLong=Show all non-valid archive logs (might be long) DownloadBlockChain=Download fingerprints -KoCheckFingerprintValidity=Archived log entry is not valid. It means someone (a hacker?) has modified some data of this record after it was recorded, or has erased the previous archived record (check that line with previous # exists) or has modified checksum of the previous record. +KoCheckFingerprintValidity=Archived log entry is not valid. It means someone (a hacker?) has modified some data of this record after it was recorded, OR has erased the previous archived record (check that the line with previous # exists) OR has modified the checksum of the previous record. OkCheckFingerprintValidity=Archived log record is valid. The data on this line was not modified and the entry follows the previous one. OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to previous one but the chain was corrupted previously. AddedByAuthority=Stored into remote authority From 837fadcc7a23d83c2f1662b4ceb81a4bdfe56cad Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 12:53:55 +0100 Subject: [PATCH 216/336] Fix filter on event type --- htdocs/blockedlog/admin/blockedlog_list.php | 7 +++-- htdocs/blockedlog/class/blockedlog.class.php | 32 ++++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 71178aff819..376120d7981 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -80,7 +80,7 @@ $search_end = -1; if (GETPOST('search_endyear') != '') { $search_end = dol_mktime(23, 59, 59, $search_endmonth, $search_endday, $search_endyear); } -$search_code = GETPOST('search_code', 'alpha'); +$search_code = GETPOST('search_code', 'array:alpha'); $search_ref = GETPOST('search_ref', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); @@ -138,7 +138,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_fk_user = ''; $search_start = -1; $search_end = -1; - $search_code = ''; + $search_code = array(); $search_ref = ''; $search_amount = ''; $search_showonlyerrors = 0; @@ -496,7 +496,8 @@ print ''; -print $form->selectarray('search_code', $block_static->trackedevents, $search_code, 1, 0, 0, '', 1, 0, 0, 'ASC', 'maxwidth150', 1); +//print $form->selectarray('search_code', $block_static->trackedevents, $search_code, 1, 0, 0, '', 1, 0, 0, 'ASC', 'maxwidth150', 1); +print $form->multiselectarray('search_code', $block_static->trackedevents, $search_code, 0, 0, 'maxwidth150', 1); print '
'; + $text .= '
'; $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Asset"), $langs->transnoentities("Asset")); $tooltip .= $langs->trans("GenericMaskCodes2"); @@ -81,7 +81,7 @@ class mod_asset_advanced extends ModeleNumRefAsset // Parametrage du prefix $text .= ''; - $text .= ''; + $text .= ''; $text .= ''; diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 944e244fd17..1ea205d0d1c 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -95,7 +95,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode // Mask parameter //$texte.= ''; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php index 9cb371267b6..69278d4643f 100644 --- a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php @@ -131,7 +131,7 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode // Mask parameter //$texte.= ''; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php index 18cbfa0cdb6..bc3ef9a72ff 100644 --- a/htdocs/core/modules/bom/mod_bom_advanced.php +++ b/htdocs/core/modules/bom/mod_bom_advanced.php @@ -82,7 +82,7 @@ class mod_bom_advanced extends ModeleNumRefBoms // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index c03e67d6687..848b3ccbace 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -76,7 +76,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index a3280fa1455..bb0603ef0f0 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -82,7 +82,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index 7af0d9e16bb..e872357c63c 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -73,7 +73,7 @@ class mod_contract_magre extends ModelNumRefContracts $tooltip .= '
'.$langs->trans("GenericMaskCodes5b"); $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'; diff --git a/htdocs/core/modules/delivery/mod_delivery_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php index 60cbc9420ab..f09c8764d7a 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -87,7 +87,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index 30bd7abd94b..a6394c0df16 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -83,7 +83,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition $tooltip .= '
'.$langs->trans("GenericMaskCodes5b"); $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/expensereport/mod_expensereport_sand.php b/htdocs/core/modules/expensereport/mod_expensereport_sand.php index 0c5962c871e..6f4f091f90e 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_sand.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_sand.php @@ -87,7 +87,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; $mask = getDolGlobalString('EXPENSEREPORT_SAND_MASK'); - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 40dc1034642..3d3a93e8154 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -84,7 +84,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltipstandardmercure').''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltipstandardmercure').''; $texte .= '  '; @@ -92,20 +92,20 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltipcreditnotemercure').''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltipcreditnotemercure').''; $texte .= ''; // Prefix setting of replacement invoices if (!getDolGlobalString('INVOICE_DISABLE_REPLACEMENT')) { $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltipreplacementmercure').''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltipreplacementmercure').''; $texte .= ''; } // Prefix setting of deposit if (!getDolGlobalString('INVOICE_DISABLE_DEPOSIT')) { $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltipdownpaymentmercure').''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltipdownpaymentmercure').''; $texte .= ''; } diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index 0ac08eb7e06..a23fe52bbf6 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -88,7 +88,7 @@ class mod_arctic extends ModeleNumRefFicheinter // Setting the prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php index 03029517427..c8ed8ec5996 100644 --- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php +++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php @@ -73,7 +73,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays //$tooltip .= '
'.$langs->trans("GenericMaskCodes5b"); $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/hrm/mod_evaluation_advanced.php b/htdocs/core/modules/hrm/mod_evaluation_advanced.php index de221e52fee..434512e1cb1 100644 --- a/htdocs/core/modules/hrm/mod_evaluation_advanced.php +++ b/htdocs/core/modules/hrm/mod_evaluation_advanced.php @@ -82,7 +82,7 @@ class mod_evaluation_advanced extends ModeleNumRefEvaluation // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; diff --git a/htdocs/core/modules/mrp/mod_mo_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php index 255a3e6da43..82286280b8e 100644 --- a/htdocs/core/modules/mrp/mod_mo_advanced.php +++ b/htdocs/core/modules/mrp/mod_mo_advanced.php @@ -83,7 +83,7 @@ class mod_mo_advanced extends ModeleNumRefMos // Parametrage du prefix $text .= ''.$langs->trans("Mask").':'; - $text .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $text .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $text .= '  '; diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 3a1fe0a9fad..5e3f0a4b37d 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -85,7 +85,7 @@ class mod_payment_ant extends ModeleNumRefPayments // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 51d3943314c..b0932e24308 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -98,7 +98,7 @@ class mod_codeproduct_elephant extends ModeleProductCode // Parametrage du prefix customers $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("ProductCodeModel").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; @@ -106,7 +106,7 @@ class mod_codeproduct_elephant extends ModeleProductCode // Parametrage du prefix suppliers $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("ServiceCodeModel").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index 35fa10f867e..d07ce3fd9e3 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -86,7 +86,7 @@ class mod_lot_advanced extends ModeleNumRefBatch // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index dfcba97ccaf..18a33833ed3 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -86,7 +86,7 @@ class mod_sn_advanced extends ModeleNumRefBatch // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index 2be62efa5f3..4132956f86e 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -92,7 +92,7 @@ class mod_project_universal extends ModeleNumRefProjects // Prefix settings $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index 08cee523fec..4fcb310c941 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -87,7 +87,7 @@ class mod_task_universal extends ModeleNumRefTask // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; diff --git a/htdocs/core/modules/propale/mod_propale_saphir.php b/htdocs/core/modules/propale/mod_propale_saphir.php index 8f3e6402b63..93ebf4f8298 100644 --- a/htdocs/core/modules/propale/mod_propale_saphir.php +++ b/htdocs/core/modules/propale/mod_propale_saphir.php @@ -90,7 +90,7 @@ class mod_propale_saphir extends ModeleNumRefPropales // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; $mask = !getDolGlobalString('PROPALE_SAPHIR_MASK') ? '' : $conf->global->PROPALE_SAPHIR_MASK; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; diff --git a/htdocs/core/modules/reception/mod_reception_moonstone.php b/htdocs/core/modules/reception/mod_reception_moonstone.php index 3810da99bb1..a482366fc36 100644 --- a/htdocs/core/modules/reception/mod_reception_moonstone.php +++ b/htdocs/core/modules/reception/mod_reception_moonstone.php @@ -67,7 +67,7 @@ class mod_reception_moonstone extends ModelNumRefReception $tooltip .= '
'.$langs->trans("GenericMaskCodes5b"); $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''; $texte .= '  '; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 566d7bb70f0..b01fcafb6db 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -110,7 +110,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode // Parametrage du prefix customers $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltipelephantcutomer').''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltipelephantcutomer').''; $texte .= '  '; @@ -118,7 +118,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode // Parametrage du prefix suppliers $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("SupplierCodeModel").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltipelephantsupplier').''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltipelephantsupplier').''; $texte .= ''; // Date of switch to that numbering model diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index 0161aff09d6..868488bd4a2 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -87,7 +87,6 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode */ public function info($langs) { - global $conf; global $form; $langs->load("companies"); @@ -100,8 +99,8 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode $texte .= ''; $texte .= ''; $texte .= ''; - $s1 = $form->textwithpicto('', $tooltip, 1, 1); - $s2 = $form->textwithpicto('', $tooltip, 1, 1); + $s1 = $form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name); + $s2 = $form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name); $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index 67592bde09a..113549aef15 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php @@ -86,7 +86,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index 4eada1d1578..9c83c7d9176 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -90,7 +90,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php index 2affafe14ba..75768b9f87e 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php @@ -84,7 +84,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos // Setting up the prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php index 81b263a931e..dcac49b041a 100644 --- a/htdocs/core/modules/ticket/mod_ticket_universal.php +++ b/htdocs/core/modules/ticket/mod_ticket_universal.php @@ -85,7 +85,7 @@ class mod_ticket_universal extends ModeleNumRefTicket // Prefix settings $text .= ''; - $text .= ''; + $text .= ''; $text .= ''; diff --git a/htdocs/core/modules/workstation/mod_workstation_advanced.php b/htdocs/core/modules/workstation/mod_workstation_advanced.php index f372547a395..c67765e88d8 100644 --- a/htdocs/core/modules/workstation/mod_workstation_advanced.php +++ b/htdocs/core/modules/workstation/mod_workstation_advanced.php @@ -83,7 +83,7 @@ class mod_workstation_advanced extends ModeleNumRefWorkstation // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php index e5feff9f403..5be97a45988 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php @@ -82,7 +82,7 @@ class mod_recruitmentcandidature_advanced extends ModeleNumRefRecruitmentCandida // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php index e7d6b1d918c..0ada1a5e802 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php @@ -82,7 +82,7 @@ class mod_recruitmentjobposition_advanced extends ModeleNumRefRecruitmentJobPosi // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; From 2ddd5180298583130c7c9d52f07028c1526dcc15 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 18:11:05 +0100 Subject: [PATCH 234/336] Debug v21 --- htdocs/core/class/html.form.class.php | 2 +- htdocs/mrp/mo_production.php | 28 ++++++++++++++++--- .../product/class/html.formproduct.class.php | 1 + .../workstation/class/workstation.class.php | 6 ++-- htdocs/workstation/workstation_card.php | 8 +++--- 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 61763c5af9a..e820a5ddc21 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -10539,7 +10539,7 @@ class Form // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return select list of groups + * Return select list of user groups * * @param int|object|object[] $selected Id group or group(s) preselected * @param string $htmlname Field name in form diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 8f5e4080fa7..ac250908951 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -494,7 +494,15 @@ if (empty($reshook)) { $moline->array_options["options_".$key] = $value; } $moline->qty = GETPOSTFLOAT('qty_lineProduce'); + if (GETPOSTISSET('warehouse_lineProduce')) { + $moline->fk_warehouse = (GETPOSTINT('warehouse_lineProduce') > 0 ? GETPOSTINT('warehouse_lineProduce') : 0); + } + if (GETPOSTISSET('workstation_lineProduce')) { + $moline->fk_default_workstation = (GETPOSTINT('workstation_lineProduce') > 0 ? GETPOSTINT('workstation_lineProduce') : 0); + } + $res = $moline->update($user); + if ($res < 0) { setEventMessages($moline->error, $moline->errors, 'errors'); header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id); @@ -1085,8 +1093,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ' ' . price2num($alreadyconsumed, 'MS'); print ''; - // Entrepot + // Warehouse / Workstation print ''; // Stock @@ -1198,9 +1211,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Warehouse and/or workstation - print ''; + print ''; print ''; print '
'; // trans remove html entities $texte .= $langs->trans("ModuleCompanyCodeCustomer".$this->name, '{s2}')."
\n"; diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index 28686db0ed6..857cb2d9521 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -112,10 +112,10 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode $texte .= ''; $texte .= ''; $texte .= ''; - $s1 = $form->textwithpicto('', $tooltip, 1, 1); - $s2 = $form->textwithpicto('', $tooltip, 1, 1); - $s3 = $form->textwithpicto('', $tooltip, 1, 1); - $s4 = $form->textwithpicto('', $tooltip, 1, 1); + $s1 = $form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name); + $s2 = $form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name); + $s3 = $form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name); + $s4 = $form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name); $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index ed15e0e7351..bafa84d20c8 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -99,7 +99,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices // Setting the prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -107,19 +107,19 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices // Prefix setting of credit note $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; if (!getDolGlobalString('INVOICE_DISABLE_REPLACEMENT') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // Prefix setting of replacement $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; } // Prefix setting of deposit $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= '
'; // trans remove html entities $texte .= $langs->trans("ModuleCompanyCodeCustomer".$this->name, '{s2}', '{s4}')."
\n"; diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php index 62387787668..0bc819da50b 100644 --- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php +++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php @@ -83,7 +83,7 @@ class mod_stocktransfer_advanced extends ModeleNumRefStockTransfer // Parametrage du prefix $texte .= '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").')'; $texte .= ':'.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltipstandardtulip').''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltipstandardtulip').' 
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltipcredittuplie').''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltipcredittuplie').'
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltipreplacementtulip').''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltipreplacementtulip').'
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltipdownpaymenttulip').''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltipdownpaymenttulip').'
'; diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index 350e22302ea..707b64505d6 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -91,7 +91,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders // Parametrage du prefix $texte .= '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1, '', 0, 3, 'tooltiporchidee').''.$form->textwithpicto('', $tooltip, 1, 'help', '', 0, 3, 'tooltiporchidee').' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'  '; + if ($tmpproduct->type == Product::TYPE_PRODUCT) { + print $formproduct->selectWarehouses($line->fk_warehouse, 'warehouse_lineProduce', 'warehouseopen', 1); + } elseif (isModEnabled('workstation')) { + print $formproduct->selectWorkstations($line->fk_default_workstation, 'workstation_lineProduce', 1); + } print ''; - if (getDolGlobalString('STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE') && $tmpwarehouse->id > 0) { - print img_picto('', $tmpwarehouse->picto) . " " . $tmpwarehouse->label; + print ''; + if ($tmpproduct->isStockManaged()) { + // When STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE is set, we always use the warehouse of the MO, the same than production. + if (getDolGlobalString('STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE') && $tmpwarehouse->id > 0) { + print img_picto('', $tmpwarehouse->picto) . " " . $tmpwarehouse->label; + } else { + $warehouseline = new Entrepot($db); + $warehouseline->fetch($line->fk_warehouse); + print $warehouseline->getNomUrl(1); + } } if (isModEnabled('workstation') && $line->fk_default_workstation > 0) { $tmpworkstation = new Workstation($db); diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index bc8a42046a2..2b2c1d0a198 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -335,6 +335,7 @@ class FormProduct } } + $out .= ''; $out .= '
'; - print $langs->trans('Groups'); + print '
'; + print $langs->trans('UserGroups'); print ''; print img_picto('', 'group'); @@ -288,7 +288,7 @@ if (($id || $ref) && $action == 'edit') { print '
'; - print $langs->trans('Groups'); + print $langs->trans('UserGroups'); print ''; print img_picto('', 'group'); From c00d07e790e8974eb2e0cd56f91eb4698b0ddae7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 18:13:08 +0100 Subject: [PATCH 235/336] Debug v21 --- htdocs/mrp/mo_production.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index ac250908951..bd40cf7ed2e 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -1217,9 +1217,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (getDolGlobalString('STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE') && $tmpwarehouse->id > 0) { print img_picto('', $tmpwarehouse->picto) . " " . $tmpwarehouse->label; } else { - $warehouseline = new Entrepot($db); - $warehouseline->fetch($line->fk_warehouse); - print $warehouseline->getNomUrl(1); + if ($line->fk_warehouse > 0) { + $warehouseline = new Entrepot($db); + $warehouseline->fetch($line->fk_warehouse); + print $warehouseline->getNomUrl(1); + } } } if (isModEnabled('workstation') && $line->fk_default_workstation > 0) { From 8673588274b9fc2b3262dcf9f93c73b0e36ab8f6 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 13 Dec 2024 20:26:32 +0100 Subject: [PATCH 236/336] Debug v21 --- htdocs/mrp/js/lib_dispatch.js.php | 27 +++++++++++-------- htdocs/mrp/mo_production.php | 45 +++++++++++++++++++++++-------- htdocs/theme/eldy/global.inc.php | 5 +++- htdocs/theme/md/style.css.php | 16 +++-------- 4 files changed, 57 insertions(+), 36 deletions(-) diff --git a/htdocs/mrp/js/lib_dispatch.js.php b/htdocs/mrp/js/lib_dispatch.js.php index c36c59b6f3b..d63cc494c2b 100644 --- a/htdocs/mrp/js/lib_dispatch.js.php +++ b/htdocs/mrp/js/lib_dispatch.js.php @@ -76,14 +76,14 @@ if (empty($dolibarr_nocache)) { * * @param index int index of product line. 0 = first product line * @param type string type of dispatch (batch = batch dispatch, dispatch = non batch dispatch) - * @param mode string 'qtymissing' will create new line with qty missing, 'lessone' will keep 1 in old line and the rest in new one + * @param mode string If mode is 'qtymissing' the split button will create a new line with qty missing, If 'lessone' it will keep 1 in old line and the rest in new one */ function addDispatchLine(index, type, mode) { mode = mode || 'qtymissing' console.log("mrp/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode); - if(mode == 'qtymissingconsume' || mode == 'allmissingconsume') { + if (mode == 'qtymissingconsume' || mode == 'allmissingconsume') { var inputId = 'qtytoconsume'; var warehouseId = 'idwarehouse'; } @@ -94,7 +94,10 @@ function addDispatchLine(index, type, mode) var nbrTrs = $("tr[name^='"+type+"_"+index+"']").length; // position of line for batch var $row = $("tr[name='"+type+'_'+index+"_1']").clone(true); // clone last batch line to jQuery object var qtyOrdered = parseFloat($("#qty_ordered_"+index).val()); // Qty ordered is same for all rows - var qty = parseFloat($("#"+inputId+"-"+index+"-"+nbrTrs).val()); + var qty = parseFloat($("#"+inputId+"-"+index+"-"+nbrTrs).val()); // qty entered in field to consume + + console.log("#"+inputId+"-"+index+"-"+nbrTrs+" => "+qty); + var qtyDispatched; if (mode === 'lessone') @@ -103,21 +106,22 @@ function addDispatchLine(index, type, mode) } else { - qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + qty; console.log($("#qty_dispatched_"+index).val()); + qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + qty; // If user did not reduced the qty to dispatch on old line, we keep only 1 on old line and the rest on new line if (qtyDispatched == qtyOrdered && qtyDispatched > 1) { qtyDispatched = parseFloat($("#qty_dispatched_" + index).val()) + 1; - } - if(mode == 'allmissingconsume' || mode == 'alltoproduce') { - var qtymax = parseFloat($($row).data('max-qty')); - if(qtymax === 'undefined') qtymax = 1; + if (mode == 'allmissingconsume' || mode == 'alltoproduce') { + var qtymax = parseFloat($($row).data('max-qty')); + if (qtymax === 'undefined') { + qtymax = 1; + } } } - if(mode == 'allmissingconsume' || mode == 'alltoproduce') { + if (mode == 'allmissingconsume' || mode == 'alltoproduce') { var count = 0; var qtyalreadyused = 0; var error = 0; @@ -141,11 +145,12 @@ function addDispatchLine(index, type, mode) $row = $("tr[name='" + type + '_' + index + "_1']").clone(true); } - if(error === 0) { + if (error === 0) { addDispatchTR(qtyOrdered, qtyDispatched, index, nbrTrs, warehouseId, inputId, type, '', mode, $row); } + } else { + addDispatchTR(qtyOrdered, qtyDispatched, index, nbrTrs, warehouseId, inputId, type, qty, mode, $row); } - else addDispatchTR(qtyOrdered, qtyDispatched, index, nbrTrs, warehouseId, inputId, type, qty, mode, $row) } diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index bd40cf7ed2e..bd701a4cf99 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -213,10 +213,21 @@ if (empty($reshook)) { $tmpproduct->fetch($moline->fk_product); if ($tmpproduct->type == Product::TYPE_SERVICE) { $moline->fk_default_workstation = $tmpproduct->fk_default_workstation; - } - $moline->disable_stock_change = ($tmpproduct->type == Product::TYPE_SERVICE ? 1 : 0); - if (getDolGlobalInt('PRODUCT_USE_UNITS')) { - $moline->fk_unit = $tmpproduct->fk_unit; + $moline->disable_stock_change = 1; + if ($tmpproduct->duration_unit) { + $moline->qty = $tmpproduct->duration_value; + include_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; + $cunits = new CUnits($db); + $res = $cunits->fetch(0, '', $tmpproduct->duration_unit, 'time'); + if ($res > 0) { + $moline->fk_unit = $cunits->id; + } + } + } else { + $moline->disable_stock_change = 0; + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { + $moline->fk_unit = $tmpproduct->fk_unit; + } } } // Extrafields @@ -859,7 +870,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''."\n"; - print ''; + print ''; // Product print ''; // Qty @@ -871,7 +882,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; } // Qty already consumed - print ''; + print ''; // Warehouse print ''; // Unit - print ''; + print ''; // Cost price if ($permissiontoupdatecost && getDolGlobalString('MRP_SHOW_COST_FOR_CONSUMPTION')) { print ''; @@ -1521,7 +1538,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print '
'.$langs->trans("Product").''.$langs->trans("UnitCost").''.$form->textwithpicto($langs->trans("QtyAlreadyConsumedShort"), $langs->trans("QtyAlreadyConsumed")).''; + print $langs->trans("QtyAlreadyConsumedShort"); + print ''; if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { @@ -936,7 +949,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Qty print ''; + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { + //... + } + print '
'; - print ''; + print ''; // Product print ''; // Qty @@ -1533,13 +1550,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Cost price if ($permissiontoupdatecost) { if (empty($bomcostupdated)) { - print ''; + print ''; } else { - print ''; + print ''; } } // Already produced - print ''; + print ''; // Warehouse print ''; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php index 69278d4643f..cf3cb3135a4 100644 --- a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php @@ -131,7 +131,7 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode // Mask parameter //$texte.= ''; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; From da26fdbb38c08ba05f54c15e544faf8a3478bafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 14 Dec 2024 09:44:19 +0100 Subject: [PATCH 239/336] test phan baseline --- dev/tools/phan/baseline.txt | 127 +++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 60 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 220cdb76c5f..d69db0e405e 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -10,43 +10,43 @@ return [ // # Issue statistics: // PhanUndeclaredProperty : 560+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 350+ occurrences - // PhanUndeclaredGlobalVariable : 300+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 320+ occurrences + // PhanUndeclaredGlobalVariable : 290+ occurrences // PhanTypeMismatchArgumentProbablyReal : 230+ occurrences // PhanPluginUnknownArrayMethodReturnType : 180+ occurrences - // PhanTypeMismatchProperty : 140+ occurrences + // PhanTypeMismatchProperty : 130+ occurrences // PhanPluginUnknownArrayMethodParamType : 120+ occurrences - // PhanPluginUnknownPropertyType : 120+ occurrences + // PhanPluginUnknownPropertyType : 110+ occurrences // PhanPossiblyUndeclaredVariable : 80+ occurrences - // PhanPluginUndeclaredVariableIsset : 60+ occurrences // PhanRedefineFunction : 45+ occurrences // PhanTypeExpectedObjectPropAccess : 45+ occurrences // PhanTypeMismatchArgumentNullableInternal : 40+ occurrences + // PhanPluginSuspiciousParamOrder : 35+ occurrences // PhanTypeInvalidDimOffset : 30+ occurrences // PhanTypeMismatchDimFetch : 30+ occurrences // PhanPluginEmptyStatementIf : 15+ occurrences - // PhanUndeclaredConstant : 15+ occurrences // PhanPluginUnknownObjectMethodCall : 10+ occurrences // PhanTypeComparisonFromArray : 10+ occurrences // PhanTypeMismatchDimFetchNullable : 10+ occurrences // PhanUndeclaredMethod : 10+ occurrences // PhanEmptyForeach : 8 occurrences - // PhanTypeArraySuspiciousNull : 8 occurrences // PhanPluginBothLiteralsBinaryOp : 7 occurrences // PhanPluginDuplicateExpressionBinaryOp : 7 occurrences // PhanPluginSuspiciousParamPosition : 7 occurrences + // PhanTypeArraySuspiciousNull : 6 occurrences + // PhanParamTooMany : 5 occurrences // PhanPossiblyNullTypeMismatchProperty : 5 occurrences - // PhanParamTooMany : 4 occurrences - // PhanPluginDuplicateArrayKey : 4 occurrences // PhanEmptyFQSENInClasslike : 3 occurrences // PhanInvalidFQSENInClasslike : 3 occurrences // PhanTypeMismatchReturn : 3 occurrences // PhanTypeExpectedObjectPropAccessButGotNull : 2 occurrences // PhanTypeMismatchDimAssignment : 2 occurrences // PhanTypeSuspiciousStringExpression : 2 occurrences + // PhanUndeclaredTypeParameter : 2 occurrences // PhanAccessMethodProtected : 1 occurrence // PhanPluginUnknownArrayPropertyType : 1 occurrence // PhanTypeConversionFromArray : 1 occurrence + // PhanTypeMismatchArgumentInternalProbablyReal : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ @@ -60,7 +60,7 @@ return [ 'htdocs/api/class/api_login.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/api/class/api_setup.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeInvalidDimOffset'], + 'htdocs/asset/class/asset.class.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'], 'htdocs/asset/tpl/accountancy_codes_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -106,7 +106,6 @@ return [ 'htdocs/compta/bank/various_payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/compta/bank/various_payment/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/compta/cashcontrol/cashcontrol_list.php' => ['PhanTypeMismatchProperty'], 'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -134,13 +133,12 @@ return [ 'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/core/actions_massactions.inc.php' => ['PhanUndeclaredProperty'], 'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/actions_sendmails.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/ajax/ajaxdirtree.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/class/canvas.class.php' => ['PhanParamTooMany', 'PhanUndeclaredMethod'], 'htdocs/core/class/ccountry.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/cgenericdic.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/class/commonorder.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/commonsocialnetworks.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/conf.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchProperty'], @@ -153,6 +151,7 @@ return [ 'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formfile.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/class/ldap.class.php' => ['PhanTypeMismatchArgumentInternalProbablyReal'], 'htdocs/core/class/notify.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/smtps.class.php' => ['PhanTypeConversionFromArray'], 'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], @@ -170,49 +169,65 @@ return [ 'htdocs/core/lib/project.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/xcal.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], 'htdocs/core/modules/barcode/doc/phpbarcode.modules.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/barcode/mod_barcode_product_standard.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/barcode/mod_barcode_product_standard.php' => ['PhanPluginSuspiciousParamOrder', 'PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php' => ['PhanPluginSuspiciousParamOrder'], + 'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/cheque/mod_chequereceipt_thyme.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/commande/mod_commande_saphir.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/commande/modules_commande.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/contract/doc/pdf_strato.modules.php' => ['PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/modules/contract/mod_contract_magre.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/delivery/doc/pdf_storm.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/delivery/doc/pdf_typhon.modules.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], 'htdocs/core/modules/expedition/doc/pdf_merou.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/modules/expedition/mod_expedition_ribera.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/expensereport/mod_expensereport_sand.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/modules_facture.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/fichinter/mod_arctic.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/fichinter/mod_pacific.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/modules/holiday/mod_holiday_immaculate.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], 'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanTypeMismatchProperty'], 'htdocs/core/modules/mailings/contacts1.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/mailings/thirdparties.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], 'htdocs/core/modules/oauth/github_oauthcallback.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/core/modules/payment/mod_payment_ant.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/printing/printgcp.modules.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/core/modules/product/doc/pdf_standard.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable'], + 'htdocs/core/modules/product/mod_codeproduct_elephant.php' => ['PhanPluginSuspiciousParamOrder'], + 'htdocs/core/modules/product_batch/mod_lot_advanced.php' => ['PhanPluginSuspiciousParamOrder'], + 'htdocs/core/modules/product_batch/mod_sn_advanced.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/project/doc/pdf_timespent.modules.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/project/mod_project_universal.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/project/task/mod_task_universal.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/propale/mod_propale_saphir.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/propale/modules_propale.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/reception/doc/pdf_squille.modules.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/modules/reception/mod_reception_moonstone.php' => ['PhanPluginSuspiciousParamOrder'], + 'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginSuspiciousParamOrder', 'PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginSuspiciousParamOrder', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], 'htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], @@ -221,24 +236,24 @@ return [ 'htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/supplier_order/modules_commandefournisseur.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanPluginDuplicateArrayKey'], + 'htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php' => ['PhanPluginSuspiciousParamOrder'], + 'htdocs/core/modules/takepos/mod_takepos_ref_universal.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], + 'htdocs/core/modules/ticket/mod_ticket_universal.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanUndeclaredProperty'], + 'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], 'htdocs/core/search_page.php' => ['PhanEmptyForeach', 'PhanPluginBothLiteralsBinaryOp'], - 'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/commonfields_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/core/tpl/document_actions_post_headers.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/extrafields_edit.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], - 'htdocs/core/tpl/extrafields_list_search_title.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], + 'htdocs/core/tpl/document_actions_post_headers.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/extrafields_view.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/list_print_total.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], - 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/tpl/notes.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/tpl/notes.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/tpl/object_discounts.tpl.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/objectline_create.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -262,11 +277,10 @@ return [ 'htdocs/delivery/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/document.php' => ['PhanRedefineFunction'], 'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'], - 'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/don/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/don/class/api_donations.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], 'htdocs/don/document.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/don/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/don/info.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/don/list.php' => ['PhanTypeMismatchProperty'], 'htdocs/don/note.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -277,9 +291,9 @@ return [ 'htdocs/ecm/dir_card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/ecm/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/emailcollector/lib/emailcollector.lib.php' => ['PhanUndeclaredTypeParameter'], 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/eventorganization/conferenceorboothattendee_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorboothattendee_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -303,12 +317,12 @@ return [ 'htdocs/expensereport/tpl/expensereport_linktofile.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fichinter/card-rec.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'], 'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/filefunc.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/filefunc.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/fourn/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], @@ -325,7 +339,7 @@ return [ 'htdocs/fourn/facture/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], 'htdocs/fourn/facture/list-rec.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/fourn/facture/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/fourn/facture/paiement.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/fourn/paiement/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/fourn/paiement/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -353,12 +367,10 @@ return [ 'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/imports/import.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset'], + 'htdocs/install/fileconf.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/install/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/install/repair.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/install/repair.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/install/step2.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], - 'htdocs/install/step5.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/intracommreport/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], @@ -376,7 +388,7 @@ return [ 'htdocs/mrp/class/mo.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/mrp/mo_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/mrp/mo_movements.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], - 'htdocs/mrp/mo_production.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/mrp/mo_production.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/mrp/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/mrp/tpl/originproductline.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], @@ -384,7 +396,6 @@ return [ 'htdocs/opcachepreload.php' => ['PhanEmptyForeach'], 'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanTypeMismatchProperty'], - 'htdocs/opensurvey/list.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/opensurvey/results.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/opensurvey/wizard/choix_date.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/wizard/create_survey.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -401,12 +412,11 @@ return [ 'htdocs/product/class/html.formproduct.class.php' => ['PhanUndeclaredProperty'], 'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/product/document.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/product/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/inventory/class/inventory.class.php' => ['PhanUndeclaredProperty'], 'htdocs/product/inventory/inventory.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/product/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'], 'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'], @@ -417,8 +427,8 @@ return [ 'htdocs/product/stock/class/mouvementstock.class.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/product/stock/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/movement_card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/movement_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/product.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/stock/productlot_card.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/productlot_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -442,7 +452,7 @@ return [ 'htdocs/projet/element.php' => ['PhanUndeclaredProperty'], 'htdocs/projet/ganttchart.inc.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/projet/ganttview.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/graph_opportunities.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], + 'htdocs/projet/graph_opportunities.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/projet/index.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/projet/list.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -453,11 +463,11 @@ return [ 'htdocs/projet/tasks/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/projet/tasks/note.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/tasks/task.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/tasks/time.php' => ['PhanEmptyForeach', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/projet/tasks/time.php' => ['PhanEmptyForeach', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/public/agenda/agendaexport.php' => ['PhanRedefineFunction'], 'htdocs/public/bookcal/index.php' => ['PhanRedefineFunction'], - 'htdocs/public/company/new.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'], + 'htdocs/public/company/new.php' => ['PhanRedefineFunction'], 'htdocs/public/cron/cron_run_jobs_by_url.php' => ['PhanUndeclaredProperty'], 'htdocs/public/demo/index.php' => ['PhanRedefineFunction'], 'htdocs/public/donations/donateurs_code.php' => ['PhanRedefineFunction'], @@ -480,7 +490,6 @@ return [ 'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], 'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/webportal/tpl/menu.tpl.php' => ['PhanUndeclaredProperty'], @@ -492,15 +501,15 @@ return [ 'htdocs/reception/class/reception.class.php' => ['PhanUndeclaredProperty'], 'htdocs/reception/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/reception/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/reception/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/reception/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/reception/note.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/recruitment/admin/setup.php' => ['PhanEmptyForeach'], 'htdocs/recruitment/admin/setup_candidatures.php' => ['PhanEmptyForeach'], 'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/class/recruitmentjobposition.class.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanUndeclaredProperty'], - 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanUndeclaredProperty'], + 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], + 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], 'htdocs/recruitment/index.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/recruitment/recruitmentcandidature_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/recruitment/recruitmentcandidature_list.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -522,7 +531,7 @@ return [ 'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/societe/class/societe.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/societe/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/paymentmodes.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], 'htdocs/societe/price.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -536,10 +545,9 @@ return [ 'htdocs/takepos/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/takepos/floors.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/freezone.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/takepos/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/takepos/invoice.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/takepos/pay.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/takepos/split.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/takepos/split.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/theme/eldy/badges.inc.php' => ['PhanRedefineFunction'], 'htdocs/theme/eldy/btn.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/eldy/dropdown.inc.php' => ['PhanUndeclaredGlobalVariable'], @@ -597,7 +605,6 @@ return [ 'htdocs/workstation/workstation_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/zapier/class/api_zapier.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/zapier/class/hook.class.php' => ['PhanUndeclaredProperty'], - 'internal' => ['PhanUndeclaredConstant'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. // (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases) From 55ef8bfe5c5cebc0e1a1f731b2837acf75802755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 14 Dec 2024 11:52:45 +0100 Subject: [PATCH 240/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 48 -------------------------- htdocs/bom/tpl/objectline_edit.tpl.php | 30 ++++++++++------ 2 files changed, 20 insertions(+), 58 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 049fc06a132..4da318ff886 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -2850,24 +2850,6 @@ parameters: count: 1 path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - - message: '#^Cannot access property \$db on mixed\.$#' - identifier: property.nonObject - count: 1 - path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - - - message: '#^Variable \$buyer might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - message: '#^Variable \$dateSelector might not be defined\.$#' identifier: variable.undefined @@ -2880,42 +2862,12 @@ parameters: count: 1 path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - - message: '#^Variable \$i might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - message: '#^Variable \$langs might not be defined\.$#' identifier: variable.undefined count: 2 path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - - message: '#^Variable \$line might not be defined\.$#' - identifier: variable.undefined - count: 20 - path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - - - message: '#^Variable \$seller might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - - - message: '#^Variable \$this might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - - - message: '#^Variable \$var might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 4ae80f95915..336c4095a78 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -1,13 +1,13 @@ - * Copyright (C) 2010-2012 Laurent Destailleur - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2012-2014 Raphaël Doursenaud - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2018 Frédéric France - * Copyright (C) 2024 Vincent Maury - * Copyright (C) 2024 MDW +/* Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 Vincent Maury + * 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 @@ -34,7 +34,17 @@ */ require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"; - +/** + * @var CommonObject $this + * @var CommonObject $object + * @var BOMLine $line + * @var Societe $buyer + * @var Societe $seller + * + * @var string $action + * @var int $i + * @var bool $var + */ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { From a0e3f617e855d4e5e2302403a220c64e0eb33558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 14 Dec 2024 13:05:41 +0100 Subject: [PATCH 241/336] fix phpstan --- htdocs/bom/tpl/objectline_edit.tpl.php | 4 +++- htdocs/bom/tpl/objectline_view.tpl.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 336c4095a78..48fa81082b1 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -35,11 +35,13 @@ require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"; /** + * @var BOMLine $line * @var CommonObject $this * @var CommonObject $object - * @var BOMLine $line + * @var HookManager $hookmanager * @var Societe $buyer * @var Societe $seller + * @var Translate $langs * * @var string $action * @var int $i diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 1c2c615a138..def20558866 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -45,6 +45,7 @@ * * @var int $i * @var int $num + * @var string $action */ ' @phan-var-force CommonObjectLine $line From 2d6389873a69ebbd218eb7d02caa96d8815e1843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 14 Dec 2024 13:32:42 +0100 Subject: [PATCH 242/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 48 ------------------- .../tpl/depreciation_options_view.tpl.php | 5 +- htdocs/asset/tpl/depreciation_view.tpl.php | 9 +++- 3 files changed, 10 insertions(+), 52 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 4da318ff886..63edb325065 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -2562,42 +2562,12 @@ parameters: count: 1 path: ../../htdocs/asset/tpl/depreciation_options_view.tpl.php - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 7 - path: ../../htdocs/asset/tpl/depreciation_options_view.tpl.php - - message: '#^Variable \$parameters might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/asset/tpl/depreciation_options_view.tpl.php - - - message: '#^Unable to resolve the template type T in call to function dol_sort_array$#' - identifier: argument.templateType - count: 1 - path: ../../htdocs/asset/tpl/depreciation_view.tpl.php - - - - message: '#^Variable \$assetdepreciationoptions might not be defined\.$#' - identifier: variable.undefined - count: 7 - path: ../../htdocs/asset/tpl/depreciation_view.tpl.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/asset/tpl/depreciation_view.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 7 - path: ../../htdocs/asset/tpl/depreciation_view.tpl.php - - message: '#^Variable \$parameters might not be defined\.$#' identifier: variable.undefined @@ -2856,18 +2826,6 @@ parameters: count: 1 path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/bom/tpl/objectline_edit.tpl.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -2880,12 +2838,6 @@ parameters: count: 1 path: ../../htdocs/bom/tpl/objectline_view.tpl.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/bom/tpl/objectline_view.tpl.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse diff --git a/htdocs/asset/tpl/depreciation_options_view.tpl.php b/htdocs/asset/tpl/depreciation_options_view.tpl.php index 7b35097b4c6..0f0a28adf63 100644 --- a/htdocs/asset/tpl/depreciation_options_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_view.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2021 Open-Dsi + * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -30,6 +30,7 @@ * @var Form $form * @var HookManager $hookmanager * @var AssetDepreciationOptions $assetdepreciationoptions + * @var Translate $langs */ ' @phan-var-force ?Form $form diff --git a/htdocs/asset/tpl/depreciation_view.tpl.php b/htdocs/asset/tpl/depreciation_view.tpl.php index 9fcf366ae3f..c0a6d3e1e91 100644 --- a/htdocs/asset/tpl/depreciation_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_view.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2021 Open-Dsi + * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -27,8 +27,13 @@ */ /** + * @var AssetDepreciationOptions $assetdepreciationoptions + * @var DoliDB $db * @var Form $form * @var HookManager $hookmanager + * @var Translate $langs + * + * @var string $action */ // Protection to avoid direct call of template From e24ad829f31b28fc44d80801581345ba1b2d4548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 14 Dec 2024 13:59:56 +0100 Subject: [PATCH 243/336] fix getPositionOfAttribute --- htdocs/variants/class/ProductAttribute.class.php | 2 +- htdocs/variants/list.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 2ce516a245b..698d6f211fe 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -976,7 +976,7 @@ class ProductAttribute extends CommonObject public function getPositionOfAttribute($rowid) { $sql = "SELECT position FROM " . MAIN_DB_PREFIX . $this->table_element; - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; + $sql .= " WHERE rowid=".(int) $rowid." AND entity IN (" . getEntity('product') . ")"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index fbec288d582..0ce02d3624c 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -53,6 +53,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' $mode = GETPOST('mode', 'aZ'); // The display mode ('list', 'kanban', 'hierarchy', 'calendar', 'gantt', ...) $id = GETPOSTINT('id'); +$rowid = GETPOSTINT('rowid'); // for line reordering in not ajax mode // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; From 323093eaeaad74d030e9e180b0ac43361e309126 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sat, 14 Dec 2024 19:23:36 +0200 Subject: [PATCH 244/336] FIX #32317 Error with report by month sales tax --- htdocs/compta/localtax/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index caa5173a13c..ec785aec784 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -446,7 +446,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $ print ''; - print ''; + print ''; $x_coll_sum = 0; foreach (array_keys($x_coll) as $rate) { From c8a7c09033943bbaab0db81a2d3f46887ed86891 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sat, 14 Dec 2024 18:38:48 +0100 Subject: [PATCH 245/336] Fix logs and protection for infinit loop --- htdocs/core/lib/files.lib.php | 13 +++++++++---- htdocs/includes/odtphp/odf.php | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 737f8ac24fc..4cd771c5191 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1641,14 +1641,19 @@ function dol_delete_dir($dir, $nophperrors = 0) * @param int $onlysub Delete only files and subdir, not main directory * @param int $countdeleted Counter to count nb of elements found really deleted * @param int $indexdatabase Try to remove also index entries. - * @param int $nolog Disable log files (too verbose when making recursive directories) + * @param int $nolog 1=Disable log for files and subdirectories (too verbose when making recursive directories) + * @param int $level 0 = level or recursivity * @return int Number of files and directory we try to remove. NB really removed is returned into var by reference $countdeleted. */ -function dol_delete_dir_recursive($dir, $count = 0, $nophperrors = 0, $onlysub = 0, &$countdeleted = 0, $indexdatabase = 1, $nolog = 0) +function dol_delete_dir_recursive($dir, $count = 0, $nophperrors = 0, $onlysub = 0, &$countdeleted = 0, $indexdatabase = 1, $nolog = 0, $level = 0) { - if (empty($nolog)) { + if (empty($nolog) || empty($level)) { dol_syslog("functions.lib:dol_delete_dir_recursive ".$dir, LOG_DEBUG); } + if ($level > 1000) { + dol_syslog("functions.lib:dol_delete_dir_recursive too many depth", LOG_WARNING); + } + if (dol_is_dir($dir)) { $dir_osencoded = dol_osencode($dir); if ($handle = opendir("$dir_osencoded")) { @@ -1659,7 +1664,7 @@ function dol_delete_dir_recursive($dir, $count = 0, $nophperrors = 0, $onlysub = if ($item != "." && $item != "..") { if (is_dir(dol_osencode("$dir/$item")) && !is_link(dol_osencode("$dir/$item"))) { - $count = dol_delete_dir_recursive("$dir/$item", $count, $nophperrors, 0, $countdeleted, $indexdatabase, $nolog); + $count = dol_delete_dir_recursive("$dir/$item", $count, $nophperrors, 0, $countdeleted, $indexdatabase, $nolog, ($level + 1)); } else { $result = dol_delete_file("$dir/$item", 1, $nophperrors, 0, null, false, $indexdatabase, $nolog); $count++; diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 0fa6d65e907..cbf958ad41b 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -836,7 +836,8 @@ IMG; dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable // We delete and recreate a subdir because the soffice may have change pemrissions on it - dol_delete_dir_recursive($conf->user->dir_temp.'/odtaspdf'); + $countdeleted = 0; + dol_delete_dir_recursive($conf->user->dir_temp.'/odtaspdf', 0, 0, 0, $countdeleted, 0, 1); dol_mkdir($conf->user->dir_temp.'/odtaspdf'); // Install prerequisites: apt install soffice libreoffice-common libreoffice-writer From a1ef08158dab0ceff90f79ce5f52cbf0f2c11846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 14 Dec 2024 20:54:08 +0100 Subject: [PATCH 246/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 63edb325065..e27f45a01a6 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -32940,12 +32940,6 @@ parameters: count: 1 path: ../../htdocs/variants/list.php - - - message: '#^Variable \$rowid might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/variants/list.php - - message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#' identifier: function.alreadyNarrowedType From 0325ee6d6d245f6bf32f0e13ec130a4819620f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 14 Dec 2024 21:07:07 +0100 Subject: [PATCH 247/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 12 ------------ htdocs/admin/agenda_other.php | 1 + htdocs/admin/agenda_reminder.php | 1 + 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index e27f45a01a6..eb9d896d365 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -1176,18 +1176,6 @@ parameters: count: 2 path: ../../htdocs/admin/agenda.php - - - message: '#^Variable \$label might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/admin/agenda_other.php - - - - message: '#^Variable \$label might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/admin/agenda_reminder.php - - message: '#^Variable \$errorsaved in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 972ede049d2..5f50050e53c 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -53,6 +53,7 @@ $langs->loadLangs(array('admin', 'other', 'agenda', 'users')); $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); +$label = GETPOST('label', 'alpha'); $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $param = GETPOST('param', 'alpha'); diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 68e63d3eb32..14821a3da45 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -48,6 +48,7 @@ $langs->loadLangs(array("admin", "other", "agenda")); $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); +$label = GETPOST('label', 'alpha'); $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $param = GETPOST('param', 'alpha'); From 9eea4d68e2155c1b8614025fdb4a8435317740a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 14 Dec 2024 21:15:27 +0100 Subject: [PATCH 248/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 12 ------------ htdocs/admin/system/security.php | 3 +++ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index eb9d896d365..7f7bb926d3c 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -1722,18 +1722,6 @@ parameters: count: 1 path: ../../htdocs/admin/system/security.php - - - message: '#^Variable \$arrayofstreamtodisable might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/admin/system/security.php - - - - message: '#^Variable \$conffile might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/admin/system/security.php - - message: '#^Variable \$dolibarr_main_document_root might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index b0f657e9411..2861b0fce9b 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -38,6 +38,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; * @var HookManager $hookmanager * @var Translate $langs * @var User $user + * + * @var string[] $arrayofstreamtodisable // $arrayofstreamtodisable is defined into filefunc.inc.php + * @var string $conffile // $conffile is defined into filefunc.inc.php */ // Load translation files required by the page From 8a2a67f2ec5be95789c97382aa6e2c852d767390 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 15 Dec 2024 02:02:14 +0100 Subject: [PATCH 249/336] Clean sql --- htdocs/public/donations/donateurs_code.php | 4 ++-- htdocs/public/fichinter/agendaexport.php | 18 +++++++++--------- htdocs/public/members/public_list.php | 4 ---- htdocs/public/onlinesign/newonlinesign.php | 2 +- htdocs/public/opensurvey/studs.php | 2 +- htdocs/public/payment/paymentok.php | 2 +- htdocs/public/project/viewandvote.php | 4 ++-- htdocs/public/recruitment/view.php | 2 +- htdocs/public/stripe/ipn.php | 2 +- htdocs/public/ticket/list.php | 20 ++++++++++---------- 10 files changed, 28 insertions(+), 32 deletions(-) diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index 96bca9bd84e..e801451df37 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -84,7 +84,7 @@ $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); if ($num) { - print "
'.$langs->trans("Product").''.$form->textwithpicto($langs->trans("UnitCost"), $langs->trans("AmountUsedToUpdateWAP")).''; + print $langs->trans("UnitCost"); + print ''.$form->textwithpicto($langs->trans("ManufacturingPrice"), $langs->trans("AmountUsedToUpdateWAP")).''; + print $langs->trans("ManufacturingPrice"); + print ''.$form->textwithpicto($langs->trans("QtyAlreadyProducedShort"), $langs->trans("QtyAlreadyProduced")).''; + print $langs->trans("QtyAlreadyProducedShort"); + print ''; if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 88adc86552b..b198e461b82 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -317,6 +317,9 @@ tr.liste_titre th.liste_titre_sel:not(.maxwidthsearch), tr.liste_titre td.liste_ tr.liste_titre th.liste_titre:not(.maxwidthsearch), tr.liste_titre td.liste_titre:not(.maxwidthsearch) { opacity: 0.8; } /* th.liste_titre_sel a, th.liste_titre a, td.liste_titre_sel a, td.liste_titre a { color: #766; } */ tr.liste_titre_filter th.liste_titre { text-align: unset; } +.liste_titre.trheight5em { + height: 4em !important; +} input { font-size: unset; @@ -3872,7 +3875,7 @@ a.fmdirlia { /* ============================================================================== */ -/* Onglets */ +/* Tabs */ /* ============================================================================== */ div.tabs { text-align: ; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8dbb46a008d..4f3b8732af4 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -600,19 +600,6 @@ th.wrapcolumntitle dl dt a span.fas.fa-list { padding-bottom: 1px; } -/*.liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], -.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], -.liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], -.liste_titre input[name=search_month_lim], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], .liste_titre input[name=search_month_create], -.liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], -.liste_titre input[name=day_date_when], .liste_titre input[name=dayvalid], .liste_titre input[name=search_orderday], .liste_titre input[name=search_deliveryday], -.liste_titre input[name=search_sday], .liste_titre input[name=search_day], .liste_titre input[name=search_eday], .liste_titre input[name=sday], .liste_titre input[name=day], .liste_titre select[name=day], -.liste_titre input[name=day_lim], .liste_titre input[name=day_start], .liste_titre input[name=day_end], .liste_titre input[name=day_create], -.liste_titre input[name=search_day_lim], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create], -.liste_titre input[name=search_day_create], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], -.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], -.liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth], -*/ .liste_titre input[name=search_month], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] { margin-right: 4px; } @@ -4256,6 +4243,9 @@ div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border tr.liste_titre.box_titre td table td, .bordernooddeven tr td { height: 28px; } +.liste_titre.trheight5em { + height: 4em !important; +} table.border td, table.bordernooddeven td, div.border div div.tagtd { padding: 3px 4px 3px 4px; From 912206d99bcd25013a31492dc282ed8b8dd57725 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Fri, 13 Dec 2024 23:35:47 +0100 Subject: [PATCH 237/336] Correction bug #32365 Warning: Attempt to read property datepaye on string --- .../modules/supplier_payment/mod_supplier_payment_brodator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index 113549aef15..628b7411ebf 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php @@ -139,7 +139,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments return 0; } - $numFinal = get_next_value($db, $mask, 'paiementfourn', 'ref', '', $objsoc, $object->datepaye); + $numFinal = get_next_value($db, $mask, 'paiementfourn', 'ref', '', $objsoc, is_object($object) ?$object->datepaye :''); return $numFinal; } From 1dd86e9d320e71a22029d3721c85296b87094ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 14 Dec 2024 09:08:33 +0100 Subject: [PATCH 238/336] fix --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 2 +- htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 1ea205d0d1c..ca5c3b7a3e0 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -95,7 +95,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode // Mask parameter //$texte.= '
'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).''.$form->textwithpicto('', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).' 
'.dol_print_date(dol_mktime(0, 0, 0, $m, 1, $y), "%b %Y").''.dol_print_date(dol_mktime(0, 0, 0, (int) $m, 1, (int) $y), "%b %Y").'
"; + print '
'; print ''; print ""; @@ -102,7 +102,7 @@ if ($resql) { print "\n"; } print "\n"; - print ''; + print ''; print ""; $i++; } diff --git a/htdocs/public/fichinter/agendaexport.php b/htdocs/public/fichinter/agendaexport.php index a5c6f843041..c122767cf85 100644 --- a/htdocs/public/fichinter/agendaexport.php +++ b/htdocs/public/fichinter/agendaexport.php @@ -474,22 +474,22 @@ function build_exportfile($format, $type, $cachedelay, $filename, $filters) } if ($key == 'year') { $sql .= " AND fd.date BETWEEN '".$db->idate(dol_get_first_day($value, 1))."'"; - $sql .= " AND '".$db->idate(dol_get_last_day($value, 12))."'"; + $sql .= " AND '".$db->idate(dol_get_last_day($value, 12))."'"; } if ($key == 'id') { - $sql .= " AND f.rowid = ".(is_numeric($value) ? $value : 0); + $sql .= " AND f.rowid = ".((int) $value); } if ($key == 'idfrom') { - $sql .= " AND f.rowid >= ".(is_numeric($value) ? $value : 0); + $sql .= " AND f.rowid >= ".((int) $value); } if ($key == 'idto') { - $sql .= " AND f.rowid <= ".(is_numeric($value) ? $value : 0); + $sql .= " AND f.rowid <= ".((int) $value); } if ($key == 'project') { - $sql .= " AND f.fk_project = ".(is_numeric($value) ? $value : 0); + $sql .= " AND f.fk_project = ".((int) $value); } if ($key == 'contract') { - $sql .= " AND f.fk_contract = ".(is_numeric($value) ? $value : 0); + $sql .= " AND f.fk_contract = ".((int) $value); } if ($key == 'logina') { @@ -502,7 +502,7 @@ function build_exportfile($format, $type, $cachedelay, $filename, $filters) $userforfilter = new User($db); $result = $userforfilter->fetch(0, $logina); if ($result > 0) { - $sql .= " AND a.fk_user_author ".$condition." ".$userforfilter->id; + $sql .= " AND a.fk_user_author ".$condition." ".((int) $userforfilter->id); } elseif ($result < 0 || $condition == '=') { $sql .= " AND a.fk_user_author = 0"; } @@ -518,7 +518,7 @@ function build_exportfile($format, $type, $cachedelay, $filename, $filters) $result = $userforfilter->fetch(0, $logini); $sql .= " AND EXISTS (SELECT ec.rowid FROM ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= " WHERE ec.element_id = f.rowid"; - $sql .= " AND ec.fk_c_type_contact = 26"; + $sql .= " AND ec.fk_c_type_contact = 26"; // FIXME do not use hardcoded ID if ($result > 0) { $sql .= " AND ec.fk_socpeople = ".((int) $userforfilter->id); } elseif ($result < 0 || $condition == '=') { @@ -537,7 +537,7 @@ function build_exportfile($format, $type, $cachedelay, $filename, $filters) $result = $userforfilter->fetch(0, $loginr); $sql .= " AND EXISTS (SELECT ecr.rowid FROM ".MAIN_DB_PREFIX."element_contact as ecr"; $sql .= " WHERE ecr.element_id = f.rowid"; - $sql .= " WHERE AND ecr.fk_c_type_contact = 27"; + $sql .= " WHERE AND ecr.fk_c_type_contact = 27"; // FIXME do not use hardcoded ID if ($result > 0) { $sql .= " AND ecr.fk_socpeople = ".((int) $userforfilter->id); } elseif ($result < 0 || $condition == '=') { diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 5445587309c..0df9b10a12b 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -168,10 +168,6 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($conf->liste_limit + 1, $offset); -//$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, zip, town, d.email, t.libelle as type, d.morphy, d.statut, t.subscription"; -//$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; -//$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut"; -//$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); $result = $db->query($sql); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 802d8996853..17506fc264a 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -194,7 +194,7 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') { // Test on pemriss $db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql .= " SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).", note_private = '".$db->escape($object->note_private)."', date_signature='".$db->idate(dol_now())."'"; + $sql .= " SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).", note_private = '".$db->escape($object->note_private)."', date_signature = '".$db->idate(dol_now())."'"; $sql .= " WHERE rowid = ".((int) $object->id); dol_syslog(__FILE__, LOG_DEBUG); diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 37051fda92d..c7dfb5d3aa8 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -191,7 +191,7 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { // bo // Check if vote already exists $sql = 'SELECT id_users, nom as name'; $sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs'; - $sql .= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; + $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; $resql = $db->query($sql); if (!$resql) { dol_print_error($db); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 63b7ed58b94..972c78675ba 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -740,7 +740,7 @@ if ($ispaymentok) { } } else { $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_account (fk_soc, login, key_account, site, site_account, status, entity, date_creation, fk_user_creat)"; - $sql .= " VALUES (".$thirdparty_id.", '', '".$db->escape($stripecu)."', 'stripe', '".$db->escape($stripearrayofkeysbyenv[$servicestatus]['publishable_key'])."', ".((int) $servicestatus).", ".((int) $conf->entity).", '".$db->idate(dol_now())."', 0)"; + $sql .= " VALUES (".((int) $thirdparty_id).", '', '".$db->escape($stripecu)."', 'stripe', '".$db->escape($stripearrayofkeysbyenv[$servicestatus]['publishable_key'])."', ".((int) $servicestatus).", ".((int) $conf->entity).", '".$db->idate(dol_now())."', 0)"; $resql = $db->query($sql); if (!$resql) { // should not happen $error++; diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 47d5893ae8a..5b9404e2515 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -122,8 +122,8 @@ $listOfConferences .= ''; $sql = "SELECT a.id, a.fk_action, a.datep, a.datep2, a.label, a.fk_soc, a.note, ca.libelle as label FROM ".MAIN_DB_PREFIX."actioncomm as a - INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as ca ON (a.fk_action=ca.id) - WHERE a.status<2"; + INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as ca ON (a.fk_action = ca.id) + WHERE a.status < 2"; $sqlforconf = $sql." AND ca.module='conference@eventorganization'"; //$sqlforbooth = $sql." AND ca.module='booth@eventorganization'"; diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index bdcf71420c2..87127f7f906 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -139,7 +139,7 @@ if ($action == "dosubmit") { // Test on permission not required here (anonymous if (!$error) { $sql = "SELECT rrc.rowid FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rrc"; $sql .= " WHERE rrc.email = '". $db->escape($email)."'"; - $sql .= " AND rrc.entity = ". getEntity($object->element, 0); + $sql .= " AND rrc.entity IN (". getEntity($object->element, 0).")"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 9e547eacb6c..0a2c982258d 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -321,7 +321,7 @@ if ($event->type == 'payout.created') { } elseif ($event->type == 'customer.deleted') { // When a customer account is delete on Stripe side $db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE key_account = '".$db->escape($event->data->object->id)."' and site='stripe'"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE key_account = '".$db->escape($event->data->object->id)."' AND site = 'stripe'"; $db->query($sql); $db->commit(); } elseif ($event->type == 'payment_intent.succeeded') { diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 86645c9a6ec..03dba86959a 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -397,26 +397,26 @@ if ($action == "view_ticketlist") { } $sql .= " WHERE t.entity IN (".getEntity('ticket').")"; $sql .= " AND ((tc.source = 'external'"; - $sql .= " AND tc.element='".$db->escape($object->element)."'"; - $sql .= " AND tc.active=1"; - $sql .= " AND sp.email='".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact - $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company - $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester + $sql .= " AND tc.element = '".$db->escape($object->element)."'"; + $sql .= " AND tc.active = 1"; + $sql .= " AND sp.email = '".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact + $sql .= " OR s.email = '".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company + $sql .= " OR t.origin_email = '".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester // Manage filter if (!empty($filter)) { foreach ($filter as $key => $value) { if (strpos($key, 'date')) { // To allow $filter['YEAR(s.dated)']=>$year - $sql .= " AND ".$key." = '".$db->escape($value)."'"; + $sql .= " AND ".$db->sanitize($key)." = '".$db->escape($value)."'"; } elseif (($key == 't.fk_user_assign') || ($key == 't.type_code') || ($key == 't.category_code') || ($key == 't.severity_code')) { - $sql .= " AND ".$key." = '".$db->escape($value)."'"; + $sql .= " AND ".$db->sanitize($key)." = '".$db->escape($value)."'"; } elseif ($key == 't.fk_statut') { if (is_array($value) && count($value) > 0) { - $sql .= " AND ".$key." IN (".$db->sanitize(implode(',', $value)).")"; + $sql .= " AND ".$db->sanitize($key)." IN (".$db->sanitize(implode(',', $value)).")"; } else { - $sql .= " AND ".$key." = ".((int) $value); + $sql .= " AND ".$db->sanitize($key)." = ".((int) $value); } } else { - $sql .= " AND ".$key." LIKE '%".$db->escape($value)."%'"; + $sql .= " AND ".$db->sanitize($key)." LIKE '%".$db->escape($value)."%'"; } } } From 8f7122c7075db11bbc9a818081d85578623aff02 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 15 Dec 2024 02:02:14 +0100 Subject: [PATCH 250/336] Clean sql --- htdocs/public/donations/donateurs_code.php | 4 ++-- htdocs/public/members/public_list.php | 4 ---- htdocs/public/onlinesign/newonlinesign.php | 2 +- htdocs/public/opensurvey/studs.php | 2 +- htdocs/public/payment/paymentok.php | 2 +- htdocs/public/project/viewandvote.php | 4 ++-- htdocs/public/stripe/ipn.php | 2 +- htdocs/public/ticket/list.php | 21 ++++++++++----------- 8 files changed, 18 insertions(+), 23 deletions(-) diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index 509eb553288..b1b481a3965 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -79,7 +79,7 @@ $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); if ($num) { - print "
".$langs->trans("Name")." / ".$langs->trans("Company")."".$langs->trans("Anonymous")."".dol_print_date($db->jdate($objp->datedon))."'.number_format($objp->amount, 2, '.', ' ').' '.$langs->trans("Currency".$conf->currency).''.price($objp->amount).' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans('Note').'
"; + print '
'; print ''; print ""; @@ -97,7 +97,7 @@ if ($resql) { print "\n"; } print "\n"; - print ''; + print ''; print ""; $i++; } diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 74bfe4e6d74..4cd5e5e291b 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -158,10 +158,6 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($conf->liste_limit + 1, $offset); -//$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, zip, town, d.email, t.libelle as type, d.morphy, d.statut, t.subscription"; -//$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; -//$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut"; -//$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); $result = $db->query($sql); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 873a0a02b56..f51498f2bda 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -184,7 +184,7 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') { $db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql .= " SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).", note_private = '".$db->escape($object->note_private)."', date_signature='".$db->idate(dol_now())."'"; + $sql .= " SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).", note_private = '".$db->escape($object->note_private)."', date_signature = '".$db->idate(dol_now())."'"; $sql .= " WHERE rowid = ".((int) $object->id); dol_syslog(__FILE__, LOG_DEBUG); diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 2c8c227984b..dd2e05bc3fb 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -183,7 +183,7 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { // bo // Check if vote already exists $sql = 'SELECT id_users, nom as name'; $sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs'; - $sql .= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; + $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; $resql = $db->query($sql); if (!$resql) { dol_print_error($db); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index b066c2e08b7..58ec412a7a4 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -729,7 +729,7 @@ if ($ispaymentok) { } } else { $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_account (fk_soc, login, key_account, site, site_account, status, entity, date_creation, fk_user_creat)"; - $sql .= " VALUES (".$thirdparty_id.", '', '".$db->escape($stripecu)."', 'stripe', '".$db->escape($stripearrayofkeysbyenv[$servicestatus]['publishable_key'])."', ".((int) $servicestatus).", ".((int) $conf->entity).", '".$db->idate(dol_now())."', 0)"; + $sql .= " VALUES (".((int) $thirdparty_id).", '', '".$db->escape($stripecu)."', 'stripe', '".$db->escape($stripearrayofkeysbyenv[$servicestatus]['publishable_key'])."', ".((int) $servicestatus).", ".((int) $conf->entity).", '".$db->idate(dol_now())."', 0)"; $resql = $db->query($sql); if (!$resql) { // should not happen $error++; diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 50dec036e9a..11be6efcada 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -112,8 +112,8 @@ $listOfConferences .= ''; $sql = "SELECT a.id, a.fk_action, a.datep, a.datep2, a.label, a.fk_soc, a.note, ca.libelle as label FROM ".MAIN_DB_PREFIX."actioncomm as a - INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as ca ON (a.fk_action=ca.id) - WHERE a.status<2"; + INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as ca ON (a.fk_action = ca.id) + WHERE a.status < 2"; $sqlforconf = $sql." AND ca.module='conference@eventorganization'"; //$sqlforbooth = $sql." AND ca.module='booth@eventorganization'"; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 1a70c445f81..604c54aec40 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -314,7 +314,7 @@ if ($event->type == 'payout.created') { //TODO: delete customer's source } elseif ($event->type == 'customer.deleted') { $db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE key_account = '".$db->escape($event->data->object->id)."' and site='stripe'"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE key_account = '".$db->escape($event->data->object->id)."' AND site = 'stripe'"; $db->query($sql); $db->commit(); } elseif ($event->type == 'payment_intent.succeeded') { // Called when making payment with PaymentIntent method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 4a7bbf39a6f..28c5a57de63 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -87,7 +87,6 @@ if (!isModEnabled('ticket')) { } - /* * Actions */ @@ -383,26 +382,26 @@ if ($action == "view_ticketlist") { } $sql .= " WHERE t.entity IN (".getEntity('ticket').")"; $sql .= " AND ((tc.source = 'external'"; - $sql .= " AND tc.element='".$db->escape($object->element)."'"; - $sql .= " AND tc.active=1"; - $sql .= " AND sp.email='".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact - $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company - $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester + $sql .= " AND tc.element = '".$db->escape($object->element)."'"; + $sql .= " AND tc.active = 1"; + $sql .= " AND sp.email = '".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact + $sql .= " OR s.email = '".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company + $sql .= " OR t.origin_email = '".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester // Manage filter if (!empty($filter)) { foreach ($filter as $key => $value) { if (strpos($key, 'date')) { // To allow $filter['YEAR(s.dated)']=>$year - $sql .= " AND ".$key." = '".$db->escape($value)."'"; + $sql .= " AND ".$db->sanitize($key)." = '".$db->escape($value)."'"; } elseif (($key == 't.fk_user_assign') || ($key == 't.type_code') || ($key == 't.category_code') || ($key == 't.severity_code')) { - $sql .= " AND ".$key." = '".$db->escape($value)."'"; + $sql .= " AND ".$db->sanitize($key)." = '".$db->escape($value)."'"; } elseif ($key == 't.fk_statut') { if (is_array($value) && count($value) > 0) { - $sql .= " AND ".$key." IN (".$db->sanitize(implode(',', $value)).")"; + $sql .= " AND ".$db->sanitize($key)." IN (".$db->sanitize(implode(',', $value)).")"; } else { - $sql .= " AND ".$key." = ".((int) $value); + $sql .= " AND ".$db->sanitize($key)." = ".((int) $value); } } else { - $sql .= " AND ".$key." LIKE '%".$db->escape($value)."%'"; + $sql .= " AND ".$db->sanitize($key)." LIKE '%".$db->escape($value)."%'"; } } } From 4c40c7886851658e62d67e715a74b0735cb3a794 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 15 Dec 2024 02:26:41 +0100 Subject: [PATCH 251/336] Trans --- htdocs/langs/en_US/errors.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 485917e7d86..302f4f0c0ed 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -140,7 +140,7 @@ ErrorBadValueForCode=Bad value for security code. Try again with new value... ErrorBothFieldCantBeNegative=Fields %s and %s can't be both negative ErrorFieldCantBeNegativeOnInvoice=Field %s cannot be negative on this type of invoice. If you need to add a discount line, just create the discount first (from field '%s' in third-party card) and apply it to the invoice. ErrorLinesCantBeNegativeForOneVATRate=Total of lines (net of tax) can't be negative for a given not null VAT rate (Found a negative total for VAT rate %s%%). -ErrorLinesCantBeNegativeOnDeposits=Lines can't be negative in a deposit. You will face problems when you will need to consume the deposit in final invoice if you do so. +ErrorLinesCantBeNegativeOnDeposits=Lines can't be negative in a down payment. You will face problems when you will need to consume the deposit in final invoice if you do so. ErrorQtyForCustomerInvoiceCantBeNegative=Quantity for line into customer invoices can't be negative ErrorQtyForSupplierInvoiceCantBeNegative=Quantity for line into supplier invoices can't be negative ErrorWebServerUserHasNotPermission=User account %s used to execute web server has no permission for that From 27a1edb6fc1d0f1b154c714647e80d22a44af2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 15 Dec 2024 08:58:20 +0100 Subject: [PATCH 252/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 8 +------- .../class/recruitmentjobposition.class.php | 12 +++++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index e4b3a0c31c9..9f5c8d9d8a7 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -29841,7 +29841,7 @@ parameters: - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue - count: 2 + count: 1 path: ../../htdocs/recruitment/class/recruitmentjobposition.class.php - @@ -29856,12 +29856,6 @@ parameters: count: 1 path: ../../htdocs/recruitment/class/recruitmentjobposition.class.php - - - message: '#^Variable \$error in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/recruitment/class/recruitmentjobposition.class.php - - message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\, RecruitmentJobPosition given\.$#' identifier: argument.type diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 0e5a14e12ea..49aefd7f41b 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -765,14 +765,12 @@ class RecruitmentJobPosition extends CommonObject $this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - if (!$error) { - $this->oldcopy = clone $this; - $this->status = $status; - $this->date_cloture = $now; - $this->note_private = $newprivatenote; - } + $this->oldcopy = clone $this; + $this->status = $status; + $this->date_cloture = $now; + $this->note_private = $newprivatenote; - if (!$notrigger && empty($error)) { + if (!$notrigger /* && empty($error) */) { // Call trigger $result = $this->call_trigger($triggerName, $user); if ($result < 0) { From 22be2de2596f090b769b6386e651accb5dcc51ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 15 Dec 2024 09:01:36 +0100 Subject: [PATCH 253/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 6 ------ .../recruitment/class/recruitmentjobposition.class.php | 10 +--------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 9f5c8d9d8a7..ad84c0bed0a 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -29838,12 +29838,6 @@ parameters: count: 1 path: ../../htdocs/recruitment/class/recruitmentjobposition.class.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../htdocs/recruitment/class/recruitmentjobposition.class.php - - message: '#^Property CommonObject\:\:\$ismultientitymanaged \(int\<0, 1\>\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 49aefd7f41b..bb64a3ccb34 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -552,20 +552,12 @@ class RecruitmentJobPosition extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->recruitmentjobposition->create)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->recruitmentjobposition->recruitmentjobposition_advance->validate)))) - { - $this->error='NotEnoughPermissions'; - dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); - return -1; - }*/ - $now = dol_now(); $this->db->begin(); // Define new ref - if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life + if (/* !$error && */ (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life $num = $this->getNextNumRef(); } else { $num = $this->ref; From 2bb990344ef03b452ac88623b01e3b0342d49e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 15 Dec 2024 09:08:27 +0100 Subject: [PATCH 254/336] fix phpstan --- build/phpstan/phpstan-baseline.neon | 12 ------- htdocs/core/class/commonobject.class.php | 34 +++++++++---------- .../asset/doc/pdf_standard_asset.modules.php | 3 +- ...tandard_recruitmentjobposition.modules.php | 3 +- 4 files changed, 21 insertions(+), 31 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index ad84c0bed0a..3d079bdac6e 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -12426,12 +12426,6 @@ parameters: count: 1 path: ../../htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php - - - message: '#^Variable \$outputlangsbis might not be defined\.$#' - identifier: variable.undefined - count: 7 - path: ../../htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php - - message: '#^Property mod_asset_standard\:\:\$prefix has no type specified\.$#' identifier: missingType.property @@ -29898,12 +29892,6 @@ parameters: count: 1 path: ../../htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php - - - message: '#^Variable \$outputlangsbis might not be defined\.$#' - identifier: variable.undefined - count: 7 - path: ../../htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php - - message: '#^Variable \$badgeStatus0 might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index caa1db00df2..28422a2d77f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1,22 +1,22 @@ - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2010-2020 Juanjo Menent - * Copyright (C) 2012-2013 Christophe Battarel - * Copyright (C) 2011-2022 Philippe Grand - * Copyright (C) 2012-2015 Marcos García - * Copyright (C) 2012-2015 Raphaël Doursenaud - * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2015-2022 Alexandre Spangaro - * Copyright (C) 2016 Bahfir abbes - * Copyright (C) 2017 ATM Consulting - * Copyright (C) 2017-2019 Nicolas ZABOURI - * Copyright (C) 2017 Rui Strecht +/* Copyright (C) 2006-2015 Laurent Destailleur + * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2010-2020 Juanjo Menent + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2011-2022 Philippe Grand + * Copyright (C) 2012-2015 Marcos García + * Copyright (C) 2012-2015 Raphaël Doursenaud + * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2015-2022 Alexandre Spangaro + * Copyright (C) 2016 Bahfir abbes + * Copyright (C) 2017 ATM Consulting + * Copyright (C) 2017-2019 Nicolas ZABOURI + * Copyright (C) 2017 Rui Strecht * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2018 Josep Lluís Amador - * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2021 Grégory Blémand - * Copyright (C) 2023 Lenin Rivas + * Copyright (C) 2018 Josep Lluís Amador + * Copyright (C) 2023 Gauthier VERDOL + * Copyright (C) 2021 Grégory Blémand + * Copyright (C) 2023 Lenin Rivas * Copyright (C) 2024 MDW * Copyright (C) 2024 William Mead * diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index 0992224c367..96140ac1780 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -173,8 +173,9 @@ class pdf_standard_asset extends ModelePDFAsset // Load translation files required by the page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); + global $outputlangsbis; + $outputlangsbis = null; if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) { - global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')); $outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies")); diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index 475cb21f216..7402190de2b 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -210,8 +210,9 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio // Load translation files required by the page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); + global $outputlangsbis; + $outputlangsbis = null; if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) { - global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')); $outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies")); From 1afe0047fb7fe9c5650a9c55d71d924f4c313871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 15 Dec 2024 09:39:02 +0100 Subject: [PATCH 255/336] fix phpstan --- htdocs/document.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/document.php b/htdocs/document.php index 9b440a30e06..895256a1def 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -102,9 +102,12 @@ function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disab * Footer empty * * @ignore + * @param string $comment A text to add as HTML comment into HTML generated page + * @param string $zone 'private' (for private pages) or 'public' (for public pages) + * @param int $disabledoutputofmessages Clear all messages stored into session without displaying them * @return void */ -function llxFooter() +function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) { } From 7d918ac0c9e912513f1b5eac5121b023f0bbd911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 15 Dec 2024 09:57:48 +0100 Subject: [PATCH 256/336] tests --- htdocs/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/document.php b/htdocs/document.php index 9b440a30e06..230282831de 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -5,8 +5,8 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010 Pierre Morin * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2022 Ferran Marcet - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2022 Ferran Marcet + * Copyright (C) 2024 Frédéric France * * 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 From 0a250142cc726d5b43cc6b458e06a6bffe5d50fe Mon Sep 17 00:00:00 2001 From: matthieu-michou-wattandsea <70541072+matthieu-michou-wattandsea@users.noreply.github.com> Date: Sun, 15 Dec 2024 10:49:55 +0100 Subject: [PATCH 257/336] API REST : specify creation date for new contact, as for companies and products --- htdocs/contact/class/contact.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 0a97ee8f407..082639332be 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -484,6 +484,10 @@ class Contact extends CommonObject $error = 0; $now = dol_now(); + if (empty($this->date_creation)) { + $this->date_creation = $now; + } + $this->db->begin(); // Clean parameters From b3a580aaa9d9105778c0759d9a240c908fbe078f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 15 Dec 2024 10:55:23 +0100 Subject: [PATCH 258/336] tests --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 4cd771c5191..6fa13fc5196 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2490,7 +2490,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring if (defined('ODTPHP_PATHTOPCLZIP')) { $foundhandler = 1; - include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php'; + include_once ODTPHP_PATHTOPCLZIP.'pclzip.lib.php'; $archive = new PclZip($outputfile); $result = $archive->add($inputfile, PCLZIP_OPT_REMOVE_PATH, dirname($inputfile)); From 8c988479cd0f8e6b7ef287de985cc9781ba5608e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 15 Dec 2024 11:24:24 +0100 Subject: [PATCH 259/336] tests --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 6fa13fc5196..4f25f02093c 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2557,7 +2557,7 @@ function dol_uncompress($inputfile, $outputdir) if ($fileinfo["extension"] == "zip") { if (defined('ODTPHP_PATHTOPCLZIP') && !getDolGlobalString('MAIN_USE_ZIPARCHIVE_FOR_ZIP_UNCOMPRESS')) { dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir); - include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php'; + include_once ODTPHP_PATHTOPCLZIP.'pclzip.lib.php'; $archive = new PclZip($inputfile); // We create output dir manually, so it uses the correct permission (When created by the archive->extract, dir is rwx for everybody). From 6e68fc7fa833d7aa6e374580699c3a76806e1847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 15 Dec 2024 12:13:12 +0100 Subject: [PATCH 260/336] tests --- build/phpstan/bootstrap_action.php | 1 + 1 file changed, 1 insertion(+) diff --git a/build/phpstan/bootstrap_action.php b/build/phpstan/bootstrap_action.php index 2bcc70dd965..90e70167c11 100644 --- a/build/phpstan/bootstrap_action.php +++ b/build/phpstan/bootstrap_action.php @@ -32,6 +32,7 @@ define('DOL_DATA_ROOT', __DIR__ . '/../../documents'); define('DOL_URL_ROOT', '/'); define('DOL_MAIN_URL_ROOT', '/'); define('MAIN_DB_PREFIX', 'llx_'); +define('ODTPHP_PATHTOPCLZIP', DOL_DOCUMENT_ROOT.'/includes/odtphp/zip/pclzip/'); /** * @var Conf $conf From a174795a60c29c06948d4253682b138a5cc82857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sun, 15 Dec 2024 13:16:40 +0100 Subject: [PATCH 261/336] tests --- build/phpstan/bootstrap_action.php | 1 - 1 file changed, 1 deletion(-) diff --git a/build/phpstan/bootstrap_action.php b/build/phpstan/bootstrap_action.php index 90e70167c11..2bcc70dd965 100644 --- a/build/phpstan/bootstrap_action.php +++ b/build/phpstan/bootstrap_action.php @@ -32,7 +32,6 @@ define('DOL_DATA_ROOT', __DIR__ . '/../../documents'); define('DOL_URL_ROOT', '/'); define('DOL_MAIN_URL_ROOT', '/'); define('MAIN_DB_PREFIX', 'llx_'); -define('ODTPHP_PATHTOPCLZIP', DOL_DOCUMENT_ROOT.'/includes/odtphp/zip/pclzip/'); /** * @var Conf $conf From 03bf9c9a4f8b5cbce29afd9fc440d84d1c2feb42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Sun, 15 Dec 2024 13:57:45 +0100 Subject: [PATCH 262/336] fix login error on update with captcha --- htdocs/core/tpl/login.tpl.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 077f7d4aeb1..e2ba274dfb2 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -3,6 +3,7 @@ * Copyright (C) 2011-2022 Laurent Destailleur * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 Charlene Benke * * 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 @@ -317,7 +318,7 @@ if (!empty($captcha)) { } // List of directories where we can find captcha handlers - $dirModCaptcha = array_merge(array('main' => '/core/modules/security/captcha/'), is_array($conf->modules_parts['captcha']) ? $conf->modules_parts['captcha'] : array()); + $dirModCaptcha = array_merge(array('main' => '/core/modules/security/captcha/'), isset($conf->modules_parts['captcha']) ? $conf->modules_parts['captcha'] : array()); $fullpathclassfile = ''; foreach ($dirModCaptcha as $dir) { $fullpathclassfile = dol_buildpath($dir."modCaptcha".ucfirst($captcha).'.class.php', 0, 2); @@ -334,7 +335,7 @@ if (!empty($captcha)) { $classname = "modCaptcha".ucfirst($captcha); if (class_exists($classname)) { /** @var ModeleCaptcha $captchaobj */ - $captchaobj = new $classname($db, $conf, $langs, $user); + $captchaobj = new $classname($db, $conf, $langs, null); '@phan-var-force ModeleCaptcha $captchaobj'; if (is_object($captchaobj) && method_exists($captchaobj, 'getCaptchaCodeForForm')) { From 7c94a01cc5c7b121752938cd4a07876d73d0351a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Sun, 15 Dec 2024 14:01:33 +0100 Subject: [PATCH 263/336] Update login.tpl.php --- htdocs/core/tpl/login.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index e2ba274dfb2..54c2238adfa 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -318,7 +318,7 @@ if (!empty($captcha)) { } // List of directories where we can find captcha handlers - $dirModCaptcha = array_merge(array('main' => '/core/modules/security/captcha/'), isset($conf->modules_parts['captcha']) ? $conf->modules_parts['captcha'] : array()); + $dirModCaptcha = array_merge(array('main' => '/core/modules/security/captcha/'), (isset($conf->modules_parts['captcha']) && is_array($conf->modules_parts['captcha'])) ? $conf->modules_parts['captcha'] : array()); $fullpathclassfile = ''; foreach ($dirModCaptcha as $dir) { $fullpathclassfile = dol_buildpath($dir."modCaptcha".ucfirst($captcha).'.class.php', 0, 2); From 65f9e7f172b2b0c6a56c43e5d9d617f8a4c59ef7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 15 Dec 2024 15:38:38 +0100 Subject: [PATCH 264/336] Fix parsing input date for eldy calendar when using short year --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/js/lib_head.js.php | 75 +++++++++++++++++---------- 2 files changed, 48 insertions(+), 29 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e820a5ddc21..a291083bf62 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7271,7 +7271,7 @@ class Form // Input area to enter date manually $retstring .= 'trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript + $retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript $retstring .= ' autocomplete="off">'; // Icon calendar diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 6f2fe0b3657..44cb68bd697 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -222,37 +222,59 @@ function getObjectFromID(id){ return theObject; } -// Called after selection of a date to save details into detailed fields +// Called after the selection or typing of a date to save details into detailed fields function dpChangeDay(dateFieldID, format) { //showDP.datefieldID=dateFieldID; console.log("Call dpChangeDay, we save date into detailed fields from format = "+format); - var thefield=getObjectFromID(dateFieldID); - var thefieldday=getObjectFromID(dateFieldID+"day"); - var thefieldmonth=getObjectFromID(dateFieldID+"month"); - var thefieldyear=getObjectFromID(dateFieldID+"year"); + var thefield = getObjectFromID(dateFieldID); + var thefieldday = getObjectFromID(dateFieldID+"day"); + var thefieldmonth = getObjectFromID(dateFieldID+"month"); + var thefieldyear = getObjectFromID(dateFieldID+"year"); - var date=getDateFromFormat(thefield.value, format); + var date = getDateFromFormat(thefield.value, format); //console.log(date); if (date) { - thefieldday.value=date.getDate(); - if(thefieldday.onchange) thefieldday.onchange.call(thefieldday); - thefieldmonth.value=date.getMonth()+1; - if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth); - thefieldyear.value=date.getFullYear(); - if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear); + thefieldday.value = date.getDate(); + if (thefieldday.onchange) thefieldday.onchange.call(thefieldday); + thefieldmonth.value = date.getMonth()+1; + if (thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth); + thefieldyear.value = date.getFullYear(); + if (thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear); + + return 1; } - else - { - thefieldday.value=''; - if(thefieldday.onchange) thefieldday.onchange.call(thefieldday); - thefieldmonth.value=''; - if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth); - thefieldyear.value=''; - if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear); + + // Replace yyyy into yy + newformat = format.replace(/yyyy/g, 'yy'); + if (newformat != format) { + console.log("dpChangeDay, we try now from format = "+newformat); + + var date = getDateFromFormat(thefield.value, newformat); + //console.log(date); + if (date) + { + thefieldday.value = date.getDate(); + if (thefieldday.onchange) thefieldday.onchange.call(thefieldday); + thefieldmonth.value = date.getMonth()+1; + if (thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth); + thefieldyear.value = date.getFullYear(); + if (thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear); + + return 2; + } } + + thefieldday.value = ''; + if (thefieldday.onchange) thefieldday.onchange.call(thefieldday); + thefieldmonth.value = ''; + if (thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth); + thefieldyear.value = ''; + if (thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear); + + return 0; } /* @@ -337,13 +359,13 @@ function formatDate(date,format) * Licence: GPL * ================================================================== */ -function getDateFromFormat(val,format) +function getDateFromFormat(val, format) { // alert('getDateFromFormat val='+val+' format='+format); // Force parameters en chaine - val=val+""; - format=format+""; + val = val+""; + format = format+""; if (val == '') return 0; @@ -356,17 +378,14 @@ function getDateFromFormat(val,format) var seconde=now.getSeconds(); var i=0; - var d=0; // -d- follows the date string while -i- follows the format - // string + var d=0; // -d- follows the date string while -i- follows the format string while (i < format.length) { c=format.charAt(i); // Recupere char du format substr=""; j=i; - while ((format.charAt(j)==c) && (j < format.length)) // Recupere char - // successif - // identiques + while ((format.charAt(j)==c) && (j < format.length)) // Get successive similar characters { substr += format.charAt(j++); } From 81f0bb892171f46209979e662faa3aa35c65e9b8 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sun, 15 Dec 2024 17:47:08 +0100 Subject: [PATCH 265/336] Debug v21 --- htdocs/compta/bank/bankentries_list.php | 14 +++++++++----- htdocs/compta/bank/line.php | 4 ++-- htdocs/compta/bank/releve.php | 5 ++--- htdocs/core/ajax/bankconciliate.php | 10 ++++++---- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 057ef86ec08..b7e00c3259c 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -900,7 +900,7 @@ if ($resql) { } // Code to adjust value date with plus and less picto using an Ajax call instead of a full reload of page - $urlajax = DOL_URL_ROOT.'/core/ajax/bankconciliate.php?token='.currentToken(); + $urlajax = DOL_URL_ROOT.'/core/ajax/bankconciliate.php?format=dayreduceformat&token='.currentToken(); print ' '; +//print 'Click'; + print "\n"; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 16db52a9770..4099d762745 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -798,7 +798,7 @@ Notes=Notes AddNewLine=Add new line AddFile=Add file FreeZone=Free-text product -FreeLineOfType=Free-text item, type: +FreeLineOfType=Free-text item, type CloneMainAttributes=Clone object with its main attributes ReGeneratePDF=Re-generate PDF PDFMerge=PDF Merge diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 5db98f3af5c..e6b4e156a26 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -748,8 +748,12 @@ input:-webkit-autofill { /* CSS for placeholder */ .placeholder { color: #ccc; } +select.placeholder { color: #ccc; } ::-webkit-input-placeholder { color: #ccc; } input:-moz-placeholder { color: #ccc; } +select.placeholder option:not(.opacitymediumbycolor):not(.opacitymedium) { + color: var(--colortext); +} input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; } fieldset { @@ -766,6 +770,7 @@ input#onlinepaymenturl, input#directdownloadlink { opacity: 0.7; } + .formconsumeproduce { background: #f3f3f3; padding: 20px 0px 0px 0px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5d31a78fe22..b333f13f1ca 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -933,11 +933,15 @@ input[type=checkbox], input[type=radio] { /* CSS for placeholder */ .placeholder { color: #ccc; } +select.placeholder { color: #ccc; } ::-webkit-input-placeholder { color:#ccc; } :-moz-placeholder { color:#bbb; } /* firefox 18- */ ::-moz-placeholder { color:#bbb; } /* firefox 19+ */ :-ms-input-placeholder { color:#ccc; } /* ie */ input:-moz-placeholder { color:#ccc; } +select.placeholder option:not(.opacitymediumbycolor):not(.opacitymedium) { + color: var(--colortext); +} input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; } fieldset { @@ -4490,7 +4494,7 @@ tr.liste_titre_filter td.liste_titre { padding-top: 4px; padding-bottom: 3px; } -.liste_titre_create td, .liste_titre_create th, .liste_titre_create .tagtd +.liste_titre_create td:not(.linecoldescription), .liste_titre_create th, .liste_titre_create .tagtd { border-top-width: 1px; border-top-color: var(--colortopbordertitle1); @@ -4512,6 +4516,10 @@ tr#trlinefordates td { border-top-style: solid; } +td.linecoldescription { + padding: 6px 10px 6px 12px !important; /* t r b l */ +} + table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td { padding: 8px 8px 8px 10px; /* t r b l */ } From d31612dbc2606331705abed76ce5052d2bf40927 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 19 Dec 2024 07:19:59 +0100 Subject: [PATCH 324/336] FIX #32402 Social Contribution - Update - Drop the attached employee --- htdocs/compta/sociales/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 1c503429393..67ede36a989 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2016-2018 Frédéric France - * Copyright (C) 2017-2022 Alexandre Spangaro + * Copyright (C) 2017-2024 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -203,7 +203,7 @@ if (empty($reshook)) { $object->periode = $dateperiod; $object->period = $dateperiod; $object->amount = $amount; - $object->fk_user = $fk_user; + $object->fk_user = $fk_user; $object->mode_reglement_id = GETPOSTINT('mode_reglement_id'); $object->fk_account = GETPOSTINT('fk_account'); $object->fk_project = GETPOSTINT('fk_project'); @@ -239,7 +239,7 @@ if (empty($reshook)) { $object->periode = $dateperiod; $object->period = $dateperiod; $object->amount = $amount; - $object->fk_user = $fk_user; + // $object->fk_user = $fk_user; $result = $object->update($user); if ($result <= 0) { From 4aba65eaeb5d42da07b15dbe58146d6fbdc6215a Mon Sep 17 00:00:00 2001 From: Irvine Fleith Date: Thu, 19 Dec 2024 08:40:56 +0100 Subject: [PATCH 325/336] fix(facture): when updating, subtype should not be trimmed as it is an int not a string --- htdocs/compta/facture/class/facture.class.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4779029d174..0723255b101 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2451,9 +2451,6 @@ class Facture extends CommonInvoice if (empty($this->type)) { $this->type = self::TYPE_STANDARD; } - if (isset($this->subtype)) { - $this->subtype = trim($this->subtype); - } if (isset($this->ref)) { $this->ref = trim($this->ref); } From 68103bc42806228542f878017dd293edebdb1881 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 19 Dec 2024 11:13:40 +0100 Subject: [PATCH 326/336] add fetch before validate in comments --- htdocs/modulebuilder/template/class/myobject.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index cd06cb211ef..ac31dc344dd 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -284,7 +284,9 @@ class MyObject extends CommonObject { $resultcreate = $this->createCommon($user, $notrigger); - //$resultvalidate = $this->validate($user, $notrigger); + // uncomment lines below if you want to validate object after creation + // $this->fetch($this->id); // needed to retrieve some fields (ie date_creation for masked ref) + // $resultcreate = $this->validate($user, $notrigger); return $resultcreate; } From e6d3dbeebcd792e6226de52623b83982b7562031 Mon Sep 17 00:00:00 2001 From: Hystepik Date: Thu, 19 Dec 2024 12:01:00 +0100 Subject: [PATCH 327/336] New add file cache in memory lib --- htdocs/core/lib/memory.lib.php | 56 ++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index 239b9f26f1d..78523378ec3 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -63,10 +63,11 @@ $shmoffset = 1000; // Max number of entries found into a language file. If too l * @param string $memoryid Memory id of shared area * @param mixed $data Data to save. It must not be a null value. * @param int $expire ttl in seconds, 0 never expire + * @param int $filecache 1 Enable file cache if no other session cache available, 0 Disabled (default) * @return int Return integer <0 if KO, 0 if nothing is done, Nb of bytes written if OK * @see dol_getcache() */ -function dol_setcache($memoryid, $data, $expire = 0) +function dol_setcache($memoryid, $data, $expire = 0, $filecache = 0) { global $conf; @@ -124,6 +125,31 @@ function dol_setcache($memoryid, $data, $expire = 0) } elseif (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) { // This is a really not reliable cache ! Use Memcached instead. // Using shmop $result = dol_setshmop($memoryid, $data, $expire); + } elseif ($filecache > 0) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $now = dol_now(); + $memoryid = session_name().'_'.$memoryid; + $dircache = 'dolcache'; + $pathcache = DOL_DATA_ROOT.'/'.$dircache; + if (!dol_is_dir($pathcache)) { + $result = dol_mkdir($pathcache); + if ($result < 0) { + return $result; + } + } + if ($expire != 0) { + $expire = dol_time_plus_duree($now, $expire, 's'); + } + + $cachedata = array("expire" => $expire, "data" => $data); + $cachejson = dolEncrypt(json_encode($cachedata)); + if (!dol_is_file($pathcache.'/'.$memoryid.'.cache')) { + $result = file_put_contents($pathcache.'/'.$memoryid.'.cache', $cachejson); + } else { + return 0; + } } else { // No intersession cache system available, we use at least the perpage cache $conf->cache['cachememory_'.$memoryid] = $data; @@ -137,10 +163,11 @@ function dol_setcache($memoryid, $data, $expire = 0) * Read a memory area shared by all users, all sessions on server * * @param string $memoryid Memory id of shared area + * @param int $filecache 1 Enable file cache if no other session cache available, 0 Disabled (default) * @return int|mixed Return integer <0 if KO, data if OK, null if not found into cache or no caching feature enabled * @see dol_setcache() */ -function dol_getcache($memoryid) +function dol_getcache($memoryid, $filecache = 0) { global $conf; @@ -203,6 +230,31 @@ function dol_getcache($memoryid) // Using shmop $data = dol_getshmop($memoryid); return $data; + } elseif ($filecache > 0) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $now = dol_now(); + $memoryid = session_name().'_'.$memoryid; + $dircache = 'dolcache'; + $pathcache = DOL_DATA_ROOT.'/'.$dircache; + if (!dol_is_file($pathcache.'/'.$memoryid.'.cache')) { + return null; + } + $data = file_get_contents($pathcache.'/'.$memoryid.'.cache'); + if (!$data) { + return -1; + } + $json = json_decode(dolDecrypt($data)); + if ($json->expire > $now) { + return $json->data; + } else { + $result = dol_delete_file($pathcache.'/'.$memoryid.'.cache'); + if (!$result) { + return -2; + } + } + return null; } else { // No intersession cache system available, we use at least the perpage cache if (isset($conf->cache['cachememory_'.$memoryid])) { From e070a3eda44d2375d9f21772875ed4010a4769ec Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 19 Dec 2024 12:22:10 +0100 Subject: [PATCH 328/336] FIX broken feature, check if module is enabled --- htdocs/core/class/commonobject.class.php | 9 +++++++++ htdocs/product/class/product.class.php | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b04f5430adc..5c8fb1cfebf 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4847,6 +4847,15 @@ abstract class CommonObject $haschild = 0; foreach ($arraytoscan as $table => $element) { //print $id.'-'.$table.'-'.$elementname.'
'; + + // Check if module is enabled (to avoid error if tables of module not created) + if (isset($element['enabled']) && !empty($element['enabled'])) { + $enabled = (int) dol_eval($element['enabled'], 1); + if (empty($enabled)) { + continue; + } + } + // Check if element can be deleted $sql = "SELECT COUNT(*) as nb"; $sql .= " FROM ".$this->db->prefix().$table." as c"; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 24ed27c5bf7..dce65ae8696 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -87,9 +87,9 @@ class Product extends CommonObject 'contratdet' => array('name' => 'Contract', 'parent' => 'contrat', 'parentkey' => 'fk_contrat'), 'facture_fourn_det' => array('name' => 'SupplierInvoice', 'parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'), 'commande_fournisseurdet' => array('name' => 'SupplierOrder', 'parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande'), - 'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo' ), - 'bom_bom' => array('name' => 'BOM'), - 'bom_bomline' => array('name' => 'BOMLine', 'parent' => 'bom_bom', 'parentkey' => 'fk_bom'), + 'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo', 'enabled' => 'isModEnabled("mrp")'), + 'bom_bom' => array('name' => 'BOM', 'enabled' => 'isModEnabled("bom")'), + 'bom_bomline' => array('name' => 'BOMLine', 'parent' => 'bom_bom', 'parentkey' => 'fk_bom', 'enabled' => 'isModEnabled("bom")'), ); /** From 425c23d28cafc1ada9c2090eac219f3a604320f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20PASCAL?= Date: Thu, 19 Dec 2024 15:38:19 +0100 Subject: [PATCH 329/336] fix: fetch action linked object --- htdocs/core/class/commonobject.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 59d71a5bf36..232a3b6893b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3832,7 +3832,7 @@ abstract class CommonObject $num = $this->db->num_rows($resql); $i = 0; while ($i < $num) { - $obj = $this->db->fetch_object($resql); + $obj = $this->db->fetch_object($resql); if ($justsource || $justtarget) { if ($justsource) { $this->linkedObjectsIds[$obj->targettype][$obj->rowid] = $obj->fk_target; @@ -3892,8 +3892,12 @@ abstract class CommonObject $classpath = 'adherents/class'; $module = 'adherent'; } elseif ($objecttype == 'contact') { - $module = 'societe'; - } + $module = 'societe'; + } elseif ($objecttype == 'action') { + $module = 'agenda'; + $subelement = 'actionComm'; + } + // Set classfile $classfile = strtolower($subelement); $classname = ucfirst($subelement); From 4222ac9a036effefe5d0f9576d304f370dd48740 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 19 Dec 2024 17:10:13 +0100 Subject: [PATCH 330/336] Fix phpstan --- htdocs/core/tpl/login.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index a9af96af82a..7b9029cf6b8 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -285,9 +285,9 @@ if ($disablenofollow) { file->main_authentication) || $conf->file->main_authentication != 'googleoauth') { ?>
- + " name="username" class="flat input-icon-user minwidth150" value="" tabindex="1" autofocus="autofocus" autocapitalize="off" autocomplete="on" spellcheck="false" autocorrect="off" /> From f8d267d69cc94fa229181acd48083a1024bd3c56 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 19 Dec 2024 17:17:27 +0100 Subject: [PATCH 331/336] Complete #32382 --- htdocs/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/document.php b/htdocs/document.php index f0e60549d1c..c870c1cca1e 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -103,7 +103,7 @@ $original_file = GETPOST('file', 'alphanohtml'); $hashp = GETPOST('hashp', 'aZ09'); $modulepart = GETPOST('modulepart', 'alpha'); $urlsource = GETPOST('urlsource', 'alpha'); -$entity = GETPOSTINT('entity'); +$entity = GETPOSTINT('entity') ? GETPOSTINT('entity') : $conf->entity; // Security check if (empty($modulepart) && empty($hashp)) { From 1350c60e7754771c085184bced3945da59facd6d Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 19 Dec 2024 17:29:33 +0100 Subject: [PATCH 332/336] Fix cti --- htdocs/comm/action/card.php | 4 ++-- htdocs/core/class/html.form.class.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 2e02f37ebec..010f405e549 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1820,7 +1820,7 @@ if ($action == 'create') { $("#addreminder").prop("checked", true); // Set period with default reminder period - $("[name=\"offsetvalue\"]").val(\'' . dol_escape_js($reminderDefaultOffset) . '\'); + $("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset) . '\'); $("#select_offsetunittype_duration").select2("destroy"); $("#select_offsetunittype_duration").val(\''.dol_escape_js($reminderDefaultUnit).'\'); $("#select_offsetunittype_duration").select2(); @@ -1832,7 +1832,7 @@ if ($action == 'create') { // Set default reminder mail model $("#select_actioncommsendmodel_mail").closest("tr").show(); $("#select_actioncommsendmodel_mail").select2("destroy"); - $("#select_actioncommsendmodel_mail").val(\''.dol_escape_js($reminderDefaultEmailModel).'\'); + $("#select_actioncommsendmodel_mail").val(\''.dol_escape_js((string) $reminderDefaultEmailModel).'\'); $("#select_actioncommsendmodel_mail").select2(); } }); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bb482bbf433..555778e7124 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2237,7 +2237,11 @@ class Form if ($errormessage) { $this->errors[] = $errormessage; dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); - return -1; + if ($outputmode == 0) { + return 'Error bad param $morefilter'; + } else { + return array(); + } } } From 992807ef2a8835fe9a581cd2936cd2d74589ff10 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 19 Dec 2024 17:42:16 +0100 Subject: [PATCH 333/336] Fix setting date_creation --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 28422a2d77f..74696c58966 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -10333,6 +10333,7 @@ abstract class CommonObject if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) { $fieldvalues['date_creation'] = $this->db->idate($now); + $this->date_creation = $this->db->idate($now); } if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) { $fieldvalues['fk_user_creat'] = $user->id; From ee119254030fed51982e9fca127e987722a56979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 19 Dec 2024 18:28:21 +0100 Subject: [PATCH 334/336] fix --- build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/societe/canvas/individual/tpl/card_view.tpl.php | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 1c7672653e5..a00105a79b3 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -30462,12 +30462,6 @@ parameters: count: 1 path: ../../htdocs/societe/canvas/individual/tpl/card_edit.tpl.php - - - message: '#^Variable \$canvas might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/societe/canvas/individual/tpl/card_view.tpl.php - - message: '#^Variable \$objcanvas might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php index 2c0a6277ac4..07e2afc2ae0 100644 --- a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php @@ -17,12 +17,15 @@ */ /** + * @var Canvas $this * @var Conf $conf * @var CommonObject $this * @var DoliDB $db * @var FormFile $formfile * @var Translate $langs * @var User $user + * + * @var string $canvas */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { From 3cedf2ee5473ed0b02847390d76437087d1fcbec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 19 Dec 2024 18:47:07 +0100 Subject: [PATCH 335/336] fix CI --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 49f32592868..86f862c0edd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: exclude: | (?x)^(htdocs/includes/.*)$ # This checks that yaml files are correct - args: [--branch, develop, --pattern, \d+.0$] + args: [--branch, develop, --pattern, \d+.0] - id: check-yaml args: [--unsafe] # This checks that json files are correct From dbcc1980610af1e71540d3071b90392fabad4e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 19 Dec 2024 18:51:40 +0100 Subject: [PATCH 336/336] fix CI --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 86f862c0edd..5f75f64fc16 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,6 @@ repos: exclude: | (?x)^(htdocs/includes/.*)$ # This checks that yaml files are correct - args: [--branch, develop, --pattern, \d+.0] - id: check-yaml args: [--unsafe] # This checks that json files are correct
".$langs->trans("Name")." / ".$langs->trans("Company")."".$langs->trans("Anonymous")."".dol_print_date($db->jdate($objp->datedon))."'.number_format($objp->amount, 2, '.', ' ').' '.$langs->trans("Currency".$conf->currency).''.price($objp->amount).' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans('Note').'