Commit graph

152359 commits

Author SHA1 Message Date
Laurent Destailleur
b4e5998f2c Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 2026-07-18 02:49:17 +02:00
Laurent Destailleur
1057ad6c7e Sec: sql injection via api in POST of thirdparties/id/banckaccount -
reported by MDnyn
2026-07-18 02:49:05 +02:00
Laurent Destailleur
19991c8ffa Sec: sql injection via api in POST of thirdparties/id/banckaccount - reported by MDnyn 2026-07-18 02:48:07 +02:00
Régis Houssin
0194d44266
FIX BLOCKEDLOG_HMAC_KEY can not be the same by entity (#39067)
* FIX BLOCKEDLOG_HMAC_KEY can not be the same by entity

* FIX migrate for all entities
2026-07-16 14:06:54 +02:00
Laurent Destailleur
a727b8ecbb Automated merge from 22.0 to 23.0 by tool pullmerge.sh 2026-07-16 13:55:30 +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
Laurent Destailleur
4c959a5ff6 Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-07-16 12:57:46 +02:00
HENRY Florian
9cc9367fc0
fix: if user cannot create suppluer invoice it cannot create payment (#39183)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 12:51:02 +02:00
MDW
8b7dab1c2d
Qual: Fix PHPStan for 23.0 + pre-commit backports (#39192) 2026-07-16 11:29:42 +02:00
nikube
3dd16ec3c2
FIX Mass action "Reverse movement" bypasses the MAIN_LIMIT_FOR_MASS_ACTIONS limit (#39091)
* FIX Mass reverse of stock movements bypasses the MAIN_LIMIT_FOR_MASS_ACTIONS limit

The confirm_reverse handler did not check the error raised by the
generic mass action limit control (TooManyRecordForMassAction), so
selecting more records than the limit still executed the reverse
after the error message was displayed. The reverse was also triggered
when relaunching a search while the confirmation form was open,
because the protection only reset $massaction, not $action.

* FIX phan: initialize $error at the start of the confirm_reverse handler

The new !$error guard lets phan narrow $error to falsy types inside
the block, so the $error++ in the query-error branch was reported as
PhanTypeInvalidUnaryOperandIncOrDec. Initialize $error to 0 at the
start of the handler (and drop the redundant init inside the loop
setup where present).

* FIX coding rule: comment on the $action test that only cancels the pending action

CodingPhpTest requires a permission check or an explicit comment on
every test of $action in the Actions section.

---------

Co-authored-by: Nicolas Zaou <nz@anatoleconseil.com>
2026-07-16 04:18:11 +02:00
HENRY Florian
34c78e21b6
fix: avoid Access refused to xxx.xxx.xxx.xxx by SQL or Script injection protection in main.inc.php:analyseVarsForSqlAndScriptsInjection type=1 (#39188)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 01:29:56 +02:00
Laurent Destailleur
e782608442 Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 2026-07-16 01:18:38 +02:00
John BOTELLA
063d0242b3
Fix extrafield hidden field not ecaped value (#39149)
* Fix extrafield hidden field not ecaped value

* Update commonobject.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 01:04:47 +02:00
ATM-NicolasV
da6ef26c8e
Fix empty SET clause in insertExtraFields UPDATE when no target column matches (#39184)
When an object is created from another element whose extrafields do not exist on
the target element (e.g. an invoice created from a shipment: the source line
extrafields are copied into array_options but none match facturedet), the
top-level empty($this->array_options) guard passes but the filtered column set is
empty. When an extrafields row already exists for the object, the UPDATE branch
then built "UPDATE llx_..._extrafields SET  WHERE fk_object = X" with an empty SET
clause, producing a MariaDB syntax error ("near 'WHERE fk_object = ...'") and
aborting the creation of the invoice.

Guard the UPDATE branch: when there is no column of the target element to update,
commit and return without running the query (the existing row is already
correct). This keeps the multicompany data-loss fix (UPDATE instead of
DELETE+INSERT, #34022) untouched.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 01:03:35 +02:00
Laurent Destailleur
c7dbdd0338 Restore good code after merge of a regression 2026-07-16 00:59:28 +02:00
Laurent Destailleur
28ee30d690 Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2026-07-16 00:57:47 +02:00
Laurent Destailleur
4c3bb8f5d1 Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2026-07-16 00:57:36 +02:00
Laurent Destailleur
070fbcdd28 Fix regression 2026-07-16 00:57:15 +02:00
Laurent Destailleur
e7473d1895 Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 2026-07-16 00:46:45 +02:00
w3houde
5358fca80c
Backport paymentok payment_intent session bypass to 23.0 (partial for #39154) (#39168)
* Fix #39154 bypass paymentok session check when returning from Stripe

When STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is set to 2, Stripe
confirmPayment() redirects the customer directly to paymentok.php and
appends payment_intent, payment_intent_client_secret and redirect_status
to the return url, but not the internal paymentoksessioncode. When the
Dolibarr session cookie is not preserved across the cross-site redirect,
the strict session-code check rejected valid payments with 'Stripe
payment verification failed: TRANSACTIONID is not set or session key
does not match', even though the payment succeeded and was recorded by
the IPN webhook.

Skip the paymentoksessioncode check when payment_intent is present in
GET. Security is preserved: the PaymentIntent is then retrieved from the
Stripe API and its amount, currency and status are verified.

Backport of the develop fix (PR #38577) to the 23.0 maintenance branch.

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

* Fix #39154 use !GETPOST instead of empty(GETPOST) per review

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

---------

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 00:46:21 +02:00
Laurent Destailleur
5348161945 Revert "Try to restore ci like before"
This reverts commit a4993a5ec4.
2026-07-16 00:44:45 +02:00
Laurent Destailleur
a4993a5ec4 Try to restore ci like before 2026-07-16 00:42:08 +02:00
Laurent Destailleur
1f779ba604 ci 2026-07-16 00:32:50 +02:00
Laurent Destailleur
4c63b7a5e3 ci 2026-07-16 00:26:08 +02:00
Laurent Destailleur
d99840c759 ci 2026-07-16 00:20:39 +02:00
Laurent Destailleur
17b3dd2c04 CI 2026-07-16 00:14:45 +02:00
Laurent Destailleur
7c447cc58f Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 2026-07-15 20:48:36 +02:00
Laurent Destailleur
af57d3cc46 Fix type 2026-07-15 20:47:56 +02:00
TowyTowy
acf69ceeee
FIX getWeekNumbersOfMonth() drops the last week when the month ends on a Monday (#39185)
getWeekNumbersOfMonth() looped with "for ($day = 1; $day < $nb_days; ...)",
so the last day of the month was never inspected. When that last day is a
Monday it starts a new ISO week that no earlier day of the month belongs to,
so its week number was silently missing from the returned array.

This surfaces in the project "time spent per month" view
(htdocs/projet/activity/permonth.php), which builds one column per week from
this list: for such months the final week column is dropped. Over 2015-2035,
35 months are affected (e.g. 2015-08 returned weeks 31-35 but omitted 36, the
week of Monday 2015-08-31).

Fix: iterate up to and including the last day ($day <= $nb_days).

Signed-off-by: TowyTowy <towy@airreps.link>
Co-authored-by: Claude <noreply@anthropic.com>
2026-07-15 20:42:56 +02:00
Grégory Aliot
b67c468eaf
FIX #37026 Chart of accounts export drops root and cross-chart accounts (#39159)
* FIX #37026 Chart of accounts export drops root and cross-chart accounts

The "Chart of accounts" export dataset joined the parent account with an
old style comma join plus aa2.active = 1 and ac.pcg_version =
aa2.fk_pcg_version. That inner join silently dropped every account that
has no parent (root accounts), whose parent is inactive, or whose parent
belongs to another chart. The last case is common with a custom chart
derived from a base one (the derived accounts keep their base parents),
which is what the reporter saw: only the self consistent base chart came
through instead of the active custom chart.

Use an explicit INNER JOIN on accounting_system for the chart and a LEFT
JOIN on the parent account keyed on the parent rowid only, so accounts
are exported whatever their parent is. On a standard install this brings
the export from 3087 to 3171 accounts (84 root or cross-chart accounts
were missing).

Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>

* Update modAccounting.class.php

* Complete the sentence left dangling in the parent join comment

Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>

---------

Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-15 20:41:31 +02:00
Laurent Destailleur
b97959e5f0 Doc 2026-07-15 01:27:33 +02:00
Laurent Destailleur
967897f763 Automated merge from 22.0 to 23.0 by tool pullmerge.sh 2026-07-15 01:26:14 +02:00
Laurent Destailleur
349c283a4a Backport ci optimizations 2026-07-15 01:22:24 +02:00
Laurent Destailleur
79242074f5 Backport ci optimizations 2026-07-15 01:20:38 +02:00
Laurent Destailleur
4f27660d6d Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-07-15 01:15:01 +02:00
Laurent Destailleur
902aa3ca88 Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-07-15 00:58:26 +02:00
w3houde
ef6631e9bd
Fix #38963 enforce website write right on legacy filemanager (#39160)
The legacy FCKeditor file manager connector (config.inc.php, also included
by browser/default/browser.php and connectors/php/connector.php) only called
main.inc.php and never checked any module right on 21.0 and 22.0, so any
authenticated user, even one with no permission, could reach the connector,
browse the medias directory and upload files.

The permission check already present on 23.0 and develop was never backported.
This adds the same guard so a non-admin without website write right is refused.
Reported by Abderrahmane Aksoum.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-07-15 00:52:28 +02:00
Grégory Aliot
61899bb8cd
FIX #39113 CSV export: decode HTML entities in header labels (#39151)
Extrafield labels are stored HTML encoded in llx_extrafields.label
because they are saved through Translate::trans(), which runs the
string through htmlentities(). write_title() wrote the label as-is,
so the CSV header line showed raw entities (Donn&eacute;es instead of
Données) while the data cells were fine. With a ; separator the
trailing ; of each entity also wrapped the label in double quotes.

Decode entities and remove HTML with dol_string_nohtmltag() before
csvClean(), consistent with the TSV and Excel export drivers. For the
derived _label column of Select extrafields, append the suffix before
csvClean() so the column stays valid CSV when the decoded label
contains the separator or a quote.

Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Gregory Aliot <greg.aliot@gmail.com>
2026-07-15 00:44:37 +02:00
w3houde
fe1386fa2d
Fix #38860 build valid ldap:// URI for scheme-less host on PHP 8.3+ (#39167)
Since PHP 8.3 ldap_connect() takes a single URI argument. connectBind()
concatenated host and port as "host:port", which is a malformed URI for a
scheme-less host (localhost, 192.168.0.2) since the host is then parsed as the
URI scheme, so the following bind returns false. It also appended ":port" to an
already qualified ldaps:// URI. Prefix scheme-less hosts with ldap:// and leave
ldap(s):// URIs untouched.

Signed-off-by: Dolicraft <clement@pixodeo.com>
2026-07-15 00:41:18 +02:00
TowyTowy
5c6e4f486d
FIX dol_string_nohtmltag() skips double-space collapsing when string starts with a double space (#39175)
The double-space removal loop guarded its condition with the truthiness
of strpos():

    while (strpos($temp, "  ")) {

strpos() returns int 0 when the first double space is at position 0 of
the string, and 0 is falsy, so the loop body never runs. As a result NO
double spaces are collapsed at all in that string, including interior
ones. This happens for any input that begins with two spaces, e.g. text
whose leading "<br><br>" is turned into two leading spaces by the
removelinefeed step just above. The trailing trim() hides the leading
spaces but the interior double spaces survive, producing wrong output
(e.g. "Total  amount  due" instead of "Total amount due").

Fix by comparing against false, the standard PHP idiom used elsewhere in
this codebase. Strings that do not start with a double space were already
handled correctly, so behaviour is unchanged for them. Also corrected the
neighbouring comment ("double quotes" -> "double spaces").

Signed-off-by: TowyTowy <towy@airreps.link>
Co-authored-by: Claude <noreply@anthropic.com>
2026-07-15 00:40:03 +02:00
GregcodeOhm
8f85bf6b0d FIX phan and phpstan errors on 21.0 static analysis (#39152)
Two errors were surfaced on the 21.0 branch by the automated pullmerge
from the 18.0 to 20.0 branches, and they make the phan and phpstan CI
jobs fail on every open pull request:

- htdocs/takepos/invoice.php: dol_htmloutput_errors() second argument
  must be an array, not null (phpstan).
- htdocs/societe/class/societe.class.php: the string parameter $remise
  must be cast to float before the multiplication, like the surrounding
  lines already do (phan PhanTypeInvalidLeftOperandOfNumericOp).

Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Gregory Aliot <greg.aliot@gmail.com>
2026-07-14 00:46:59 +02:00
GregcodeOhm
edc19593c9
FIX phan and phpstan errors on 21.0 static analysis (#39152)
Two errors were surfaced on the 21.0 branch by the automated pullmerge
from the 18.0 to 20.0 branches, and they make the phan and phpstan CI
jobs fail on every open pull request:

- htdocs/takepos/invoice.php: dol_htmloutput_errors() second argument
  must be an array, not null (phpstan).
- htdocs/societe/class/societe.class.php: the string parameter $remise
  must be cast to float before the multiplication, like the surrounding
  lines already do (phan PhanTypeInvalidLeftOperandOfNumericOp).

Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Gregory Aliot <greg.aliot@gmail.com>
2026-07-14 00:42:54 +02:00
Laurent Destailleur
6cb5380087 Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2026-07-13 16:33:26 +02:00
Laurent Destailleur
dc382c14aa Automated merge from 19.0 to 20.0 by tool pullmerge.sh 2026-07-13 16:28:07 +02:00
Laurent Destailleur
febbfc8207 Automated merge from 18.0 to 19.0 by tool pullmerge.sh 2026-07-13 16:16:47 +02:00