Commit graph

3434 commits

Author SHA1 Message Date
Laurent Destailleur
18d0c251e1 Doc 2026-06-06 16:41:45 +02:00
Laurent Destailleur
ae3fa68698 Clean dump file 2026-06-04 23:28:05 +02:00
Laurent Destailleur
e10ed7b38b Test check on checksum 2026-06-04 22:57:30 +02:00
Laurent Destailleur
348e96f4c0 Merge branch 'lne_audit_init_20260601' of
git@github.com:Dolibarr/dolibarr.git into develop
2026-06-03 19:44:59 +02:00
Laurent Destailleur
d50413f77f Update dump file 2026-06-02 20:31:27 +02:00
Laurent Destailleur
9864f652dc Doc 2026-06-02 04:48:59 +02:00
Laurent Destailleur
ac4a64ef0a Fix init demo 2026-06-02 04:38:46 +02:00
Laurent Destailleur
47ad274b0b Fix demo file 2026-06-02 04:28:58 +02:00
Laurent Destailleur
ec32e34c02 Update tool for test 2026-06-02 04:28:34 +02:00
Laurent Destailleur
197293da0b Update tool for test 2026-06-02 04:26:00 +02:00
Laurent Destailleur
5a2bded38b Fix delete sql 2026-06-02 03:43:53 +02:00
Laurent Destailleur
da3ad23825 Debug tool 2026-06-02 02:46:01 +02:00
Laurent Destailleur
ba8a23cdc4 Enhance demo tool 2026-06-02 02:15:01 +02:00
Laurent Destailleur
a09519ce41 Fix phan 2026-06-01 23:47:52 +02:00
Laurent Destailleur
b8f9d4ab78 Fix tool for generation of signatures 2026-06-01 22:55:42 +02:00
Laurent Destailleur
593f855244 Fix script to generate file 2026-06-01 20:10:17 +02:00
Laurent Destailleur
8ff57bfaf7 Fix generation of signature files 2026-06-01 19:57:57 +02:00
Laurent Destailleur
ebfc5955a3 Doc 2026-05-28 19:48:52 +02:00
Laurent Destailleur
87f2c4d2dc Clean dump 2026-05-28 00:04:34 +02:00
Laurent Destailleur
609e234639 Doc 2026-05-27 23:31:54 +02:00
Laurent Destailleur
75b7cadc92 Update sql 2026-05-27 23:11:37 +02:00
Laurent Destailleur
b86b1c4ada Enhance test tool 2026-05-27 23:03:44 +02:00
Laurent Destailleur
cb4f7e361b Doc 2026-05-27 22:43:11 +02:00
Laurent Destailleur
754f991798 Debug v24 2026-05-26 17:12:48 +02:00
Laurent Destailleur
16956c092a Debug 2026-05-26 16:58:26 +02:00
Laurent Destailleur
b87149d839 More complete setup page 2026-05-26 13:52:34 +02:00
github-actions[bot]
ade06212fe
PHPStan > Update baseline (#38436)
Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>
2026-05-26 05:17:58 +02:00
VIAL-GOUTEYRON Quentin
fefbe81380
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object

Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.

- NamingContract: canonical ordered substitution map (12 tokens with object,
  7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
  processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
  for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
  mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
  XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
  (case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions

* fix(initobject): apply object substitution to all module PHP files

After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.

* fix(initmodule): prevent array_merge from renumbering the '500000' key

PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.

Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.

* Fix initapi: apply header substitution after addObjectsToApiFile

addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.

'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.

* Move NamingContractTest to core test directory

NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).

Updated require_once paths accordingly.

* fix useless file

* fix(phpcs): add missing @param descriptions and function docblocks

- NamingContract: merge adjacent string literals in exception message,
  add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
  in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
  methods, merge unnecessary string concat on template variable

* fix(phan/phpstan): remove readonly, add baselines for test file

- NamingContract: replace readonly properties with plain public string
  (readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
  for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
  declaration and method.notFound on each assertion call (PHPUnit not
  in phpstan bootstrap, consistent with CommonClassTest.class.php)

* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound

- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
  (typed properties require PHP 7.4, phan min target is 7.2 — warning only
  but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
  called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
  comment on class declaration (docblock placement not picked up by phpstan)

* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock

- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
  (same pattern as l.577 and l.587 for identical dolReplaceInFile calls
  where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
  docblock before class declaration (inline // comment not picked up by phpstan
  on class declarations; separate docblock matches CommonClassTest.class.php pattern)

* Update baseline.txt

* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods

* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 14:52:38 +02:00
MDW
80d8a459e1
Qual: Fix Hookmanager::executeHooks() notices with extended type (#38416)
# Qual: Fix Hookmanager::executeHooks() notices with extended type

Add int as possible key type to array corrects multiple notices.
2026-05-25 14:43:57 +02:00
MDW
180088d1ee
Qual: Add missing sqlite3 stub for Phan (#38426)
# Qual: Add missing sqlite3 stub for Phan

About 43 Phan notices on https://cti.dolibarr.org are present
because of missing information about SQLite3.
This stub and configuration change adds the information.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 13:30:24 +02:00
Laurent Destailleur
b045de9e9b Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-05-25 01:09:03 +02:00
Laurent Destailleur
f32a4884e8 Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 2026-05-25 01:07:38 +02:00
Laurent Destailleur
bd97fbd653 Fix debian package 2026-05-25 01:01:08 +02:00
MDW
f55e7998cc
Qual: Fix Phan notices, set PHP min to 7.2 to avoid some (#38400)
* Qual: Fix Phan notices, set PHP min to 7.2 to avoid some

* Qual: Fix Phan and PHPStan notices

* Update apstats.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-23 04:09:56 +02:00
MDW
f6cc55454e
Qual: Update Phan baseline and config using global variables for dolibarr_* (#38395)
# Qual: Update Phan baseline and config using global variables for dolibarr_*

- Add new global variables to config.php to improve static analysis
- Remove dolibarr_* global variable references in filefunc.inc.php
- Update Phan baseline
2026-05-22 14:19:29 +02:00
Laurent Destailleur
a38192682c CI 2026-05-22 12:17:17 +02:00
MDW
b34c5530d9
Qual: Fix PHPStan notices (#38388)
* Qual: Fix ftp related typing for PHPStan

* Qual: Fix multiple PHPStan notices

* Qual: Update PHPStan baseline
2026-05-22 11:22:11 +02:00
MDW
bc2a6c68f0
Qual: Fix PHPStan notice about menumanager (#38360)
* Qual: Fix PHPStan notice about menumanager

# Qual: Fix PHPStan notice about menumanager

Declare type for MenuManager $menumanager typically defined in menu.inc.php

* Qual: Update PHPStan baseline

# Qual: Update PHPStan baseline

Removed the warning for the undefined variable $menumanager in style.css.php.
2026-05-22 10:39:43 +02:00
Laurent Destailleur
2468b51a4d Reduce exceptions 2026-05-22 10:36:30 +02:00
MDW
1a66f03134
Qual: Update dol_ftp_connect return type for PHPStan (#38362)
# Qual: Update dol_ftp_connect return type for PHPStan

Fixes Phan notices in ftp/index.php

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-22 10:26:58 +02:00
Laurent Destailleur
97f51c1bc7 CI 2026-05-22 08:31:54 +02:00
MDW
23e2541e55
Qual: Fix PHPStan neon files indentation (#38337) 2026-05-22 08:13:17 +02:00
Laurent Destailleur
7d2851ec48 CI 2026-05-21 22:32:22 +02:00
MDW
bd1abf66e4
qual: Update return type annotations in Projects::getRoles() (#38338)
The return type annotations for the method Projects::getRoles() have been updated from array<object> to list<string> to better reflect the actual return type. This change was also reflected in the phpstan-baseline.neon file to maintain consistency.
2026-05-21 21:54:31 +02:00
MDW
0a64b8b47d
Qual: Update parameter type, fixes PHPStan, Phan (#38339)
# Qual: Update parameter type, fixes PHPStan, Phan

Updates the _cleanObjectDatasRate method parameter types.
2026-05-21 21:53:20 +02:00
Laurent Destailleur
3e3ca74a67 Debug AI assistant and MCP server 2026-05-20 01:27:19 +02:00
MDW
18b7fa0fd4
FIX: Add Ghostscript installation and caching for Windows CI (#38325)
* Exclude doctemplates as DB dependencies

* FIX: Add Ghostscript installation and caching for Windows CI

# FIX: Add Ghostscript installation and caching for Windows CI

Ghostscript is necessary for one of the tests that converts an image into a PDF.
This commit adds the necessary steps to install Ghostscript and cache it for the Windows CI workflow.
2026-05-18 19:44:48 +02:00
MDW
1b94023550
Qual: Better error message for missing translation (#38313)
# Qual: Better error message for missing translation

Update error message to include 'error - ' after the line:offset: text
to correspond to an emacs like error message recognized by logToCs
which allows it to appear as a github annotation
2026-05-18 03:52:53 +02:00
MDW
4b191b12b4
Qual: Upgrade tool versions in pre-commit setup (#38233)
* Qual: Upgrade tool versions in pre-commit

* Qual: avoid codespell notice

* Qual: Fix spelling

* Qual: Fix spelling

* Qual: Add spelling exceptions

* Qual: whitespace/line-ending
2026-05-18 03:05:44 +02:00
MDW
24bba6caa9
Qual: Fix PHPStan for ldap, pgsql, odtphp (#38246)
# Qual: Fix PHPStan for ldap, pgsql, odtphp

- Adjust typing in ldap and pgsql class to fix PHPStan notices;
- Exclude all files for odtphp from analysis (external lib);
- Update PHPStan baseline.
2026-05-18 03:01:50 +02:00