Commit graph

155976 commits

Author SHA1 Message Date
Laurent Destailleur
dc96d8d720 Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 24.0 2026-08-14 20:32:03 +02:00
Frédéric FRANCE
592128018b
Update ci-checkfilesetlock.yml (#39525) 2026-08-14 20:31:46 +02:00
Frédéric FRANCE
047344bf82
NEW: Add phpunit test for Dolresource class (#39520)
* NEW: Add phpunit test for Dolresource class

Add a CRUD test (create/fetch/update/delete) for the Dolresource
class, which had no test coverage yet.

Note: the update() test intentionally does not exercise note_public/
note_private - Dolresource::update()'s SQL UPDATE statement omits
these 2 columns, so changes to them are silently not persisted.

* FIX Dolresource::update() does not persist note_public/note_private

The SQL UPDATE statement was missing these 2 columns while every
other property of the object was included, so changes to a
resource's notes were silently dropped on update. Add them following
the same pattern as the other fields, and extend the phpunit test to
cover it.

* FIX pre-commit PHPStan hook errors on commits with no file in scope

phpstan.neon.dist only analyzes htdocs/ and scripts/, but the
pre-commit wrapper passed every staged file straight to phpstan
regardless of path. A commit touching only files outside that scope
(e.g. test/phpunit/) made phpstan exit with "No files found to
analyse", failing the hook for reasons unrelated to the change being
committed. Filter to htdocs/ and scripts/ first, and skip cleanly
when nothing remains.

* NEW: Auto-activate module resource in DolresourceTest if needed

Activate module resource in setUpBeforeClass() when it is not
already enabled, so the test does not depend on the environment's
module configuration. Same pattern as
OpensurveysondageTest::setUpBeforeClass().

Note: this activation is real and persists after the test run - it
is not undone by the transaction rollback in tearDownAfterClass().
Activating a module re-runs its SQL install scripts (CREATE/ALTER
TABLE), which causes an implicit commit in MySQL/InnoDB, same as an
admin enabling it from Setup > Modules would do.

* fix
2026-08-14 20:31:06 +02:00
Laurent Destailleur
cc8cca3a04 Fix check for external user when using a child object like order lines -
reported by Pavel Kohout
2026-08-14 20:29:05 +02:00
Laurent Destailleur
78a9b01b38 Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-14 20:09:12 +02:00
Laurent Destailleur
2d765488ac Clean url 2026-08-14 20:08:48 +02:00
Laurent Destailleur
fbf476cc5d Restrict some field in api create/update of member for secure purpose -
reported by vulncheck
2026-08-14 20:01:30 +02:00
Laurent Destailleur
52d83c89d6 Disqualified some fields from api 2026-08-14 19:47:17 +02:00
Laurent Destailleur
9e385dc0ab Exclude some keys in api put and post 2026-08-14 19:45:47 +02:00
Laurent Destailleur
19f512369d Clean property 2026-08-14 19:42:47 +02:00
Laurent Destailleur
7a259b80f5 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-14 18:54:15 +02:00
Laurent Destailleur
13d0e912d9 WIP Code to manage permission on extrafields 2026-08-14 18:45:14 +02:00
Laurent Destailleur
4da2578588 Fix AISLE-2026-0340-0087 IDOR in user bank account edit flow - reported
by Pavel Kohout
2026-08-14 18:10:58 +02:00
VIAL-GOUTEYRON Quentin
f20581cf86
FIX Contact documents were readable by any external user (#39516)
dol_check_secure_access_document() built its protection query against a table
named socpepople, which does not exist. The query therefore always failed, so
document.php and viewimage.php never iterated its result and never lowered
$accessallowed back to 0.

Any external user having the permission to read contacts could consequently
download the documents of any contact, including the contacts of other third
parties.

Note that this also restores the intended behaviour for the contacts having no
third party: an external user no longer has access to their documents, since
the query returns a NULL fk_soc that cannot match their own.

The typo was introduced in 0dd9e6acc2 on 2026-07-20, so only develop and the
24.0 branch are affected, no released version is.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-08-14 17:56:23 +02:00
Laurent Destailleur
1730aa5667 Fix AISLE-2026-0340-0086 Authorization bypass in clonetasks: private
destination project check is inverted - reported by Pavel Kohout
2026-08-14 16:25:46 +02:00
Frédéric FRANCE
750145e663
NEW: #0 Resolve password generator/validator classes via modules_parts['models'] (#39486)
Password generator/validator classes (USER_PASSWORD_GENERATED,
modGeneratePassXxx extends ModeleGenPassword) could previously only live
under htdocs/core/modules/security/generate/ — every call site resolving
one by name hardcoded that path, so no third-party module could
contribute its own generator without patching core.

Reuse the modules_parts['models'] extension point already populated for
any enabled module declaring $this->module_parts['models'] = 1 (the same
mechanism every numbering-module scan in Dolibarr already uses — see e.g.
Facture::getNextNumRef()), and wire it into the password-generator scan
too:

- admin/security.php's generator listing now scans core plus every
  enabled module declaring module_parts['models'], instead of only
  core/modules/security/generate/.
- Added ModeleGenPassword::loadAndInstantiate($id, ...) in
  modules_genpassword.php, a shared factory doing that same multi-root
  resolution once, used by the four runtime call sites that previously
  hardcoded the core-only path: User::setPassword(), getRandomPassword()
  (security2.lib.php), FormSetupItem::generateInputFieldPassword()
  (html.formsetup.class.php), and PasswordField::verifyFieldValue()
  (passwordfield.class.php). getRandomPassword() falls back to the
  'standard' generator (with a warning logged) if the configured
  generator's class can't be resolved, rather than silently generating
  and persisting an empty password.

Behavior for the built-in Standard/None/Perso generators is unchanged —
core is always the first root scanned, so it always wins for those ids.
2026-08-14 16:19:48 +02:00
Laurent Destailleur
f3bf35a0ad Merge branch 'frederic34-extrafields-admin-unification' into develop 2026-08-14 16:16:11 +02:00
Laurent Destailleur
700df8c6b9 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
2026-08-14 16:13:22 +02:00
Laurent Destailleur
294a9c0baf Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-14 16:09:50 +02:00
Laurent Destailleur
ddd59f5df7 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
2026-08-14 16:09:36 +02:00
Frédéric FRANCE
ad7fc74b10
NEW: Add phpunit test for Workstation class (#39518)
* NEW: Add phpunit test for Workstation class

Add a CRUD test (create/fetch/update/setStatusCommon/delete) for the
Workstation class, which had no test coverage yet.

* FIX pre-commit PHPStan hook errors on commits with no file in scope

phpstan.neon.dist only analyzes htdocs/ and scripts/, but the
pre-commit wrapper passed every staged file straight to phpstan
regardless of path. A commit touching only files outside that scope
(e.g. test/phpunit/) made phpstan exit with "No files found to
analyse", failing the hook for reasons unrelated to the change being
committed. Filter to htdocs/ and scripts/ first, and skip cleanly
when nothing remains.

* NEW: Auto-activate module workstation in WorkstationTest if needed

Activate module workstation in setUpBeforeClass() when it is not
already enabled, so the test does not depend on the environment's
module configuration. Same pattern as
OpensurveysondageTest::setUpBeforeClass().

Note: this activation is real and persists after the test run - it
is not undone by the transaction rollback in tearDownAfterClass().
Activating a module re-runs its SQL install scripts (CREATE/ALTER
TABLE), which causes an implicit commit in MySQL/InnoDB, same as an
admin enabling it from Setup > Modules would do.

* fix
2026-08-14 15:56:13 +02:00
Laurent Destailleur
340a08734b Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 24.0 2026-08-14 15:54:52 +02:00
Laurent Destailleur
53a7f8eff4 Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 2026-08-14 15:52:54 +02:00
Laurent Destailleur
f506d5459a Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 22.0 2026-08-14 15:52:11 +02:00
MDW
f092c9b7f6
Qual(ci): Fix phan notices (typing) (#39510) 2026-08-14 15:49:33 +02:00
MDW
a053ecf7d3
Qual(ci): Fix phan notices (typing) (#39509) 2026-08-14 15:48:28 +02:00
Frédéric FRANCE
2263c40eff
FIX pre-commit PHPStan hook errors on commits with no file in scope (#39521)
phpstan.neon.dist only analyzes htdocs/ and scripts/, but the
pre-commit wrapper passed every staged file straight to phpstan
regardless of path. A commit touching only files outside that scope
(e.g. test/phpunit/) made phpstan exit with "No files found to
analyse", failing the hook for reasons unrelated to the change being
committed. Filter to htdocs/ and scripts/ first, and skip cleanly
when nothing remains.
2026-08-14 15:48:00 +02:00
VIAL-GOUTEYRON Quentin
15aaa26b1f
FIX Phan warnings introduced by the 24.0 merges of 2026-08-13 (#39519)
The four files below were modified by the automated merges from the 24.0 branch
into develop on 2026-08-13 and each brought a type warning. Phan reports them on
every pull request opened since, because the list of files it analyses on a pull
request includes the recent changes of develop, so every contributor gets a red
phan on files they never touched.

- mrp/mo_card.php: fetchAll() takes int for $limit and $offset, '1' and '' were
  passed.
- commande/class/commande.class.php: escape() takes a string and
  deposit_percent is numeric. The insert path of the same class already casts it
  a few hundred lines above, only the update path was missing it.
- asset/class/asset.class.php: the note on disposal_amount_ht says the card
  assigns an int, but asset/card.php now assigns the result of GETPOSTFLOAT().
- core/modules/dons/html_cerfafr.modules.php: modepaymentid is used as an array
  index outside of the test that guarantees it is not null.

No functional change: the four values were already used as int, string, float
and int by PHP itself.
2026-08-14 15:45:06 +02:00
Laurent Destailleur
cf4c308022 Fix escape js string - reported by Vulncheck 2026-08-14 15:43:43 +02:00
Laurent Destailleur
3094b0aa3b Fix escape js string - reported by Vulncheck 2026-08-14 15:43:28 +02:00
Laurent Destailleur
bd3ddf6db4 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-14 15:42:46 +02:00
Laurent Destailleur
6c4210de21 Fix escape js string - reported by Vulncheck 2026-08-14 15:42:32 +02:00
Laurent Destailleur
ab4b522d69 Fi regression, restore type string 2026-08-14 15:40:51 +02:00
MDW
9e215be47c
Qual(ci): Fix phan notices (typing) (#39511)
* Qual(ci): Fix phan notices (typing)

* Qual: Fix deposit_percent type (escaping)

# Qual: Fix deposit_percent type (escaping)

deposit_percent is a float but was escaped to string resulting in argument mismatch.
Fixed by casting to float.
2026-08-14 15:35:17 +02:00
Frédéric FRANCE
0b974869ba
Add opensurveysondage phpunit test (#39522)
* FIX pre-commit PHPStan hook errors on commits with no file in scope

phpstan.neon.dist only analyzes htdocs/ and scripts/, but the
pre-commit wrapper passed every staged file straight to phpstan
regardless of path. A commit touching only files outside that scope
(e.g. test/phpunit/) made phpstan exit with "No files found to
analyse", failing the hook for reasons unrelated to the change being
committed. Filter to htdocs/ and scripts/ first, and skip cleanly
when nothing remains.

* NEW: Add phpunit test for Opensurveysondage class

Add a CRUD test (create/fetch/update/delete) for the Opensurveysondage
class, which had no test coverage yet.

Note: create()'s return value is not used to identify the created
record - Opensurveysondage::create() returns $this->id, but this
class never sets $this->id (the real primary key is the caller-
supplied $this->id_sondage string), so the return value carries no
information. The test uses errors/re-fetch to check success instead.

* NEW: Auto-activate module opensurvey in OpensurveysondageTest if needed

Activate module opensurvey in setUpBeforeClass() when it is not
already enabled, so the test does not depend on the environment's
module configuration.

Note: this activation is real and persists after the test run - it
is not undone by the transaction rollback in tearDownAfterClass().
Activating a module re-runs its SQL install scripts (CREATE/ALTER
TABLE), which causes an implicit commit in MySQL/InnoDB, same as an
admin enabling it from Setup > Modules would do.
2026-08-14 14:57:48 +02:00
Laurent Destailleur
c093e3d0ab Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-14 14:31:10 +02:00
Laurent Destailleur
ddcbbf7717 Hide duplicate section that is already visible in banner 2026-08-14 14:30:50 +02:00
Laurent Destailleur
fd938b07d8 Fix missing token param 2026-08-14 14:00:54 +02:00
Laurent Destailleur
da5917d02a Trans 2026-08-14 13:46:40 +02:00
Laurent Destailleur
b4db290594 Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-14 02:37:17 +02:00
Laurent Destailleur
5706222c3d Fix MAIN_INFO_SOCIETE_VAT_EXEMPTION_CODE not saved 2026-08-14 02:34:28 +02:00
Laurent Destailleur
ec33d4fab0 Debug v24 2026-08-13 20:14:53 +02:00
Laurent Destailleur
6b3b1e0589 Doc 2026-08-13 20:13:30 +02:00
Laurent Destailleur
a111a3adc7 Doc 2026-08-13 19:58:44 +02:00
Laurent Destailleur
8ab7bc1a1d Version 2026-08-13 19:25:07 +02:00
Laurent Destailleur
368f3d74b7 Debug v24 2026-08-13 19:21:32 +02:00
Laurent Destailleur
4679c736ed Automated merge from 24.0 to develop 2026-08-13 17:54:41 +02:00
Laurent Destailleur
2469bb54ae Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into 24.0 2026-08-13 17:48:25 +02:00
Laurent Destailleur
fcaa87c34d Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into 24.0 2026-08-13 17:41:57 +02:00
Laurent Destailleur
48958ae565 Automated merge from 22.0 to 23.0 by tool pullmerge.sh 2026-08-13 17:38:17 +02:00