From 2fd6be2112cbc770733dab673f8dded3be757bd4 Mon Sep 17 00:00:00 2001 From: MathildeMar <52039073+MathildeMar@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:56:42 +0200 Subject: [PATCH 001/700] Bug fix: substitution variables in notification of a quote signed by customer Add fetch_thirdparty before getCommonSubstitutionArray to initialize substitution variables of type __THIRDPARTY_XXX__ in notification mails --- htdocs/core/class/notify.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 93519c6e0ec..1f9d52ba70b 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -938,6 +938,9 @@ class Notify $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $object_type.'_send', $user, $outputlangs, 0, 1, $labeltouse); } if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + if (empty($object->thirdparty)) { + $object->fetch_thirdparty(); + } $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs); From 72cf841677e2402647811b8e115f227114a7fc4e Mon Sep 17 00:00:00 2001 From: MathildeMar <52039073+MathildeMar@users.noreply.github.com> Date: Fri, 20 Sep 2024 11:06:24 +0200 Subject: [PATCH 002/700] Check that the method fetch_thirdparty() exists --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 1f9d52ba70b..127e49fe12c 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -938,7 +938,7 @@ class Notify $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $object_type.'_send', $user, $outputlangs, 0, 1, $labeltouse); } if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - if (empty($object->thirdparty)) { + if (method_exists($object, 'fetch_thirdparty') && empty($object->thirdparty)) { $object->fetch_thirdparty(); } $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); 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 003/700] 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 004/700] 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 005/700] 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 006/700] 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 007/700] 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 008/700] 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 009/700] 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 010/700] 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 011/700] 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 012/700] 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 013/700] 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 014/700] 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 015/700] 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 016/700] 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 017/700] 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 018/700] 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 019/700] 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 020/700] 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 021/700] 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 022/700] 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 023/700] 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 024/700] 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 025/700] 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 026/700] 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 027/700] 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 028/700] 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 029/700] 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 030/700] 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 031/700] 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 032/700] 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 033/700] 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 034/700] 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 035/700] 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 dccde49388c7385c1a9954e73e3c0a471e0278d7 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Wed, 13 Nov 2024 21:31:22 +0100 Subject: [PATCH 036/700] FIX calculate start date of cloned task from cloned project (#31799) * FIX calculate start date of cloned task from cloned project * Fix wrong strat comment --- htdocs/projet/class/task.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 94f04c401fe..d54e2080cf6 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1984,15 +1984,15 @@ class Task extends CommonObjectLine $projectstatic = new Project($this->db); $projectstatic->fetch($ori_project_id); - //Origin project strat date - $orign_project_dt_start = $projectstatic->date_start; + // Origin project start date + $orign_project_dt_start = (!isset($projectstatic->date_start) || $projectstatic->date_start == '') ? $projectstatic->date_c : $projectstatic->date_start; - //Calcultate new task start date with difference between origin proj start date and origin task start date + // Calculate new task start date with difference between origin proj start date and origin task start date if (!empty($clone_task->date_start)) { $clone_task->date_start = $now + $clone_task->date_start - $orign_project_dt_start; } - //Calcultate new task end date with difference between origin proj end date and origin task end date + // Calculate new task end date with difference between origin proj start date and origin task end date if (!empty($clone_task->date_end)) { $clone_task->date_end = $now + $clone_task->date_end - $orign_project_dt_start; } From 4feb9def4ee0f5100e2dce1c3d0a429e03ca81d5 Mon Sep 17 00:00:00 2001 From: MaximilienR-easya <122890855+MaximilienR-easya@users.noreply.github.com> Date: Wed, 13 Nov 2024 22:52:42 +0100 Subject: [PATCH 037/700] Fix Preview present even when there is no corresponding file (#30585) * Fix cas de previews de fichier non existant * another way to detect missing or missnamed file than using file_exists function --- htdocs/comm/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index e49beb53e0d..8b4949cd770 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -868,9 +868,9 @@ if ($object->id > 0) { $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -980,9 +980,9 @@ if ($object->id > 0) { $filedir = $conf->commande->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1074,9 +1074,9 @@ if ($object->id > 0) { $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1180,9 +1180,9 @@ if ($object->id > 0) { $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1271,9 +1271,9 @@ if ($object->id > 0) { $filedir = $conf->ficheinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1471,9 +1471,9 @@ if ($object->id > 0) { $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { From b8f481b5795b7198b1ce4a78929229097bd9d5d1 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 14 Nov 2024 23:30:11 +0100 Subject: [PATCH 038/700] fix: php 8 warning on create object from table module builder (#31817) * fix: php 8 wrning on create object form table module builder * remove unwanted linebreak * fix: remove warning on filed type checklbst show output list --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/modulebuilder/index.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b1355bde030..89a691f0c74 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8456,7 +8456,7 @@ abstract class CommonObject $sql = "SELECT ".$keyList; $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; - if (strpos($InfoFieldList[4], 'extra') !== false) { + if (isset($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra') !== false) { $sql .= ' as main'; } // $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 66df4aa33c3..377f7157689 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1259,6 +1259,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { $position = 900; } // $alwayseditable + $alwayseditable=0; if ($fieldname == 'label') { $alwayseditable = 1; } @@ -1286,7 +1287,9 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { } // type - $picto = $obj->Picto; + if (isset($obj->Picto)) { + $picto = $obj->Picto; + } if ($obj->Field == 'fk_soc') { $picto = 'company'; } From 1d4c5b61e267a7b33375d5cb94c60c57df4c0f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 15 Nov 2024 14:08:14 +0100 Subject: [PATCH 039/700] fix filters not compatible with Usf (#31832) --- htdocs/categories/info.php | 2 +- htdocs/categories/photos.php | 2 +- htdocs/categories/traduction.php | 2 +- htdocs/categories/viewcat.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/categories/info.php b/htdocs/categories/info.php index 59dedc1312e..036b4c55b0f 100644 --- a/htdocs/categories/info.php +++ b/htdocs/categories/info.php @@ -75,7 +75,7 @@ print dol_get_fiche_head($head, 'info', $langs->trans($title), -1, 'category'); $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = 'type = '.((int) $object->type); +$object->next_prev_filter = 'type:=:'.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 4d299e86ea8..0324500d62b 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -126,7 +126,7 @@ if ($object->id) { $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = 'type = '.((int) $object->type); + $object->next_prev_filter = 'type:=:'.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 8ecd22e6c19..09ea99fecb9 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -188,7 +188,7 @@ print dol_get_fiche_head($head, 'translation', $langs->trans($title), -1, 'categ $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = 'type = '.((int) $object->type); +$object->next_prev_filter = 'type:=:'.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index c7a1d940bc2..772dfaaaf5e 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -261,7 +261,7 @@ print dol_get_fiche_head($head, 'card', $langs->trans($title), -1, 'category'); $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = 'type = '.((int) $object->type); +$object->next_prev_filter = 'type:=:'.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); From ce9a1b36618beac106cdc4eaa9dfe83d61396096 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:10:35 +0100 Subject: [PATCH 040/700] FIX: swiftmailer: correctly set errors-to header (#31826) --- htdocs/core/class/CMailFile.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index db8b30ed249..319969bbd18 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -577,7 +577,7 @@ class CMailFile if (!empty($this->errors_to)) { try { - $headers->addTextHeader('Errors-To', $this->getArrayAddress($this->errors_to)); + $headers->addTextHeader('Errors-To', $this->getValidAddress($this->errors_to, 0)); } catch (Exception $e) { $this->errors[] = $e->getMessage(); } @@ -644,7 +644,6 @@ class CMailFile $this->errors[] = $e->getMessage(); } } - //if (!empty($this->errors_to)) $this->message->setErrorsTo($this->getArrayAddress($this->errors_to)); if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) { try { $this->message->setReadReceiptTo($this->getArrayAddress($this->addr_from)); From fd3482f3312af692cbee1c9d760d30b89f04a57b Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:13:05 +0200 Subject: [PATCH 041/700] fix #31798 End of month incorrect button value(clone salary) (#31827) --- htdocs/salaries/card.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index df548b3d709..e09c663b181 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -760,8 +760,18 @@ if ($id > 0) { $('#fill_end_of_month').click(function(){ var clone_date_startmonth = +$('#clone_date_startmonth').val(); var clone_date_startyear = +$('#clone_date_startyear').val(); - var end_date = new Date(clone_date_startyear, clone_date_startmonth, 0); - end_date.setMonth(clone_date_startmonth - 1); + var end_date; + if (clone_date_startmonth && clone_date_startyear) { + end_date = new Date(clone_date_startyear, clone_date_startmonth , 0); + } else { + var currentDate = new Date(); + var currentDay = currentDate.getDate(); + if (currentDay <= 15) { + end_date = new Date(currentDate.getFullYear(), currentDate.getMonth(), 0); + } else { + end_date = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0); + } + } $('#clone_date_end').val(formatDate(end_date,'".$langs->trans("FormatDateShortJavaInput")."')); $('#clone_date_endday').val(end_date.getDate()); $('#clone_date_endmonth').val(end_date.getMonth() + 1); From cd7a6e6de03cc8cb11f4e9627ecf964dfefbb341 Mon Sep 17 00:00:00 2001 From: Expresion <67320879+Expresion@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:13:46 +0100 Subject: [PATCH 042/700] Fix php8 warnings in agenda module (#31834) * Update index.php Fix: avoid php8 warnings in the agenda module * Update index.php Fix: php8 warnings in agenda module --- htdocs/comm/action/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 6e23e6d0a93..6f24008c7ad 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1384,9 +1384,9 @@ if (count($listofextcals)) { $event->datep = $datestart + $usertime; $event->datef = $dateend + $usertime; - if ($icalevent['SUMMARY']) { + if (isset($icalevent['SUMMARY']) && $icalevent['SUMMARY']) { $event->label = dol_string_nohtmltag($icalevent['SUMMARY']); - } elseif ($icalevent['DESCRIPTION']) { + } elseif (isset($icalevent['DESCRIPTION']) && $icalevent['DESCRIPTION']) { $event->label = dol_nl2br(dol_string_nohtmltag($icalevent['DESCRIPTION']), 1); } else { $event->label = $langs->trans("ExtSiteNoLabel"); From 7e9919e6b356929a9a89840e36d002197c510603 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:01:03 +0100 Subject: [PATCH 043/700] FIX: invoice: revenue stamp wrongly converted to int (#31840) --- 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 01c52600a6b..364b22cfe4c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2511,7 +2511,7 @@ class Facture extends CommonInvoice $sql .= " localtax2=".(isset($this->total_localtax2) ? (float) $this->total_localtax2 : "null").","; $sql .= " total_ht=".(isset($this->total_ht) ? (float) $this->total_ht : "null").","; $sql .= " total_ttc=".(isset($this->total_ttc) ? (float) $this->total_ttc : "null").","; - $sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? (int) $this->revenuestamp : "null").","; + $sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? (float) $this->revenuestamp : "null").","; $sql .= " fk_statut=".(isset($this->status) ? (int) $this->status : "null").","; $sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? (int) $this->fk_user_valid : "null").","; $sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? (int) $this->fk_facture_source : "null").","; From f408803ae074ca3ff2afce68781b4e80bafbc5ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= <85104766+Kazimir42@users.noreply.github.com> Date: Fri, 15 Nov 2024 16:02:11 +0100 Subject: [PATCH 044/700] list contact check by module (#31845) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rémi Champlon --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 09512e9df32..7186e44a767 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1572,7 +1572,7 @@ abstract class CommonObject $tab = array(); - $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle as type_label, tc.position, tc.element"; + $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle as type_label, tc.position, tc.element, tc.module"; $sql .= " FROM ".$this->db->prefix()."c_type_contact as tc"; $sqlWhere = array(); @@ -1609,7 +1609,7 @@ abstract class CommonObject $langs->loadLangs(array("propal", "orders", "bills", "suppliers", "contracts", "supplier_proposal")); while ($obj = $this->db->fetch_object($resql)) { - $modulename = $obj->element; + $modulename = $obj->module ?? $obj->element; if (strpos($obj->element, 'project') !== false) { $modulename = 'projet'; } elseif ($obj->element == 'contrat') { From 206570dac5e68caa1b11b4be3d8b96ff9f6ad15e Mon Sep 17 00:00:00 2001 From: Alarig Le Lay Date: Fri, 15 Nov 2024 22:33:24 +0100 Subject: [PATCH 045/700] Add new check for ldap sync (#31925) Closes: https://github.com/Dolibarr/dolibarr/issues/30819 Signed-off-by: Alarig Le Lay --- .../core/triggers/interface_50_modLdap_Ldapsynchro.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 1a92bca5b66..d35e60aec30 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -512,6 +512,11 @@ class InterfaceLdapsynchro extends DolibarrTriggers $object->oldcopy = clone $object; } + if (!method_exists($object->oldcopy, '_load_ldap_info')) { + dol_syslog("Trigger ".$action." was called by a function that did not set previously the method ->_load_ldap_info onto object", LOG_WARNING); + $object->oldcopy = clone $object; + } + $oldinfo = $object->oldcopy->_load_ldap_info(); $olddn = $object->oldcopy->_load_ldap_dn($oldinfo); From d21d794e0780f21335452702468c643cc0cedaed Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Fri, 15 Nov 2024 22:56:08 +0100 Subject: [PATCH 046/700] Fix reception lines when qte is strictly between 0 and 1 (#31920) --- htdocs/reception/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 6b28afe31de..d62429ea28f 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -388,7 +388,7 @@ if (empty($reshook)) { //var_dump(GETPOST("productl".$i, 'int').' '.GETPOST('entl'.$i, 'int').' '.GETPOST($idl, 'int').' '.GETPOST($qty, 'int').' '.GETPOST($batch, 'alpha')); //if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS')) || (GETPOST($qty, 'int') < 0 && getDolGlobalString('RECEPTION_ALLOW_NEGATIVE_QTY'))) { - if (GETPOSTINT($qty) > 0 || (GETPOSTINT($qty) == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS'))) { + if (GETPOSTFLOAT($qty) > 0 || (GETPOSTFLOAT($qty) == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS'))) { $ent = "entl".$i; $idl = "idl".$i; From 4b9a5db62f0fcbd0da51707d0269b18bf0dfa6bf Mon Sep 17 00:00:00 2001 From: moreauftheobald Date: Fri, 15 Nov 2024 23:02:49 +0100 Subject: [PATCH 047/700] Tracking conf->module->enabled 1 (#31895) * Fix Php 8 warning on commande dispach * Tracking $conf->module->enabled --------- Co-authored-by: Theobald --- dev/initdemo/mysqldump_dolibarr_3.5.0.sql | 2 +- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/core/bookmarks_page.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 12 ++++++++++-- htdocs/fourn/commande/dispatch.php | 8 ++++++-- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/dev/initdemo/mysqldump_dolibarr_3.5.0.sql b/dev/initdemo/mysqldump_dolibarr_3.5.0.sql index c6d16c22e45..f94c3238db3 100644 --- a/dev/initdemo/mysqldump_dolibarr_3.5.0.sql +++ b/dev/initdemo/mysqldump_dolibarr_3.5.0.sql @@ -1150,7 +1150,7 @@ CREATE TABLE `llx_c_field_list` ( LOCK TABLES `llx_c_field_list` WRITE; /*!40000 ALTER TABLE `llx_c_field_list` DISABLE KEYS */; -INSERT INTO `llx_c_field_list` VALUES (1,'2011-02-06 11:18:30','product_default',1,'p.ref','ref','Ref','left',1,1,'1',1),(2,'2011-02-06 11:18:30','product_default',1,'p.label','label','Label','left',1,1,'1',2),(3,'2011-02-06 11:18:30','product_default',1,'p.barcode','barcode','BarCode','center',1,1,'$conf->barcode->enabled',3),(4,'2011-02-06 11:18:30','product_default',1,'p.tms','datem','DateModification','center',1,0,'1',4),(5,'2011-02-06 11:18:30','product_default',1,'p.price','price','SellingPriceHT','right',1,0,'1',5),(6,'2011-02-06 11:18:30','product_default',1,'p.price_ttc','price_ttc','SellingPriceTTC','right',1,0,'1',6),(7,'2011-02-06 11:18:30','product_default',1,'p.stock','stock','Stock','right',0,0,'$conf->stock->enabled',7),(8,'2011-02-06 11:18:30','product_default',1,'p.envente','status','Status','right',1,0,'1',8); +INSERT INTO `llx_c_field_list` VALUES (1,'2011-02-06 11:18:30','product_default',1,'p.ref','ref','Ref','left',1,1,'1',1),(2,'2011-02-06 11:18:30','product_default',1,'p.label','label','Label','left',1,1,'1',2),(3,'2011-02-06 11:18:30','product_default',1,'p.barcode','barcode','BarCode','center',1,1,'isModEnabled("barcode")',3),(4,'2011-02-06 11:18:30','product_default',1,'p.tms','datem','DateModification','center',1,0,'1',4),(5,'2011-02-06 11:18:30','product_default',1,'p.price','price','SellingPriceHT','right',1,0,'1',5),(6,'2011-02-06 11:18:30','product_default',1,'p.price_ttc','price_ttc','SellingPriceTTC','right',1,0,'1',6),(7,'2011-02-06 11:18:30','product_default',1,'p.stock','stock','Stock','right',0,0,'isModEnabled("stock")',7),(8,'2011-02-06 11:18:30','product_default',1,'p.envente','status','Status','right',1,0,'1',8); /*!40000 ALTER TABLE `llx_c_field_list` ENABLE KEYS */; UNLOCK TABLES; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 93edb0d1f07..c633ac44b74 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -343,8 +343,8 @@ class Propal extends CommonObject 'fk_delivery_address' => array('type' => 'integer', 'label' => 'DeliveryAddress', 'enabled' => 1, 'visible' => 0, 'position' => 200), // deprecated 'fk_input_reason' => array('type' => 'integer', 'label' => 'InputReason', 'enabled' => 1, 'visible' => -1, 'position' => 205), 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 215), - 'fk_incoterms' => array('type' => 'integer', 'label' => 'IncotermCode', 'enabled' => '$conf->incoterm->enabled', 'visible' => -1, 'position' => 220), - 'location_incoterms' => array('type' => 'varchar(255)', 'label' => 'IncotermLabel', 'enabled' => '$conf->incoterm->enabled', 'visible' => -1, 'position' => 225), + 'fk_incoterms' => array('type' => 'integer', 'label' => 'IncotermCode', 'enabled' => 'isModEnabled("incoterm")', 'visible' => -1, 'position' => 220), + 'location_incoterms' => array('type' => 'varchar(255)', 'label' => 'IncotermLabel', 'enabled' => 'isModEnabled("incoterm")', 'visible' => -1, 'position' => 225), 'fk_multicurrency' => array('type' => 'integer', 'label' => 'MulticurrencyID', 'enabled' => 1, 'visible' => -1, 'position' => 230), 'multicurrency_code' => array('type' => 'varchar(255)', 'label' => 'MulticurrencyCurrency', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 235), 'multicurrency_tx' => array('type' => 'double(24,8)', 'label' => 'MulticurrencyRate', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 240, 'isameasure' => 1), diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php index a6df90ac883..d24e62f6dd8 100644 --- a/htdocs/core/bookmarks_page.php +++ b/htdocs/core/bookmarks_page.php @@ -89,7 +89,7 @@ $bookmarkList = ''; $searchForm = ''; -if (empty($conf->bookmark->enabled)) { +if (!isModEnabled('bookmark')) { $langs->load("admin"); $bookmarkList .= '
'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Bookmarks")).''; $bookmarkList .= '

'; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 8b9a0de6dbb..ad60b19387d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3542,14 +3542,22 @@ class CommandeFournisseur extends CommonOrder // Build array with quantity deliverd by product foreach ($supplierorderdispatch->lines as $line) { - $qtydelivered[$line->fk_product] += $line->qty; + if (array_key_exists($line->fk_product, $qtydelivered)) { + $qtydelivered[$line->fk_product] += $line->qty; + } else { + $qtydelivered[$line->fk_product] = $line->qty; + } } foreach ($this->lines as $line) { // Exclude lines not qualified for shipment, similar code is found into interface_20_modWrokflow for customers if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES') && $line->product_type > 0) { continue; } - $qtywished[$line->fk_product] += $line->qty; + if (array_key_exists($line->fk_product, $qtywished)) { + $qtywished[$line->fk_product] += $line->qty; + } else { + $qtywished[$line->fk_product] = $line->qty; + } } //Compare array diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 4d8fc56e4dd..f74b838b97d 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1197,7 +1197,7 @@ if ($id > 0 || !empty($ref)) { print ''; // Reception ref - if ($conf->reception->enabled) { + if (isModEnabled("reception")) { print ''.$langs->trans("Reception").''; } // Product @@ -1271,7 +1271,11 @@ if ($id > 0 || !empty($ref)) { print ''.dol_print_date($db->jdate($objp->datec), 'day').''; // Date delivery - print ''.dol_print_date($db->jdate($objp->date_delivery), 'day').''; + if (property_exists($objp, "date_delivery")) { + print '' . dol_print_date($db->jdate($objp->date_delivery), 'day') . ''; + } else { + print ''; + } // Batch / Eat by / Sell by if (isModEnabled('productbatch')) { From ef67a4c31b36a26a505dccfdc62dc014f1a6e4e5 Mon Sep 17 00:00:00 2001 From: Eric - CAP-REL <1468823+rycks@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:26:05 +0100 Subject: [PATCH 048/700] fix #27534 (#31896) --- htdocs/product/stock/stocktransfer/stocktransfer_list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_list.php b/htdocs/product/stock/stocktransfer/stocktransfer_list.php index 163db565a2e..2d818515796 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_list.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_list.php @@ -44,6 +44,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'stocktransferlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $id = GETPOST('id', 'int'); From 230eee4ead39a888c9e684bce9295a0da639eb74 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 15 Nov 2024 23:31:12 +0100 Subject: [PATCH 049/700] FIX issue #28222 Edit date extrafield diplayed on all on lines (#31914) * FIX issue #28222 Edit date extrafield diplayed on all on lines * wrong id --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8c5a84c9120..905d8cbc2c5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8329,7 +8329,7 @@ abstract class CommonObject } } $datekey = $keyprefix.'options_'.$key.$keysuffix; - $value = (GETPOSTISSET($datekey)) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring; + $value = (GETPOSTISSET($datekey) && $this->id == GETPOST('elrowid', 'int')) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring; } if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) { $datenotinstring = null; From bab49d66c5e7a9a542cc532decc6d8e1a856379d Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 15 Nov 2024 23:36:54 +0100 Subject: [PATCH 050/700] Backported default ticket type fix (#31912) --- htdocs/core/class/html.formticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 47f9c6d0778..9ccf2517a52 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -753,7 +753,7 @@ class FormTicket print ' selected="selected"'; } elseif (in_array($id, $selected)) { print ' selected="selected"'; - } elseif ($arraytypes['use_default'] == "1" && !$selected && !$empty) { + } elseif ($arraytypes['use_default'] == "1" && empty($selected)) { print ' selected="selected"'; } From 038f8d5dff24376b25dbeaf1b6e127779eab965c Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 15 Nov 2024 23:44:08 +0100 Subject: [PATCH 051/700] Backported default ticket severity fix (#31908) --- htdocs/core/class/html.formticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 9ccf2517a52..f30da8bc8b0 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1199,7 +1199,7 @@ class FormTicket print ' selected="selected"'; } elseif (isset($selected) && $selected == $id) { print ' selected="selected"'; - } elseif ($arrayseverities['use_default'] == "1" && !$selected && !$empty) { + } elseif ($arrayseverities['use_default'] == "1" && empty($selected)) { print ' selected="selected"'; } From d0323fa27d9c704503f6d97b5679de2d5dbf64a4 Mon Sep 17 00:00:00 2001 From: kkhelifa-opendsi Date: Fri, 15 Nov 2024 23:53:04 +0100 Subject: [PATCH 052/700] FIX : Update on a sold line of bank entrie set the type to empty, now it's fixed #22539 (#31888) --- htdocs/compta/bank/line.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index d8517391e17..74fecf8ecbb 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -163,7 +163,8 @@ if ($user->rights->banque->modifier && $action == "update") { $sql .= " SET "; // Always opened if (GETPOSTISSET('value')) { - $sql .= " fk_type='".$db->escape(GETPOST('value'))."',"; + $type = GETPOST('value'); + $sql .= " fk_type='".$db->escape(empty($type) && $object->fk_type == 'SOLD' ? 'SOLD' : $type)."',"; } if (GETPOSTISSET('num_chq')) { $sql .= " num_chq='".$db->escape(GETPOST("num_chq"))."',"; From 5d9d282f1be0767e9adac33bbee5cac07e6268d1 Mon Sep 17 00:00:00 2001 From: alex10843 Date: Fri, 15 Nov 2024 23:56:14 +0100 Subject: [PATCH 053/700] FIX: Takepos: set the country of the default customer (#31915) * FIX: Takepos: set the country of the default customer * Update modTakePos.class.php --------- Co-authored-by: Alex - Solauv Co-authored-by: Laurent Destailleur --- htdocs/core/modules/modTakePos.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 06b5b79dbf3..447e43f5399 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -283,6 +283,7 @@ class modTakePos extends DolibarrModules $societe->client = 1; $societe->code_client = -1; $societe->code_fournisseur = -1; + $societe->country_id = $mysoc->country_id ? $mysoc->country_id : 1; // By default we consider the default customer is in the same country than the company $societe->note_private = "Default customer automaticaly created by Point Of Sale module activation. Can be used as the default generic customer in the Point Of Sale setup. Can also be edited or removed if you don't need a generic customer."; $searchcompanyid = $societe->create($user); From c2a7c4bbc153fa12419f11250d11c99547eccb79 Mon Sep 17 00:00:00 2001 From: Delthair <41671350+Delthair@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:59:30 +0100 Subject: [PATCH 054/700] FIX #31724 (#31885) * FIX TakePOS : Undefined variable $servicestatus in pay.php on lines 126, 368 and 392 when stripe is not enabled #31724 TakePOS : Undefined variable $servicestatus in pay.php on lines 126, 368 and 392 when stripe is not enabled #31724 * nettoyage ligne 89 whitespace --- htdocs/takepos/pay.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index c8786128687..d2ee2999100 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -82,10 +82,11 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); Date: Sat, 16 Nov 2024 00:00:05 +0100 Subject: [PATCH 055/700] Fix mod_facture_fournisseur_tulip::getExample & get_next_value if no object in parameter (#31878) --- .../modules/supplier_invoice/mod_facture_fournisseur_tulip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e6838b9c4c4..5454c810e8d 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -176,7 +176,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices } // Supplier invoices take invoice date instead of creation date for the mask - $numFinal = get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, $object->date); + $numFinal = get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, is_object($object) ?$object->date :''); return $numFinal; } From 348981a4190d12c54df4974ac59ce1a6899ea2da Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sat, 16 Nov 2024 00:06:15 +0100 Subject: [PATCH 056/700] Fix show payment URL in massaction context when not one email per recipient (#31927) --- htdocs/core/actions_massactions.inc.php | 7 ++++++- htdocs/core/class/html.formmail.class.php | 11 ++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ca8232c584b..5ff3a0973fd 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -464,7 +464,12 @@ if (!$error && $massaction == 'confirm_presend') { $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref); $substitutionarray['__EMAIL__'] = $thirdparty->email; $substitutionarray['__CHECK_READ__'] = ''; - + + if ($oneemailperrecipient) { + $substitutionarray['__ONLINE_PAYMENT_URL__'] = ''; + $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ''; + } + $parameters = array('mode'=>'formemail'); if (!empty($listofobjectthirdparties)) { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 21d7f071043..cc45aaa2e91 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -863,12 +863,12 @@ class FormMail extends Form // Complete substitution array with the url to make online payment $paymenturl = ''; - $validpaymentmethod = array(); + // Set the online payment url link into __ONLINE_PAYMENT_URL__ key + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + $validpaymentmethod = getValidOnlinePaymentMethods(''); if (empty($this->substit['__REF__'])) { $paymenturl = ''; } else { - // Set the online payment url link into __ONLINE_PAYMENT_URL__ key - require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->loadLangs(array('paypal', 'other')); $typeforonlinepayment = 'free'; if ($this->param["models"] == 'order' || $this->param["models"] == 'order_send') { @@ -882,14 +882,15 @@ class FormMail extends Form } $url = getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']); $paymenturl = $url; - - $validpaymentmethod = getValidOnlinePaymentMethods(''); } if (count($validpaymentmethod) > 0 && $paymenturl) { $langs->load('other'); $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl)); $this->substit['__ONLINE_PAYMENT_URL__'] = $paymenturl; + } elseif (count($validpaymentmethod) > 0) { + $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = '__ONLINE_PAYMENT_TEXT_AND_URL__'; + $this->substit['__ONLINE_PAYMENT_URL__'] = '__ONLINE_PAYMENT_URL__'; } else { $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ''; $this->substit['__ONLINE_PAYMENT_URL__'] = ''; From a07894a01fa88ffd8adfe039fa7c1a225816e6ee Mon Sep 17 00:00:00 2001 From: Delthair <41671350+Delthair@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:10:14 +0100 Subject: [PATCH 057/700] #31661 (#31874) Incoterm location is int/float instead of alpha (in ther most card.php) #31661 --- 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 634d4624ca9..16edbdc502e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -415,7 +415,7 @@ if (empty($reshook)) { } } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) { // Set incoterm - $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOSTINT('location_incoterms')); + $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); } elseif ($action == 'add' && $usercancreate) { // Create proposal $object->socid = $socid; From aa6422ea81bae8229bca139cd9accb05445220f6 Mon Sep 17 00:00:00 2001 From: moreauftheobald Date: Sat, 16 Nov 2024 00:25:30 +0100 Subject: [PATCH 058/700] Fix Php 8 warning on commande dispach (#31871) Co-authored-by: Theobald From a6b18b1f5d0e1a9045c2f51df7181d55294efa58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20PASCAL?= Date: Sat, 16 Nov 2024 01:55:35 +0100 Subject: [PATCH 059/700] fix: get file link in invoice list with multicompany (#31930) --- htdocs/compta/facture/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 9e569f25967..dfc15d484b0 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2146,7 +2146,8 @@ if ($num > 0) { } $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $filepath = $conf->invoice->multidir_output[$obj->entity] ?? $conf->invoice->dir_output; + $filedir = $filepath.'/'.$filename; $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->id; print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print ''; From 4d51d72d731cfaf8a7068d95ec9607f6fd082684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 16 Nov 2024 02:11:32 +0100 Subject: [PATCH 060/700] clean phpstan baseline (#31926) * clean phpstan baseline * clean phpstan baseline * clean phpstan baseline * clean baseline * fix --- build/phpstan/phpstan-baseline.neon | 150 ------------------ htdocs/product/stats/mo.php | 26 ++- htdocs/product/stock/productlot_list.php | 1 + .../stock/stats/commande_fournisseur.php | 21 ++- htdocs/product/stock/stats/expedition.php | 17 +- htdocs/product/stock/stats/mo.php | 18 +-- htdocs/product/stock/stats/reception.php | 17 +- 7 files changed, 44 insertions(+), 206 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 7a97e63e9ee..431b7d30d06 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -28476,24 +28476,6 @@ parameters: count: 1 path: ../../htdocs/product/stats/facturerec.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 1 - path: ../../htdocs/product/stats/mo.php - - - - message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/product/stats/mo.php - - - - message: '#^Variable \$sortorder in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/product/stats/mo.php - - message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -29166,12 +29148,6 @@ parameters: count: 1 path: ../../htdocs/product/stock/productlot_list.php - - - message: '#^Variable \$show_files might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/productlot_list.php - - message: '#^Variable \$draftchecked in isset\(\) always exists and is not nullable\.$#' identifier: isset.variable @@ -29196,114 +29172,6 @@ parameters: count: 1 path: ../../htdocs/product/stock/replenishorders.php - - - message: '#^Variable \$morehtmlref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/stats/commande_fournisseur.php - - - - message: '#^Variable \$option might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/stats/commande_fournisseur.php - - - - message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/product/stock/stats/commande_fournisseur.php - - - - message: '#^Variable \$sortorder in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/product/stock/stats/commande_fournisseur.php - - - - message: '#^Variable \$morehtmlref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/stats/expedition.php - - - - message: '#^Variable \$option might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/stats/expedition.php - - - - message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/product/stock/stats/expedition.php - - - - message: '#^Variable \$sortorder in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/product/stock/stats/expedition.php - - - - message: '#^Variable \$batch might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/stats/mo.php - - - - message: '#^Variable \$morehtmlref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/stats/mo.php - - - - message: '#^Variable \$objectid might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/stats/mo.php - - - - message: '#^Variable \$socid might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/product/stock/stats/mo.php - - - - message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/product/stock/stats/mo.php - - - - message: '#^Variable \$sortorder in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/product/stock/stats/mo.php - - - - message: '#^Variable \$morehtmlref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/stats/reception.php - - - - message: '#^Variable \$option might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/stats/reception.php - - - - message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/product/stock/stats/reception.php - - - - message: '#^Variable \$sortorder in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../htdocs/product/stock/stats/reception.php - - message: '#^Variable \$nbofmovement might not be defined\.$#' identifier: variable.undefined @@ -29412,18 +29280,6 @@ parameters: count: 1 path: ../../htdocs/product/stock/stocktransfer/stocktransfer_card.php - - - message: '#^Variable \$sortfield might not be defined\.$#' - identifier: variable.undefined - count: 8 - path: ../../htdocs/product/stock/stocktransfer/stocktransfer_card.php - - - - message: '#^Variable \$sortorder might not be defined\.$#' - identifier: variable.undefined - count: 8 - path: ../../htdocs/product/stock/stocktransfer/stocktransfer_card.php - - message: '#^Variable \$text might not be defined\.$#' identifier: variable.undefined @@ -34272,12 +34128,6 @@ parameters: count: 14 path: ../../htdocs/societe/price.php - - - message: '#^Variable \$extralabels might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/societe/price.php - - message: '#^Variable \$prodcustprice might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index 69603ef5bdd..23a987a6243 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -49,6 +49,8 @@ $ref = GETPOST('ref', 'alpha'); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); + +$socid = 0; if ($user->socid) { $socid = $user->socid; } @@ -60,6 +62,12 @@ $hookmanager->initHooks(array('productstatsmo')); $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); +if (empty($sortorder)) { + $sortorder = "DESC"; +} +if (empty($sortfield)) { + $sortfield = "c.date_valid"; +} $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); if (empty($page) || $page == -1) { $page = 0; @@ -67,12 +75,6 @@ if (empty($page) || $page == -1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortorder) { - $sortorder = "DESC"; -} -if (!$sortfield) { - $sortfield = "c.date_valid"; -} $search_month = GETPOSTINT('search_month'); $search_year = GETPOSTINT('search_year'); @@ -82,8 +84,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_year = ''; } -$socid = 0; - $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); @@ -167,7 +167,7 @@ if ($id > 0 || !empty($ref)) { if (!empty($search_year)) { $sql .= ' AND YEAR(c.date_valid) IN ('.$db->sanitize($search_year).')'; } - if ($socid) { + if ($socid > 0) { $sql .= " AND s.rowid = ".((int) $socid); } $sql .= " GROUP BY c.rowid, c.ref, c.date_valid, c.status"; @@ -205,12 +205,8 @@ if ($id > 0 || !empty($ref)) { print '
'."\n"; print ''; - if (!empty($sortfield)) { - print ''; - } - if (!empty($sortorder)) { - print ''; - } + print ''; + print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("MOs"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 95784d927cc..e6164d741d3 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -59,6 +59,7 @@ $search_batch = GETPOST('search_batch', 'alpha'); $search_fk_user_creat = GETPOSTINT('search_fk_user_creat'); $search_fk_user_modif = GETPOSTINT('search_fk_user_modif'); $search_import_key = GETPOSTINT('search_import_key'); +$show_files = GETPOSTINT('show_files'); // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php index 1c9e3a2d4c6..a55a9341b1c 100644 --- a/htdocs/product/stock/stats/commande_fournisseur.php +++ b/htdocs/product/stock/stats/commande_fournisseur.php @@ -48,13 +48,13 @@ $langs->loadLangs(array('companies', 'bills', 'products', 'orders')); $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); -$batch = GETPOST('batch', 'alpha'); -$objectid = GETPOSTINT('productid'); +$batch = GETPOST('batch', 'alpha'); +$objectid = GETPOSTINT('productid'); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); -$socid = ''; +$socid = 0; if (!empty($user->socid)) { $socid = $user->socid; } @@ -75,10 +75,10 @@ if (empty($page) || $page == -1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortorder) { +if (empty($sortorder)) { $sortorder = "DESC"; } -if (!$sortfield) { +if (empty($sortfield)) { $sortfield = "cf.date_commande"; } @@ -131,6 +131,7 @@ if ($id > 0 || !empty($ref)) { $head = productlot_prepare_head($object); $titre = $langs->trans("CardProduct".$object->type); $picto = 'lot'; + $morehtmlref = ''; print dol_get_fiche_head($head, 'referers', $langs->trans("Batch"), -1, $object->picto); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -271,7 +272,7 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); - $option .= '&id='.$object->id; + $option = '&id='.$object->id; if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.((int) $limit); @@ -285,12 +286,8 @@ if ($id > 0 || !empty($ref)) { print ''."\n"; print ''; - if (!empty($sortfield)) { - print ''; - } - if (!empty($sortorder)) { - print ''; - } + print ''; + print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); diff --git a/htdocs/product/stock/stats/expedition.php b/htdocs/product/stock/stats/expedition.php index 38ecd66d215..e6a24a0cb16 100644 --- a/htdocs/product/stock/stats/expedition.php +++ b/htdocs/product/stock/stats/expedition.php @@ -54,7 +54,7 @@ $objectid = GETPOSTINT('productid'); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); -$socid = ''; +$socid = 0; if (!empty($user->socid)) { $socid = $user->socid; } @@ -75,10 +75,10 @@ if (empty($page) || $page == -1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortorder) { +if (empty($sortorder)) { $sortorder = "DESC"; } -if (!$sortfield) { +if (empty($sortfield)) { $sortfield = "exp.date_creation"; } @@ -131,6 +131,7 @@ if ($id > 0 || !empty($ref)) { $head = productlot_prepare_head($object); $titre = $langs->trans("CardProduct".$object->type); $picto = 'lot'; + $morehtmlref = ''; print dol_get_fiche_head($head, 'referers', $langs->trans("Batch"), -1, $object->picto); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -270,7 +271,7 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); - $option .= '&id='.$object->id; + $option = '&id='.$object->id; if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.((int) $limit); @@ -284,12 +285,8 @@ if ($id > 0 || !empty($ref)) { print ''."\n"; print ''; - if (!empty($sortfield)) { - print ''; - } - if (!empty($sortorder)) { - print ''; - } + print ''; + print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Shipments"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); diff --git a/htdocs/product/stock/stats/mo.php b/htdocs/product/stock/stats/mo.php index 8cc868fecc3..9a87fa83783 100644 --- a/htdocs/product/stock/stats/mo.php +++ b/htdocs/product/stock/stats/mo.php @@ -50,6 +50,7 @@ $ref = GETPOST('ref', 'alpha'); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); +$socid = 0; if ($user->socid) { $socid = $user->socid; } @@ -68,10 +69,10 @@ if (empty($page) || $page == -1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortorder) { +if (empty($sortorder)) { $sortorder = "DESC"; } -if (!$sortfield) { +if (empty($sortfield)) { $sortfield = "c.date_valid"; } @@ -100,6 +101,8 @@ $formother = new FormOther($db); if ($id > 0 || !empty($ref)) { $object = new Productlot($db); + $batch = ''; + $objectid = 0; if ($ref) { $tmp = explode('_', $ref); $objectid = $tmp[0]; @@ -124,6 +127,7 @@ if ($id > 0 || !empty($ref)) { $head = productlot_prepare_head($object); $titre = $langs->trans("CardProduct".$object->type); $picto = 'lot'; + $morehtmlref = ''; print dol_get_fiche_head($head, 'referers', $langs->trans("Batch"), -1, $object->picto); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook @@ -188,7 +192,7 @@ if ($id > 0 || !empty($ref)) { if (!empty($search_year)) { $sql .= ' AND YEAR(c.date_valid) IN ('.$db->sanitize($search_year).')'; } - if ($socid) { + if ($socid > 0) { $sql .= " AND s.rowid = ".((int) $socid); } $sql .= " GROUP BY c.rowid, c.ref, c.date_valid, c.status"; @@ -226,12 +230,8 @@ if ($id > 0 || !empty($ref)) { print ''."\n"; print ''; - if (!empty($sortfield)) { - print ''; - } - if (!empty($sortorder)) { - print ''; - } + print ''; + print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("MOs"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); diff --git a/htdocs/product/stock/stats/reception.php b/htdocs/product/stock/stats/reception.php index b8257cd12c8..00f44bbf175 100644 --- a/htdocs/product/stock/stats/reception.php +++ b/htdocs/product/stock/stats/reception.php @@ -54,7 +54,7 @@ $objectid = GETPOSTINT('productid'); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); -$socid = ''; +$socid = 0; if (!empty($user->socid)) { $socid = $user->socid; } @@ -75,10 +75,10 @@ if (empty($page) || $page == -1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortorder) { +if (empty($sortorder)) { $sortorder = "DESC"; } -if (!$sortfield) { +if (empty($sortfield)) { $sortfield = "recep.date_creation"; } @@ -131,6 +131,7 @@ if ($id > 0 || !empty($ref)) { $head = productlot_prepare_head($object); $titre = $langs->trans("CardProduct".$object->type); $picto = 'lot'; + $morehtmlref = ''; print dol_get_fiche_head($head, 'referers', $langs->trans("Batch"), -1, $object->picto); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -269,7 +270,7 @@ if ($id > 0 || !empty($ref)) { if ($result) { $num = $db->num_rows($result); - $option .= '&id='.$object->id; + $option = '&id='.$object->id; if ($limit > 0 && $limit != $conf->liste_limit) { $option .= '&limit='.((int) $limit); @@ -283,12 +284,8 @@ if ($id > 0 || !empty($ref)) { print ''."\n"; print ''; - if (!empty($sortfield)) { - print ''; - } - if (!empty($sortorder)) { - print ''; - } + print ''; + print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Receptions"), $page, $_SERVER["PHP_SELF"], $option, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit, 0, 0, 1); From aff3a20aa87dd99b1ce43ae89a0b0b73d0a17e81 Mon Sep 17 00:00:00 2001 From: MB Informatique <63406589+mbinformatique68@users.noreply.github.com> Date: Sat, 16 Nov 2024 02:23:08 +0100 Subject: [PATCH 061/700] FIX #29449 Products not allowed on contracts (#31909) * FIX #31269 Bad use of GETPOSTINT * FIX #29449 Products not allowed on contracts * Update card.php --------- Co-authored-by: Laurent Destailleur --- htdocs/contrat/card.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 7fab37fabc7..1083fa5d155 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1821,7 +1821,12 @@ if ($action == 'create') { } else { $senderissupplier = 0; // @TODO Option to allow purchased products ? if (empty($senderissupplier)) { - print $form->select_produits($currentLineProductId, 'idprod', '', 0, 0, 1, 2, '', 0, array(), 0, 1, 0, 'minwidth250onall maxwidth500 widthcentpercentminusx'); + if (getDolGlobalString('CONTRACT_SUPPORT_PRODUCTS')) { + $filtertype = ''; + } else { + $filtertype = '1'; + } + print $form->select_produits($currentLineProductId, 'idprod', $filtertype, 0, 0, 1, 2, '', 0, array(), 0, 1, 0, 'minwidth250onall maxwidth500 widthcentpercentminusx'); } else { $form->select_produits_fournisseurs($currentLineProductId, 'idprod'); } From 15d82576dea0ef84664e5031e4ccf94f3f63361c Mon Sep 17 00:00:00 2001 From: jyhere Date: Sat, 16 Nov 2024 02:45:13 +0100 Subject: [PATCH 062/700] FIX : Default values feature is broken on units field on product create (#31873) * FIX : Default values feature is broken on units field on product create * FIX: use getDolGlobalString, removed useless ternary --- htdocs/product/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 6e9ebf57447..2c85b6b141a 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1651,7 +1651,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''.$langs->trans("Weight").''; print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"'); print ''; - print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT')), 0, 2); + print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units', 'alpha') : (GETPOST('weight_units', 'alpha') ?: getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 0)), 0, 2); print ''; } @@ -1662,21 +1662,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ' x '; print ' x '; print ''; - print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units', 'alpha') : '0', 0, 2); + print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units', 'alpha') : (GETPOST('size_units', 'alpha') ?: '0'), 0, 2); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_SURFACE')) { // Brut Surface print ''.$langs->trans("Surface").''; print ''; - print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units', 'alpha') : '0', 0, 2); + print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units', 'alpha') : (GETPOST('surface_units', 'alpha') ?: '0'), 0, 2); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_VOLUME')) { // Brut Volume print ''.$langs->trans("Volume").''; print ''; - print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units', 'alpha') : '0', 0, 2); + print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units', 'alpha') : (GETPOST('volume_units', 'alpha') ?: '0'), 0, 2); print ''; } @@ -1684,7 +1684,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Net Measure print ''.$langs->trans("NetMeasure").''; print ''; - print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT')), 0, 0); + print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units', 'alpha') : (GETPOST('net_measure_units', 'alpha') ?: getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 0)), 0, 0); print ''; } } From a5bd461505fa02e554b24c9686a81bc00212bfc3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 16 Nov 2024 10:33:28 +0100 Subject: [PATCH 063/700] FIX compatibility with multicompany (#31934) --- .../mysql/data/llx_c_socialnetworks.sql | 65 +-- .../data/llx_c_ticket_category-ticket.sql | 5 +- .../data/llx_c_ticket_resolution-ticket.sql | 9 +- .../data/llx_c_ticket_severity-ticket.sql | 11 +- .../mysql/data/llx_c_ticket_type-ticket.sql | 17 +- htdocs/install/mysql/data/llx_c_tva.sql | 474 +++++++++--------- .../data/llx_c_type_container-website.sql | 14 +- 7 files changed, 300 insertions(+), 295 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_socialnetworks.sql b/htdocs/install/mysql/data/llx_c_socialnetworks.sql index f581eb6322c..9975eb539e3 100644 --- a/htdocs/install/mysql/data/llx_c_socialnetworks.sql +++ b/htdocs/install/mysql/data/llx_c_socialnetworks.sql @@ -3,6 +3,7 @@ -- eldy -- frederic34 -- dolibit-ut +-- Copyright (C) 2024 Regis Houssin -- -- License @@ -28,35 +29,35 @@ -- socialnetworks -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, '500px', '500px', '{socialid}', 'fa-500px', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'dailymotion', 'Dailymotion', '{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'diaspora', 'Diaspora', '{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'discord', 'Discord', '{socialid}', 'fa-discord', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'facebook', 'Facebook', 'https://www.facebook.com/{socialid}', 'fa-facebook', 1); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'flickr', 'Flickr', '{socialid}', 'fa-flickr', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'gifycat', 'Gificat', '{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'giphy', 'Giphy', '{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'github', 'GitHub', 'https://www.github.com/{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'linkedin', 'LinkedIn', 'https://www.linkedin.com/in/{socialid}', 'fa-linkedin', 1); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'mastodon', 'Mastodon', '{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'meetup', 'Meetup', '{socialid}', 'fa-meetup', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'periscope', 'Periscope', '{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'pinterest', 'Pinterest', '{socialid}', 'fa-pinterest', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'quora', 'Quora', '{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'reddit', 'Reddit', '{socialid}', 'fa-reddit', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'slack', 'Slack', '{socialid}', 'fa-slack', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'snapchat', 'Snapchat', '{socialid}', 'fa-snapchat', 1); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'skype', 'Skype', 'https://www.skype.com/{socialid}', 'fa-skype', 1); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'tripadvisor', 'Tripadvisor', '{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'tumblr', 'Tumblr', 'https://www.tumblr.com/{socialid}', 'fa-tumblr', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'twitch', 'Twitch', '{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'twitter', 'X-Twitter', 'https://www.x.com/{socialid}', 'fa-twitter', 1); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'vero', 'Vero', 'https://vero.co/{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'viadeo', 'Viadeo', 'https://fr.viadeo.com/fr/{socialid}', 'fa-viadeo', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'viber', 'Viber', '{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'vimeo', 'Vimeo', '{socialid}', 'fa-vimeo', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'whatsapp', 'Whatsapp', 'https://web.whatsapp.com/send?phone={socialid}', 'fa-whatsapp', 1); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'wikipedia', 'Wikipedia', '{socialid}', 'fa-wikipedia-w', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'xing', 'Xing', '{socialid}', 'fa-xing', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'youtube', 'Youtube', 'https://www.youtube.com/{socialid}', 'fa-youtube', 1); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, '500px', '500px', '{socialid}', 'fa-500px', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'dailymotion', 'Dailymotion', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'diaspora', 'Diaspora', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'discord', 'Discord', '{socialid}', 'fa-discord', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'facebook', 'Facebook', 'https://www.facebook.com/{socialid}', 'fa-facebook', 1); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'flickr', 'Flickr', '{socialid}', 'fa-flickr', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'gifycat', 'Gificat', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'giphy', 'Giphy', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'github', 'GitHub', 'https://www.github.com/{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'linkedin', 'LinkedIn', 'https://www.linkedin.com/in/{socialid}', 'fa-linkedin', 1); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'mastodon', 'Mastodon', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'meetup', 'Meetup', '{socialid}', 'fa-meetup', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'periscope', 'Periscope', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'pinterest', 'Pinterest', '{socialid}', 'fa-pinterest', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'quora', 'Quora', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'reddit', 'Reddit', '{socialid}', 'fa-reddit', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'slack', 'Slack', '{socialid}', 'fa-slack', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'snapchat', 'Snapchat', '{socialid}', 'fa-snapchat', 1); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'skype', 'Skype', 'https://www.skype.com/{socialid}', 'fa-skype', 1); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'tripadvisor', 'Tripadvisor', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'tumblr', 'Tumblr', 'https://www.tumblr.com/{socialid}', 'fa-tumblr', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'twitch', 'Twitch', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'twitter', 'X-Twitter', 'https://www.x.com/{socialid}', 'fa-twitter', 1); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'vero', 'Vero', 'https://vero.co/{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'viadeo', 'Viadeo', 'https://fr.viadeo.com/fr/{socialid}', 'fa-viadeo', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'viber', 'Viber', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'vimeo', 'Vimeo', '{socialid}', 'fa-vimeo', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'whatsapp', 'Whatsapp', 'https://web.whatsapp.com/send?phone={socialid}', 'fa-whatsapp', 1); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'wikipedia', 'Wikipedia', '{socialid}', 'fa-wikipedia-w', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'xing', 'Xing', '{socialid}', 'fa-xing', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES (__ENTITY__, 'youtube', 'Youtube', 'https://www.youtube.com/{socialid}', 'fa-youtube', 1); diff --git a/htdocs/install/mysql/data/llx_c_ticket_category-ticket.sql b/htdocs/install/mysql/data/llx_c_ticket_category-ticket.sql index 7a1a6d557d8..050f8be628b 100644 --- a/htdocs/install/mysql/data/llx_c_ticket_category-ticket.sql +++ b/htdocs/install/mysql/data/llx_c_ticket_category-ticket.sql @@ -1,4 +1,5 @@ --- Copyright (C) 2018 Laurent Destailleur +-- Copyright (C) 2018 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,4 +18,4 @@ -- Contenu de la table llx_c_ticket_category -- -INSERT INTO llx_c_ticket_category (code, pos, label, active, use_default, description) VALUES('OTHER', '10', 'Other', 1, 1, NULL); +INSERT INTO llx_c_ticket_category (code, pos, label, active, use_default, description, entity) VALUES ('OTHER', '10', 'Other', 1, 1, NULL, __ENTITY__); diff --git a/htdocs/install/mysql/data/llx_c_ticket_resolution-ticket.sql b/htdocs/install/mysql/data/llx_c_ticket_resolution-ticket.sql index 2fa139b602d..cdd7fbcacab 100644 --- a/htdocs/install/mysql/data/llx_c_ticket_resolution-ticket.sql +++ b/htdocs/install/mysql/data/llx_c_ticket_resolution-ticket.sql @@ -1,4 +1,5 @@ --- Copyright (C) 2018 Laurent Destailleur +-- Copyright (C) 2018 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 @@ -- Contenu de la table llx_c_ticket_resolution -- -INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description) VALUES('SOLVED', '10', 'Solved', 1, 0, NULL); -INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description) VALUES('CANCELED', '50', 'Canceled', 1, 0, NULL); -INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description) VALUES('OTHER', '90', 'Other', 1, 0, NULL); +INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description, entity) VALUES ('SOLVED', '10', 'Solved', 1, 0, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description, entity) VALUES ('CANCELED', '50', 'Canceled', 1, 0, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description, entity) VALUES ('OTHER', '90', 'Other', 1, 0, NULL, __ENTITY__); diff --git a/htdocs/install/mysql/data/llx_c_ticket_severity-ticket.sql b/htdocs/install/mysql/data/llx_c_ticket_severity-ticket.sql index 0f385ab2005..00ccea37d4f 100644 --- a/htdocs/install/mysql/data/llx_c_ticket_severity-ticket.sql +++ b/htdocs/install/mysql/data/llx_c_ticket_severity-ticket.sql @@ -1,4 +1,5 @@ --- Copyright (C) 2018 Laurent Destailleur +-- Copyright (C) 2018 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,7 +18,7 @@ -- Contenu de la table llx_c_ticket_severity -- -INSERT INTO llx_c_ticket_severity (code, pos, label, color, active, use_default, description) VALUES('LOW', '10', 'Low', '', 1, 0, NULL); -INSERT INTO llx_c_ticket_severity (code, pos, label, color, active, use_default, description) VALUES('NORMAL', '20', 'Normal', '', 1, 1, NULL); -INSERT INTO llx_c_ticket_severity (code, pos, label, color, active, use_default, description) VALUES('HIGH', '30', 'High', '', 1, 0, NULL); -INSERT INTO llx_c_ticket_severity (code, pos, label, color, active, use_default, description) VALUES('BLOCKING', '40', 'Critical / blocking', '', 1, 0, NULL); +INSERT INTO llx_c_ticket_severity (code, pos, label, color, active, use_default, description, entity) VALUES ('LOW', '10', 'Low', '', 1, 0, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_severity (code, pos, label, color, active, use_default, description, entity) VALUES ('NORMAL', '20', 'Normal', '', 1, 1, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_severity (code, pos, label, color, active, use_default, description, entity) VALUES ('HIGH', '30', 'High', '', 1, 0, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_severity (code, pos, label, color, active, use_default, description, entity) VALUES ('BLOCKING', '40', 'Critical / blocking', '', 1, 0, NULL, __ENTITY__); diff --git a/htdocs/install/mysql/data/llx_c_ticket_type-ticket.sql b/htdocs/install/mysql/data/llx_c_ticket_type-ticket.sql index 85a85b0a63d..86f95ca04a0 100644 --- a/htdocs/install/mysql/data/llx_c_ticket_type-ticket.sql +++ b/htdocs/install/mysql/data/llx_c_ticket_type-ticket.sql @@ -1,4 +1,5 @@ --- Copyright (C) 2018 Laurent Destailleur +-- Copyright (C) 2018 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,10 +18,10 @@ -- Contenu de la table llx_c_ticket_type -- -INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('COM', '10', 'Commercial question', 1, 0, NULL); -INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('HELP', '15', 'Request for functionnal help', 1, 0, NULL); -INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('ISSUE', '20', 'Issue or bug', 1, 0, NULL); -INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('PROBLEM', '22', 'Problem', 0, 0, NULL); -INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('REQUEST', '25', 'Change or enhancement request', 1, 0, NULL); -INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('PROJECT', '30', 'Project', 0, 0, NULL); -INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('OTHER', '40', 'Other', 1, 1, NULL); +INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description, entity) VALUES ('COM', '10', 'Commercial question', 1, 0, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description, entity) VALUES ('HELP', '15', 'Request for functionnal help', 1, 0, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description, entity) VALUES ('ISSUE', '20', 'Issue or bug', 1, 0, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description, entity) VALUES ('PROBLEM', '22', 'Problem', 0, 0, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description, entity) VALUES ('REQUEST', '25', 'Change or enhancement request', 1, 0, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description, entity) VALUES ('PROJECT', '30', 'Project', 0, 0, NULL, __ENTITY__); +INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description, entity) VALUES ('OTHER', '40', 'Other', 1, 1, NULL, __ENTITY__); diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index e813b643bf3..e00828f78b7 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -3,7 +3,7 @@ -- Copyright (C) 2004-2011 Laurent Destailleur -- Copyright (C) 2004 Benoit Mortier -- Copyright (C) 2004 Guillaume Delecourt --- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2005-2024 Regis Houssin -- Copyright (C) 2007 Patrick Raguin -- Copyright (C) 2010-2016 Juanjo Menent -- Copyright (C) 2012 Sebastian Neuwert @@ -40,382 +40,382 @@ -- -delete from llx_c_tva; +-- delete from llx_c_tva; -- ALGERIA (id country=13) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 131, 13, '0','0','TVA 0%', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 132, 13, '9','0','TVA 9%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 133, 13, '19','0','TVA 19%', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 131, 13, '0','0','TVA 0%', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 132, 13, '9','0','TVA 9%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 133, 13, '19','0','TVA 19%', 1,__ENTITY__); -- ANGOLA (id country=35) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 351, 35, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 352, 35, '7','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 353, 35, '14','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 351, 35, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 352, 35, '7','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 353, 35, '14','0','VAT rate - standard',1,__ENTITY__); -- ARGENTINA (id country=23) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (231, 23, '0','0','IVA Rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (232, 23,'10.5','0','IVA reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (233, 23, '21','0','IVA standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (231, 23, '0','0','IVA Rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (232, 23,'10.5','0','IVA reduced rate',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (233, 23, '21','0','IVA standard rate',1,__ENTITY__); -- AUSTRALIA (id country=28) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (281, 28, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (282, 28, '10','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (281, 28, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (282, 28, '10','0','VAT rate - standard',1,__ENTITY__); -- AUSTRIA (id country=41) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (411, 41, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (412, 41, '10','0','VAT rate - reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (413, 41, '20','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (411, 41, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (412, 41, '10','0','VAT rate - reduced', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (413, 41, '20','0','VAT rate - standard',1,__ENTITY__); -- BRASIL (id country=56) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (561, 56, '0','0','VAT rate - reduced',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (561, 56, '0','0','VAT rate - reduced',1,__ENTITY__); -- BULGARIA (id country=59) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (591, 59, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (592, 59, '7','0','VAT rate - reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (593, 59, '20','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (591, 59, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (592, 59, '7','0','VAT rate - reduced', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (593, 59, '20','0','VAT rate - standard',1,__ENTITY__); -- BELGIUM (id country=2) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 21, 2, '0','0','VAT rate 0 ou non applicable',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 22, 2, '6','0','VAT rate - reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 23, 2, '21','0','VAT rate - standard',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 24, 2, '12','0','VAT rate - reduced', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 21, 2, '0','0','VAT rate 0 ou non applicable',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 22, 2, '6','0','VAT rate - reduced', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 23, 2, '21','0','VAT rate - standard',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 24, 2, '12','0','VAT rate - reduced', 1,__ENTITY__); -- CANADA (id country=14) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (141, 14, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (142, 14, '7','0','VAT rate - standard',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (143, 14,'5','0','9.975','1','GST/TPS and PST/TVQ rate for Province',1); --- insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (143, 14,'5','0','9.975','1','GST/TPS and PST/TVQ rate for Quebec',1); --- insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (144, 14,'5','0','7','1','GST/TPS and PST/TVQ rate for British Columbia',1); --- insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (149, 14,'5','0',null,null,'GST/TPS and PST/TVQ rate for Yukon',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (141, 14, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (142, 14, '7','0','VAT rate - standard',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (143, 14,'5','0','9.975','1','GST/TPS and PST/TVQ rate for Province',1,__ENTITY__); +-- insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (143, 14,'5','0','9.975','1','GST/TPS and PST/TVQ rate for Quebec',1,__ENTITY__); +-- insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (144, 14,'5','0','7','1','GST/TPS and PST/TVQ rate for British Columbia',1,__ENTITY__); +-- insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (149, 14,'5','0',null,null,'GST/TPS and PST/TVQ rate for Yukon',1,__ENTITY__); -- CAMEROUN (id country=24) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (241, 24, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (242, 24, '19.25','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (241, 24, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (242, 24, '19.25','0','VAT rate - standard',1,__ENTITY__); -- CHILE (id country=67) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (671, 67, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (672, 67, '19','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (671, 67, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (672, 67, '19','0','VAT rate - standard',1,__ENTITY__); -- CHINA (id country=9) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 91, 9, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 92, 9, '13','0','VAT rate - reduced 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 93, 9, '3','0','VAT rate - super-reduced 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 94, 9, '17','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 91, 9, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 92, 9, '13','0','VAT rate - reduced 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 93, 9, '3','0','VAT rate - super-reduced 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 94, 9, '17','0','VAT rate - standard',1,__ENTITY__); -- CONGO = REPUBLIQUE DU CONGO (id country=72) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT rate 18+0.9', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (721, 72, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active,entity) values (722, 72, '18','0', '0.9', '1', 'VAT rate 18+0.9', 1,__ENTITY__); -- CROATIA (id country=76) -insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (761, 76, '25','PDV 25%', 1); -insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (762, 76, '13','PDV 13%', 1); -insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (763, 76, '5', 'PDV 5%', 1); -insert into llx_c_tva(rowid,fk_pays,taux,note,active) values (764, 76, '0', 'PDV 0%', 1); +insert into llx_c_tva(rowid,fk_pays,taux,note,active,entity) values (761, 76, '25','PDV 25%', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,note,active,entity) values (762, 76, '13','PDV 13%', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,note,active,entity) values (763, 76, '5', 'PDV 5%', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,note,active,entity) values (764, 76, '0', 'PDV 0%', 1,__ENTITY__); -- CYPRUS (id country=78) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (781, 78, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (782, 78, '9','0','VAT rate 9',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (783, 78, '5','0','VAT rate 5',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (784, 78, '19','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (781, 78, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (782, 78, '9','0','VAT rate 9',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (783, 78, '5','0','VAT rate 5',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (784, 78, '19','0','VAT rate - standard',1,__ENTITY__); -- DANMERK (id country=80) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (801, 80, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (802, 80, '25','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (801, 80, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (802, 80, '25','0','VAT rate - standard',1,__ENTITY__); -- FRANCE (id country=1) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 11, 1, '0','0','VAT rate 0 ou non applicable',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 12, 1, '20','0','VAT rate - standard (France hors DOM-TOM)',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 13, 1, '10','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 14, 1, '5.5','0','VAT rate - reduced (France hors DOM-TOM)',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 15, 1, '2.1','0','VAT rate - super-reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,note,active) values (16, 1, '8.5', '85', '0', 'VAT rate - standard (DOM sauf Guyane et Saint-Martin)',0); -insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,note,active) values (17, 1, '8.5', '85NPR', '1', 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0); -insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active) values (18, 1, '8.5', '85NPROM', '1', 2, 3, 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0); -insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (19, 1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 11, 1, '0','0','VAT rate 0 ou non applicable',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 12, 1, '20','0','VAT rate - standard (France hors DOM-TOM)',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 13, 1, '10','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 14, 1, '5.5','0','VAT rate - reduced (France hors DOM-TOM)',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 15, 1, '2.1','0','VAT rate - super-reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,note,active,entity) values (16, 1, '8.5', '85', '0', 'VAT rate - standard (DOM sauf Guyane et Saint-Martin)',0,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,note,active,entity) values (17, 1, '8.5', '85NPR', '1', 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active,entity) values (18, 1, '8.5', '85NPROM', '1', 2, 3, 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (19, 1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT rate - standard (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0,__ENTITY__); -- GABON (id country=16) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (161, 16, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (162, 16, 'TPS95', 10, 0, '0', 0, '0', 0, 'VAT 9.5', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (163, 16, 'TPS95C', 10, 1, '1', 0, '0', 0, 'VAT 9.5+CSS', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (164, 16, 'TPS10', 10, 0, '0', 0, '0', 0, 'VAT 10', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (165, 16, 'TPS10C', 10, 1, '1', 0, '0', 0, 'VAT 10+CSS', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (166, 16, 'TPS18', 18, 0, '0', 0, '0', 0, 'VAT 18', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (167, 16, 'TPS18C', 18, 1, '1', 0, '0', 0, 'VAT 18+CSS', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (161, 16, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (162, 16, 'TPS95', 10, 0, '0', 0, '0', 0, 'VAT 9.5', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (163, 16, 'TPS95C', 10, 1, '1', 0, '0', 0, 'VAT 9.5+CSS', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (164, 16, 'TPS10', 10, 0, '0', 0, '0', 0, 'VAT 10', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (165, 16, 'TPS10C', 10, 1, '1', 0, '0', 0, 'VAT 10+CSS', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (166, 16, 'TPS18', 18, 0, '0', 0, '0', 0, 'VAT 18', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (167, 16, 'TPS18C', 18, 1, '1', 0, '0', 0, 'VAT 18+CSS', 1,__ENTITY__); -- GERMANY (id country=5) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5, '0','0','No VAT', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 52, 5, '7.0','0','ermäßigte USt.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 54, 5, '5.5','0','USt. Forst', 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 55, 5, '10.7','0','USt. Landwirtschaft', 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 56, 5, '19.0','0','allgemeine Ust.',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 51, 5, '0','0','No VAT', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 52, 5, '7.0','0','ermäßigte USt.', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 54, 5, '5.5','0','USt. Forst', 0,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 55, 5, '10.7','0','USt. Landwirtschaft', 0,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 56, 5, '19.0','0','allgemeine Ust.',1,__ENTITY__); -- GREECE (id country=102) -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1021, 102, 0, 0, '0', 0, '0', 0, 'Μηδενικό Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1022, 102, 24, 0, '0', 0, '0', 0, 'Κανονικός Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1023, 102, 13, 0, '0', 0, '0', 0, 'Μειωμένος Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1024, 102, 6, 0, '0', 0, '0', 0, 'Υπερμειωμένος Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1025, 102, 3, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1026, 102, 9, 0, '0', 0, '0', 0, 'Νήσων μειωμένος Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1027, 102, 4, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1); -insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1028, 102, 17, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1021, 102, 0, 0, '0', 0, '0', 0, 'Μηδενικό Φ.Π.Α.', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1022, 102, 24, 0, '0', 0, '0', 0, 'Κανονικός Φ.Π.Α.', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1023, 102, 13, 0, '0', 0, '0', 0, 'Μειωμένος Φ.Π.Α.', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1024, 102, 6, 0, '0', 0, '0', 0, 'Υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1025, 102, 3, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1026, 102, 9, 0, '0', 0, '0', 0, 'Νήσων μειωμένος Φ.Π.Α.', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1027, 102, 4, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1028, 102, 17, 0, '0', 0, '0', 0, 'Νήσων υπερμειωμένος Φ.Π.Α.', 1,__ENTITY__); -- ICELAND (id country=116) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1161, 116, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1163, 116,'25.5','0','VAT rate - standard',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1162, 116, '7','0','VAT rate - reduced',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1161, 116, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1163, 116,'25.5','0','VAT rate - standard',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1162, 116, '7','0','VAT rate - reduced',1,__ENTITY__); -- INDIA (id country=117) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1171, 117, '0','0','VAT rate 0', 0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1171, 117, '0','0','VAT rate 0', 0,__ENTITY__); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1172, 117, 'C+S-5' , 0, 2.5, '1', 2.5, '1', 0, 'CGST+SGST - Same state sales', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1173, 117, 'I-5' , 5, 0, '0', 0, '0', 0, 'IGST', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1174, 117, 'C+S-12', 0, 6, '1', 6, '1', 0, 'CGST+SGST - Same state sales', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1175, 117, 'I-12' , 12, 0, '0', 0, '0', 0, 'IGST', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'C+S-18', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'I-18' , 18, 0, '0', 0, '0', 0, 'IGST', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1178, 117, 'C+S-28', 0, 14, '1', 14, '1', 0, 'CGST+SGST - Same state sales', 1); -insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1179, 117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1172, 117, 'C+S-5' , 0, 2.5, '1', 2.5, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1173, 117, 'I-5' , 5, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1174, 117, 'C+S-12', 0, 6, '1', 6, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1175, 117, 'I-12' , 12, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1176, 117, 'C+S-18', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1177, 117, 'I-18' , 18, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1178, 117, 'C+S-28', 0, 14, '1', 14, '1', 0, 'CGST+SGST - Same state sales', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active,entity) values (1179, 117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1,__ENTITY__); -- IRELAND (id country=8) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 81, 8, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 82, 8, '23','0','VAT rate - standard',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 83, 8, '13.5','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 84, 8, '9','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 85, 8, '4.8','0','VAT rate - reduced',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 81, 8, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 82, 8, '23','0','VAT rate - standard',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 83, 8, '13.5','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 84, 8, '9','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 85, 8, '4.8','0','VAT rate - reduced',1,__ENTITY__); -- ITALY (id country=3) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 31, 3, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 32, 3, '10','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 33, 3, '4','0','VAT rate - super-reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 34, 3, '22','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 31, 3, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 32, 3, '10','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 33, 3, '4','0','VAT rate - super-reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 34, 3, '22','0','VAT rate - standard',1,__ENTITY__); -- IVORY COST (id country=21) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1,__ENTITY__); -- JAPAN (id country=123) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1231, 123, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1232, 123, '5','0','VAT rate 5',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1231, 123, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1232, 123, '5','0','VAT rate 5',1,__ENTITY__); -- LUXEMBOURG (id country=140) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1401, 140, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1402, 140, '14','0','VAT rate - intermediary',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1403, 140, '8','0','VAT rate - reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1404, 140, '3','0','VAT rate - super-reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1405, 140, '16','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1401, 140, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1402, 140, '14','0','VAT rate - intermediary',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1403, 140, '8','0','VAT rate - reduced', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1404, 140, '3','0','VAT rate - super-reduced', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1405, 140, '16','0','VAT rate - standard',1,__ENTITY__); -- MALI (id country=147) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1471, 147, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1472, 147, '18','0','VAT rate - standard', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1471, 147, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1472, 147, '18','0','VAT rate - standard', 1,__ENTITY__); -- MONACO (id country=27) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 271, 27, '0','0','VAT rate 0 ou non applicable',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 272, 27, '8.5','0','VAT rate - standard (DOM sauf Guyane et Saint-Martin)',0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 273, 27, '8.5','1','VAT rate - standard (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 274, 27, '5.5','0','VAT rate - reduced (France hors DOM-TOM)',0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 275, 27,'19.6','0','VAT rate - standard (France hors DOM-TOM)',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 276, 27, '2.1','0','VAT rate - super-reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 277, 27, '7','0','VAT rate - reduced',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 271, 27, '0','0','VAT rate 0 ou non applicable',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 272, 27, '8.5','0','VAT rate - standard (DOM sauf Guyane et Saint-Martin)',0,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 273, 27, '8.5','1','VAT rate - standard (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 274, 27, '5.5','0','VAT rate - reduced (France hors DOM-TOM)',0,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 275, 27,'19.6','0','VAT rate - standard (France hors DOM-TOM)',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 276, 27, '2.1','0','VAT rate - super-reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 277, 27, '7','0','VAT rate - reduced',1,__ENTITY__); -- MAROCO (id country=12) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 121, 12, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 122, 12, '14','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 123, 12, '10','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 124, 12, '7','0','VAT rate - super-reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 125, 12, '20','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 121, 12, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 122, 12, '14','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 123, 12, '10','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 124, 12, '7','0','VAT rate - super-reduced', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 125, 12, '20','0','VAT rate - standard',1,__ENTITY__); -- MALTA (id country=148) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1481, 148, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1482, 148, '7','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1483, 148, '5','0','VAT rate - super-reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1484, 148, '18','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1481, 148, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1482, 148, '7','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1483, 148, '5','0','VAT rate - super-reduced', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1484, 148, '18','0','VAT rate - standard',1,__ENTITY__); -- NEDERLAND (id country=17) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 171, 17, '0','0','0 BTW tarief', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 172, 17, '6','0','Verlaagd BTW tarief', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 173, 17, '19','0','Algemeen BTW tarief',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 174, 17, '21','0','Algemeen BTW tarief (vanaf 1 oktober 2012)',0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 171, 17, '0','0','0 BTW tarief', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 172, 17, '6','0','Verlaagd BTW tarief', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 173, 17, '19','0','Algemeen BTW tarief',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 174, 17, '21','0','Algemeen BTW tarief (vanaf 1 oktober 2012)',0,__ENTITY__); -- NEW CALEDONIA (id country=165) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1651, 165, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1652, 165, '3','0','VAT standard 3', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1653, 165, '6','0','VAT standard 6', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1654, 165, '11','0','VAT rate - standard', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1655, 165, '22','0','VAT standard high', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1651, 165, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1652, 165, '3','0','VAT standard 3', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1653, 165, '6','0','VAT standard 6', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1654, 165, '11','0','VAT rate - standard', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1655, 165, '22','0','VAT standard high', 1,__ENTITY__); -- NEW ZEALAND (id country=166) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1661, 166, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1662, 166, '15','0','VAT rate - standard', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1661, 166, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1662, 166, '15','0','VAT rate - standard', 1,__ENTITY__); -- NIGERIA (id country=169) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1691, 169, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1692, 169, '5','0','VAT rate - standard', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1691, 169, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1692, 169, '5','0','VAT rate - standard', 1,__ENTITY__); -- NORWAY (id country=173) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1731, 173, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1732, 173, '14','0','VAT rate - reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1733, 173, '8','0','VAT rate - reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1734, 173, '25','0','VAT rate - standard', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1731, 173, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1732, 173, '14','0','VAT rate - reduced', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1733, 173, '8','0','VAT rate - reduced', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1734, 173, '25','0','VAT rate - standard', 1,__ENTITY__); -- PANAMA (id country=178) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1781, 178, '0','0','ITBMS Rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1782, 178, '7','0','ITBMS standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1781, 178, '0','0','ITBMS Rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1782, 178, '7','0','ITBMS standard rate',1,__ENTITY__); -- PERU (id country=181) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1811, 181, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1818, 181, '18','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1811, 181, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1818, 181, '18','0','VAT rate - standard',1,__ENTITY__); -- POLAND (id country=184) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1841, 184, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1842, 184, '8','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1843, 184, '3','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1844, 184, '23','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1841, 184, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1842, 184, '8','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1843, 184, '3','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1844, 184, '23','0','VAT rate - standard',1,__ENTITY__); -- PORTUGAL (id country=25) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 251, 25, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 252, 25, '13','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 253, 25, '23','0','VAT rate - standard',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 254, 25, '6','0','VAT rate - reduced',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 251, 25, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 252, 25, '13','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 253, 25, '23','0','VAT rate - standard',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 254, 25, '6','0','VAT rate - reduced',1,__ENTITY__); -- ROMANIA (id country=188) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1881, 188, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1882, 188, '9','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1883, 188, '19','0','VAT rate - standard',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1884, 188, '5','0','VAT rate - reduced',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1881, 188, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1882, 188, '9','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1883, 188, '19','0','VAT rate - standard',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1884, 188, '5','0','VAT rate - reduced',1,__ENTITY__); -- SAUDI ARABIA (id country=26) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 261, 26, '0', '0', 'VAT rate 0', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 262, 26, '5', '0', 'VAT rate 5', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 261, 26, '0', '0', 'VAT rate 0', 1,__ENTITY__); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 262, 26, '5', '0', 'VAT rate 5', 1,__ENTITY__); -- SAN SALVADOR (id country=86) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 861, 86, '0', '0', 'SIN IVA', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 862, 86, '13', '0', 'IVA 13', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 861, 86, '0', '0', 'SIN IVA', 1,__ENTITY__); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 862, 86, '13', '0', 'IVA 13', 1,__ENTITY__); -- SENEGAL (id country=22) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 221, 22, '0', '0', 'VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 222, 22, '10', '0', 'VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 223, 22, '18', '0', 'VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 221, 22, '0', '0', 'VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 222, 22, '10', '0', 'VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 223, 22, '18', '0', 'VAT rate - standard',1,__ENTITY__); -- SLOVAKIA (id country=201) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2011, 201, '0', '0', 'VAT rate 0', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2012, 201, '10', '0', 'VAT rate - reduced', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2013, 201, '20', '0', 'VAT rate - standard', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2011, 201, '0', '0', 'VAT rate 0', 1,__ENTITY__); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2012, 201, '10', '0', 'VAT rate - reduced', 1,__ENTITY__); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2013, 201, '20', '0', 'VAT rate - standard', 1,__ENTITY__); -- SLOVENIA (id country=202) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2021, 202, '0', '0', 'VAT rate 0', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2022, 202,'9.5', '0', 'VAT rate - reduced', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2023, 202, '22', '0', 'VAT rate - standard', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2021, 202, '0', '0', 'VAT rate 0', 1,__ENTITY__); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2022, 202,'9.5', '0', 'VAT rate - reduced', 1,__ENTITY__); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2023, 202, '22', '0', 'VAT rate - standard', 1,__ENTITY__); -- SOUTH AFRICA (id country=205) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2051, 205, '0', '0', 'VAT rate 0', 1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2052, 205, '15', '0', 'VAT rate - standard', 1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2051, 205, '0', '0', 'VAT rate 0', 1,__ENTITY__); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES (2052, 205, '15', '0', 'VAT rate - standard', 1,__ENTITY__); -- SPAIN (id country=4) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4, '0','0', '0','3','-19:-15:-9','5','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-19:-15:-9','5','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 43, 4, '4','0','0.5','3','-19:-15:-9','5','VAT rate - super-reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4,'21','0','5.2','3','-19:-15:-9','5','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values ( 41, 4, '0','0', '0','3','-19:-15:-9','5','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values ( 42, 4,'10','0','1.4','3','-19:-15:-9','5','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values ( 43, 4, '4','0','0.5','3','-19:-15:-9','5','VAT rate - super-reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active,entity) values ( 44, 4,'21','0','5.2','3','-19:-15:-9','5','VAT rate - standard',1,__ENTITY__); -- SWEDEN (id country=20) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 201, 20, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 202, 20, '12','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 203, 20, '6','0','VAT rate - super-reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 204, 20, '25','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 201, 20, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 202, 20, '12','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 203, 20, '6','0','VAT rate - super-reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 204, 20, '25','0','VAT rate - standard',1,__ENTITY__); -- SWITZERLAND (id country=6) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 61, 6, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 62, 6, '3.8','0','VAT rate - reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 63, 6, '2.6','0','VAT rate - super-reduced',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 64, 6, '8.1','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 61, 6, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 62, 6, '3.8','0','VAT rate - reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 63, 6, '2.6','0','VAT rate - super-reduced',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 64, 6, '8.1','0','VAT rate - standard',1,__ENTITY__); -- SRI LANKA (id country=207) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2071, 207, '0','0','VAT 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2072, 207, '15','0','VAT 15%', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2071, 207, '0','0','VAT 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2072, 207, '15','0','VAT 15%', 1,__ENTITY__); -- TAIWAN (id country=213) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2131, 213, '0','0','VAT 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2132, 213, '5','0','VAT 5%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2131, 213, '0','0','VAT 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2132, 213, '5','0','VAT 5%',1,__ENTITY__); -- TUNISIA (id country=10) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (101,10, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (102,10, '12','0','VAT 12%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (103,10, '18','0','VAT 18%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (104,10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (105,10, '15','0','VAT 12% Majoré à 25% (15%)',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (107,10, '6','0','VAT 6%', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (108,10,'18.18','0','VAT 18%+FODEC', 1, 1, '4', 0, 0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (101,10, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (102,10, '12','0','VAT 12%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (103,10, '18','0','VAT 18%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (104,10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (105,10, '15','0','VAT 12% Majoré à 25% (15%)',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (107,10, '6','0','VAT 6%', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type,entity) values (108,10,'18.18','0','VAT 18%+FODEC', 1, 1, '4', 0, 0,__ENTITY__); -- UKRAINE (id country=226) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2261,226, '0','0','VAT rate 0',1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2262,226, '20','0','VAT standart rate',1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2261,226, '0','0','VAT rate 0',1,__ENTITY__); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2262,226, '20','0','VAT standart rate',1,__ENTITY__); -- UNITED OF KINGDOM (id country=7) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 71, 7, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 72, 7, '17.5','0','VAT rate - standard before 2011',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 73, 7, '5','0','VAT rate - reduced', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 74, 7, '20','0','VAT rate - standard',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 71, 7, '0','0','VAT rate 0', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 72, 7, '17.5','0','VAT rate - standard before 2011',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 73, 7, '5','0','VAT rate - reduced', 1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values ( 74, 7, '20','0','VAT rate - standard',1,__ENTITY__); -- UNITED STATES (id country=11) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (111,11, '0','0','No Sales Tax',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (112,11, '4','0','Sales Tax 4%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (113,11, '6','0','Sales Tax 6%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (111,11, '0','0','No Sales Tax',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (112,11, '4','0','Sales Tax 4%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (113,11, '6','0','Sales Tax 6%',1,__ENTITY__); -- Pour les DOM-TOM, il faut utiliser le pays FRANCE (Sinon pb avec regles de TVA et autres regles propres aux pays et europe) -- SAINT PIERRE ET MIQUELON (id country=19) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1931,193, '0','0','No VAT in SPM',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1931,193, '0','0','No VAT in SPM',1,__ENTITY__); -- SAINT MARTIN (id country=24) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2461,246, '0','0','VAT rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2461,246, '0','0','VAT rate 0',1,__ENTITY__); -- MAURITANIA (id country=151) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1511,151, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1512,151, '14','0','VAT rate 14',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1511,151, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1512,151, '14','0','VAT rate 14',1,__ENTITY__); -- MAURITIUS (id country=152) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1521,152, '0','0','VAT rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1522,152, '15','0','VAT rate 15',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1521,152, '0','0','VAT rate 0',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1522,152, '15','0','VAT rate 15',1,__ENTITY__); -- HONDURAS (id country=114) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1141,114, '0','0','No ISV',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1142,114, '12','0','ISV 12%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1141,114, '0','0','No ISV',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1142,114, '12','0','ISV 12%',1,__ENTITY__); -- MEXIQUE (id country=154) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1541,154, '0','0','No VAT',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1542,154, '16','0','VAT 16%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1543,154, '10','0','VAT Frontero',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1541,154, '0','0','No VAT',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1542,154, '16','0','VAT 16%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (1543,154, '10','0','VAT Frontero',1,__ENTITY__); -- BARBADOS (id country=46) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 461, 46, '0','0','No VAT',1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 462, 46, '15','0','VAT 15%',1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 461, 46, '0','0','No VAT',1,__ENTITY__); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 462, 46, '15','0','VAT 15%',1,__ENTITY__); +INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1,__ENTITY__); -- VENEZUELA (id country=232) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2321,232, '0','0','No VAT',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2323,232, '8','0','VAT 8%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2321,232, '0','0','No VAT',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2322,232, '12','0','VAT 12%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2323,232, '8','0','VAT 8%',1,__ENTITY__); -- VIETNAM (id country=233) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2331,233, '0','0','Thuế GTGT đươc khấu trừ 0%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2332,233, '5','0','Thuế GTGT đươc khấu trừ 5%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2333,233, '8','0','Thuế GTGT đươc khấu trừ 8%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2334,233, '10','0','Thuế GTGT đươc khấu trừ 10%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2331,233, '0','0','Thuế GTGT đươc khấu trừ 0%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2332,233, '5','0','Thuế GTGT đươc khấu trừ 5%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2333,233, '8','0','Thuế GTGT đươc khấu trừ 8%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2334,233, '10','0','Thuế GTGT đươc khấu trừ 10%',1,__ENTITY__); -- Example of code to insert a VAT rate 0 for each country -- delete from llx_c_tva where rowid = 1181; -- to delete a record that does not follow rules for rowid (fk_pays+'1') --- insert into llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active) SELECT CONCAT(c.rowid, '1'), c.rowid, 0, 0, 'No VAT', 1 from llx_c_country as c where c.rowid not in (select fk_pays from llx_c_tva); +-- insert into llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active,entity) SELECT CONCAT(c.rowid, '1'), c.rowid, 0, 0, 'No VAT', 1 from llx_c_country as c where c.rowid not in (select fk_pays from llx_c_tva,__ENTITY__); -- BURUNDI (id country=61) -- https://www.objectif-import-export.fr/fr/marches-internationaux/fiche-pays/burundi/presentation-fiscalite -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2335,61, '0','0','No VAT',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2336,61, '10','0','VAT 10%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2337,61, '18','0','VAT 18%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2335,61, '0','0','No VAT',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2336,61, '10','0','VAT 10%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (2337,61, '18','0','VAT 18%',1,__ENTITY__); -- Turkiye (Turkey) (id country=221) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (22101,221, '0','0','No VAT',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (22102,221, '1','0','VAT 1%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (22103,221, '8','0','VAT 8%',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (22104,221, '18','0','VAT 18%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (22101,221, '0','0','No VAT',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (22102,221, '1','0','VAT 1%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (22103,221, '8','0','VAT 8%',1,__ENTITY__); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,entity) values (22104,221, '18','0','VAT 18%',1,__ENTITY__); diff --git a/htdocs/install/mysql/data/llx_c_type_container-website.sql b/htdocs/install/mysql/data/llx_c_type_container-website.sql index 87bfd807332..77ac2ff6c0b 100644 --- a/htdocs/install/mysql/data/llx_c_type_container-website.sql +++ b/htdocs/install/mysql/data/llx_c_type_container-website.sql @@ -30,11 +30,11 @@ -- Type of website page/container -- -insert into llx_c_type_container (code,label,module,active) values ('page', 'Page', 'system', 1); -insert into llx_c_type_container (code,label,module,active) values ('banner', 'Banner', 'system', 1); -insert into llx_c_type_container (code,label,module,active) values ('blogpost', 'BlogPost', 'system', 1); -insert into llx_c_type_container (code,label,module,active) values ('menu', 'Menu', 'system', 1); -insert into llx_c_type_container (code,label,module,active) values ('other', 'Other', 'system', 1); +insert into llx_c_type_container (code,label,module,active,entity) values ('page', 'Page', 'system', 1, __ENTITY__); +insert into llx_c_type_container (code,label,module,active,entity) values ('banner', 'Banner', 'system', 1, __ENTITY__); +insert into llx_c_type_container (code,label,module,active,entity) values ('blogpost', 'BlogPost', 'system', 1, __ENTITY__); +insert into llx_c_type_container (code,label,module,active,entity) values ('menu', 'Menu', 'system', 1, __ENTITY__); +insert into llx_c_type_container (code,label,module,active,entity) values ('other', 'Other', 'system', 1, __ENTITY__); -INSERT INTO llx_c_type_container(code, label, active, module, position, typecontainer) VALUES ('service', 'Service (ajax or api)', 1, 'system', 300, 'library'); -INSERT INTO llx_c_type_container(code, label, active, module, position, typecontainer) VALUES ('library', 'Library (functions)', 1, 'system', 400, 'library'); +INSERT INTO llx_c_type_container(code, label, active, module, position, typecontainer, entity) VALUES ('service', 'Service (ajax or api)', 1, 'system', 300, 'library', __ENTITY__); +INSERT INTO llx_c_type_container(code, label, active, module, position, typecontainer, entity) VALUES ('library', 'Library (functions)', 1, 'system', 400, 'library', __ENTITY__); From 4f5d3dddc7bc9b84a9ce103856aac4d89db37f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 16 Nov 2024 10:40:12 +0100 Subject: [PATCH 064/700] fix tooltip (#31933) --- htdocs/core/js/lib_foot.js.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 06a5ecef2e9..224caed534c 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -118,8 +118,10 @@ if (empty($conf->dol_no_mouse_hover)) { success: function(response){ // Setting content option console.log("ajax success"); - elemfortooltip.tooltip("option","content",response); - elemfortooltip.tooltip("open"); + if (elemfortooltip.is(":hover")) { + elemfortooltip.tooltip("option","content",response); + elemfortooltip.tooltip("open"); + } } }); }, opendelay)); From cd6ed63768a2a0f4c7f66366db62b98f423fdd2c Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sat, 16 Nov 2024 10:45:01 +0100 Subject: [PATCH 065/700] Fix Specimen warning in supplier admin when database has no products (#31867) --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b7c01fa4306..b50bce3bd6c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2938,7 +2938,7 @@ class CommandeFournisseur extends CommonOrder $sql .= $this->db->order("rowid", "ASC"); $sql .= $this->db->plimit(1); $resql = $this->db->query($sql); - if ($resql) { + if ($resql && $this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); $prodid = $obj->rowid; } From 1ec2b053b7959e69b2bfc1abfbddc83b9f4e7b12 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Sat, 16 Nov 2024 10:45:29 +0100 Subject: [PATCH 066/700] fix warning in html form class (#31860) Co-authored-by: Hystepik --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c471ea18b23..f33876a2f0c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7207,7 +7207,7 @@ class Form $shour = ''; $smin = ''; $ssec = ''; - if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/', $set_time, $reg)) { // deprecated usage + if (!empty($set_time) && preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/', $set_time, $reg)) { // deprecated usage // Date format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' $syear = (!empty($reg[1]) ? $reg[1] : ''); $smonth = (!empty($reg[2]) ? $reg[2] : ''); From b6dfc496a2d872e470d37e6378cea18facf83b87 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Sat, 16 Nov 2024 10:51:24 +0100 Subject: [PATCH 067/700] FIX: assets: division by zero when trying to calculate depreciation on assets that don't have it (#31858) * FIX: assets: division by zero when trying to calculate depreciation on assets that don't have it * FIX: assets: division by zero when trying to calculate depreciation on assets that don't have it, part 2 --- htdocs/asset/class/asset.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index eae77489859..1ff9497759f 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -814,6 +814,10 @@ class Asset extends CommonObject return -1; } + if (! empty($this->not_depreciated)) { + return 1; + } + // Get depreciation options //--------------------------- require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; From 5f5fc076b50e5539deddc830e7b17384a6f228ef Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Sat, 16 Nov 2024 10:55:31 +0100 Subject: [PATCH 068/700] fix undefined property in expensereportline class (#31854) Co-authored-by: Hystepik Co-authored-by: Laurent Destailleur --- htdocs/expensereport/class/expensereportline.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereportline.class.php b/htdocs/expensereport/class/expensereportline.class.php index 52f3ce88190..0402ebff545 100644 --- a/htdocs/expensereport/class/expensereportline.class.php +++ b/htdocs/expensereport/class/expensereportline.class.php @@ -268,7 +268,7 @@ class ExpenseReportLine extends CommonObjectLine $this->rowid = $objp->rowid; $this->id = $objp->rowid; - $this->ref = $objp->ref; + //$this->ref = $objp->ref; Undefined property $this->fk_expensereport = $objp->fk_expensereport; $this->comments = $objp->comments; $this->qty = $objp->qty; From 976399c2d9840386be879ac2e16e4e4259efbf73 Mon Sep 17 00:00:00 2001 From: "Thomas C." <56068416+Thomas905@users.noreply.github.com> Date: Sat, 16 Nov 2024 10:57:03 +0100 Subject: [PATCH 069/700] fix (#31683) --- htdocs/core/lib/company.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 82e42792144..2146f00ba66 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2193,7 +2193,7 @@ function show_subsidiaries($conf, $langs, $db, $object) $i = -1; - $sql = "SELECT s.rowid, s.client, s.fournisseur, s.nom as name, s.name_alias, s.email, s.address, s.zip, s.town, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.canvas"; + $sql = "SELECT s.rowid, s.client, s.fournisseur, s.nom as name, s.name_alias, s.email, s.address, s.zip, s.town, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.canvas, s.status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.parent = ".((int) $object->id); $sql .= " AND s.entity IN (".getEntity('societe').")"; @@ -2233,6 +2233,7 @@ function show_subsidiaries($conf, $langs, $db, $object) $socstatic->canvas = $obj->canvas; $socstatic->client = $obj->client; $socstatic->fournisseur = $obj->fournisseur; + $socstatic->status = $obj->status; print ''; From 31926333e1e316afe813bd778133b8cfb5d57bae Mon Sep 17 00:00:00 2001 From: Nicolas SILOBRE <45969285+ns-info90@users.noreply.github.com> Date: Sat, 16 Nov 2024 10:58:48 +0100 Subject: [PATCH 070/700] Update viewcat.php (#31849) * Update viewcat.php * Update viewcat.php --- htdocs/categories/viewcat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index c45c5f016e9..211e2d1f7b4 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -634,7 +634,7 @@ if ($type == Categorie::TYPE_CUSTOMER) { print ''; print ''; print ''; From 54891e8fa7474e4519ba924abbec76495197f6c5 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sat, 16 Nov 2024 11:34:36 +0100 Subject: [PATCH 071/700] FIX Status not correct in Public ticket list (#31922) --- htdocs/public/ticket/list.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index fcc9a00e72a..4a7bbf39a6f 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -702,7 +702,10 @@ if ($action == "view_ticketlist") { // Statut if (!empty($arrayfields['t.fk_statut']['checked'])) { print ''; } From c496df7dfeb084aedc27b773d954bd654225caf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 16 Nov 2024 11:39:55 +0100 Subject: [PATCH 072/700] test github token (#31931) * test github token * solving errors * test github token * test * test * fix * fix * fix * fix * fix --- .github/workflows/phpstan_baseline.yml | 21 +++++++++++--------- htdocs/comm/propal/stats/index.php | 16 +++++---------- htdocs/commande/stats/index.php | 5 ++--- htdocs/product/stock/productlot_document.php | 2 ++ 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/.github/workflows/phpstan_baseline.yml b/.github/workflows/phpstan_baseline.yml index 618a2d26690..9503c25de77 100644 --- a/.github/workflows/phpstan_baseline.yml +++ b/.github/workflows/phpstan_baseline.yml @@ -1,9 +1,9 @@ name: 'PHPStan baseline' on: - # Every Thursday we want to refresh the baseline + # Every day we want to refresh the baseline schedule: - - cron: '0 6 * * 4' + - cron: '0 12 * * *' # We want to be able to manually refresh the baseline too workflow_dispatch: @@ -14,18 +14,21 @@ on: required: true type: string # Run PHPStan analyse on pull requests - #pull_request: + # pull_request: + +permissions: {} # none env: PHP_VERSION: '8.2' + GH_TOKEN: ${{ github.token }} gh_event: ${{ inputs.gh_event || github.event_name }} CACHE_KEY_PART: ${{ ( inputs.gh_event == 'pull_request' || github.event_name == 'pull_request' ) && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} jobs: phpstan: runs-on: ubuntu-latest - permissions: write-all - # contents: write - # pull-requests: write + permissions: + contents: write + pull-requests: write steps: - name: Checkout uses: actions/checkout@v4 @@ -54,7 +57,7 @@ jobs: phpstan-cache-${{ env.PHP_VERSION }}- - uses: ruudk/phpstan-baseline-refresh-create-pr-action@main with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ env.GH_TOKEN }} phpstan_path: phpstan configuration_path: phpstan.neon.dist phpstan_additional_arguments: --memory-limit 7G -a build/phpstan/bootstrap_action.php @@ -63,8 +66,8 @@ jobs: commit_email: dolibarr-bot@users.noreply.github.com commit_message: PHPStan > Update baseline target_branch: develop - pr_create: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && 1 || 0 }} - # pr_create: 1 + # pr_create: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && 1 || 0 }} + pr_create: 1 pr_title: PHPStan > Update baseline pr_reviewer: eldy pr_body: | diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 55c4d15f18f..ff88cc5e51f 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -97,18 +97,12 @@ $formother = new FormOther($db); $langs->loadLangs(array('propal', 'other', 'companies')); -$picto = null; -$dir = null; -$cat_type = null; -$cat_label = null; +$picto = 'propal'; +$title = $langs->trans("ProposalsStatistics"); +$dir = $conf->propal->dir_temp; +$cat_type = Categorie::TYPE_CUSTOMER; +$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer")); -if ($mode == 'customer') { - $picto = 'propal'; - $title = $langs->trans("ProposalsStatistics"); - $dir = $conf->propal->dir_temp; - $cat_type = Categorie::TYPE_CUSTOMER; - $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer")); -} if ($mode == 'supplier') { $picto = 'supplier_proposal'; $title = $langs->trans("ProposalsStatisticsSuppliers"); diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 555c04558e5..cc2aac53b02 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -304,9 +304,8 @@ $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; -if ($mode == 'customer') { - $type = 'order_stats'; -} +$type = 'order_stats'; + if ($mode == 'supplier') { $type = 'supplier_order_stats'; } diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index 54813e16de1..a53aafa557f 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -88,6 +88,8 @@ if (!$sortfield) { $modulepart = 'product_batch'; $object = new Productlot($db); if ($id || $ref) { + $productid = 0; + $batch = ''; if ($ref) { $tmp = explode('_', $ref); $productid = $tmp[0]; From af6a487178012f1a9340fd17c3ef0059677bc313 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 16 Nov 2024 14:45:30 +0100 Subject: [PATCH 073/700] FIX missing check permissions for clone user action (#31944) * FIX missing check permissions for clone action * FIX missing permission for the action --- htdocs/user/card.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 83566e92ba2..da755e4c775 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -134,6 +134,16 @@ if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "write")); } +$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity)); +$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin)); +$permissiontocloneuser = $permissiontoadd; +// Can clone only in master entity if transverse mode is used +if (getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity > 1) { + $permissiontoclonesuperadmin = false; + $permissiontocloneadmin = false; + $permissiontocloneuser = false; +} + if ($user->id != $id && !$permissiontoread) { accessforbidden(); } @@ -774,7 +784,7 @@ if (empty($reshook)) { if ($action == 'confirm_clone' && $confirm != 'yes') { $action = ''; } - if ($action == 'confirm_clone' && $confirm == 'yes' && $user->hasRight("user", "user", "write")) { + if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontocloneuser) { if (!GETPOST('clone_name')) { setEventMessages($langs->trans('ErrorNoCloneWithoutName'), null, 'errors'); } elseif (getDolGlobalString('USER_MAIL_REQUIRED') && !GETPOST('new_email')) { @@ -786,7 +796,6 @@ if (empty($reshook)) { $clone->id = 0; $clone->email = (getDolGlobalString('USER_MAIL_REQUIRED') ? GETPOST('new_email', 'alphanohtml') : ''); - $clone->entity = 1; $clone->api_key = ''; $parts = explode(' ', GETPOST('clone_name'), 2); @@ -2132,15 +2141,18 @@ if ($action == 'create' || $action == 'adduserldap') { 'class' => 'classfortooltip' ) ); - //clone user - $cloneButtonId = ''; - $cloneUserUrl = ''; - - if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { + // Clone user + // a simple user can not clone an admin or superadmin and a simple admin can not clone a superadmin + if ((empty($object->entity) && $permissiontoclonesuperadmin) || (!empty($object->admin) && !empty($object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty($object->admin) && !empty($object->entity))) { + $cloneButtonId = ''; $cloneUserUrl = ''; - $cloneButtonId = 'action-clone'; - } + + if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { + $cloneUserUrl = ''; + $cloneButtonId = 'action-clone'; + } print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $cloneUserUrl, $cloneButtonId, $user->hasRight('user', 'user', 'write')); + } if (getDolGlobalString('USER_PASSWORD_GENERATED') != 'none') { if ($object->status == $object::STATUS_DISABLED) { From 31dda93490abbd585765b4720e43f93b0b99ae90 Mon Sep 17 00:00:00 2001 From: omogenot Date: Sat, 16 Nov 2024 14:47:02 +0100 Subject: [PATCH 074/700] Add missing hook context to parameters array (#31942) There is a missing context value in the parameters array passed to executeHooks. This missing parameter prevents an external hook to determine which context called and define hook behaviour. --- htdocs/product/stock/card.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 4736a24eff0..1914448023d 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -114,7 +114,7 @@ $usercandelete = $user->hasRight('stock', 'supprimer'); $error = 0; -$parameters = array('id' => $id, 'ref' => $ref); +$parameters = array('context' => 'warehousecard', 'id' => $id, 'ref' => $ref); $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'); @@ -439,7 +439,7 @@ if ($action == 'create') { } // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm); + $parameters = array('context' => 'warehousecard', 'formConfirm' => $formconfirm); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $formconfirm .= $hookmanager->resPrint; @@ -599,7 +599,7 @@ if ($action == 'create') { */ print "
\n"; - $parameters = array(); + $parameters = array('context' => 'warehousecard'); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { if (empty($action) || $action == 'classin') { @@ -634,7 +634,7 @@ if ($action == 'create') { print '
'; print '
'; print $langs->trans("AddCustomerIntoCategory").'  '; - $filter = '(s.client:IN:1,3)'; + $filter = '(s.client:IN:1,2,3)'; print $form->select_company('', 'elemid', $filter); print '
'; - $object->fk_statut = $obj->fk_statut; + $object->status = $obj->fk_statut; + if (getDolGlobalString('TICKET_SHOW_PROGRESSION')) { + $object->progress = $obj->progress; + } print $object->getLibStatut(2); print '
'; print ''; - $parameters = array('totalarray' => &$totalarray); + $parameters = array('context' => 'warehousecard', 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -680,7 +680,7 @@ if ($action == 'create') { $totalarray['nbfield']++; } // Hook fields - $parameters = array('sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); + $parameters = array('context' => 'warehousecard', 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print "\n"; @@ -714,7 +714,7 @@ if ($action == 'create') { } $sql .= ", (ps.reel * p.pmp) as svalue"; // Add fields from hooks - $parameters = array(); + $parameters = array('context' => 'warehousecard'); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook if ($reshook > 0) { //Note that $sql is replaced if reshook > 0 $sql = ""; @@ -847,7 +847,7 @@ if ($action == 'create') { print ""; } - $parameters = array('obj' => $objp, 'totalarray' => &$totalarray); + $parameters = array('context' => 'warehousecard', 'obj' => $objp, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -871,7 +871,7 @@ if ($action == 'create') { $totalarray['val']['totalvaluesell'] = price2num($totalvaluesell, 'MT'); $totalarray['val']['units'] = $langs->trans($productstatic->getLabelOfUnit()); - $parameters = array('totalarray' => &$totalarray); + $parameters = array('context' => 'warehousecard', 'totalarray' => &$totalarray); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTotal', $parameters, $object); if ($reshook < 0) { @@ -976,7 +976,7 @@ if ($action == 'create') { print ''; // Other attributes - $parameters = array('colspan' => ' colspan="3"', 'cols' => '3'); + $parameters = array('context' => 'warehousecard', 'colspan' => ' colspan="3"', 'cols' => '3'); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { From ee1cdd765ac7a0b2044d14a4b00a675952591062 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 16 Nov 2024 14:48:04 +0100 Subject: [PATCH 075/700] PHPStan > Update baseline (#31940) Co-authored-by: Dolibot --- build/phpstan/phpstan-baseline.neon | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 431b7d30d06..fcd41ac896b 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -4950,12 +4950,6 @@ parameters: count: 1 path: ../../htdocs/comm/propal/note.php - - - message: '#^Variable \$title might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/comm/propal/stats/index.php - - message: '#^Unable to resolve the template type T in call to function dol_sort_array$#' identifier: argument.templateType @@ -5382,12 +5376,6 @@ parameters: count: 1 path: ../../htdocs/commande/note.php - - - message: '#^Variable \$type might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/commande/stats/index.php - - message: '#^Unable to resolve the template type T in call to function dol_sort_array$#' identifier: argument.templateType @@ -29130,18 +29118,6 @@ parameters: count: 1 path: ../../htdocs/product/stock/productlot_card.php - - - message: '#^Variable \$batch might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/productlot_document.php - - - - message: '#^Variable \$productid might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/product/stock/productlot_document.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable From fac36d2376d42e01f4e0e63a4f684f1b59c1daa3 Mon Sep 17 00:00:00 2001 From: Sami Filali <139965072+samifilali@users.noreply.github.com> Date: Sat, 16 Nov 2024 14:51:24 +0100 Subject: [PATCH 076/700] add hook (#31938) --- htdocs/admin/mails_templates.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index b19093eeeb0..90ce91457db 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1103,6 +1103,10 @@ if ($num) { if (getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) { $fieldsforcontent[] = 'content_lines'; } + + $parameters = array('fieldsforcontent' => &$fieldsforcontent, 'tabname' => $tabname[$id]); + $hookmanager->executeHooks('editEmailTemplateFieldsForContent', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks + foreach ($fieldsforcontent as $tmpfieldlist) { $showfield = 1; $css = "left"; From 7a84561bba6944accdb37be59883d7c317101bf9 Mon Sep 17 00:00:00 2001 From: iouston <4319513+iouston@users.noreply.github.com> Date: Sat, 16 Nov 2024 14:56:42 +0100 Subject: [PATCH 077/700] =?UTF-8?q?Fix=20issue=20n=C2=B0=2030845=20-=20Res?= =?UTF-8?q?ources=20not=20saved=20on=20new=20event=20creation=20(#31889)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * short_open_tag was always on No * Fix Bug - Return an error if SOCIETE_EMAIL_UNIQUE = 1 if SOCIETE_EMAIL_UNIQUE is on 1, this form return an error because thirdparty already exist. * fix issue n°31839 * fix wrong parameters * fix issue n°30845 * Revert "fix issue n°30845" This reverts commit cf88b7b236ffb51fb01c7564f81c1f86fbca6f53. * fix issue n°30845 * replace space by tabs for CI * fix cat statement * precommit is very ball breaker ;-) * is this the right one? * fix precommit error * Please phpstan... --------- Co-authored-by: Laurent Destailleur --- htdocs/comm/action/card.php | 75 +++++++++++++++++++++ htdocs/public/project/new.php | 30 ++++----- htdocs/resource/class/dolresource.class.php | 2 +- 3 files changed, 91 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 5cff3073b8b..8ef1b664a29 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -367,6 +367,8 @@ if (empty($reshook) && $action == 'add' && $usercancreate) { $object->type_code = GETPOST('actioncode', 'aZ09'); } + $listofresourceid = array(); + if (!$error) { // Initialisation of object actioncomm $object->priority = GETPOSTISSET("priority") ? GETPOSTINT("priority") : 0; @@ -430,6 +432,11 @@ if (empty($reshook) && $action == 'add' && $usercancreate) { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); } + + if (!empty($_SESSION['assignedtoresource'])) { + $listofresourceid = json_decode($_SESSION['assignedtoresource'], true); + } + $i = 0; foreach ($listofuserid as $key => $value) { if ($i == 0) { // First entry @@ -541,6 +548,74 @@ if (empty($reshook) && $action == 'add' && $usercancreate) { if ($idaction > 0) { if (!$object->error) { + if (is_array($listofresourceid) && count($listofresourceid)) { + foreach ($listofresourceid as $resource_id => $val) { + $resource_type = 'dolresource'; + $busy = 1;//GETPOSTINT('busy'); + + // Resources association + if (getDolGlobalString('RESOURCE_USED_IN_EVENT_CHECK')) { + $eventDateStart = $object->datep; + $eventDateEnd = $object->datef; + $isFullDayEvent = $object->fulldayevent; + if (empty($eventDateEnd)) { + if ($isFullDayEvent) { + $eventDateStartArr = dol_getdate($eventDateStart); + $eventDateStart = dol_mktime(0, 0, 0, $eventDateStartArr['mon'], $eventDateStartArr['mday'], $eventDateStartArr['year']); + $eventDateEnd = dol_mktime(23, 59, 59, $eventDateStartArr['mon'], $eventDateStartArr['mday'], $eventDateStartArr['year']); + } + } + + $sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label"; + $sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = '" . $db->escape($resource_type) . "'"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'"; + $sql .= " WHERE er.resource_id = " . ((int) $resource_id); + $sql .= " AND er.busy = 1"; + $sql .= " AND ("; + + // event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end) + $sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))"; + // event date end between ac.datep and ac.datep2 + if (!empty($eventDateEnd)) { + $sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))"; + } + // event date start before ac.datep and event date end after ac.datep2 + $sql .= " OR ("; + $sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'"; + if (!empty($eventDateEnd)) { + $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')"; + } + $sql .= ")"; + + $sql .= ")"; + $resql = $db->query($sql); + if (!$resql) { + $error++; + $object->error = $db->lasterror(); + $object->errors[] = $object->error; + } else { + if ($db->num_rows($resql) > 0) { + // Resource already in use + $error++; + $object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; + while ($obj = $db->fetch_object($resql)) { + $object->error .= '
- ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); + } + $object->errors[] = $object->error; + } + $db->free($resql); + } + } + + if (!$error) { + $res = $object->add_element_resource($resource_id, $resource_type, $busy, $val['mandatory']); + } + } + } + + unset($_SESSION['assignedtoresource']); + // Category association $categories = GETPOST('categories', 'array'); $object->setCategories($categories); diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index b2d2e9ba830..a794d2f5735 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -186,26 +186,26 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he $db->begin(); - if (!GETPOST("lastname")) { + if (!GETPOST('lastname', 'alpha')) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."
\n"; } - if (!GETPOST("firstname")) { + if (!GETPOST('firstname', 'alpha')) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."
\n"; } - if (!GETPOST("email")) { + if (!GETPOST('email', 'alpha')) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; } - if (!GETPOST("description")) { + if (!GETPOST('description', 'alpha')) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Message"))."
\n"; } - if (GETPOST("email") && !isValidEmail(GETPOST("email"))) { + if (GETPOST('email', 'alpha') && !isValidEmail(GETPOST('email', 'alpha'))) { $error++; $langs->load("errors"); - $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; + $errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email', 'alpha'))."
\n"; } // Set default opportunity status $defaultoppstatus = getDolGlobalInt('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD'); @@ -222,21 +222,21 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he if (!$error) { // Search thirdparty and set it if found to the new created project - $result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', GETPOST('email')); + $result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', GETPOST('email', 'alpha')); if ($result > 0) { $proj->socid = $thirdparty->id; } else { // Create the prospect - if (GETPOST('societe')) { - $thirdparty->name = GETPOST('societe'); - $thirdparty->name_alias = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname')); + if (GETPOST('societe', 'alpha')) { + $thirdparty->name = GETPOST('societe', 'alpha'); + $thirdparty->name_alias = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('lastname', 'alpha')); } else { - $thirdparty->name = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname')); + $thirdparty->name = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('lastname', 'alpha')); } - $thirdparty->email = GETPOST('email'); - $thirdparty->address = GETPOST('address'); - $thirdparty->zip = GETPOST('zip'); - $thirdparty->town = GETPOST('town'); + $thirdparty->email = GETPOST('email', 'alpha'); + $thirdparty->address = GETPOST('address', 'alpha'); + $thirdparty->zip = GETPOST('zip', 'int'); + $thirdparty->town = GETPOST('town', 'alpha'); $thirdparty->country_id = GETPOSTINT('country_id'); $thirdparty->state_id = GETPOSTINT('state_id'); $thirdparty->client = $thirdparty::PROSPECT; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index d673e501d30..40955b2f77c 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -207,7 +207,7 @@ class Dolresource extends CommonObject $sql .= ") VALUES ("; $sql .= getEntity('resource') . ", "; foreach ($new_resource_values as $value) { - $sql .= " " . ((isset($value) && $value > 0) ? "'" . $this->db->escape($value) . "'" : 'NULL') . ","; + $sql .= " " . (!empty($value) ? "'" . $this->db->escape($value) . "'" : 'NULL') . ","; } $sql .= " '" . $this->db->idate($this->date_creation) . "',"; $sql .= " " . (!empty($user->id) ? ((int) $user->id) : "null"); From 78fde76f617fb6e6129aa0bc598cd355a26e3fbe Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 16 Nov 2024 17:59:26 +0100 Subject: [PATCH 078/700] Qual: Fix some phan notices (#31948) --- dev/tools/phan/baseline.txt | 16 +++++----------- htdocs/compta/cashcontrol/cashcontrol_card.php | 5 ++++- htdocs/compta/charges/index.php | 6 +++--- htdocs/compta/deplacement/stats/index.php | 1 + htdocs/compta/facture/agenda-rec.php | 17 +++++++++-------- htdocs/compta/facture/contact.php | 5 +++-- htdocs/compta/facture/invoicetemplate_list.php | 2 +- htdocs/compta/facture/list.php | 14 +++++++++----- 8 files changed, 35 insertions(+), 31 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 85e1a4e33c7..a9d07010f51 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -10,9 +10,9 @@ return [ // # Issue statistics: // PhanUndeclaredProperty : 560+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 500+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 490+ occurrences // PhanUndeclaredGlobalVariable : 350+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 270+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 260+ occurrences // PhanPluginUnknownArrayMethodReturnType : 180+ occurrences // PhanTypeMismatchProperty : 140+ occurrences // PhanPluginUnknownPropertyType : 130+ occurrences @@ -21,7 +21,7 @@ return [ // PhanPluginUndeclaredVariableIsset : 65+ occurrences // PhanRedefineFunction : 45+ occurrences // PhanTypeExpectedObjectPropAccess : 45+ occurrences - // PhanTypeMismatchArgumentNullableInternal : 45+ occurrences + // PhanTypeMismatchArgumentNullableInternal : 40+ occurrences // PhanTypeInvalidDimOffset : 35+ occurrences // PhanPluginEmptyStatementIf : 30+ occurrences // PhanTypeMismatchDimFetch : 30+ occurrences @@ -108,19 +108,13 @@ return [ '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', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/compta/cashcontrol/cashcontrol_list.php' => ['PhanTypeMismatchProperty'], - 'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/deplacement/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginEmptyStatementIf'], 'htdocs/compta/facture/card.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/facture/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/facture/invoicetemplate_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/note.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/prelevement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/facture/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -599,7 +593,7 @@ return [ 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/paymentmodes.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], - 'htdocs/societe/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/societe/price.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/website.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition'], diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 89675f57f08..66dc032dd2a 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -280,6 +280,9 @@ $theoricalnbofinvoiceforterminal = array(); llxHeader('', $langs->trans("CashControl")); +$terminalid = ''; +$terminaltouse = ''; + if ($action == "create" || $action == "start" || $action == 'close') { if ($action == 'close') { $posmodule = $object->posmodule; @@ -305,7 +308,7 @@ if ($action == "create" || $action == "start" || $action == 'close') { } } - if (isset($terminalid) && $terminalid != '') { + if (isset($terminalid) && $terminalid != '' && isset($posmodule)) { // Calculate $initialbalanceforterminal for terminal 0 foreach ($arrayofpaymentmode as $key => $val) { if ($key != 'cash') { diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 9299b55c2cb..76dde4ff08b 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -166,7 +166,7 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) { $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= ")"; } - if (preg_match('/^cs\./', $sortfield) || preg_match('/^c\./', $sortfield) || preg_match('/^pc\./', $sortfield) || preg_match('/^pct\./', $sortfield)) { + if (preg_match('/^(cs?|pct?)\./', (string) $sortfield)) { $sql .= $db->order($sortfield, $sortorder); } //$sql.= $db->plimit($limit+1,$offset); @@ -310,7 +310,7 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) { // so we are compatible when period is not mandatory $sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'"; } - if (preg_match('/^pv\./', $sortfield) || preg_match('/^ptva\./', $sortfield)) { + if (preg_match('/^(pv|ptva)\./', (string) $sortfield)) { $sql .= $db->order($sortfield, $sortorder); } @@ -465,7 +465,7 @@ while ($j < $numlt) { // so we are compatible when period is not mandatory $sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'"; } - if (preg_match('/^pv/', $sortfield)) { + if (preg_match('/^pv/', (string) $sortfield)) { $sql .= $db->order($sortfield, $sortorder); } diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index d2f0ef05647..79f3f16c9d8 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -176,6 +176,7 @@ if (!$mesg) { $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); $filename_avg = ''; +$fileurl_avg = ''; if (!$user->hasRight('societe', 'client', 'voir')) { $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') { diff --git a/htdocs/compta/facture/agenda-rec.php b/htdocs/compta/facture/agenda-rec.php index 5ae579f5a82..6cdbed1196e 100644 --- a/htdocs/compta/facture/agenda-rec.php +++ b/htdocs/compta/facture/agenda-rec.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * 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 @@ -227,15 +228,15 @@ if ($object->id > 0) { //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; //$morehtmlstatus .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); - if (isModEnabled('agenda')) { - /* - if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { - $morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); - } else { - $morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); - } - */ + //if (isModEnabled('agenda')) { + /* + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { + $morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + } else { + $morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); } + */ + //} if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 65aff00aa88..bd9486e2b97 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -6,6 +6,7 @@ * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2023 Christian Foellmann * Copyright (C) 2024 Frédéric France + * 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 @@ -63,7 +64,7 @@ if ($user->socid) { $object = new Facture($db); // Load object if ($id > 0 || !empty($ref)) { - $ret = $object->fetch($id, $ref, '', '', (getDolGlobalString('INVOICE_USE_SITUATION') ? $conf->global->INVOICE_USE_SITUATION : 0)); + $ret = $object->fetch($id, $ref, '', 0, (getDolGlobalString('INVOICE_USE_SITUATION') ? $conf->global->INVOICE_USE_SITUATION : 0)); } // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('invoicecontactcard', 'globalcard')); @@ -77,7 +78,7 @@ $usercancreate = $user->hasRight("facture", "creer"); * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index cf8faf85f15..c3a18a0aa26 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -927,7 +927,7 @@ while ($i < $imaxinloop) { // Payment term if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { print '
'."\n"; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index dfc15d484b0..992fea6556d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -570,6 +570,8 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement')) $result_sql = $db->query($rsql); if ($result_sql) { $numprlv = $db->num_rows($result_sql); + } else { + $numprlv = 0; } if ($numprlv > 0) { @@ -633,9 +635,11 @@ if ($socid > 0) { if (empty($search_company)) { $search_company = $soc->name; } +} else { + $soc = null; } -$title = $langs->trans('BillsCustomers').' '.($socid > 0 ? ' - '.$soc->name : ''); +$title = $langs->trans('BillsCustomers').' '.(($socid > 0 && $soc !== null) ? ' - '.$soc->name : ''); $help_url = 'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; @@ -1341,7 +1345,7 @@ if (isModEnabled('category') && $user->hasRight("categorie", "lire") && ($user-> include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('IncludingProductWithTag'); - $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); + $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 0, 0, 1); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1); $moreforfilter .= '
'; } @@ -1509,7 +1513,7 @@ if (!empty($arrayfields['state.nom']['checked'])) { // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; } // Company type @@ -2051,10 +2055,10 @@ if ($num > 0) { $multicurrency_remaintopay = 0; } if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consumed - $remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id); + $remaincreditnote = $discount->getAvailableDiscounts($companystatic, null, 'rc.fk_facture_source='.$facturestatic->id); $remaintopay = -$remaincreditnote; $totalallpayments = price2num($facturestatic->total_ttc - $remaintopay); - $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1); + $multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic, null, 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1); $multicurrency_remaintopay = -$multicurrency_remaincreditnote; $multicurrency_totalpay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay); } From 3c3a1193a58ab35b47901bd0a306ec738a66d285 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Nov 2024 18:08:53 +0100 Subject: [PATCH 079/700] Fix conf->global --- htdocs/compta/facture/class/facture.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 24b2fac72c6..0b6eacce4f3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -361,15 +361,15 @@ class Facture extends CommonInvoice 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 210), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 215), 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 225), - 'situation_cycle_ref' => array('type' => 'smallint(6)', 'label' => 'Situation cycle ref', 'enabled' => '$conf->global->INVOICE_USE_SITUATION', 'visible' => -1, 'position' => 230), - 'situation_counter' => array('type' => 'smallint(6)', 'label' => 'Situation counter', 'enabled' => '$conf->global->INVOICE_USE_SITUATION', 'visible' => -1, 'position' => 235), - 'situation_final' => array('type' => 'smallint(6)', 'label' => 'Situation final', 'enabled' => 'empty($conf->global->INVOICE_USE_SITUATION) ? 0 : 1', 'visible' => -1, 'position' => 240), - 'retained_warranty' => array('type' => 'double', 'label' => 'Retained warranty', 'enabled' => '$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible' => -1, 'position' => 245), - 'retained_warranty_date_limit' => array('type' => 'date', 'label' => 'Retained warranty date limit', 'enabled' => '$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible' => -1, 'position' => 250), - 'retained_warranty_fk_cond_reglement' => array('type' => 'integer', 'label' => 'Retained warranty fk cond reglement', 'enabled' => '$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible' => -1, 'position' => 255), - 'fk_incoterms' => array('type' => 'integer', 'label' => 'IncotermCode', 'enabled' => '$conf->incoterm->enabled', 'visible' => -1, 'position' => 260), - 'location_incoterms' => array('type' => 'varchar(255)', 'label' => 'IncotermLabel', 'enabled' => '$conf->incoterm->enabled', 'visible' => -1, 'position' => 265), - 'date_pointoftax' => array('type' => 'date', 'label' => 'DatePointOfTax', 'enabled' => '$conf->global->INVOICE_POINTOFTAX_DATE', 'visible' => -1, 'position' => 270), + 'situation_cycle_ref' => array('type' => 'smallint(6)', 'label' => 'Situation cycle ref', 'enabled' => 'getDolGlobalInt("INVOICE_USE_SITUATION")', 'visible' => -1, 'position' => 230), + 'situation_counter' => array('type' => 'smallint(6)', 'label' => 'Situation counter', 'enabled' => 'getDolGlobalInt("INVOICE_USE_SITUATION")', 'visible' => -1, 'position' => 235), + 'situation_final' => array('type' => 'smallint(6)', 'label' => 'Situation final', 'enabled' => 'getDolGlobalInt("INVOICE_USE_SITUATION")', 'visible' => -1, 'position' => 240), + 'retained_warranty' => array('type' => 'double', 'label' => 'Retained warranty', 'enabled' => 'getDolGlobalString("INVOICE_USE_RETAINED_WARRANTY")', 'visible' => -1, 'position' => 245), + 'retained_warranty_date_limit' => array('type' => 'date', 'label' => 'Retained warranty date limit', 'enabled' => 'getDolGlobalString("INVOICE_USE_RETAINED_WARRANTY")', 'visible' => -1, 'position' => 250), + 'retained_warranty_fk_cond_reglement' => array('type' => 'integer', 'label' => 'Retained warranty fk cond reglement', 'enabled' => 'getDolGlobalString("INVOICE_USE_RETAINED_WARRANTY")', 'visible' => -1, 'position' => 255), + 'fk_incoterms' => array('type' => 'integer', 'label' => 'IncotermCode', 'enabled' => 'isModEnabled("incoterm")', 'visible' => -1, 'position' => 260), + 'location_incoterms' => array('type' => 'varchar(255)', 'label' => 'IncotermLabel', 'enabled' => 'isModEnabled("incoterm")', 'visible' => -1, 'position' => 265), + 'date_pointoftax' => array('type' => 'date', 'label' => 'DatePointOfTax', 'enabled' => 'isModEnabled("INVOICE_POINTOFTAX_DATE")', 'visible' => -1, 'position' => 270), 'fk_multicurrency' => array('type' => 'integer', 'label' => 'MulticurrencyID', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 275), 'multicurrency_code' => array('type' => 'varchar(255)', 'label' => 'Currency', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 280), 'multicurrency_tx' => array('type' => 'double(24,8)', 'label' => 'CurrencyRate', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 285, 'isameasure' => 1), From f51935a25895a70652f4bd408ce7a5bfeb17acde Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sat, 16 Nov 2024 18:10:08 +0100 Subject: [PATCH 080/700] Fix slow user card when many users in same group, disable loading of all other users (#31947) --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 50002e10a25..edb98825159 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1940,7 +1940,7 @@ if ($action == 'create' || $action == 'adduserldap') $exclude = array(); $usergroup = new UserGroup($db); - $groupslist = $usergroup->listGroupsForUser($object->id); + $groupslist = $usergroup->listGroupsForUser($object->id, false); if (!empty($groupslist)) { From a602309e04572e30cb95f9001cd159978c0b69b1 Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sat, 16 Nov 2024 18:19:59 +0100 Subject: [PATCH 081/700] Fix user::load_previous_next_ref() with MULTICOMPANY_TRANSVERSE_MODE bad sql query (cartesian product replaced by INNER JOIN) (#31946) --- htdocs/core/class/commonobject.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ee4a56eaa9c..0332a29c0ce 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1891,7 +1891,9 @@ abstract class CommonObject $sql = "SELECT MAX(te.".$fieldid.")"; $sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te"; if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { - $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; + if (empty($user->admin) || !empty($user->entity) || $conf->entity != 1) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON ug.fk_user=te.rowid"; + } } if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) { $tmparray = explode('@', $this->ismultientitymanaged); @@ -1916,7 +1918,6 @@ abstract class CommonObject if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) { $sql .= " AND te.entity IS NOT NULL"; // Show all users } else { - $sql .= " AND ug.fk_user = te.rowid"; $sql .= " AND ug.entity IN (".getEntity($this->element).")"; } } else { @@ -1944,7 +1945,9 @@ abstract class CommonObject $sql = "SELECT MIN(te.".$fieldid.")"; $sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te"; if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { - $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; + if (empty($user->admin) || !empty($user->entity) || $conf->entity != 1) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON ug.fk_user=te.rowid"; + } } if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) { $tmparray = explode('@', $this->ismultientitymanaged); @@ -1969,7 +1972,6 @@ abstract class CommonObject if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) { $sql .= " AND te.entity IS NOT NULL"; // Show all users } else { - $sql .= " AND ug.fk_user = te.rowid"; $sql .= " AND ug.entity IN (".getEntity($this->element).")"; } } else { From 8d580eaa5fdbce468a2dc65f0758a07748f6a417 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Nov 2024 18:39:54 +0100 Subject: [PATCH 082/700] Fix travis --- 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 0b6eacce4f3..d649b49108f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -369,7 +369,7 @@ class Facture extends CommonInvoice 'retained_warranty_fk_cond_reglement' => array('type' => 'integer', 'label' => 'Retained warranty fk cond reglement', 'enabled' => 'getDolGlobalString("INVOICE_USE_RETAINED_WARRANTY")', 'visible' => -1, 'position' => 255), 'fk_incoterms' => array('type' => 'integer', 'label' => 'IncotermCode', 'enabled' => 'isModEnabled("incoterm")', 'visible' => -1, 'position' => 260), 'location_incoterms' => array('type' => 'varchar(255)', 'label' => 'IncotermLabel', 'enabled' => 'isModEnabled("incoterm")', 'visible' => -1, 'position' => 265), - 'date_pointoftax' => array('type' => 'date', 'label' => 'DatePointOfTax', 'enabled' => 'isModEnabled("INVOICE_POINTOFTAX_DATE")', 'visible' => -1, 'position' => 270), + 'date_pointoftax' => array('type' => 'date', 'label' => 'DatePointOfTax', 'enabled' => 'getDolGlobalString("INVOICE_POINTOFTAX_DATE")', 'visible' => -1, 'position' => 270), 'fk_multicurrency' => array('type' => 'integer', 'label' => 'MulticurrencyID', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 275), 'multicurrency_code' => array('type' => 'varchar(255)', 'label' => 'Currency', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 280), 'multicurrency_tx' => array('type' => 'double(24,8)', 'label' => 'CurrencyRate', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 285, 'isameasure' => 1), From 830d0bebeb3298c5d5009768a18d68cf3da641d6 Mon Sep 17 00:00:00 2001 From: evarisk-kilyan Date: Sat, 16 Nov 2024 18:43:21 +0100 Subject: [PATCH 083/700] fix: replace isModEnabled with getDolGlobalString (#31955) Co-authored-by: Laurent Destailleur From 5aab1417144757351e1d424fb0da079dc0cb3c68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Nov 2024 18:48:08 +0100 Subject: [PATCH 084/700] Clean code --- htdocs/core/boxes/box_last_modified_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index f5c5c6b49d3..d10a3db50fd 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -58,7 +58,7 @@ class box_last_modified_ticket extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs; + global $user, $langs; $this->max = $max; From a811e061ca78ef9e1cac744fcc62eb6d7f4564cf Mon Sep 17 00:00:00 2001 From: evarisk-kilyan Date: Sat, 16 Nov 2024 18:58:24 +0100 Subject: [PATCH 085/700] fix: fatal on install step-5 (#31954) Co-authored-by: Laurent Destailleur --- htdocs/core/modules/DolibarrModules.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 57c2eb780f0..2eaef0842e9 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1606,6 +1606,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // phpcs:enable include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; include_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php'; + include_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; global $conf, $user; From 48f0f55b7c8b2bfd1a715793588302139f0b7f00 Mon Sep 17 00:00:00 2001 From: omogenot Date: Sat, 16 Nov 2024 20:13:40 +0100 Subject: [PATCH 086/700] NEW: Allow multiple extrafields deletion (#31956) * Allow multiple extrafields deletion If no element type parameter is given to the delete_label function, all occurences of the same extra field name are deleted at once. This simplifies the de-installation of a module that would have created multiple extra fields accros several element types. * Update extrafields.class.php Remove empty line whitespace --- htdocs/core/class/extrafields.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 65dfd9a94f8..1712b3aca53 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -619,7 +619,9 @@ class ExtraFields $sql = "DELETE FROM ".$this->db->prefix()."extrafields"; $sql .= " WHERE name = '".$this->db->escape($attrname)."'"; $sql .= " AND entity IN (0,".$conf->entity.')'; - $sql .= " AND elementtype = '".$this->db->escape($elementtype)."'"; + if (!empty($elementtype)) { + $sql .= " AND elementtype = '".$this->db->escape($elementtype)."'"; + } dol_syslog(get_class($this)."::delete_label", LOG_DEBUG); $resql = $this->db->query($sql); From 8642e77110023bb00b54a9c1b96aa35d2859aa79 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 16 Nov 2024 20:48:09 +0100 Subject: [PATCH 087/700] Accountancy personalized reports - Prepare menu (#31932) * Accountancy personalized reports - Prepare menu * Indent --- htdocs/core/menus/standard/eldy.lib.php | 37 +++++++++++++++++++++++-- htdocs/langs/en_US/accountancy.lang | 2 ++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b0c55fd6364..8bfe214c523 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1702,7 +1702,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_product', 110); $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_closure', 120); if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $newmenu->add("/accountancy/admin/report_list.php?id=32&search_country_id=" . $mysoc->country_id . "&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingReport"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 125); + $newmenu->add("/accountancy/admin/report_list.php?id=32&search_country_id=" . $mysoc->country_id . "&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingReport"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_report', 125); } $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 130); } @@ -1844,7 +1844,40 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + global $mysoc; + + // Multi personalized reports + $sql = "SELECT rowid, code, label"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_report"; + $sql .= " WHERE entity = ".((int) $conf->entity); + $sql .= " AND fk_country = ".((int) $mysoc->country_id); + $sql .= " AND active = 1"; + $sql .= " ORDER BY label DESC"; + + $resql = $db->query($sql); + if ($resql) { + $numr = $db->num_rows($resql); + $i = 0; + + if ($numr > 0) { + while ($i < $numr) { + $objp = $db->fetch_object($resql); + $newmenu->add('/compta/resultat/result.php?mainmenu=accountancy&leftmenu=accountancy_report&id_report='.$objp->rowid, $langs->trans("Personalized") . " - " . $objp->label, 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $i++; + } + } else { + // Should not happen. Entries are added + $newmenu->add('', $langs->trans("NoReportDefined"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + } + } else { + dol_print_error($db); + } + $db->free($resql); + } else { + $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + } } $modecompta = 'CREANCES-DETTES'; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 8233f08c9dd..c4e8cfb2e9f 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -229,6 +229,8 @@ AccountingAccountGroupsDesc=You can define here some groups of accounting accoun ByAccounts=By accounts ByPredefinedAccountGroups=By predefined groups ByPersonalizedAccountGroups=By personalized groups +Personalized=Personalized +NoReportDefined=No personalized reports defined NotMatch=Not Set DeleteMvt=Delete some lines from accounting DelMonth=Month to delete From 73171867e0e7b55b90b8404b42f7c372539639a1 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 16 Nov 2024 20:58:09 +0100 Subject: [PATCH 088/700] Accountancy personalized reports - Prepare report page (#31935) --- .../class/accountancycategory.class.php | 4 +++- htdocs/compta/resultat/result.php | 14 +++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 0bf41cf2e42..d71dc306478 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -775,10 +775,11 @@ class AccountancyCategory // extends CommonObject * * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups * @param int $active 1= active, 0=not active + * @param int $id_report id of the report * @return never|array|int Array of groups or -1 if error * @see getCatsCpts(), getCptsCat() */ - public function getCats($categorytype = -1, $active = 1) + public function getCats($categorytype = -1, $active = 1, $id_report = 1) { global $conf, $mysoc; @@ -790,6 +791,7 @@ class AccountancyCategory // extends CommonObject $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens"; $sql .= " FROM ".$this->db->prefix().$this->table_element." as c"; $sql .= " WHERE c.active = " . (int) $active; + $sql .= " AND c.fk_report=".((int) $id_report); $sql .= " AND c.entity = ".$conf->entity; if ($categorytype >= 0) { $sql .= " AND c.category_type = 1"; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 5d20a92b03d..a021c95cfab 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyreport.class.php'; /** * @var Conf $conf @@ -45,6 +46,8 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php // Load translation files required by the page $langs->loadLangs(array('compta', 'bills', 'donation', 'salaries', 'accountancy')); +$id_report = GETPOSTINT('id_report'); + $error = 0; $mesg = ''; @@ -238,7 +241,12 @@ if ($modecompta == "CREANCES-DETTES") { $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "BOOKKEEPING") { - $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPersonalizedAccountGroups"); + $accountingreportstatic = new AccountancyReport($db); + $accountingreportstatic->fetch($id_report); + $reportLabel = ''; + $reportLabel = $accountingreportstatic->label; + + $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPersonalizedAccountGroups").' '.$reportLabel; $calcmode = $langs->trans("CalcModeBookkeeping"); //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; @@ -292,8 +300,8 @@ if ($modecompta == 'CREANCES-DETTES') { // $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; } elseif ($modecompta == "BOOKKEEPING") { // Get array of all report groups that are active - $cats = $AccCat->getCats(); // WARNING: Computed groups must be after group they include - $unactive_cats = $AccCat->getCats(-1, 0); + $cats = $AccCat->getCats(-1, 1, $id_report); // WARNING: Computed groups must be after group they include + $unactive_cats = $AccCat->getCats(-1, 0, $id_report); /* $sql = 'SELECT DISTINCT t.numero_compte as nb FROM '.MAIN_DB_PREFIX.'accounting_bookkeeping as t, '.MAIN_DB_PREFIX.'accounting_account as aa'; From a6266ce664a644e556365b9854ff462ebd437a53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Nov 2024 22:22:49 +0100 Subject: [PATCH 089/700] Try to discard a false positive of phpstan --- phpstan.neon.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 5d7e7bd30f1..ba219466cea 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -51,6 +51,7 @@ parameters: treatPhpDocTypesAsCertain: false ignoreErrors: - '#.*phan-var#' + - '#Right side of && is always true#' internalErrorsCountLimit: 50 cache: # nodesByFileCountMax: 512 From ab9c7f9a31483e169c19d17c75b7f376849ca946 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Nov 2024 22:31:40 +0100 Subject: [PATCH 090/700] Try to exclude phpstan false positive --- phpstan.neon.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index ba219466cea..e469fffd923 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -51,6 +51,7 @@ parameters: treatPhpDocTypesAsCertain: false ignoreErrors: - '#.*phan-var#' + - '#is always true#' - '#Right side of && is always true#' internalErrorsCountLimit: 50 cache: From f4899904420d19a21ef4b532692dbd8527effd30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Nov 2024 22:42:21 +0100 Subject: [PATCH 091/700] Try to solve false positive of 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 fcd41ac896b..d6085a40913 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -36294,12 +36294,6 @@ parameters: count: 1 path: ../../htdocs/webhook/target_card.php - - - message: '#^Right side of && is always true\.$#' - identifier: booleanAnd.rightAlwaysTrue - count: 6 - path: ../../htdocs/webhook/target_card.php - - message: '#^Variable \$permissiontoadd in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable From e866f90b122180f6e7b8a22de4bfdac347b733d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Nov 2024 22:51:35 +0100 Subject: [PATCH 092/700] Compatible php 8.3 --- htdocs/install/check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 0ea1ec87528..76cdc282233 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -108,7 +108,7 @@ if (empty($force_install_nophpinfo)) { print "
\n"; // Check PHP version max -$arrayphpmaxversionwarning = array(8, 2, 0); +$arrayphpmaxversionwarning = array(8, 3, 0); if (versioncompare(versionphparray(), $arrayphpmaxversionwarning) > 0 && versioncompare(versionphparray(), $arrayphpmaxversionwarning) < 3) { // Maximum to use (warning if higher) print 'Error '.$langs->trans("ErrorPHPVersionTooHigh", versiontostring($arrayphpmaxversionwarning)); $checksok = 1; // 0=error, 1=warning From cbdda5d1a8efd4b3bbf7f867b5b070ed028f8074 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Nov 2024 23:23:14 +0100 Subject: [PATCH 093/700] Fix the automatic nb of list --- htdocs/core/class/conf.class.php | 7 +++++-- htdocs/main.inc.php | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index a86f0551bab..02e4d63e5f0 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -951,11 +951,14 @@ class Conf extends stdClass } // conf->liste_limit = constant to limit size of lists + // This value can be overwritten by user choice in main.inc.php $this->liste_limit = getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT', 15); if ((int) $this->liste_limit <= 0) { - // Mode automatic. + // Mode automatic. Similar code than into main.inc.php $this->liste_limit = 15; - if (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 910) { + if (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 700) { + $this->liste_limit = 8; + } elseif (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 910) { $this->liste_limit = 10; } elseif (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] > 1130) { $this->liste_limit = 20; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 24cb4211074..53cdffdb145 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1405,9 +1405,11 @@ if (!defined('NOLOGIN')) { $conf->liste_limit = getDolUserInt('MAIN_SIZE_LISTE_LIMIT'); // Can be 0 } if ((int) $conf->liste_limit <= 0) { - // Mode automatic. + // Mode automatic. Similar code than into conf.class.php $conf->liste_limit = 15; - if (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 910) { + if (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 700) { + $conf->liste_limit = 8; + } elseif (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 910) { $conf->liste_limit = 10; } elseif (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] > 1130) { $conf->liste_limit = 20; From a960be440bf7d88de3246cb0577f7841d354143d Mon Sep 17 00:00:00 2001 From: noec764 <58433943+noec764@users.noreply.github.com> Date: Sun, 17 Nov 2024 00:06:33 +0100 Subject: [PATCH 094/700] FIX: All contacts were loaded even if no thirdparty was selected (#31877) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FIX: All contact were loaded even if no thirdparty selected * Update card.php --------- Co-authored-by: Noé Co-authored-by: Laurent Destailleur --- htdocs/comm/action/card.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 2b004f0ff10..3076f3d4854 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -2067,7 +2067,27 @@ if ($id > 0) { // related contact print '
'; print ''; From 860e1b779fcfb44728d27a0813fc90d6612b3406 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 17 Nov 2024 01:09:56 +0100 Subject: [PATCH 095/700] Fix vCard output #31958 (#31959) Fix #31958 - avoid messing up ENCODIGN & add CHARSET Workaround by limiting the too generic replacement for social networks. Add CHARSET for proper decoding. --- htdocs/core/class/vcard.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 9e68c6669c5..d447c0b7010 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -2,6 +2,7 @@ /* Copyright (C) Kai Blankenhorn * Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2020 Tobias Sekan + * 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 @@ -100,7 +101,7 @@ class vCard /** * @var string encoding */ - public $encoding = "ENCODING=QUOTED-PRINTABLE"; + public $encoding = "CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE"; /** @@ -163,7 +164,7 @@ class vCard public function setName($family = "", $first = "", $additional = "", $prefix = "", $suffix = "") { //$this->properties["N;".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); - $this->properties["N"] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); + $this->properties["N;".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); $this->filename = "$first%20$family.vcf"; if (empty($this->properties["FN"])) { $this->setFormattedName(trim("$prefix $first $additional $family $suffix")); @@ -211,7 +212,7 @@ class vCard $this->properties[$key] = encode($postoffice).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country); //if ($this->properties["LABEL;".$type.";".$this->encoding] == '') { - //$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type); + //$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type); //} } @@ -362,7 +363,7 @@ class vCard $text .= "VERSION:4.0\r\n"; // With V4, all encoding are UTF-8 //$text.= "VERSION:2.1\r\n"; foreach ($this->properties as $key => $value) { - $newkey = preg_replace('/-.*$/', '', $key); // remove suffix -twitter, -facebook, ... + $newkey = preg_replace('/(? Date: Sun, 17 Nov 2024 01:16:29 +0100 Subject: [PATCH 096/700] Fix phpstan --- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index fa4b09bd26f..6ce3e174457 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -1190,7 +1190,7 @@ class MyObject extends CommonObject * Return validation test result for a field. * Need MAIN_ACTIVATE_VALIDATION_RESULT to be called. * - * @param array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> $fields Array of properties of field to show + * @param array|string,position:int,notnull?:int,visible:int<-2,5>|string,noteditable?:int<0,1>,default?:int<0,1>|string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,2>,disabled?:int<0,1>,arrayofkeyval?:array,comment?:string,validate?:int<0,1>}> $fields Array of properties of field to show * @param string $fieldKey Key of attribute * @param string $fieldValue value of attribute * @return bool Return false if fail, true on success, set $this->error for error message From ceaeabb115307aa1dbc2958a20221bc079b789a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2024 01:27:33 +0100 Subject: [PATCH 097/700] FIX #22539 #31900 --- htdocs/core/lib/pdf.lib.php | 12 ++++++------ .../modules/commande/doc/pdf_eratosthene.modules.php | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 1fdc37aa211..566c3707443 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2647,10 +2647,9 @@ function pdf_getLinkedObjects(&$object, $outputlangs) */ function pdf_getSizeForImage($realpath) { - global $conf; - $maxwidth = getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20); $maxheight = getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT', 32); + include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; $tmp = dol_getImageSize($realpath); $width = 0; @@ -2674,17 +2673,18 @@ function pdf_getSizeForImage($realpath) * @param int $i Current line number * @param Translate $outputlangs Object langs for output * @param int<0,2> $hidedetails Hide details (0=no, 1=yes, 2=just special lines) - * @return float|string Return total of line excl tax + * @return int|float|string Return total of line excl tax */ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0) { - global $conf, $hookmanager; + global $hookmanager; $sign = 1; if (isset($object->type) && $object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) { $sign = -1; } if ($object->lines[$i]->special_code == 3) { + // If option return $outputlangs->transnoentities("Option"); } else { if (is_object($hookmanager)) { @@ -2704,7 +2704,7 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = if ($hookmanager->executeHooks('getlinetotalremise', $parameters, $object, $action) > 0) { // Note that $action and $object may have been modified by some hooks if (isset($hookmanager->resArray['linetotalremise'])) { - return $hookmanager->resArray['linetotalremise']; + return (float) $hookmanager->resArray['linetotalremise']; } else { return (float) $hookmanager->resPrint; // For backward compatibility } @@ -2712,7 +2712,7 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = } if (empty($hidedetails) || $hidedetails > 1) { - return $sign * (($object->lines[$i]->subprice * (float) $object->lines[$i]->qty) - $object->lines[$i]->total_ht); + return (float) price2num($sign * (($object->lines[$i]->subprice * (float) $object->lines[$i]->qty) - $object->lines[$i]->total_ht), 'MT', 1); } } return 0; diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 4cef49bc129..9a371ccb0a2 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1158,6 +1158,8 @@ class pdf_eratosthene extends ModelePDFCommandes $total_line_remise += -$line->total_ht; } } + $total_line_remise = (float) price2num($total_line_remise, 'MT', 1); + if ($total_line_remise > 0) { $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + $tab2_hl); From 6485d02de286d24e5b84dc617e7a805e17e50d8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2024 01:40:32 +0100 Subject: [PATCH 098/700] Fix missing migration in v20 --- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) 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 1a052915748..b823e23f6f8 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 @@ -47,6 +47,8 @@ ALTER TABLE llx_c_holiday_types ADD UNIQUE INDEX uk_c_holiday_types (entity, cod ALTER TABLE llx_hrm_evaluation MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL; +-- Add ref_ext to asset_model to use various CommonOjbect methods +ALTER TABLE llx_asset_model ADD COLUMN ref_ext varchar(255) AFTER ref; -- V21 migration From da70b46647671c3ba3f483e089ee5a1cb0507c42 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Sun, 17 Nov 2024 01:43:43 +0100 Subject: [PATCH 099/700] FIX: asset: missing ref_ext field used in CommonObject::isExistingObject() (#31870) --- htdocs/asset/class/assetmodel.class.php | 1 + htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 4 ++++ htdocs/install/mysql/tables/llx_asset_model-asset.sql | 1 + 3 files changed, 6 insertions(+) diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index 0e457761f9d..208e90efa50 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -94,6 +94,7 @@ class AssetModel extends CommonObject public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1), + 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'position' => 25, 'notnull' => 0, 'visible' => 0), 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2', 'validate' => 1,), 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetTypeIntangible', '1' => 'AssetTypeTangible', '2' => 'AssetTypeInProgress', '3' => 'AssetTypeFinancial'), 'validate' => 1,), 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 300, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 65901dcd91e..b2397e2069c 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -420,3 +420,7 @@ UPDATE llx_c_units SET short_label = 'mn' WHERE short_label = 'i' AND code = 'MI ALTER TABLE llx_c_holiday_types DROP INDEX uk_c_holiday_types; ALTER TABLE llx_c_holiday_types ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; ALTER TABLE llx_c_holiday_types ADD UNIQUE INDEX uk_c_holiday_types (entity, code); + + +-- Add ref_ext to asset_model to use various CommonOjbect methods +ALTER TABLE llx_asset_model ADD COLUMN ref_ext varchar(255) AFTER ref; diff --git a/htdocs/install/mysql/tables/llx_asset_model-asset.sql b/htdocs/install/mysql/tables/llx_asset_model-asset.sql index 8c285515986..9a264204e58 100644 --- a/htdocs/install/mysql/tables/llx_asset_model-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_model-asset.sql @@ -25,6 +25,7 @@ CREATE TABLE llx_asset_model( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id ref varchar(128) NOT NULL, + ref_ext varchar(255), label varchar(255) NOT NULL, asset_type smallint NOT NULL, fk_pays integer DEFAULT 0, From fc565e6b76b0e497bc311fa207d34fb2f67e73cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2024 02:03:13 +0100 Subject: [PATCH 100/700] Look and feel v21 --- htdocs/user/param_ihm.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index abcc5511bdb..df2897a86cf 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -92,6 +92,7 @@ $searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$lan $form = new Form($db); $formadmin = new FormAdmin($db); + /* * Actions */ @@ -379,9 +380,9 @@ if ($action == 'edit') { // Language by default print ''; print ''; print ''; $mainsizelistelimit = getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT'); - print ''; + print ''; print ''; print ''; - // Max size of lists + // Max size of short lists print ''; print ''; print ''; print ''; print ''; print ''; $mainsizelistelimit = getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT'); - print ''; + print ''; print ''; print ''; - // Max size for lists + // Max size for short lists print ''; print ''; print ''; From 63011d3029cc242ef8e43b0658a629a89c7134d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2024 02:15:53 +0100 Subject: [PATCH 101/700] Debug v21 --- htdocs/hrm/skill_tab.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index 1c8d60d0d62..c933765fdef 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -611,15 +611,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $sql .= " WHERE e.rowid = ed.fk_evaluation"; $sql .= " AND s.rowid = ed.fk_skill"; $sql .= " AND e.fk_user = ".((int) $id); - $sql .= " AND e.status > 0"; + $resql = $db->query($sql); $num = $db->num_rows($resql); //num of evaluations for each user - $sqlEval = "SELECT rowid FROM ".MAIN_DB_PREFIX."hrm_evaluation as e"; + $sqlEval = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."hrm_evaluation as e"; $sqlEval .= " WHERE e.fk_user = ".((int) $id); $rslt = $db->query($sqlEval); - $numEval = $db->num_rows($rslt); + $tmpobj = $db->fetch_object($rslt); + $numEval = 0; + if ($tmpobj) { + $numEval = $tmpobj->nb; + } $page = 0; print_barre_liste($langs->trans("Evaluations"), $page, $_SERVER["PHP_SELF"], '', '', '', '', $numEval, $numEval, $evaltmp->picto, 0); @@ -646,6 +650,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $objects[$i] = $obj; $i++; } + //grouped skills by evaluation $resultArray = getGroupedEval($objects); foreach ($resultArray as $object) { @@ -673,12 +678,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $evaltmp->getLibStatut(2); print ''; print ''; From b2bad15a046d13594efd463fcf10fe899e2eb736 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2024 02:25:37 +0100 Subject: [PATCH 102/700] CSS --- htdocs/contact/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index f6aedacb6bf..e4831263aff 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1600,7 +1600,7 @@ while ($i < $imaxinloop) { // EMail if (!empty($arrayfields['p.email']['checked'])) { - print ''; print ''; print ''; print ''; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 1bf6c6f207f..eb867663795 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -640,10 +640,11 @@ function ajax_event($htmlname, $events) * @param string $mode Add parameter &mode= to the href link (Used for href link) * @param string $morecss More CSS * @param int $userconst 1=OnOff for user constant of user $userconst + * @param string $showwarning String to show a warning when enabled the option * @return string * @see ajax_object_onoff() to update the status of an object */ -function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = 'inline-block', $userconst = 0) +function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = 'inline-block', $userconst = 0, $showwarning = '') { global $conf, $langs, $user; @@ -672,9 +673,13 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof var yesButton = \''.dol_escape_js($langs->transnoentities("Yes")).'\'; var noButton = \''.dol_escape_js($langs->transnoentities("No")).'\'; var token = \''.currentToken().'\'; + var warning = \''.dol_escape_js($showwarning).'\'; // Set constant $("#set_" + code).click(function() { + if (warning) { + alert(warning); + } if (input.alert && input.alert.set) { if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton; if (input.alert.set.noButton) noButton = input.alert.set.noButton; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 238d6185f15..4bbbf0ec069 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2593,4 +2593,5 @@ 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. 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 \ No newline at end of file +PdfAddTermOfSaleHelp=Upload the condition of sales from file input at the bottom of this setup page +WarningOnlineSignature=Please note that this function allows a user (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. From a746c6aab0525550e9a93903e7c890bd5d9b2631 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2024 13:20:55 +0100 Subject: [PATCH 109/700] Show a legal warning when enabling online signature --- htdocs/admin/bank.php | 18 ++++++++---------- htdocs/admin/contract.php | 18 +++++++++++------- htdocs/admin/expedition.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 9ce6cbdf83e..b8d13476e4e 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -499,13 +499,13 @@ print load_fiche_titre($langs->trans("Other"), '', ''); print '
'; print '
'; - $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none'); + $form->form_conditions_reglement(0, $objp->fk_cond_reglement, 'none'); print ''; - print $form->select_country($search_country, 'search_country', '', 0, 'minwidth150imp maxwidth150', 'code2', 1, 0, 1, null, 1); + print $form->select_country($search_country, 'search_country', '', 0, 'minwidth150imp maxwidth150', 'code2', 1, 0, 1, array(), 1); print '
'.$langs->trans("ActionOnContact").''; print '
'; - print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(!getDolGlobalString('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT') ? $object->socid : 0, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'minwidth300 widthcentpercentminusx', false, 0, 0, array(), 'multiple', 'contactid'); + + $searchSocid = ($object->socid > 0) ? $object->socid : (getDolGlobalString('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT') ? 0 : -1); + + print img_picto('', 'contact', 'class="paddingrightonly"'); + print $form->selectcontacts( + $searchSocid, + array_keys($object->socpeopleassigned), + 'socpeopleassigned[]', + 1, + '', + '', + 1, + 'minwidth300 widthcentpercentminusx', + false, + 0, + 0, + array(), + 'multiple', + 'contactid' + ); + print '
'; print '
'.$langs->trans("Language").''; - $s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); + $s = picto_from_langcode(getDolGlobalString('MAIN_LANG_DEFAULT')); print $s ? $s.' ' : ''; - print(getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT'))); + print(getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $form->textwithpicto($langs->trans("Automatic"), $langs->trans("AutoDetectLang")) : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT'))); print 'conf->MAIN_LANG_DEFAULT) ? " checked" : ""); print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo @@ -426,13 +427,13 @@ if ($action == 'edit') { // Max size of lists print '
'.$langs->trans("MaxSizeList").''.($mainsizelistelimit > 0 ? getDolGlobalString('MAIN_SIZE_LISTE_LIMIT') : ''.$langs->trans("Automatic").'').''.($mainsizelistelimit > 0 ? getDolGlobalString('MAIN_SIZE_LISTE_LIMIT') : ''.$langs->trans("Automatic").'').'conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : ""); print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo print '>
'.$langs->trans("MaxSizeShortList").'' . getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT').'conf->MAIN_SIZE_SHORTLIST_LIMIT) ? " checked" : ""); @@ -501,9 +502,9 @@ if ($action == 'edit') { // Language print '
'.$langs->trans("Language").''; - $s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); + $s = picto_from_langcode(getDolGlobalString('MAIN_LANG_DEFAULT')); print($s ? $s.' ' : ''); - print(getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT'))); + print(getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $form->textwithpicto($langs->trans("Automatic"), $langs->trans("AutoDetectLang")) : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT'))); print 'conf->MAIN_LANG_DEFAULT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").''; @@ -568,11 +569,11 @@ if ($action == 'edit') { // Max size for lists print '
'.$langs->trans("MaxSizeList").''.($mainsizelistelimit > 0 ? getDolGlobalString('MAIN_SIZE_LISTE_LIMIT') : ''.$langs->trans("Automatic").'').''.($mainsizelistelimit > 0 ? getDolGlobalString('MAIN_SIZE_LISTE_LIMIT') : ''.$langs->trans("Automatic").'').'conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").''.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT : ' ').'
'.$langs->trans("MaxSizeShortList").''.getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT', ' ').'conf->MAIN_SIZE_SHORTLIST_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").''; - - if (!is_array($object)) { - print $object->result; - } else { - foreach ($object as $skill) { - print $skill->result; + if ($job->status == $job::STATUS_VALIDATED) { + if (!is_array($object)) { + print $object->result; + } else { + foreach ($object as $skill) { + print $skill->result; + } } } print ''; + print ''; if ($contextpage == 'poslist') { print $obj->email; } else { @@ -1640,7 +1640,7 @@ while ($i < $imaxinloop) { // Company / Third Party if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; if ($obj->socid) { $objsoc = new Societe($db); $objsoc->fetch($obj->socid); From 7ca9f0022aeee2939955f48452ac212f86a903a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2024 10:31:11 +0100 Subject: [PATCH 103/700] Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 18.0 --- htdocs/commande/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7128688a7cc..7002ba580eb 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -871,17 +871,17 @@ if (empty($reshook)) { // Set unit price to use if (!empty($price_ht) || $price_ht === '0') { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + $pu_ht = (float) price2num($price_ht, 'MU'); + $pu_ttc = (float) price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } elseif (!empty($price_ttc) || $price_ttc === '0') { - $pu_ttc = price2num($price_ttc, 'MU'); - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $pu_ttc = (float) price2num($price_ttc, 'MU'); + $pu_ht = (float) price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } elseif ($tmpvat != $tmpprodvat) { // Is this still used ? if ($price_base_type != 'HT') { - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $pu_ht = (float) price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } else { - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + $pu_ttc = (float) price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } From 72fda5eeb38ac11e81b015387e23c3bc40eaf569 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2024 14:13:51 +0100 Subject: [PATCH 104/700] Debug v21 --- htdocs/core/modules/hrm/mod_evaluation_advanced.php | 4 ++-- htdocs/recruitment/admin/setup.php | 7 +++---- .../recruitment/mod_recruitmentcandidature_advanced.php | 4 ++-- .../recruitment/mod_recruitmentjobposition_advanced.php | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/hrm/mod_evaluation_advanced.php b/htdocs/core/modules/hrm/mod_evaluation_advanced.php index 9482b998962..de221e52fee 100644 --- a/htdocs/core/modules/hrm/mod_evaluation_advanced.php +++ b/htdocs/core/modules/hrm/mod_evaluation_advanced.php @@ -71,7 +71,7 @@ class mod_evaluation_advanced extends ModeleNumRefEvaluation $texte .= ''; $texte .= ''; $texte .= ''; - $texte .= ''; + $texte .= '
'; $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Evaluation"), $langs->transnoentities("Evaluation")); $tooltip .= $langs->trans("GenericMaskCodes2"); @@ -84,7 +84,7 @@ class mod_evaluation_advanced extends ModeleNumRefEvaluation $texte .= ''; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index b641c23432d..d2bf9e12306 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -229,7 +229,7 @@ if ($action == 'edit') { } else { if (!empty($arrayofparameters)) { print '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).'   
'; - print ''; + print ''; foreach ($arrayofparameters as $key => $val) { $setupnotempty++; @@ -251,9 +251,7 @@ if ($action == 'edit') { foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectArray['includerefgeneration']) { - /* - * Orders Numbering model - */ + // Numbering models $setupnotempty++; print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', ''); @@ -278,6 +276,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { while (($file = readdir($handle)) !== false) { if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') { $file = substr($file, 0, dol_strlen($file) - 4); + print ''."\n"; require_once $dir.'/'.$file.'.php'; $module = new $file($db); diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php index 95503767c91..e5feff9f403 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php @@ -22,7 +22,7 @@ */ /** - * \file htdocs/core/modules/recruitment/mod_recruitmentcandidaturen_advanced.php + * \file htdocs/core/modules/recruitment/mod_recruitmentcandidature_advanced.php * \ingroup recruitment * \brief File containing class for advanced numbering model of RecruitmentCandidature */ @@ -84,7 +84,7 @@ class mod_recruitmentcandidature_advanced extends ModeleNumRefRecruitmentCandida $texte .= ''; $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 28b5b161c5b..e7d6b1d918c 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php @@ -84,7 +84,7 @@ class mod_recruitmentjobposition_advanced extends ModeleNumRefRecruitmentJobPosi $texte .= ''; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; From 7d5e6e9f729b499e547e9385f179c7367618315e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2024 15:04:00 +0100 Subject: [PATCH 105/700] FIX PHP 7.0 compatibility --- .../vendor/illuminate/collections/Traits/EnumeratesValues.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/webklex/php-imap/vendor/illuminate/collections/Traits/EnumeratesValues.php b/htdocs/includes/webklex/php-imap/vendor/illuminate/collections/Traits/EnumeratesValues.php index 269d1a66656..7d6d4e70100 100644 --- a/htdocs/includes/webklex/php-imap/vendor/illuminate/collections/Traits/EnumeratesValues.php +++ b/htdocs/includes/webklex/php-imap/vendor/illuminate/collections/Traits/EnumeratesValues.php @@ -736,7 +736,7 @@ trait EnumeratesValues function ($carry, $pipe) { return $pipe($carry); }, - $this, + $this ); } From 07bd12717a404e9b0ea12b2caff734a2944d2593 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2024 12:15:47 +0100 Subject: [PATCH 106/700] Fix look and feel v21 --- htdocs/admin/propal.php | 28 +++------- htdocs/admin/tools/ui/content/tables.php | 70 +++++++++++++++++++----- 2 files changed, 63 insertions(+), 35 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 09ddd0877ae..2a0a8cdfcde 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -718,35 +718,21 @@ print '
'; - -/* - * Directory - */ -print '
'; -print load_fiche_titre($langs->trans("PathToDocuments"), '', ''); - -print "
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").'
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).'   
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).'   
\n"; -print "\n"; -print " \n"; -print " \n"; -print "\n"; -print "\n \n \n\n"; print "
".$langs->trans("Name")."".$langs->trans("Value")."
".$langs->trans("PathDirectory")."".$conf->propal->multidir_output[$conf->entity]."
\n
"; +print '

