Commit graph

154638 commits

Author SHA1 Message Date
MDW
c72056ae34
Qual: Correct language detection in moderation workflow (#38681)
# Qual: Correct language detection in moderation workflow

Fix "TypeError: franc is not a function"
- Converting language detection to an async function
- Adding Scottish language detection (locally, an English sentence was detected as Scottish)

Co-authored-by: Alexandre SPANGARO <alexandre.spangaro@gmail.com>
2026-06-11 09:34:27 +02:00
Quentin-Seekness
08997e0ea2
Merging company children on company merge (#38350)
* Merging company children on company merge

BugFix :  When we merge two companies with children companies linked to them, we loose the children of the origin (incoming) company.

This approach allows children to be merged as well

* Remove orphan translation

* Update societe.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-11 09:33:50 +02:00
Pichinov-Jose
9ccdbff271
New: granular right for AI Assistant usage (#38312)
The AI module currently has no declared rights ($this->rights stays
empty), so per-user/group attribution of "who is allowed to talk to
the LLM" is not possible. Assistant access is gated only by
isModEnabled('ai'), meaning any authenticated user on an AI-enabled
install can send organisational data to the configured LLM provider
-- which is a GDPR / EU AI Act concern (see issue #38331).

This patch introduces ONE proper Dolibarr right that admins can
attribute per user/group via the standard permission UI
(Users -> Permissions):

  ai/assistant/use   -> right to use the AI Assistant page
                        NOT granted by default; admins must
                        explicitly assign it to authorized users

Per the feedback from @sonikf and @eldy on PR #38312:

- Setup access intentionally stays a hard-coded $user->admin check.
  The technical setup of the AI module (API keys, provider URLs) is
  an admin task in line with how every other Dolibarr module is
  configured -- a dedicated 'ai/setup/write' right would only
  duplicate responsibility that admins already hold.

- ai/assistant/use defaults to OFF (not granted) so that, on a
  fresh install or after enabling the module, no user can talk to
  the LLM until the admin explicitly authorises them. This matches
  the EU AI Act expectation that AI usage is an opt-in per-user
  decision owned by the GDPR DPO / AI module DPA.

Access checks added:

- htdocs/ai/assistant/index.php
    + if (!$user->hasRight('ai','assistant','use')) accessforbidden();
  Added after the existing isModEnabled('ai') / AI_MCP_ENABLED gate.

- htdocs/ai/assistant/parse_intent.php
    + if (!$user->hasRight('ai','assistant','use')) accessforbidden();
  Defence in depth: the AJAX endpoint that actually talks to the LLM
  cannot be reached by a user who lacks the right, even via direct
  call bypassing the Assistant page.

- htdocs/ai/admin/setup.php
    Unchanged behaviour: $user->admin check stays (just a comment
    clarifying the reason).

The right is declared between the existing MODULEBUILDER PERMISSIONS
placeholders in modAi.class.php so the standard right-installation
flow applies: after applying this change, administrators must
disable/re-enable the AI module once to register the new right in
llx_rights_def (existing Dolibarr mechanism, no migration script
needed).

Tested:
- Fresh non-admin user (no extra right granted) -> Assistant page
  shows accessforbidden; parse_intent.php also blocks direct call.
- Same user with 'ai/assistant/use' granted by an admin ->
  Assistant accessible, LLM round-trip works.
- Admin user -> Assistant accessible transparently (admins hold
  every declared right by definition); Setup accessible via the
  unchanged $user->admin check.
- Module disabled -> both still blocked by the existing
  isModEnabled gate.

Refs: #38331 (EU AI Act / GDPR for the AI module).

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-11 09:33:14 +02:00
Alexandre SPANGARO
410a07f628
Merge pull request #38685 from aspangaro/24_matchingproblem
Matching - Remove harcoded error
2026-06-11 07:48:49 +02:00
Alexandre SPANGARO
9d86908e6c Better comment 2026-06-11 06:45:12 +02:00
Alexandre SPANGARO
c06ddd5a2f Spaces 2026-06-11 06:34:46 +02:00
Alexandre SPANGARO
d51d5f8f7b Matching - Remove harcoded error 2026-06-11 05:46:17 +02:00
Alexandre SPANGARO
dc3e157cb2
Merge pull request #38684 from aspangaro/24_CRSFlinkpdf
Accountancy - CRSF problem on export to pdf
2026-06-11 04:43:14 +02:00
Alexandre SPANGARO
4d3c181141 Merge branch 'develop' into 24_CRSFlinkpdf 2026-06-11 04:33:35 +02:00
Alexandre SPANGARO
aa0bdaf43e Accountancy - CRSF problem on export to pdf 2026-06-11 04:02:52 +02:00
Alexandre SPANGARO
b704e8ee46
Merge pull request #38678 from aspangaro/24_MATCHING
Finalize general partial matching
2026-06-11 03:46:51 +02:00
Alexandre SPANGARO
507c320484 Merge branch 'develop' into 24_MATCHING 2026-06-11 03:24:34 +02:00
Alexandre SPANGARO
0b417d39e1 CI 2026-06-11 03:23:59 +02:00
Alexandre SPANGARO
cc986487e8
Merge branch 'develop' into 24_MATCHING 2026-06-11 03:06:32 +02:00
Laurent Destailleur
f1d20d38bb Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-06-10 23:43:21 +02:00
Laurent Destailleur
85c4766b80 Debug v24 2026-06-10 23:31:55 +02:00
Alexandre SPANGARO
986108f9b2 Finalize general partial matching 2026-06-10 22:51:13 +02:00
John BOTELLA
cffe700160
New : hidden conf to remove PDF total discount amount (order PDF) (#38454)
* Fix inverted conf

* add show discount amout on PDF conf for einstein

* Add conf order granularity

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-10 22:10:52 +02:00
w3houde
ad2ca4c598
Fix #38279 expose Subscription dates and note under documented names in API (#38674)
GET /api/index.php/members/{id}/subscriptions returned the raw
Subscription object fields (dateh, datef, note_public, amount) while
POST /api/index.php/members/{id}/subscriptions takes start_date,
end_date, amount, label. A client that fetches existing subscriptions
to push them back has to translate the field names by hand.

Per @eldy review on PR #38556, address this with the renaming that
fits the rest of the codebase:

- Add date_start / date_end aliases on the Subscription class. The
  date_start / date_end naming convention is already used by other
  objects (task, expense, holiday), so the alias matches the existing
  contract instead of inventing a new pair of names.
- Do not introduce a 'label' alias. note_public is already the
  documented field on v24; declare it as a real property so phpstan
  stops flagging the dynamic-property write.
- _cleanObjectDatas on the Subscription branch now sets only
  date_start and date_end. note_public is left as the existing
  property name. dateh / datef stay populated for backward
  compatibility with existing consumers.

Develop-branch version of PR #38556 (closed).

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-10 21:16:27 +02:00
MDW
29b60cd552
Fix: Update comment moderation logic (#38451)
# Fix: Update comment moderation logic

Inspired by #38450 to help fix/complete the moderation script,
this updates the moderation script to:

- Add language detection for non-English comments
- Implement profanity filtering
- Check for off-topic content
- Improve forbidden link detection
- Add owner exemption logic
- Enhance error handling and logging
- Add a message indicating why the comment was deleted.

*To configure the moderation lists:*

- Go to repository Settings > Secrets > Actions
- Add `MODERATION_PROFANITY` secret containing a JSON array of terms
- Add `MODERATION_OFFTOPIC` secret containing a JSON array of phrases
- Example format for each: `["term1","term2","term3"]`

Resources for priming the PROFANITY and OFFTOPIC lists:
- https://www.cs.cmu.edu/~biglou/resources/ (first link)
- https://github.com/OOPSpam/spam-words/blob/main/spam-words-EN.txt

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-10 21:15:32 +02:00
Balowser
0874c86165
Fix empty recipient when sending email after event (#38489)
* Fix empty recipient when sending email after event
  registration

* Fix code style: use tabs for indentation, remove trailing whitespace

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-10 21:15:24 +02:00
dzprod
6c4fef2c0b
Fix dropFIX: TakePOS dropdown user menu layout broken missing side-nav-vert context under MD themedown user-header layout in TakePOS (#38462) 2026-06-10 20:41:19 +02:00
John BOTELLA
13c70559b5
Fix inverted conf (#38453)
* Fix inverted conf

* Add conf invoice granularity
2026-06-10 20:34:49 +02:00
John BOTELLA
269add8bd0
add show discount amount on PDF conf for propale (#38455) 2026-06-10 20:34:08 +02:00
Laurent Destailleur
fc380fc584 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-06-10 20:01:00 +02:00
Laurent Destailleur
3afe444746 CI 2026-06-10 20:00:47 +02:00
Vincent Maury
5c552554ab
Add thead in main responsive table of list (#38470)
It was asked to me to fix the head of main projects table list
Without adding thead's markups it's impossible to achieve this in css, because the're 2 tr head's lines
2026-06-10 20:00:24 +02:00
Frédéric FRANCE
536b66c119
clean code (#38463)
* clean code

* fix

* fix
2026-06-10 19:53:55 +02:00
github-actions[bot]
65233b182f
PHPStan > Update baseline (#38465)
Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>
2026-06-10 19:52:57 +02:00
Lucas Marcouiller
7d853349c4
Fix port scanning ghsa 6w89 8vmc mjpc (#38473)
* TODO

* Add test on server port for smtp

---------

Co-authored-by: Hystepik <lmarcouiller@dolicloud.com>
Co-authored-by: Alexandre SPANGARO <alexandre.spangaro@gmail.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-10 19:49:25 +02:00
Frédéric FRANCE
855a00ae09
clean code (#38472)
* clean code

* clean code

* clean code

* clean code

* fix

* clean code

* clean code

* clean code

* clean code

* clean code
2026-06-10 19:31:35 +02:00
John BOTELLA
758f0a5482
Fix + New(but fix too) : FIX UI for memo text auto resize + form setup improvement (#38485)
* Fix langs cache reload spam

* Fix langs cache reload spam

* Fix UI font size auto resize

* Patch UI for memo and add setup options

* remove useless var

* fix var type

* fix php stan error

* fix php stan error

* fix php stan error
2026-06-10 19:24:14 +02:00
hansemschnokeloch
a4ebce9e59
fix moderation workflow (#38487) 2026-06-10 19:21:46 +02:00
w3houde
eafe7741d0
Fix #38058 Reset top menu context on entry of admin/modules.php (#38503)
The modules list is a setup hub but it never declares its own menu
context, so loadMenu in core/menus/standard/eldy_menu.php falls back
to whatever value is still in $_SESSION["mainmenu"]. After opening
a module's config page the session keeps that module's mainmenu;
clicking "Back to list of modules" then leaves the previous module
highlighted on the list, and clicking the gear icon of another
module inherits the same stale value until that next page sets its
own context.

Force $_GET["mainmenu"] = "home" at the very top of modules.php when
the caller did not provide a mainmenu, before main.inc.php is loaded.
loadMenu then sees the GET value, writes "home" into the session and
the top menu reflects the setup hub. An explicit mainmenu in the URL
(for example the "?mainmenu=home" links emitted by admin/index.php
and the SetupIsReadyForUse string in modules.php itself) keeps full
precedence.

Reported by @ccrica.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-10 19:20:20 +02:00
Laurent Destailleur
6ecf7b7c16 Remove not required hack param 2026-06-10 19:14:07 +02:00
Laurent Destailleur
b9b44cc890 Automated merge from 23.0 to develop 2026-06-10 19:13:04 +02:00
Laurent Destailleur
d00ba1d8ae Automated merge from 22.0 to 23.0 by tool pullmerge.sh 2026-06-10 19:12:32 +02:00
Laurent Destailleur
38065c94b7 Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-06-10 19:08:54 +02:00
Laurent Destailleur
2b3909aa85 Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-06-10 19:08:51 +02:00
w3houde
782d521978
Fix #36079 keep online signature URL from ending with a bcrypt trailing dot (#38526)
`getOnlineSignatureUrl()` ends each public signature URL with
`&securekey=` followed by the output of `dol_hash(..., '0')`. With the
default `MAIN_SECURITY_HASH_ALGO = password_hash`, that output is a
bcrypt string whose alphabet is `[./A-Za-z0-9]`, so a non-trivial share
of generated URLs legitimately end with `.` or `/`.

Gmail and several mobile mail clients autolink plain-text URLs but
drop trailing punctuation, so the recipient clicks on a URL with the
last character missing and gets a securekey mismatch error
(`Bad value for securitykey`). The user-facing symptom is exactly the
one in #31464.

When multicompany is enabled, the URL already ends with `&entity=N`,
which sidesteps the issue. For installations without multicompany,
append a stable trailing `&_=1` so the URL never ends with the hash.
The receiver in `public/onlinesign/newonlinesign.php` does not read
`_`, only `source`, `ref`, `securekey` and (when multicompany) `entity`,
so adding the parameter has no behavior impact and existing links keep
verifying as before. Only the real URL (mode 0) is affected, not the
mode 1 preview shown in the admin setup.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-10 19:08:26 +02:00
Lucas Marcouiller
d7b1bc7921
Fix some php stan warnings (#38670)
* Fix soem php stan warnings

* fix CI

---------

Co-authored-by: Hystepik <lmarcouiller@dolicloud.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-10 16:53:54 +02:00
Laurent Destailleur
ebbece26a0 Fix travis 2026-06-10 16:51:46 +02:00
Jyhere
f29e9e5eb2
FIX Add geoDataType handling for extrafield updates (#38655)
* Add geoDataType handling for extrafield updates

* Geo extrafield update fix, sanitize SQL update statement

* Update commonobject.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-10 16:34:40 +02:00
Laurent Destailleur
a051e91ffd Clean code 2026-06-10 16:28:13 +02:00
w3houde
21cea7627a
Fix #33042 divide by multicurrency_tx when checking minimum price (#38542)
The minimum-price guard on the customer invoice, customer order and
customer proposal forms compares the entered unit price to the
product's price_min. When the document is in a foreign currency the
unit price is provided in the foreign currency ($pu_ht_devise), so
it must first be converted back to the base (company) currency before
the comparison.

card.php was multiplying by $currency_tx:

    $pu_equivalent = (float) $pu_ht_devise * $currency_tx;

but multicurrency_tx is defined as 'units of foreign currency per
1 unit of base', exactly as price.lib.php uses it
(calcul_price_total at line 181):

    $pu = $pu_devise / $multicurrency_tx;

With the reporter's example (1 MXN = 0.055 USD, so tx = 0.055,
product min price = 1000 MXN, entered 55 USD), the wrong direction
gives 55 * 0.055 = 3.025 MXN < 1000 MXN and the form errors out with
'CantBeLessThanMinPrice', even though 55 USD is exactly 1000 MXN.
Dividing yields 55 / 0.055 = 1000 MXN and the check passes.

Mirror calcul_price_total's direction at all four invoice sites
(htdocs/compta/facture/card.php lines 2503/2506 and 2684/2687) plus
the corresponding sites in htdocs/commande/card.php and
htdocs/comm/propal/card.php. Documents in the base currency
($pu_ht_devise empty) are not affected because the conversion
branch is gated on $pu_ht_devise being non-empty.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-10 16:16:35 +02:00
Laurent Destailleur
c49ed304ff Fix label 2026-06-10 15:56:19 +02:00
Laurent Destailleur
0afc6155f4 Label of field 2026-06-10 15:54:44 +02:00
Laurent Destailleur
6c5a86a1c7 Debug v24 2026-06-10 15:50:02 +02:00
Laurent Destailleur
14eaa935a3 Fix phan 2026-06-10 15:28:24 +02:00
Laurent Destailleur
b6a109db31 Prepare code to use an external obfuscation code. 2026-06-10 15:13:57 +02:00