From ceecf89892eb42f1cf6fd0616d357144cf3bc3c5 Mon Sep 17 00:00:00 2001 From: samifilali26 Date: Tue, 19 Dec 2023 18:08:12 +0100 Subject: [PATCH 01/55] add function to check if output is too long to be set in db --- htdocs/cron/class/cronjob.class.php | 33 +++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 5101fcbe1c5..479051647cf 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1268,13 +1268,15 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$errmsg, LOG_ERR); $this->error = $errmsg; - $this->lastoutput = (!empty($object->output) ? $object->output."\n" : "").$errmsg; + if (!empty($object->output) && $this->canSetLastOutput(mb_strlen(trim($object->output."\n".$errmsg)))) $this->lastoutput = $object->output."\n".$errmsg; + else $this->lastoutput = $errmsg; $this->lastresult = is_numeric($result) ? $result : -1; $retval = $this->lastresult; $error++; } else { dol_syslog(get_class($this)."::run_jobs END"); - $this->lastoutput = (!empty($object->output) ? $object->output : ""); + if (!empty($object->output) && $this->canSetLastOutput(mb_strlen(trim($object->output)))) $this->lastoutput = $object->output; + else $this->lastoutput = ""; $this->lastresult = var_export($result, true); $retval = $this->lastresult; } @@ -1518,6 +1520,33 @@ class Cronjob extends CommonObject return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } + + /** + * Check if the lastoutput column can be set for the cronjob table. + * + * @param int $lastoutput_length The length of lastoutput. + * @return bool True if lastoutput can be set, false otherwise. + */ + function canSetLastOutput($lastoutput_length) { + global $dolibarr_main_db_name; + + $sql = "SELECT character_maximum_length + FROM information_schema.columns + WHERE table_name = '".MAIN_DB_PREFIX."cronjob' + AND column_name = 'lastoutput' + AND table_schema = '$dolibarr_main_db_name'"; + $resql = $this->db->query($sql); + + if($resql) { + $row = $this->db->fetch_object($resql); + if($row->character_maximum_length >= $lastoutput_length) return true; + } + else { + dol_syslog($this->db->lasterror(), 'LOG_ERR'); + } + + return false; + } } From 4d6c39ed6e3711689b9bc11a42a299bd820acd2a Mon Sep 17 00:00:00 2001 From: samifilali26 Date: Tue, 19 Dec 2023 18:11:35 +0100 Subject: [PATCH 02/55] update --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 322d1ed9285..f6f6c7ba763 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1323,7 +1323,7 @@ class FactureFournisseurRec extends CommonInvoice } if (!$error && ($facturerec->auto_validate || $forcevalidation)) { $result = $new_fac_fourn->validate($user); - $laststep="Validate by user {$user->id}"; + $laststep="Validate by user {$user}"; if ($result <= 0) { $this->errors = $new_fac_fourn->errors; $this->error = $new_fac_fourn->error; From 292cf02d0c19c7a66d66d52690d269de9fbc4d76 Mon Sep 17 00:00:00 2001 From: samifilali26 Date: Tue, 19 Dec 2023 18:12:16 +0100 Subject: [PATCH 03/55] update --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index f6f6c7ba763..cb455ae5cc9 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1323,7 +1323,7 @@ class FactureFournisseurRec extends CommonInvoice } if (!$error && ($facturerec->auto_validate || $forcevalidation)) { $result = $new_fac_fourn->validate($user); - $laststep="Validate by user {$user}"; + $laststep="Validate by user $user"; if ($result <= 0) { $this->errors = $new_fac_fourn->errors; $this->error = $new_fac_fourn->error; From b5d2fde37ddcdf53c9e96822ac6b58728d3cafce Mon Sep 17 00:00:00 2001 From: samifilali26 Date: Tue, 19 Dec 2023 18:13:19 +0100 Subject: [PATCH 04/55] update --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index cb455ae5cc9..322d1ed9285 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1323,7 +1323,7 @@ class FactureFournisseurRec extends CommonInvoice } if (!$error && ($facturerec->auto_validate || $forcevalidation)) { $result = $new_fac_fourn->validate($user); - $laststep="Validate by user $user"; + $laststep="Validate by user {$user->id}"; if ($result <= 0) { $this->errors = $new_fac_fourn->errors; $this->error = $new_fac_fourn->error; From 7d3c348c686a71b23e0cd9bb5c8716ec81f383bf Mon Sep 17 00:00:00 2001 From: samifilali26 Date: Mon, 8 Jan 2024 10:08:06 +0100 Subject: [PATCH 05/55] update --- htdocs/cron/class/cronjob.class.php | 32 +++-------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 479051647cf..4186c65f4ff 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -187,6 +187,7 @@ class Cronjob extends CommonObject const STATUS_DISABLED = 0; const STATUS_ENABLED = 1; const STATUS_ARCHIVED = 2; + const MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD = 65535; /** @@ -1268,14 +1269,14 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$errmsg, LOG_ERR); $this->error = $errmsg; - if (!empty($object->output) && $this->canSetLastOutput(mb_strlen(trim($object->output."\n".$errmsg)))) $this->lastoutput = $object->output."\n".$errmsg; + if (!empty($object->output) && $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD > mb_strlen(trim($object->output."\n".$errmsg))) $this->lastoutput = $object->output."\n".$errmsg; else $this->lastoutput = $errmsg; $this->lastresult = is_numeric($result) ? $result : -1; $retval = $this->lastresult; $error++; } else { dol_syslog(get_class($this)."::run_jobs END"); - if (!empty($object->output) && $this->canSetLastOutput(mb_strlen(trim($object->output)))) $this->lastoutput = $object->output; + if (!empty($object->output) && $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD > mb_strlen(trim($object->output))) $this->lastoutput = $object->output; else $this->lastoutput = ""; $this->lastresult = var_export($result, true); $retval = $this->lastresult; @@ -1520,33 +1521,6 @@ class Cronjob extends CommonObject return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } - - /** - * Check if the lastoutput column can be set for the cronjob table. - * - * @param int $lastoutput_length The length of lastoutput. - * @return bool True if lastoutput can be set, false otherwise. - */ - function canSetLastOutput($lastoutput_length) { - global $dolibarr_main_db_name; - - $sql = "SELECT character_maximum_length - FROM information_schema.columns - WHERE table_name = '".MAIN_DB_PREFIX."cronjob' - AND column_name = 'lastoutput' - AND table_schema = '$dolibarr_main_db_name'"; - $resql = $this->db->query($sql); - - if($resql) { - $row = $this->db->fetch_object($resql); - if($row->character_maximum_length >= $lastoutput_length) return true; - } - else { - dol_syslog($this->db->lasterror(), 'LOG_ERR'); - } - - return false; - } } From efce6c5aab47d65d23491d60230095c99b3f1acc Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 8 Jan 2024 23:45:26 +0100 Subject: [PATCH 06/55] Fix: fournisseur.commande - add missing argument addline call The call to addline had several missing arguments. Added. --- .../class/fournisseur.commande.class.php | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index fa70a9e0b25..800ef87b319 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1457,8 +1457,12 @@ class CommandeFournisseur extends CommonOrder $line->date_end, $line->array_options, $line->fk_unit, + $line->multicurrency_subprice, // pu_ht_devise + $line->origin, // origin + $line->origin_id, // origin_id + $line->rang, // rang $line->special_code - ); + ); if ($result < 0) { dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); // do not use dol_print_error here as it may be a functionnal error $this->db->rollback(); @@ -1727,31 +1731,31 @@ class CommandeFournisseur extends CommonOrder /** * Add order line * - * @param string $desc Description - * @param float $pu_ht Unit price (used if $price_base_type is 'HT') - * @param float $qty Quantity - * @param float $txtva Taux tva - * @param float $txlocaltax1 Localtax1 tax - * @param float $txlocaltax2 Localtax2 tax - * @param int $fk_product Id product - * @param int $fk_prod_fourn_price Id supplier price - * @param string $ref_supplier Supplier reference price - * @param float $remise_percent Remise - * @param string $price_base_type HT or TTC - * @param float $pu_ttc Unit price TTC (used if $price_base_type is 'TTC') - * @param int $type Type of line (0=product, 1=service) - * @param int $info_bits More information - * @param bool $notrigger Disable triggers - * @param int $date_start Date start of service - * @param int $date_end Date end of service - * @param array $array_options extrafields array - * @param string $fk_unit Code of the unit to use. Null to use the default one - * @param string $pu_ht_devise Amount in currency - * @param string $origin 'order', ... - * @param int $origin_id Id of origin object - * @param int $rang Rank - * @param int $special_code Special code - * @return int <=0 if KO, >0 if OK + * @param string $desc Description + * @param float $pu_ht Unit price (used if $price_base_type is 'HT') + * @param float $qty Quantity + * @param float $txtva VAT Rate + * @param float $txlocaltax1 Localtax1 tax + * @param float $txlocaltax2 Localtax2 tax + * @param int $fk_product Id product + * @param int $fk_prod_fourn_price Id supplier price + * @param string $ref_supplier Supplier reference price + * @param float $remise_percent Remise + * @param string $price_base_type HT or TTC + * @param float $pu_ttc Unit price TTC (used if $price_base_type is 'TTC') + * @param int $type Type of line (0=product, 1=service) + * @param int $info_bits More information + * @param bool $notrigger Disable triggers + * @param int $date_start Date start of service + * @param int $date_end Date end of service + * @param array $array_options extrafields array + * @param string $fk_unit Code of the unit to use. Null to use the default one + * @param string $pu_ht_devise Amount in currency + * @param string $origin 'order', ... + * @param int $origin_id Id of origin object + * @param int $rang Rank + * @param int $special_code Special code + * @return int Return integer <=0 if KO, >0 if OK */ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $fk_prod_fourn_price = 0, $ref_supplier = '', $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $type = 0, $info_bits = 0, $notrigger = false, $date_start = null, $date_end = null, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $origin = '', $origin_id = 0, $rang = -1, $special_code = 0) { @@ -1975,7 +1979,7 @@ class CommandeFournisseur extends CommonOrder // Multicurrency $this->line->fk_multicurrency = $this->fk_multicurrency; $this->line->multicurrency_code = $this->multicurrency_code; - $this->line->multicurrency_subprice = $pu_ht_devise; + $this->line->multicurrency_subprice = $pu_ht_devise; $this->line->multicurrency_total_ht = $multicurrency_total_ht; $this->line->multicurrency_total_tva = $multicurrency_total_tva; $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; From 6d88670eeebdf4d51649ac746115dd17078c80b9 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 9 Jan 2024 00:03:24 +0100 Subject: [PATCH 07/55] Fix: Sitemap generation - fix invalid replacement regex # Fix: Sitemap generation - fix invalid replacement regex The regex is invalid because the delimiters are slashes which are also present in the text to match. Fixed by changing the delimiters. --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 84d408b4f0b..c799e2ce898 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2673,7 +2673,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { // Add the entry Sitemap: into the robot file. $robotcontent = @file_get_contents($filerobot); - $result = preg_replace('/\n/ims', '', $robotcontent); + $result = preg_replace('@\n@ims', '', $robotcontent); if ($result) { $robotcontent = $result; } From 8f7a4800ee7bf05051305647071e7dcc5fc0a066 Mon Sep 17 00:00:00 2001 From: William Mead Date: Tue, 9 Jan 2024 14:49:20 +0100 Subject: [PATCH 08/55] Added notification information on intervention validated confirmation message --- htdocs/fichinter/card.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 349139e69ff..de838f401bf 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1105,6 +1105,12 @@ if ($action == 'create') { $numref = $object->ref; } $text = $langs->trans('ConfirmValidateIntervention', $numref); + if (isModEnabled('notification')) { + require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('FICHINTER_VALIDATE', $object->socid, $object); + } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate', '', 1, 1); } From 5c434e273ea053dc4c302b86ea74fe3c14960040 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Jan 2024 15:25:16 +0100 Subject: [PATCH 09/55] Update index.php --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index c799e2ce898..fad19c82a61 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2673,7 +2673,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { // Add the entry Sitemap: into the robot file. $robotcontent = @file_get_contents($filerobot); - $result = preg_replace('@\n@ims', '', $robotcontent); + $result = preg_replace('/\n/ims', '', $robotcontent); if ($result) { $robotcontent = $result; } From 72210dc19b92c7f8e31da594d35a3cce4dd590ce Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 10 Jan 2024 16:57:10 +0100 Subject: [PATCH 10/55] Fix: discount - add missing db parameter to dol_print_error (#27337) # Fix: discount - add missing db parameter to dol_print_error dol_print_error requires the db instance to be the first parameter --- htdocs/core/class/discount.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 86fb546be9a..b1cf3fb7749 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -581,7 +581,7 @@ class DiscountAbsolute $sql .= " AND f.type = 3"; } else { $this->error = get_class($this)."::getSumDepositsUsed was called with a bad object as a first parameter"; - dol_print_error($this->error); + dol_print_error($this->db, $this->error); return -1; } @@ -622,7 +622,7 @@ class DiscountAbsolute $sql .= " AND f.type IN (".$this->db->sanitize($invoice::TYPE_STANDARD.", ".$invoice::TYPE_CREDIT_NOTE).")"; // Find discount coming from credit note or excess paid } else { $this->error = get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter"; - dol_print_error($this->error); + dol_print_error($this->db, $this->error); return -1; } @@ -660,7 +660,7 @@ class DiscountAbsolute $sql .= " WHERE rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_source = ".((int) $invoice->id); } else { $this->error = get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter"; - dol_print_error($this->error); + dol_print_error($this->db, $this->error); return -1; } From 3e7cf0a463bc6f686d8beacf77663b149538526e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 12 Jan 2024 16:14:15 +0100 Subject: [PATCH 11/55] fix pdf nbpages (#27457) Co-authored-by: Christophe Battarel --- htdocs/core/lib/pdf.lib.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 95fc3b34f89..de788b67583 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1306,10 +1306,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // Show page nb only on iso languages (so default Helvetica font) // if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); - // $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); - // $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); // doesn't works with all fonts - // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell - $pagination = $pdf->PageNo().' / '.$pdf->getNumPages(); + $pagination = $pdf->PageNo().' / '.$pdf->getAliasNbPages(); $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); // } From 4374aa1a205d57b13fc655c8616b8f7a7df936a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Jan 2024 16:31:49 +0100 Subject: [PATCH 12/55] FIX Bad visible status of proposal after reopen --- htdocs/comm/propal/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 205eab09655..8ad14f7f48b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -780,10 +780,14 @@ if (empty($reshook)) { if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) { $db->begin(); - $result = $object->reopen($user, empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)); + $newstatus = (getDolGlobalInt('PROPAL_SKIP_ACCEPT_REFUSE') ? Propal::STATUS_DRAFT : Propal::STATUS_VALIDATED); + $result = $object->reopen($user, $newstatus); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; + } else { + $object->statut = $newstatus; + $object->status = $newstatus; } if (!$error) { From f03eb1f505ab6b8918d90d0ed7d569a8de3d2ce4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Jan 2024 16:47:09 +0100 Subject: [PATCH 13/55] Fix restore old code due to regression on some lang. Add hidden PDF_USE_GETALIASNBPAGE_FOR_TOTAL for the case it bugs --- htdocs/core/lib/pdf.lib.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index de788b67583..9dfae331e51 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1304,11 +1304,16 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } } // Show page nb only on iso languages (so default Helvetica font) - // if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { - $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); - $pagination = $pdf->PageNo().' / '.$pdf->getAliasNbPages(); - $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); - // } + $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); + + if (getDolGlobalString('PDF_USE_GETALIASNBPAGE_FOR_TOTAL')) { + // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell + $pagination = $pdf->PageNo().' / '.$pdf->getAliasNbPages(); // seems to not works with all fonts like ru_UK + } else { + $pagination = $pdf->PageNo().' / '.$pdf->getNumPages(); // seems to always work even with $pdf->Cell. But some users has reported wrong nb (no way to reproduce) + } + + $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); // Show Draft Watermark if (!empty($watermark)) { From 5df2850dca80b77399cd1f7b0600aae2dbcda93e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 12 Jan 2024 16:49:30 +0100 Subject: [PATCH 14/55] FIX Accountancy - Level 3 of binding not working on supplier side (#27462) --- htdocs/accountancy/class/accountingaccount.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 98d58450e7b..d25025f3c76 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2013-2021 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) @@ -865,10 +865,14 @@ class AccountingAccount extends CommonObject // Level 3 (define $code_t): Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding) if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { - if (!empty($buyer->code_compta_product)) { + if ($type == 'customer' && !empty($buyer->code_compta_product)) { $code_t = $buyer->code_compta_product; $suggestedid = $accountingAccount['thirdparty']; $suggestedaccountingaccountfor = 'thirdparty'; + } elseif ($type == 'supplier' && !empty($seller->code_compta_product)) { + $code_t = $seller->code_compta_product; + $suggestedid = $accountingAccount['thirdparty']; + $suggestedaccountingaccountfor = 'thirdparty'; } } From 13ddcb95527d68df15acc195d33bfe88f29f38fd Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Fri, 12 Jan 2024 18:04:00 +0100 Subject: [PATCH 15/55] fix: filter on date lost on sort (#27467) --- htdocs/comm/action/list.php | 48 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 3305b44af46..0b0c8cb496f 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -345,41 +345,41 @@ if ($search_title != '') { if ($search_note != '') { $param .= '&search_note='.urlencode($search_note); } -if (GETPOST('datestartday_dtstart', 'int')) { - $param .= '&datestartday_dtstart='.GETPOST('datestartday_dtstart', 'int'); +if (GETPOST('datestart_dtstartday', 'int')) { + $param .= '&datestart_dtstartday='.GETPOST('datestart_dtstartday', 'int'); } -if (GETPOST('datestartmonth_dtstart', 'int')) { - $param .= '&datestartmonth_dtstart='.GETPOST('datestartmonth_dtstart', 'int'); +if (GETPOST('datestart_dtstartmonth', 'int')) { + $param .= '&datestart_dtstartmonth='.GETPOST('datestart_dtstartmonth', 'int'); } -if (GETPOST('datestartyear_dtstart', 'int')) { - $param .= '&datestartyear_dtstart='.GETPOST('datestartyear_dtstart', 'int'); +if (GETPOST('datestart_dtstartyear', 'int')) { + $param .= '&datestart_dtstartyear='.GETPOST('datestart_dtstartyear', 'int'); } -if (GETPOST('datestartday_dtend', 'int')) { - $param .= '&datestartday_dtend='.GETPOST('datestartday_dtend', 'int'); +if (GETPOST('datestart_dtendday', 'int')) { + $param .= '&datestart_dtendday='.GETPOST('datestart_dtendday', 'int'); } -if (GETPOST('datestartmonth_dtend', 'int')) { - $param .= '&datestartmonth_dtend='.GETPOST('datestartmonth_dtend', 'int'); +if (GETPOST('datestart_dtendmonth', 'int')) { + $param .= '&datestart_dtendmonth='.GETPOST('datestart_dtendmonth', 'int'); } -if (GETPOST('datestartyear_dtend', 'int')) { - $param .= '&datestartyear_dtend='.GETPOST('datestartyear_dtend', 'int'); +if (GETPOST('datestart_dtendyear', 'int')) { + $param .= '&datestart_dtendyear='.GETPOST('datestart_dtendyear', 'int'); } -if (GETPOST('dateendday_dtstart', 'int')) { - $param .= '&dateendday_dtstart='.GETPOST('dateendday_dtstart', 'int'); +if (GETPOST('dateend_dtstartday', 'int')) { + $param .= '&dateend_dtstartday='.GETPOST('dateend_dtstartday', 'int'); } -if (GETPOST('dateendmonth_dtstart', 'int')) { - $param .= '&dateendmonth_dtstart='.GETPOST('dateendmonth_dtstart', 'int'); +if (GETPOST('dateend_dtstartmonth', 'int')) { + $param .= '&dateend_dtstartmonth='.GETPOST('dateend_dtstartmonth', 'int'); } -if (GETPOST('dateendyear_dtstart', 'int')) { - $param .= '&dateendyear_dtstart='.GETPOST('dateendyear_dtstart', 'int'); +if (GETPOST('dateend_dtstartyear', 'int')) { + $param .= '&dateend_dtstartyear='.GETPOST('dateend_dtstartyear', 'int'); } -if (GETPOST('dateendday_dtend', 'int')) { - $param .= '&dateendday_dtend='.GETPOST('dateendday_dtend', 'int'); +if (GETPOST('dateend_dtendday', 'int')) { + $param .= '&dateend_dtendday='.GETPOST('dateend_dtendday', 'int'); } -if (GETPOST('dateendmonth_dtend', 'int')) { - $param .= '&dateendmonth_dtend='.GETPOST('dateendmonth_dtend', 'int'); +if (GETPOST('dateend_dtendmonth', 'int')) { + $param .= '&dateend_dtendmonth='.GETPOST('dateend_dtendmonth', 'int'); } -if (GETPOST('dateendyear_dtend', 'int')) { - $param .= '&dateendyear_dtend='.GETPOST('dateendyear_dtend', 'int'); +if (GETPOST('dateend_dtendyear', 'int')) { + $param .= '&dateend_dtendyear='.GETPOST('dateend_dtendyear', 'int'); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From b053b55e2fec74ccc2fbffae5957163cde1414ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Jan 2024 11:15:17 +0100 Subject: [PATCH 16/55] FIX link to print when there is a search on multiselect fields --- htdocs/main.inc.php | 17 ++++++++++++++--- htdocs/product/stock/stockatdate.php | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2690ad2af84..0895077bc18 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2158,14 +2158,25 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $toprightmenu .= $form->textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2); } - // Link to print main content area + // Link to print main content area (optioncss=print) if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $qs = dol_escape_htmltag($_SERVER["QUERY_STRING"]); if (isset($_POST) && is_array($_POST)) { foreach ($_POST as $key => $value) { - if ($key !== 'action' && $key !== 'password' && !is_array($value)) { - $qs .= '&'.$key.'='.urlencode($value); + if (in_array($key, array('action', 'massaction', 'password'))) { + continue; + } + if (!is_array($value)) { + if ($value !== '') { + $qs .= '&'.$key.'='.urlencode($value); + } + } else { + foreach ($value as $value2) { + if ($value2 !== '') { + $qs .= '&'.$key.'[]='.urlencode($value2); + } + } } } } diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index bfc3b92b2a9..1503e439749 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -427,7 +427,7 @@ if (!empty($search_fk_warehouse)) { } } if ($productid > 0) { - $param .= '&productid='.$productid; + $param .= '&productid='.(int) $productid; } if (GETPOST('dateday', 'int') > 0) { $param .= '&dateday='.GETPOST('dateday', 'int'); From 2de0c09e8ea60d370052f292855ab579cfcaf3ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Jan 2024 15:44:37 +0100 Subject: [PATCH 17/55] Try a better fix for #27477 --- htdocs/core/class/html.form.class.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c9c3e09f634..783f3afef74 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2247,7 +2247,7 @@ class Form * @param int|string $filtertype Filter on product type (''=nofilter, 0=product, 1=service) * @param int $limit Limit on number of returned lines * @param int $price_level Level of price to show - * @param int $status Sell status -1=Return all products, 0=Products not on sell, 1=Products on sell + * @param int $status Sell status: -1=No filter on sell status, 0=Products not on sell, 1=Products on sell * @param int $finished 2=all, 1=finished, 0=raw material * @param string $selected_input_value Value of preselected input text (for use with ajax) * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) @@ -2263,7 +2263,7 @@ class Form * 'warehouseinternal' = count products from warehouses for internal correct/transfer only * @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) * @param string $nooutput No print, return the output into a string - * @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase + * @param int $status_purchase Purchase status: -1=No filter on purchase status, 0=Products not on purchase, 1=Products on purchase * @return void|string */ public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0, $status_purchase = -1) @@ -2638,10 +2638,8 @@ class Form $sql .= " AND p.finished = ".((int) $finished); } elseif ($finished == 1) { $sql .= " AND p.finished = ".((int) $finished); - if ($status >= 0) { - $sql .= " AND p.tosell = ".((int) $status); - } - } elseif ($status >= 0) { + } + if ($status >= 0) { $sql .= " AND p.tosell = ".((int) $status); } if ($status_purchase >= 0) { From 790df062c7e9f215c2a2b97c8fbde4767bc6d2a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= <109105553+comaiteseb@users.noreply.github.com> Date: Mon, 15 Jan 2024 11:24:44 +0100 Subject: [PATCH 18/55] Issue #27529 Check if $value2 is an array. --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0895077bc18..ab78b4bd5f7 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2173,7 +2173,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } } else { foreach ($value as $value2) { - if ($value2 !== '') { + if (($value2 !== '') && (!is_array($value2))) { $qs .= '&'.$key.'[]='.urlencode($value2); } } From 5453f0c628787ecec4319f32c69669fef19a257c Mon Sep 17 00:00:00 2001 From: atm-sami <139965072+atm-sami@users.noreply.github.com> Date: Mon, 15 Jan 2024 12:06:11 +0100 Subject: [PATCH 19/55] Update cronjob.class.php --- htdocs/cron/class/cronjob.class.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 4186c65f4ff..dc2751faff3 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1269,15 +1269,13 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$errmsg, LOG_ERR); $this->error = $errmsg; - if (!empty($object->output) && $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD > mb_strlen(trim($object->output."\n".$errmsg))) $this->lastoutput = $object->output."\n".$errmsg; - else $this->lastoutput = $errmsg; + $this->lastoutput = dol_substr(!empty($object->output) ? $object->output."\n" : "").$errmsg, 0, $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD, 'UTF-8', 1); $this->lastresult = is_numeric($result) ? $result : -1; $retval = $this->lastresult; $error++; } else { dol_syslog(get_class($this)."::run_jobs END"); - if (!empty($object->output) && $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD > mb_strlen(trim($object->output))) $this->lastoutput = $object->output; - else $this->lastoutput = ""; + $this->lastoutput = dol_substr(!empty($object->output) ? $object->output."\n" : "").$errmsg, 0, $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD, 'UTF-8', 1); $this->lastresult = var_export($result, true); $retval = $this->lastresult; } From 6a2d7d152386d34c12a0bbf0e53dabdbff726bf4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jan 2024 14:14:51 +0100 Subject: [PATCH 20/55] Update cronjob.class.php --- htdocs/cron/class/cronjob.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index dc2751faff3..b89d7ea3cb7 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1269,13 +1269,13 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$errmsg, LOG_ERR); $this->error = $errmsg; - $this->lastoutput = dol_substr(!empty($object->output) ? $object->output."\n" : "").$errmsg, 0, $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD, 'UTF-8', 1); + $this->lastoutput = dol_substr((empty($object->output) ? "" : $object->output."\n").$errmsg, 0, $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD, 'UTF-8', 1); $this->lastresult = is_numeric($result) ? $result : -1; $retval = $this->lastresult; $error++; } else { dol_syslog(get_class($this)."::run_jobs END"); - $this->lastoutput = dol_substr(!empty($object->output) ? $object->output."\n" : "").$errmsg, 0, $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD, 'UTF-8', 1); + $this->lastoutput = dol_substr((empty($object->output) ? "" : $object->output."\n").$errmsg, 0, $this::MAXIMUM_LENGTH_FOR_LASTOUTPUT_FIELD, 'UTF-8', 1); $this->lastresult = var_export($result, true); $retval = $this->lastresult; } From d4fd234b7589f14b65185dbc6e42e96a606d3dc1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 15 Jan 2024 15:11:27 +0100 Subject: [PATCH 21/55] FIX missing entity filter for check if period exists --- htdocs/expensereport/class/expensereport.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 9a1866247eb..8af62d14736 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2340,10 +2340,13 @@ class ExpenseReport extends CommonObject */ public function periode_existe($fuser, $date_debut, $date_fin) { + global $conf; + // phpcs:enable $sql = "SELECT rowid, date_debut, date_fin"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " WHERE fk_user_author = ".((int) $fuser->id); + $sql .= " WHERE entity = ".((int) $conf->entity); // not shared, only for the current entity + $sql .= " AND fk_user_author = ".((int) $fuser->id); dol_syslog(get_class($this)."::periode_existe sql=".$sql); $result = $this->db->query($sql); From 5a04b2393df0f549f57fca0d957c21291685e627 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Mon, 15 Jan 2024 18:43:17 +0100 Subject: [PATCH 22/55] end fix #10417 : custom payment number for supplier invoices --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 066027aa24a..4c20f648932 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -973,7 +973,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if (!is_object($objsoc)) { $valueforccc = $objsoc; - } elseif ($table == "commande_fournisseur" || $table == "facture_fourn") { + } elseif ($table == "commande_fournisseur" || $table == "facture_fourn" || $table == "paiementfourn") { $valueforccc = dol_string_unaccent($objsoc->code_fournisseur); } else { $valueforccc = dol_string_unaccent($objsoc->code_client); From 82bc2e2d7192886c964862cdd206d657523c5d70 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Mon, 15 Jan 2024 21:22:59 +0100 Subject: [PATCH 23/55] phpstan Property ProductCombination2ValuePair::$fk_prod_attr (int) does not accept string. Property ProductCombination2ValuePair::$fk_prod_attr_val (int) does not accept string. --- htdocs/variants/combinations.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index ee667ea4c49..a7850bd660b 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -175,8 +175,8 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( $sanit_features[$explode[0]] = $explode[1]; $tmp = new ProductCombination2ValuePair($db); - $tmp->fk_prod_attr = $explode[0]; - $tmp->fk_prod_attr_val = $explode[1]; + $tmp->fk_prod_attr = (int) $explode[0]; + $tmp->fk_prod_attr_val = (int) $explode[1]; $productCombination2ValuePairs1[] = $tmp; } From 85c055e9973e4759b9c59b17ac25b3dc631a0b41 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Jan 2024 13:33:18 +0100 Subject: [PATCH 24/55] FIX format of color in manifest is wrong when using a custom color --- htdocs/theme/eldy/manifest.json.php | 12 ++++++++++-- htdocs/theme/md/manifest.json.php | 10 ++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index 1fe54edfd63..9efcd8e6165 100644 --- a/htdocs/theme/eldy/manifest.json.php +++ b/htdocs/theme/eldy/manifest.json.php @@ -77,8 +77,16 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { $manifest->short_name = $manifest->name; -$manifest->theme_color = empty($conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR) ? getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', '#F05F40') : $conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR; -$manifest->background_color = empty($conf->global->MAIN_MANIFEST_APPLI_BG_COLOR) ? "#ffffff" : $conf->global->MAIN_MANIFEST_APPLI_BG_COLOR; +$manifest->theme_color = getDolGlobalString('MAIN_MANIFEST_APPLI_THEME_COLOR', getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', '#F05F40')); +if (!preg_match('/#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]$/', $manifest->theme_color)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $manifest->theme_color = '#'.colorArrayToHex(colorStringToArray($manifest->theme_color)); +} +$manifest->background_color = getDolGlobalString('MAIN_MANIFEST_APPLI_BG_COLOR', "#ffffff"); +if (!preg_match('/#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]$/', $manifest->background_color)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $manifest->background_color = '#'.colorArrayToHex(colorStringToArray($manifest->background_color)); +} $manifest->display = "standalone"; $manifest->splash_pages = null; $manifest->icons = array(); diff --git a/htdocs/theme/md/manifest.json.php b/htdocs/theme/md/manifest.json.php index 887fb2f9564..3e78f0bb9e8 100644 --- a/htdocs/theme/md/manifest.json.php +++ b/htdocs/theme/md/manifest.json.php @@ -75,6 +75,16 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { } $manifest->short_name = $manifest->name; +$manifest->theme_color = getDolGlobalString('MAIN_MANIFEST_APPLI_THEME_COLOR', getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', '#F05F40')); +if (!preg_match('/#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]$/', $manifest->theme_color)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $manifest->theme_color = '#'.colorArrayToHex(colorStringToArray($manifest->theme_color)); +} +$manifest->background_color = getDolGlobalString('MAIN_MANIFEST_APPLI_BG_COLOR', "#ffffff"); +if (!preg_match('/#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]$/', $manifest->background_color)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $manifest->background_color = '#'.colorArrayToHex(colorStringToArray($manifest->background_color)); +} $manifest->theme_color = empty($conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR) ? getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', '#F05F40') : $conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR; $manifest->background_color = empty($conf->global->MAIN_MANIFEST_APPLI_BG_COLOR) ? "#ffffff" : $conf->global->MAIN_MANIFEST_APPLI_BG_COLOR; $manifest->display = "standalone"; From 4f4c4272594d28755d971d36c1bd8c38db00a5e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Jan 2024 14:37:33 +0100 Subject: [PATCH 25/55] Move comment --- htdocs/core/js/lib_head.js.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 96f2fe24274..20f1d81846b 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1334,6 +1334,9 @@ jQuery(document).ready(function() { }); +global->MAIN_DISABLE_SELECT2_FOCUS_PROTECTION) && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) { + ?> /* * Hacky fix for a bug in select2 with jQuery 3.6.0's new nested-focus "protection" * see: https://github.com/select2/select2/issues/5993 @@ -1342,9 +1345,6 @@ jQuery(document).ready(function() { * TODO: Recheck with the select2 GH issue and remove once this is fixed on their side */ -global->MAIN_DISABLE_SELECT2_FOCUS_PROTECTION) && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) { - ?> $(document).on('select2:open', (e) => { console.log("Execute the focus (click on combo or use space when on component"); const target = $(e.target); From 83dc5273890af2bcfd0c9bebf9ac757daae7f85e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Jan 2024 14:45:05 +0100 Subject: [PATCH 26/55] Doc --- htdocs/core/js/lib_head.js.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 20f1d81846b..c33cb7eb748 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1338,13 +1338,13 @@ jQuery(document).ready(function() { if (empty($conf->global->MAIN_DISABLE_SELECT2_FOCUS_PROTECTION) && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) { ?> /* - * Hacky fix for a bug in select2 with jQuery 3.6.0's new nested-focus "protection" + * Hacky fix for a bug in select2 with jQuery 3.6.4's new nested-focus "protection" + * This fix needs to click a second time when clicking into a combo with ajax (see Test4d and Test5a in test_forms.php * see: https://github.com/select2/select2/issues/5993 * see: https://github.com/jquery/jquery/issues/4382 * * TODO: Recheck with the select2 GH issue and remove once this is fixed on their side */ - $(document).on('select2:open', (e) => { console.log("Execute the focus (click on combo or use space when on component"); const target = $(e.target); From 16c30d5ef9e308c4322d906c5a4e4b015ae2293d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 17 Jan 2024 20:55:01 +0100 Subject: [PATCH 27/55] fix: exchange bad translation --- htdocs/compta/resultat/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 8a5c2855fac..6a1fd134562 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -189,12 +189,12 @@ if (isModEnabled('accounting')) { $calcmode .= ''; $calcmode .= '
'; } -$calcmode .= '