dolibarr/dev/tools
Frédéric FRANCE a0b0e44278
NEW Link manage extrafields and phpunit test for the class (#39514)
* NEW: Add extrafields support to Link class

Link now declares isextrafieldmanaged and wires fetch_optionals()/
insertExtraFields()/deleteExtraFields() into fetch(), fetchAll(),
create(), update() and delete(), matching the llx_links_extrafields
table added previously.

* FIX: Several bugs in Link class review

- create(): wrong duplicate-record error message (copy-pasted from
  Societe, referenced undefined $this->name) replaced by the generic
  ErrorDuplicateField, consistent with update().
- create()/update(): missing "NoURL" translation key replaced by the
  standard ErrorFieldRequired pattern.
- fetch(): guard against running an unfiltered query (no rowid, no
  hashforshare) that could silently return an arbitrary link; a caller
  in actions_linkedfiles.inc.php could hit this when 'linkid' was
  missing from the request.
- actions_linkedfiles.inc.php: check fetch() result with `> 0` instead
  of a truthy test, since -1 (error) is truthy in PHP.
- delete(): add User type hint (consistent with create()/update()) and
  a $notrigger parameter to optionally skip the LINK_DELETE trigger.
- update(): fix copy-pasted docblock ("third party" -> "link").

* NEW: Add PHPUnit test for Link class

Covers create/fetch/update/fetchAll/count/delete, plus regression
tests for the two bugs fixed in the previous commit: create() rejects
an empty url, and fetch() rejects a call with neither rowid nor
hashforshare instead of returning an arbitrary record.

* FIX Phan false positive on $object in actions_linkedfiles.inc.php

Phan's ambient type inference for the loosely-typed global $object in
this shared include file was picking up CommonSocialNetworks (an
unrelated trait, not even a class), reported as undeclared
->id/->entity/->addThumbs()/->delThumbs() in a real CI Phan run on
this branch, once this file was analyzed on its own via the
changed-files file-list (this file has no prior baseline entry, so it
was apparently never previously exercised in isolation like this).

Force $object's type explicitly to CommonObject via the same
@phan-var-force string-literal idiom this file already uses for
$upload_dir/$upload_dirold/$confirm/$forceFullTextIndexation -
CommonObject genuinely declares addThumbs()/delThumbs(), which
resolves those two errors outright. $id/$entity remain reported as
PhanUndeclaredProperty (CommonObject itself does not declare them,
only its concrete subclasses do at runtime) - baseline-suppress that
for this file the same way it is already suppressed for the sibling
shared-include files actions_addupdatedelete.inc.php,
actions_massactions.inc.php and actions_sendmails.inc.php, which have
the exact same $object typing situation.
2026-08-19 02:18:46 +02:00
..
api/macos Clean files 2026-01-07 19:01:54 +01:00
codespell Qual: Fix 'SqlInjection' notices (#39228) 2026-07-20 15:26:30 +02:00
phan NEW Link manage extrafields and phpunit test for the class (#39514) 2026-08-19 02:18:46 +02:00
php-cs-fixer Qual: Update PHP-CS-Fixer configuration and DolibarrModules class 2025-11-27 01:08:46 +01:00
phpstan Add opensurveysondage phpunit test (#39522) 2026-08-14 14:57:48 +02:00
rector Qual: Fix french comments and improve detector (#39026) 2026-07-01 12:26:51 +02:00
test Clean files 2026-01-07 19:01:54 +01:00
.gitignore NEW: dev tools: add github webhook handler to auto-assign pull requests (#34579) 2025-06-20 15:45:31 +02:00
apstats.php Qual: Fix Phan notices, set PHP min to 7.2 to avoid some (#38400) 2026-05-23 04:09:56 +02:00
dolibarr-mysql2pgsql.pl Qual: Add perltidy & perlcritic + updates to fix notices. (#36370) 2025-11-23 01:52:07 +01:00
dolibarr-postgres2mysql.php Reduce exceptions 2026-05-22 10:36:30 +02:00
fixaltlanguages.sh
fixaltlanguages_pre-commit.sh
fixcopyrightheader.php Fix: Copyright generation when single year 2025-01-05 15:16:18 +01:00
fixdosfiles.sh
fixduplicatelangkey.sh
fixduplicatelanglines.sh
fixnotabfiles.sh
fixperms.sh
fixsnakeCaseToCamelCase.sh Clean files 2026-01-07 19:01:54 +01:00
fixutf8bomfiles.sh
github_authors_and_commits_bydate.sh
github_commits_byversion.sh Fix CI 2025-11-26 21:49:07 +01:00
github_lines_byuser.sh
github_pr_reviewers_webhook.php NEW: dev tools: add github webhook handler to auto-assign pull requests (#34579) 2025-06-20 15:45:31 +02:00
make_sprite.sh
optimize_images.sh Qual: Update pre-commit hooks (#36262) 2025-11-17 21:50:29 +01:00
resize_window.sh Clean files 2026-01-07 19:01:54 +01:00