'; + + /* - * Notifications + * Other */ -print load_fiche_titre($langs->trans("Notifications"), '', ''); print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; -print '\n \n \n\n"; + +print '\n"; diff --git a/htdocs/admin/tools/ui/content/tables.php b/htdocs/admin/tools/ui/content/tables.php index a39ac89d44b..00fd9bbf666 100644 --- a/htdocs/admin/tools/ui/content/tables.php +++ b/htdocs/admin/tools/ui/content/tables.php @@ -62,7 +62,7 @@ $documentation->showSidebar(); ?>

trans('DocTableTitle'); ?>

-

trans('DocTableMainDescription'); ?>

+

trans('Description'); ?>

showSummary(); ?> @@ -70,37 +70,37 @@ $documentation->showSidebar(); ?>
-

trans('DocTableBasic'); ?>

+

Table with a title line

trans('DocTableBasicDescription'); ?>

-
'.$langs->trans("Parameter").' 
'; +print "
".$langs->trans("PathToDocuments")."".$conf->propal->multidir_output[$conf->entity]."
'; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; print '
'; print "
+
- + - + - + - + @@ -115,15 +115,15 @@ $documentation->showSidebar(); ?> echo $documentation->showCode($lines); ?> - +
-

trans('DocTableWithFilters'); ?>

