Commit graph

155340 commits

Author SHA1 Message Date
Jam Balaya
b2eae1b7d7
FIX #37826 country_code must be an ISO code, not a label (#39191)
* FIX #37826 country_code must be an ISO code, not a label

On a proposal/order, the 2nd+ line got VAT 0% with the error "no vat rates
defined for country 'France'/'Suisse'". Root cause: the seller country_code
held a translated country label instead of the ISO code, so the
"c.code IN (...)" lookup in Form::load_cache_vatrates() matched nothing.

- Societe::setMysoc(): the canonical MAIN_INFO_SOCIETE_COUNTRY is
  "id:code:label"; a legacy "id:label" value put the label into
  country_code. Only treat the full 3-token form as "id:code:label" and
  otherwise rebuild code/label from the authoritative country id.
- Form::load_tva(): defensively recover the seller ISO code from its
  country id when country_code is not a known c_country code, so a bad
  value can never silently force the VAT rate to 0%.

Signed-off-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>

* FIX #37826 avoid useless SQL per page: recover country ISO code from id only when code is not a 2-char ISO code

---------

Signed-off-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
2026-07-16 13:56:33 +02:00
Zakaria Boushaba
6d828c29fc
FIX accounting export: reexport date not updated and fiscal year filter incorrectly applied on reexport (#39186)
* fix: accounting export reexport date not updated and fiscal year filter incorrectly applied on reexport

* Update date_export only if it is empty or ACCOUNTING_REEXPORT is active

---------

Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 11:35:37 +02:00
Zakaria Boushaba
8a246db393
FIX Wrong margin calculation on situation invoices due to cumulative situation_percent (#39090)
* FIX: Margin calculation on situation invoices uses cumulative percent instead of delta, causing inflated amounts across all margin views

* Fix

* use the 'as' between table name and alias name

---------

Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 11:27:35 +02:00
Laurent Destailleur
989182d31b Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-16 04:11:16 +02:00
Laurent Destailleur
5e15653707 Fix default value system for checkbox "Show variant" on product list. 2026-07-16 04:11:02 +02:00
Jam Balaya
27d13fc880
FIX: supplier payment document.php runs restrictedArea() on unloaded object (#39117)
htdocs/fourn/paiement/document.php called
  restrictedArea($user, $object->element, $object->id, 'paiementfourn', '')
before $object was instantiated (the 'Load object' block sat after the
security check), so the permission check ran on an undefined $object (null
element / null id) and PHPStan level 10 flagged 'Variable $object might not
be defined'.

The sibling pages fourn/paiement/card.php and info.php instantiate the
PaiementFourn object before the same restrictedArea() call. Move the object
load ahead of the security check so the check runs against the real object.
2026-07-16 03:46:25 +02:00
Jam Balaya
591974e5d1
FIX: agenda day view passes usergroup filter as string instead of id array (#39157)
In htdocs/comm/action/index.php the month and week views call
print_actions_filter(..., $actioncode, $usergroupids, ...) with
$usergroupids (array<int>, built at the top from the comma-separated
$usergroup), but the day view passed the raw $usergroup string instead.
print_actions_filter() forwards this to select_dolgroups() which expects an
array, so a multi-group filter (e.g. '3,5') is not preselected in the day view.
Pass $usergroupids to match the two sibling calls.

PHPStan level 10 flagged: Parameter #16 $usergroupid of function
print_actions_filter expects array<int>, string given.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 03:08:11 +02:00
Jam Balaya
3058208201
FIX: PayPal API calls set CURLOPT_SSL_VERIFYHOST to a bool instead of 2 (#39155)
htdocs/paypal/lib/paypal.lib.php passed a boolean to CURLOPT_SSL_VERIFYHOST:
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($ssl_verifypeer ? true : false));
CURLOPT_SSL_VERIFYHOST expects 0, 1 or 2 (not a bool). 'true' is cast to int 1,
which only checks that a Common Name is present, not that it matches the host
(value 1 is also deprecated / a no-op on some libcurl builds) - weakening TLS
host verification on PayPal API calls. Use 2 (full host check) / 0.

PHPStan level 10 flagged: Parameter #3 $value of function curl_setopt expects
0|2, bool given.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 02:23:26 +02:00
Jam Balaya
4be9257efa
FIX: OpenID server discovery passes the whole HTTP response array as HTML (#39156)
htdocs/core/class/openid.class.php OpenId::GetOpenIDServer() calls:
	$response = getURLContent(...);            // array{http_code,content,...}
	list($servers, $delegates) = $this->HTML2OpenIDServer($response);
but HTML2OpenIDServer($content) runs preg_match_all(..., $content), i.e. it
expects the HTML string, not the whole getURLContent() array. On PHP 8 this
throws a TypeError (preg_match_all subject must be string), breaking OpenID
server discovery; on PHP 7 it silently matches nothing. Pass $response['content'].

PHPStan level 10 flagged: Parameter #1 $content of method
SimpleOpenID::HTML2OpenIDServer() expects string, array given.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 02:07:23 +02:00
Laurent Destailleur
5350af22ba Trans 2026-07-16 01:42:19 +02:00
Laurent Destailleur
d4fc52b182 version 2026-07-16 01:39:10 +02:00
Laurent Destailleur
650a339f5b Version 2026-07-16 01:27:25 +02:00
Laurent Destailleur
2b4a16df16 Version 2026-07-16 01:24:52 +02:00
Laurent Destailleur
3ecc61845e Fix type 2026-07-16 01:19:08 +02:00
Laurent Destailleur
546b51704f Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-16 00:00:17 +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
Laurent Destailleur
25ef7d42ea Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop 2026-07-15 20:46:43 +02:00
MDW
ca789645fc
Fix: Use AI provider agnostic .agents, update commit exclusion: develop and version branches (#39189)
* qual: Update branch protection rules in AGENTS.md

Updated the branch protection rules in AGENTS.md to reflect the new policy of never committing directly to the `develop` branch or version branches matching the regex `^\d+\.\d+$`.

* Fix: Rename .claude directory to .agents

Renamed the .claude directory and its contents to .agents.
.agents is AI provider agnostic.
2026-07-15 20:40:45 +02:00
Laurent Destailleur
40e7493eac Debug v24 2026-07-15 20:31:48 +02:00
Laurent Destailleur
7624ab0b0a Doc 2026-07-15 19:31:58 +02:00
Laurent Destailleur
a1c2470021 Debug v24 2026-07-15 13:04:32 +02:00
Laurent Destailleur
4ddbfd977f Fix regressions 2026-07-15 02:34:01 +02:00
Laurent Destailleur
ad4ceba536 Automated merge from 23.0 to develop 2026-07-15 02:06:09 +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
675b5bf1bc Doc 2026-07-15 00:59:45 +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
Laurent Destailleur
a326afccdc Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-15 00:56:54 +02:00
Laurent Destailleur
f267603a7c Fix mailmap file 2026-07-15 00:56:44 +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
github-actions[bot]
e8227696b4
PHPStan > Update baseline (#39174)
Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>
2026-07-15 00:39:16 +02:00
MDW
03319e88c9
Qual: Improve some CodingPhpTest notices with line numbers (#39176)
* Qual: Improve a notice with line numbers

* Qual: Fix PHPStan ci when no files are to be analyzed
2026-07-15 00:38:28 +02:00
Charlène Benke
a366cee392
create categorie_fichinter-fichinter not run (#39177) 2026-07-15 00:37:05 +02:00
Charlène Benke
10492c5c81
Add 'ficheinter' to module security tests (#39180) 2026-07-15 00:36:38 +02:00
Charlène Benke
d8a61e5200
Add 'notnull' attribute to fk_statut field (#39179)
generate warning error on list
2026-07-15 00:36:11 +02:00
Laurent Destailleur
45c13ab4ef Doc 2026-07-15 00:06:18 +02:00
Laurent Destailleur
29f4ddcdf1 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-15 00:03:29 +02:00
Laurent Destailleur
9d5c3a33b9 Doc 2026-07-15 00:03:17 +02:00
Laurent Destailleur
eb998bbc67 Update agents setup files 2026-07-14 23:57:05 +02:00
Zakaria Boushaba
c8ba7f4696
FIX #37775 Improve extra fields merge when creating invoice from template (#39173)
* FIX Invoice creation from template ignores extra fields set in form

* Fix Strict comparison using === between mixed and null will always evaluate to false

---------

Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
2026-07-14 13:51:21 +02:00
MDW
9ecec7b248
Qual: Update logToCheckStyle (now extracts PHP Lint error msg) (#39169)
# Qual: Update logToCheckStyle (now extracts PHP Lint error msg)

logToCheckStyle  was updated to extract PHP Lint (php -l) errors.
So they will show in the summary report and as annotations.
2026-07-14 13:50:39 +02:00
MDW
ff2adb5b84
Qual: Update Phan baseline.txt (#39170) 2026-07-14 13:49:56 +02:00
Laurent Destailleur
66daa3ffed Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-14 00:47:15 +02:00