Commit graph

148192 commits

Author SHA1 Message Date
Zakaria Boushaba
d0810e11e3
FIX: Fix mandatory field validation for select (empty '-1') and textarea (CKEDITOR not defined) (#39458)
Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
2026-08-11 19:46:22 +02:00
w3houde
6a647097bd
Fix #39355 load images.lib.php before image_format_supported in API (#39462)
The POST /documents endpoint with generateThumbs=1 called
image_format_supported() after requiring only files.lib.php, but that
function is defined in images.lib.php, which was never included on this
path. The call raised a fatal error and the request returned a bare
HTTP 500 with no JSON body. Add the missing require_once.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-08-11 19:41:49 +02:00
Frédéric FRANCE
61b3bc52b8
fix stock_alerte may be empty (null) (#38484)
* fix stock_alerte may be empty (null)

* Update product.php
2026-08-11 02:00:55 +02:00
Laurent Destailleur
d5dde5a7b2 Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 22.0 2026-08-05 23:24:47 +02:00
Florian Hödl
f5907fe212
FIX Missing bottom margin on dropdown action buttons in md theme (#39388)
In theme md, the rule in btn.inc.php that gives action buttons their
bottom margin only lists direct children of div.tabsAction and children
of div.divButAction. Dropdown action buttons are not in that list.

dolGetButtonAction() renders a dropdown button as
<div class="dropdown inline-block dropdown-holder"><a class="dropdown-toggle ... butAction">,
so the anchor is a grandchild of div.tabsAction and matches none of the
existing selectors. It therefore gets no bottom margin.

When the action bar wraps onto more than one line and a line is made of
dropdown buttons, the rows have no vertical spacing at all and the
buttons visually touch each other.

Theme eldy already fixes this with the same selector
(div.tabsAction > .dropdown > .dropdown-toggle in theme/eldy/btn.inc.php);
theme md was never aligned. This adds the identical selector to md.

Measured with the compiled md stylesheet, six dropdown buttons wrapping
onto two rows: gap between rows 0px before, 22px after, which matches
the 1.4em the plain buttons already get. Layout of rows that mix plain
and dropdown buttons is unchanged.

Signed-off-by: Florian Hödl <florian@hoedl.co>
Co-authored-by: Florian Hödl <florian@hoedl.co>
2026-08-05 10:27:59 +02:00
Florian Hödl
72ecff38e4
FIX Missing include of ActionComm in doAutoRenewContracts (#39387)
Contrat::doAutoRenewContracts() instantiates ActionComm to log the
RENEW_CONTRACT event, but contrat.class.php never loads
comm/action/class/actioncomm.class.php.

From a web request the class is usually already loaded by some other
include, so the problem stays hidden. When the method is run as a
scheduled job it is not: scripts/cron/cron_run_jobs.php loads only
master.inc.php, functionscli.lib.php, cronjob.class.php and
user.class.php, and cronjob.class.php then loads only the job class
itself via dol_include_once($this->classesname). ActionComm is not part
of that include closure, so the method fails with
"Class ActionComm not found".

The fatal error happens after the UPDATE on llx_contratdet has been
issued but before $this->db->commit(), so the transaction is never
committed and the renewal is lost. The job also aborts, so every
remaining contract line in the loop is left unprocessed and the failure
is only visible as a fatal error in the log.

Verified on 23.0.3: after the cron bootstrap, class_exists('Contrat')
is true while class_exists('ActionComm') is false. Adding the include
next to the existing html.formmail.class.php include makes it true.

Signed-off-by: Florian Hödl <florian@hoedl.co>
Co-authored-by: Florian Hödl <florian@hoedl.co>
2026-08-05 10:18:26 +02:00
TowyTowy
9d10392d66
FIX isValidTinForES() rejects almost every Spanish NIE starting with T (#39384)
The "Check NIE T" branch compared the control character of the TIN to the
return value of preg_match() instead of using preg_match() as the condition:

    if ($num[8] == preg_match('/^[T]{1}[A-Z0-9]{8}$/', $str)) {

Since execution only reaches that branch when the string already matched the
format, preg_match() always returns 1, so the test collapsed to
$num[8] == 1. A NIE of type T therefore validated only when its last
character was literally "1", and every other one was reported as -3
(invalid control key). Out of the 36 possible control characters, 35 were
wrongly rejected.

A NIE starting with T has no control key algorithm, so matching the
documented syntax is the only check to perform.

Also fill in and enable the testIsValidTinForES() unit test that was left
commented out with empty input strings.

Co-authored-by: Claude <noreply@anthropic.com>
2026-08-04 22:48:15 +02:00
kkhelifa-opendsi
6dfc8de4b5
FIX: Show error when clone order fail (#39382)
* FIX: Show error when clone order fail

* Fix missing variable

* Fix foreach loop to reference correct object

Updated foreach loop to use the correct object reference for lines.

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-08-04 22:35:21 +02:00
Grégory Aliot
f45d71a4b1
FIX MySQL DB_ERROR_1055 on treasury journal (#39359)
With the MySQL 8 default sql_mode (which includes ONLY_FULL_GROUP_BY),
the supplier invoices query of the treasury journal fails with
DB_ERROR_1055 ("Expression #5 of SELECT list is not in GROUP BY clause
and contains nonaggregated column 'pff.amount' which is not
functionally dependent on columns in GROUP BY clause"). Supplier
payments are then missing from the journal view and from the transfer
into the ledger, while customer invoices still pass, so a treasury
ledger is produced with revenues only and no supplier expense, with no
other signal than one error line in the transfer report.

This is the MySQL counterpart of PostgreSQL error 42803 fixed on
develop by #38910, then simplified by commit 42840b47a which removed
the GROUP BY of the three queries entirely: they contain no aggregate
function, and the fetch loops already deduplicate rows (isset() guards
on the object/payment keys and the already_sum check on the detail
line id), so the GROUP BY is useless. This backports that resolution,
with lines identical to develop so the upward merge stays clean.

Verified on a 23.0.2 instance on MySQL 8 with factory sql_mode: the
vanilla supplier query returns error 1055, the same query without
GROUP BY succeeds and returns the same rows, row for row, as the
exhaustive GROUP BY variant of #38910; the full year transfer produces
balanced pieces and a re-transfer creates no duplicate.

Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Gregory Aliot <greg.aliot@gmail.com>
2026-08-04 18:39:19 +02:00
Günter Lukas
bff60c0562
FIX EmailCollector: DateTime/Carbon object passed as timestamp when MAIN_IMAP_USE_PHPIMAP is enabled (#39378)
* FIX EmailCollector: DateTime/Carbon object passed as timestamp when MAIN_IMAP_USE_PHPIMAP is enabled

When using the PHPIMAP driver, $overview['date'] is a Carbon/DateTime object,
not an integer timestamp. Passing it to dol_print_date() silently produces
a wrong date under PHP 8 (object-to-int cast warning + result 1) instead of
throwing, since the intended value is masked without any visible error.

Also guard the two strtotime($headers['Date']) calls against a missing
Date header, which raised a PHP 8 deprecation notice.

Fixes #39376

* FIX Phan: suppress PhanUndeclaredMethod on Carbon::toDate() after narrowing $overview['date'] to DateTimeInterface

The new instanceof DateTimeInterface check for $overview['date'] made
Phan narrow its inferred type for the rest of the scope, so the existing
->toDate() call (a Carbon-only method, not part of DateTimeInterface)
now also triggers PhanUndeclaredMethod in addition to the already
suppressed PhanPluginUnknownObjectMethodCall.
2026-08-04 16:36:40 +02:00
Günter Lukas
e6b54cbc72
FIX Ticket list: "Remove filter" button does not reset the Company filter (#39375)
$search_societe is a standalone variable used to filter on the joined
llx_societe.nom (fk_soc is not a plain field usable by the generic
$search[...] purge loop), so it was missing from the list of extra
variables reset by the "Remove filter" button.

Fixes #39374
2026-08-04 16:25:01 +02:00
ThomasNgr-OpenDSI
78ab3a9aec
FIX : change mark rate on all lines would display an error if some lines are free lines. (#39305)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-30 21:28:29 +02:00
Lucky
3c02819090
Update expedition.class.php (#39314)
* Update expedition.class.php

In Expedition::addline_batch() (expedition.class.php:1284), the creation form submits all batch lines (even those with qty=0), because SHIPMENT_GETS_ALL_ORDER_PRODUCTS=1 forces their inclusion ($value['q'] == 0 && ...SHIPMENT_GETS_ALL_ORDER_PRODUCTS, line 1295). For each line included, the STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT control compared $prod_batch->qty < $linebatch->qty without verifying that $linebatch->qty (the actual quantity requested for this batch) is greater than 0.

Result: For the line in batch "azerty" (requested quantity = 0, stock = -10), the -10 < 0 test is true → the entire shipment is rejected with "insufficient stock," even though the batch actually chosen ("azerty123456789", requested quantity = 2, stock = 5) is more than sufficient.

* Update expedition.class.php

---------

Co-authored-by: Sylvain Legrand <sylvain.legrand@infras.fr>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-30 18:24:51 +02:00
Lucky
58c951afd6
Update fournisseur.commande.class.php (#39321)
In CommandeFournisseur::create(), the line insertion loop accepts lines provided as arrays, cast to stdClass on the fly (fournisseur.commande.class.php:1687-1689). When a cast line does not contain all the expected properties, the call to addline() reads 13 properties without guards, hence the repeated PHP Warning: Undefined property: stdClass::$...

Co-authored-by: Sylvain Legrand <sylvain.legrand@infras.fr>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-30 18:15:29 +02:00
Sylvain Legrand
19c5b8f825
fix card when action=create (#39336)
some default values are not set
2026-07-30 17:37:46 +02:00
Lucky
c7d2a661bf
fix PHP Warnings (#39316)
commonobject.class.php:9398 — Undefined array key "options_pos": direct access to $this->array_options[$ef_name] without checking its existence → added an isset() with fallback to an empty string.

commonobject.class.php:9767 (getRights() method) — Undefined property: stdClass::$shipping: $user->rights->$element accessed without checking that the module has registered this property (e.g., shipping module not active for this user) → added an isset(), returns null otherwise.

html.form.class.php:6088-6091 — Undefined array key "value": the $input array passed to formconfirm/multiSelect may not contain a value key for a checkbox field → added an isset($input['value']) on both conditions.

html.form.class.php:6752 (method form_modes_reglement()) — Undefined array key 2 / access on null: $selected corresponds to a payment method not in the cache cache_types_paiements → add an isset().

supplier_proposal/index.php:362 — Undefined property: stdClass::$dfv: the SQL query in the block (line 316) does not select the field fin_validite/dfv (unlike comm/propal/index.php which selects p.fin_validite as dfv) — this field does not even exist in llx_supplier_proposal. In addition to the warning, this bug systematically displayed the "Delay" icon (PHP8 comparison '' < number always true) → addition of an isset($obj->dfv) which properly neutralizes the test as long as this field is not returned by the request.

Co-authored-by: Sylvain Legrand <sylvain.legrand@infras.fr>
2026-07-30 12:59:04 +02:00
Zakaria Boushaba
0f583bdf5f
FIX: Fix variable collision in foreach loop causing 'Remove from cycle' button to be always disabled (#39243)
Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
2026-07-27 13:39:34 +02:00
MDW
c2943aade9
Fix CI: Better typing for TBomLineId (#39275) 2026-07-27 13:20:15 +02:00
Jam Balaya
4116c251da
FIX Buyer state/province VAT default (VATRULE 2) ignores active and entity filters (#39279)
get_default_tva() VATRULE 2 selects the VAT rate attached to the buyer
department (c_tva.fk_department_buyer) but filters only on the department id.
Unlike get_product_vat_for_country(), it omits t.active and t.entity, so a
disabled rate (or a rate from another entity) can be returned as the default,
and because of the taux DESC ordering an inactive higher rate wins over the
active one.

Add "AND t.active > 0" and "AND t.entity IN (getEntity('c_tva'))" to the query.
The ordering is unchanged, so the documented behaviour is preserved: the rate
flagged Default (use_default) wins, otherwise the highest active rate.

Add testGetDefaultTvaForBuyerState() covering VATRULE 2, which was previously
untested: it asserts the active department rate is selected and the inactive
one is ignored.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 13:04:30 +02:00
atm-corentin
9d2c5edae3
# FIX|Fix #*Robust Date Comparison for MO (Manufacturing Order) Planned Dates* (#36934)
* fix date start and date end in massaction

* PR returns : change comment langs and restore comment mandatroty for travis

* Clarify permission check for date change action

Updated comment to clarify that permission check is not required for date change action.

* FIX : keep inline permission comment on changedateend action test

---------

Co-authored-by: atm-nicolasV <nicolas.vidal@atm-consulting.fr>
Co-authored-by: ATM-NicolasV <92087862+ATM-NicolasV@users.noreply.github.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-27 10:57:01 +02:00
Alexandre SPANGARO
1bbf06f587
Merge pull request #39296 from aspangaro/21_acchookexportnamemanagement
FIX Accountancy - Hook to name generate file is not working
2026-07-27 07:17:10 +02:00
Alexandre SPANGARO
80a49c1666 CI 2026-07-26 08:00:26 +02:00
Alexandre SPANGARO
1e7182d0b3 FIX Accountancy - Hook to name generate file is not working 2026-07-26 07:34:18 +02:00
Laurent Destailleur
45560ce69c Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-07-23 16:44:38 +02:00
Laurent Destailleur
ad7dd389ff Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-07-23 16:38:08 +02:00
Laurent Destailleur
0543dbf14d Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-07-23 16:36:43 +02:00
Laurent Destailleur
8851cba51a Cast 2026-07-23 16:36:22 +02:00
Laurent Destailleur
9cfefbeafa Automated merge from 19.0 to 20.0 by tool pullmerge.sh 2026-07-23 16:26:25 +02:00
Laurent Destailleur
9a99b4ddf0 Automated merge from 18.0 to 19.0 by tool pullmerge.sh 2026-07-23 16:23:08 +02:00
lvessiller-opendsi
1af18fca49
FIX #39258 Shipment: wrong backlog and component stock for a kit on several order lines (#39261) 2026-07-23 16:13:39 +02:00
lvessiller-opendsi
d12e6ec371
FIX #39259 Shipment: qty to ship prefilled 0 for 2nd+ order line of a same kit (#39262) 2026-07-23 16:12:33 +02:00
brice.l
5152e6f67e
FIX Documents generated/sent in fichinter card use wrong directory in multicompany mode (Change branch from develop to 22.0) (#39266)
* Update SQL queries to use getEntity for entity filtering

* Update file path handling for ficheinter module

* Refactor output directory handling in card.php
2026-07-23 16:10:18 +02:00
ThomasNgr-OpenDSI
9926334e78
Sec: sql injection via api in POST of thirdparties/id/banckaccount - (#39234)
reported by MDnyn

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-23 09:21:33 +02:00
Jam Balaya
f71bf6575e
FIX #32217 Fire BILL_CREATE with create-form extrafields on next situation invoice (#39254)
When creating the next situation invoice, the create-form extrafields were
saved AFTER createFromCurrent() had already fired BILL_CREATE, so triggers
listening to BILL_CREATE never saw them. Passing 'BILL_CREATE' to
insertExtraFields() (as first proposed) would fire the trigger a second time.

Instead, set the extrafields on $object before createFromCurrent() and let
create() insert them and fire BILL_CREATE once with the values present.
createFromCurrent() now skips its fetch_optionals() when array_options is
already set by the caller, so the form values are no longer overwritten by
the source invoice values. The two other createFromCurrent() callers do not
pre-set array_options, so their behaviour is unchanged.

Supersedes #32217.

Signed-off-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
2026-07-22 11:37:10 +02:00
Jam Balaya
ed47b61151
FIX mo_production: show very-short unit label instead of untranslated 'UnitPShort' (#39253)
The "Unit" column of the consume/produce tables used
measuringUnitString(..., 2), which translates a <Label>Short key. Those
keys do not exist for most units (e.g. a Piece -> 'UnitPShort', kg ->
'WeightUnitkgShort'), so the raw untranslated key was displayed. Use
param 1 (the very-short DB short_label: 'p', 'kg', ...) like every other
unit column in this file and across the codebase.

Supersedes #31706.

Signed-off-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
2026-07-22 03:35:51 +02:00
Jam Balaya
136be3c196
FIX #34667 checkUserAccessToObject: skip entity check for non-multientity objects (multicompany) (#39246)
When the multicompany module is enabled, checkUserAccessToObject() (used
by restrictedArea(), e.g. from an ajax tooltip) ran the entity check
unconditionally in its default/custom-object branch, building
"AND dbt.entity IN (...)". For a custom object whose table has no entity
column (ismultientitymanaged = 0), that SQL fails, nb comes back 0 and
access is wrongly denied.

Guard the branch so the entity test only runs when the object is actually
multi-entity managed. Keep the test for legacy classes that never define
ismultientitymanaged (null/unset) and for a non-object $object, and skip
it only when a class explicitly sets ismultientitymanaged = 0.

Supersedes the stale #34667 (by @jyhere) and applies the condition
requested by @eldy in its review.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 20:31:00 +02:00
Jam Balaya
797312579b
FIX isInt() does not detect sized integer types (tinyint, bigint) (#39236)
CommonObject::isInt() decides whether a list-page column gets numeric
search mode and is also used when resolving $this->id. The regex
/(^int|int$)/ missed sized integer types such as tinyint(4) and
bigint(20): they neither start nor end with "int".

These types are not exotic: tinyint(4) is used in several core $fields
definitions (societe, contact, entrepot, companypaymentmode, ...) and
ModuleBuilder-generated tables use bigint(20) for rowid, so isInt()
should recognise them rather than requiring callers to change the
column type.

The new regex /^(?:tiny|small|medium|big)?int|int$/ also handles
smallint/mediumint with a size. Anchoring is preserved on purpose so
that strings which merely contain "int" (e.g. sellist:Table:...) are
still NOT matched, while the Dolibarr foreign-key syntax
"integer:Class:path" keeps being detected.

Signed-off-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
2026-07-20 15:30:28 +02:00
ThomasNgr-OpenDSI
7ec003387a
22 report sec (#39235)
* Sec: sql injection via api in POST of thirdparties/id/banckaccount - reported by MDnyn

* Sec: sql injection via api in POST of thirdparties/id/banckaccount -
reported by MDnyn

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-20 15:29:30 +02:00
Jam Balaya
a270e0852b
FIX #39190 wrong unit price when invoicing time spent with one line per declaration (#39215)
* FIX #39190 wrong unit price when invoicing time spent with one line per declaration

In projet/tasks/time.php, the 'onelineperperiod' mode (invoice generation option
"One line for each time spent declaration") computed the unit price as

    $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU');

but totalvaluetodivideby3600 is timespent_duration (seconds) * timespent_thm
(hourly rate), so dividing by 3600 yields "hours * hourly rate", which is the line
total and not a unit price. The quantity passed to addline() is the number of hours,
so the line was billed hours * (hours * rate) instead of hours * rate: the time is
over-billed by a factor equal to the number of hours.

The sibling modes are already correct: 'onelineperuser' and 'onelinepertask' divide
by the recorded number of seconds. Up to 16.0 'onelineperuser' had the same /3600
expression; it was fixed there and 'onelineperperiod' was left behind. Align it with
that reference implementation, including the same guard against a zero duration.

Also reset $pu_ht for each generated line. $pu_ht is initialized once before the loops
(with the price of the selected product/service, or 0) and this mode only had an
"if (empty($pu_ht))" test, so once a price was computed for the first line every
following line reused it, and lines of users with a different hourly rate got the rate
of the first line. The base price is saved before the loop and restored on each
iteration, so the product/service price path is preserved.

* Rename variable for clarity in time.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-20 02:53:33 +02:00
w3houde
ad73f9d879
Fix #39020 avoid duplicate MO when BOM has a sub-BOM (#39163)
* Fix #39020 avoid duplicate MO when BOM has a sub-BOM

When generating child MOs from a BOM with a sub-BOM line, the lookup of
the parent MO consume line used a substring filter
(origin_id LIKE '%id%') that was not scoped to the parent MO. It could
match an unrelated mrp_production row or none at all. When it matched
none, the child MO was still created from the leftover parent POST data,
producing a second MO identical to the parent instead of a real child.

Scope the lookup to the parent MO with an exact match on origin_id and
origin_type via customsql, and skip the iteration when no matching
consume line is found so no duplicate parent MO can be created.

Signed-off-by: Dolicraft <contact@dolicraft.com>

* Fix #39020 use exact-match filter keys instead of customsql per review

Add exact-match handling for fk_mo, origin_id and origin_type in
MoLine::fetchAll and call it with those keys instead of a customsql
clause, so the lookup stays valid on 18.0/19.0 where customsql would be
the only alternative to the buggy LIKE. The universal-search filter form
is handled separately on 20.0 and later.

Signed-off-by: Dolicraft <contact@dolicraft.com>

---------

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-07-19 17:31:25 +02:00
Joachim Kueter
118ae2e655
FIX #39210 Contact extrafields filters missing on advanced emailing target selection (#39211)
Typo $elementype vs $elementtype: extrafields were fetched for socpeople
but read under the stale key societe, so the contact extrafields section
rendered empty.
2026-07-19 15:52:40 +02:00
Jam Balaya
e9e526c032
FIX #35658 leading-zero account numbers dropped from personalized group totals (#39208)
In compta/resultat/result.php and clientfourn.php the account number was cast to
(int) before being passed to AccountancyCategory::getSumDebitCredit(), which
compares it as a string (t.numero_compte = '...'). (int) '0510' -> 510 -> '510'
never matches the stored '0510' (numero_compte and account_number are varchar(32),
so leading zeros are significant). Accounts whose code starts with 0 were therefore
silently excluded from the current-year and per-month totals of a personalized
account group, while the previous-year column was already correct because it passes
a string array.

The (int) cast had no functional purpose: it was added to silence a phan notice in
"Qual: Fix phan notices" (#33484). Remove it and pass the raw string, and widen the
getSumDebitCredit() @param to string|int|array<?string> so the string argument is
accepted by static analysis and the cast is not reintroduced. Numeric codes are
unaffected (the callee already casts the scalar with (string)).
2026-07-19 15:45:45 +02:00
Laurent Destailleur
6251488091 Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-07-19 15:41:02 +02:00
TowyTowy
b305e6a0cc
FIX getFirstDayOfEachWeek()/getLastDayOfEachWeek() use the wrong year for weeks overlapping 2 years (#39198)
In a January that starts with week 52 or 53 of the previous year (for
example January 2022), getFirstDayOfEachWeek() wrongly shifted week 01
to the next year, and the $year++ inside the loop then also corrupted
all the following weeks of the month: every first day returned was the
one of the next year (02, 09, 16, 23, 30 instead of 03, 10, 17, 24, 31
for January 2022). getLastDayOfEachWeek() had no year handling at all,
so the trailing/leading weeks of the other year were resolved in the
wrong year too.

This made the per-month time spent view (projet/activity/permonth.php)
display wrong week date ranges, link to the wrong week and compute the
weekly holiday overlap on wrong date ranges for such months.

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-18 19:40:57 +02:00
Laurent Destailleur
647c404c53 Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-07-16 13:15:59 +02:00
Laurent Destailleur
f056d4fd1e Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-07-16 13:15:15 +02:00
Grégory Aliot
5f75ee865a
FIX #37540 DST distorts working day count in num_public_holiday (#39158)
The day loop of num_public_holiday() advanced with
dol_time_plus_duree($timestampStart, 1, 'd'). On 21.0 and 22.0 that
function only forces UTC when MAIN_DATE_IN_MEMORY_ARE_GMT is set, so by
default it adds a wall-clock day in the server timezone. When the range
crosses a DST boundary (last Sunday of March in Europe), the GMT
timestamp advances by only 23 hours, the same GMT day is evaluated
twice, one day is counted as holiday twice and the working day after
the boundary is never examined.

For a leave request from Sat 28/03/2026 to Mon 30/03/2026 with a server
in Europe/Paris: 3 days between, 3 holidays counted (Sunday twice),
0 working days instead of 1.

Advance by exactly 86400 seconds instead. Inputs of this function are
GMT dates (enforced by the modulo check at the top of the function), so
a GMT day is always exactly 86400 seconds, in every timezone and conf.
This matches the behaviour that 23.0 and develop get by default since
dol_time_plus_duree() switched to UTC by default there.

Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Gregory Aliot <greg.aliot@gmail.com>
2026-07-16 13:14:59 +02:00
Laurent Destailleur
f70ccfa842 Add a TODO 2026-07-16 13:10:41 +02:00
Laurent Destailleur
0c2306c41f Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2026-07-16 13:06:22 +02:00
John BOTELLA
bd419519ff
Fix extrafield hidden field not ecaped value (#39148)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 13:06:00 +02:00