+

Table with a filter line and title line

trans('DocTableWithFiltersDescription'); ?>

-
First Name Last Name Age Country
John Doe 37 U.S.A
Jack Sparrow 29 Caribbean
Sacha Ketchum 16 Kanto
Albert Einstein 72
+
@@ -136,25 +136,25 @@ $documentation->showSidebar(); ?> - + - + - + - + @@ -170,6 +170,48 @@ $documentation->showSidebar(); ?> + +
+ +

Table with no filter, no title line

+ +

trans('Description'); ?>

+
+
+
Age Country
John Doe 37 U.S.A
Jack Sparrow 29 Caribbean
Sacha Ketchum 16 Kanto
Albert Einstein 72
+ + + + + + + + + + + + + + + + + + + + + + + + +
JohnDoe37U.S.A
JackSparrow29Caribbean
SachaKetchum16Kanto
AlbertEinstein72Germany
+ + + showCode($lines); ?> + + From e06bf7c145db2a02c7ac45946c4dc63089399047 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2024 12:19:17 +0100 Subject: [PATCH 107/700] Clean code --- htdocs/admin/tools/ui/class/documentation.class.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/admin/tools/ui/class/documentation.class.php b/htdocs/admin/tools/ui/class/documentation.class.php index f7f00b5dc52..584f6c36a7f 100644 --- a/htdocs/admin/tools/ui/class/documentation.class.php +++ b/htdocs/admin/tools/ui/class/documentation.class.php @@ -26,7 +26,6 @@ */ class Documentation { - /** * Views * @@ -206,7 +205,7 @@ class Documentation */ public function docFooter() { - global $conf, $langs; + global $langs; // DIV FOR SCROLL ANIMATION print '
'; @@ -320,9 +319,6 @@ class Documentation */ public function showSummary($showsubmenu = 1, $showsubmenu_summary = 1) { - - global $langs; - $i = 0; if (!empty($this->view)) : // On se place au bon niveau From d9d97c4eb386cf361b830a1af078b1469f721a75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2024 12:52:49 +0100 Subject: [PATCH 108/700] Add a lega linformation on online signature --- htdocs/admin/propal.php | 2 +- htdocs/core/lib/ajax.lib.php | 7 ++++++- htdocs/langs/en_US/admin.lang | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 2a0a8cdfcde..5b68c10a838 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -677,7 +677,7 @@ print '
'.$langs->trans("AllowOnLineSign").''; -print ajax_constantonoff('PROPOSAL_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1); +print ajax_constantonoff('PROPOSAL_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1, '', '', 'inline-block', 0, $langs->trans("WarningOnlineSignature")); print '
'."\n"; print ''."\n"; -print ''; -print ''; -print '\n"; +print ''; +print "\n"; print "\n"; +// Disable direct input print ''; -print ''; +print ''; if (getDolGlobalString('BANK_DISABLE_DIRECT_INPUT')) { print ''; -print ''; // Active @@ -539,10 +538,9 @@ print "\n"; // Allow SEPA Mandate OnLine Sign if (!getDolGlobalInt('SOCIETE_DISABLE_BANKACCOUNT')) { print ''; - print ''; - print ''; + print ''; print ''; } diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index d850d5f6eb3..f60f8cb8d44 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -540,14 +540,18 @@ print ''; print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index f18c2c4b7bd..45c74c98523 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -487,7 +487,7 @@ print ''; print ''; print ''; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Parameter").'
'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").''.$langs->trans("BANK_DISABLE_DIRECT_INPUT").''; print img_picto($langs->trans("Activated"), 'switch_on'); @@ -517,9 +517,8 @@ if (getDolGlobalString('BANK_DISABLE_DIRECT_INPUT')) { } print '
'; -print $langs->trans('AccountStatement'); -print "\n"; +// Autofill bank statement +print '
'."\n"; print $langs->trans('AutoReportLastAccountStatement'); print '
'.$langs->trans("AllowOnLineSign").''.$langs->trans("AllowOnLineSignDesc").''.$form->textwithpicto($langs->trans("AllowOnLineSign"), $langs->trans("AllowOnLineSignDesc")).''; - print ajax_constantonoff('SOCIETE_RIB_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1); + print ajax_constantonoff('SOCIETE_RIB_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1, '', '', 'inline-block', 0, $langs->trans("WarningOnlineSignature")); print '
'.$langs->trans("AllowOnlineSign").''; -if (getDolGlobalString('CONTRACT_ALLOW_ONLINESIGN')) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('CONTRACT_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1, '', '', 'inline-block', 0, $langs->trans("WarningOnlineSignature")); } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; + if (getDolGlobalString('CONTRACT_ALLOW_ONLINESIGN')) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; + } } print '
'.$langs->trans("AllowOnLineSign"); print ''; -print ajax_constantonoff('EXPEDITION_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1); +print ajax_constantonoff('EXPEDITION_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1, '', '', 'inline-block', 0, $langs->trans("WarningOnlineSignature")); print '
'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4bbbf0ec069..9648aa4f2e1 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2594,4 +2594,4 @@ FilesIntegrityDesc=If you want to check the integrity of files instead of databa 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. 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 user (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. +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. From 1486dea1c2c6ba1e25d3fd31ae2e0dc6bc5f2d2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2024 13:35:04 +0100 Subject: [PATCH 110/700] Debug v21 --- htdocs/core/actions_setmoduleoptions.inc.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index fd622c1017f..3d1725e4a46 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -129,13 +129,19 @@ if ($action == 'setModuleOptions' && !empty($user->admin)) { foreach ($_POST as $key => $val) { $reg = array(); if (preg_match('/^param(\d*)$/', $key, $reg)) { // Works for POST['param'], POST['param1'], POST['param2'], ... - $param = GETPOST("param".$reg[1], 'alpha'); + $param = GETPOST("param".$reg[1], 'aZ09'); $value = GETPOST("value".$reg[1], 'alpha'); if ($param) { $res = dolibarr_set_const($db, $param, $value, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } + + // Case we modify the list of directories for ODT templases, we want to be sure directory exists + if (preg_match('/_ADDON_PDF_ODT_PATH$/', $param) && preg_match('/^DOL_DATA_ROOT/', $value)) { + $tmpdir = preg_replace('/^DOL_DATA_ROOT/', DOL_DATA_ROOT, $value); + dol_mkdir($tmpdir, DOL_DATA_ROOT); + } } } } From 2d08d89d55f18ef264e293b7e239896a7a46f914 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2024 13:58:29 +0100 Subject: [PATCH 111/700] Trans --- htdocs/admin/modules.php | 3 ++- htdocs/admin/user.php | 4 +++- htdocs/core/modules/DolibarrModules.class.php | 6 +++--- htdocs/langs/en_US/admin.lang | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 9e91aac4327..6b6faa7d481 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; require_once DOL_DOCUMENT_ROOT.'/admin/remotestore/class/dolistore.class.php'; ' @@ -745,7 +746,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { $moreforfilter = '
'; $moreforfilter .= '