Commit graph

155236 commits

Author SHA1 Message Date
Jam Balaya
67aadf2cba
FIX: undefined variables from wrong variable names (#39115)
Several pages read a variable that is never defined on that page (copy/paste
from another page), so PHPStan level 10 flags 'Variable $x might not be
defined' and PHP 8 emits an undefined-variable warning with a null value:

- reception/card.php: $reception -> $object (matches the 10 other builddoc
  blocks in the same file; otherwise the output PDF language is wrong)
- loan/payment/card.php: $object->id -> $id (page uses $id; matches the
  adjacent enabled-button line)
- opensurvey/card.php: ConfirmRemovalOfPoll uses $id -> $numsondage
  (otherwise the confirmation message placeholder is empty)
- opensurvey/results.php: guard $expiredate with !empty() (never defined on
  this page; still falls back to $object->date_fin)
- projet/card.php: guard $morecss with !empty() (never defined here)

No behaviour change beyond removing the undefined-variable reads.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 16:08:10 +02:00
Jam Balaya
ae463f2234
FIX: stocktransfer addcontact reports false success without a valid object (#39118)
In htdocs/product/stock/stocktransfer/stocktransfer_contact.php the
'addcontact' action assigns $result only inside 'if ($object->id > 0)', but
the success test 'if ($result >= 0)' runs unconditionally. On a POST with no
id/ref the object is not fetched ($object->id == 0), so $result is undefined
and 'null >= 0' evaluates to true, redirecting as if the contact was added.

Initialize $result = -1 at the start of the block so the missing-object case
takes the error branch instead of a false-success redirect. PHPStan level 10
also flagged 'Variable $result might not be defined' here.
2026-07-13 16:07:05 +02:00
minimexat
9b5229ef3a
FIX: #39063 prevent self-edit users updating other notes (#39123)
* FIX: #39063 prevent self-edit users updating other notes

* Update note.php

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 15:59:46 +02:00
minimexat
6eb81e0166
FIX: check document list read permissions (#39131)
* FIX: Check document list read permissions

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 15:50:21 +02:00
minimexat
946b19276d
FIX: escape cron setup key (#39127)
* FIX: escape cron setup key

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 15:49:39 +02:00
minimexat
55c48e1fba
FIX: scope login API token reset to user row (#39132)
* FIX: Scope login API token reset to user row

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 15:48:37 +02:00
minimexat
b2a2c99553
FIX: #39053 prevent non-admin users deleting admin accounts (#39119)
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
2026-07-13 15:48:01 +02:00
Laurent Destailleur
d01495d6a7 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-13 15:45:07 +02:00
Laurent Destailleur
94517cbda6 Remove field never used 2026-07-13 15:44:57 +02:00
minimexat
a0e15bf915
FIX: encode backtourl in Google OAuth callback URL (#39128)
* FIX: Encode backtourl in Google OAuth callback URL

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 15:42:17 +02:00
minimexat
c95e337c40
FIX: Require delete permission for email templates API (#39134)
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 14:59:15 +02:00
minimexat
bd9e8a55e8
FIX: Delete establishment by object rowid (#39135)
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 14:29:42 +02:00
minimexat
0442259154
FIX: restrict establishment setup API to admin users (#39137)
* FIX: Restrict establishment setup API to admins

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 14:29:21 +02:00
minimexat
9e709619d9
FIX: correct security event entity SQL (#39141)
* FIX: Correct security event entity SQL

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 14:28:27 +02:00
Laurent Destailleur
3e95b7057c Fix bad picto on not allowed left menu 2026-07-13 13:39:25 +02:00
Laurent Destailleur
1d5acc6268 FIX bad dol_eval test when method is wrong 2026-07-13 13:17:41 +02:00
Laurent Destailleur
1b4f92b543 Fix warning 2026-07-13 12:13:35 +02:00
Laurent Destailleur
22c3b23d56 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-13 12:07:16 +02:00
minimexat
9105fa4813
FIX: escape session list fields (#39129)
* FIX: Escape session list fields

* FIX: Cast nullable session fields before escaping

* Update ChangeLog with new features and fixes

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 12:05:08 +02:00
Laurent Destailleur
f96a4af9f3 Doc 2026-07-13 12:04:47 +02:00
minimexat
6b71832a44
FIX: escape cron command attributes (#39126)
* FIX: escape cron command attributes

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 12:02:09 +02:00
minimexat
049851bc31
FIX: require invoice right for order mass invoice action (#39139)
* FIX: Require invoice right for order mass invoice

* Update list.php

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 12:01:16 +02:00
Laurent Destailleur
0726bf945a Typo 2026-07-13 11:59:49 +02:00
Laurent Destailleur
d1e679633f Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-13 11:48:52 +02:00
Laurent Destailleur
2cd4aa3abb Doc 2026-07-13 11:48:42 +02:00
minimexat
95701131bc
FIX: use generic online signature token fallback (#39138)
* FIX: Use generic online signature token fallback

* FIX: Avoid nullable source in signature token lookup

* FIX: Initialize online signature message

* FIX: Print online signature error directly

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
2026-07-13 11:45:45 +02:00
Laurent Destailleur
f6b4073c3f Fix fatal error 2026-07-13 11:37:27 +02:00
Laurent Destailleur
80ace0d0cb Complete template issue 2026-07-13 10:50:17 +02:00
Laurent Destailleur
5ec93d9c94 Debug v24 2026-07-13 10:35:52 +02:00
Laurent Destailleur
8e4cb12e3b Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-13 10:02:45 +02:00
Laurent Destailleur
d02749d15b css 2026-07-13 10:02:23 +02:00
Pichinov-Jose
1aeec05d80
Fix: MCP server propagates authenticated service user to tools (#38294)
The MCP server (htdocs/ai/server/mcp_server.php) loads a service user
from AI_MCP_USER_ID but does not expose it as the PHP global $user.
Several tool classes call 'global $user' to identify the caller --
they therefore see no authenticated user in HTTP MCP context (no PHP
web session exists) and return 'User not authenticated' even though
authentication via X-API-Key/Bearer has already succeeded.

This breaks roughly 40% of the MCP tools shipped by the module when
called from external clients (Claude Desktop Custom Connectors,
Claude Code CLI, MCP Inspector, custom scripts).

Two complementary fixes applied:

1. mcp_server.php: after successfully loading the service user,
   assign it to $GLOBALS['user'] and the local $user variable. This
   acts as a safety net for any tool (current or third-party) that
   relies on the legacy 'global $user' pattern.

2. Three tool classes harmonize their constructor signatures with
   the McpHandler contract -- new $className($db, $user, $conf):
   - ToolCrudObjects (htdocs/ai/tools/crud_objects.class.php)
   - ToolInvoices (htdocs/ai/tools/invoices.class.php)
   - ToolReports (htdocs/ai/tools/reports.class.php)

   These now accept $user via constructor (matching the pattern
   already used in ToolThirdParty, ToolCategories, ToolProducts)
   and store it as $this->user. Methods that previously called
   'global $user' (execute, validateInvoice, payInvoice) now use
   the injected $this->user, with a fallback to the global for
   web-session contexts.

Tested with:
- create_other_document (proposal, supplier_invoice): works
- search_invoice, validate_invoice, pay_invoice: works
- get_sales_report, get_purchase_report: works
- AI Assistant web UI: unchanged, no regression
2026-07-13 06:57:42 +02:00
Jam Balaya
217e32c6c1
FIX: undefined $objcanvas/$socid in societe thirdparty canvas templates (#39116)
Canvas::display_canvas() (htdocs/core/class/canvas.class.php) includes these
templates from inside a method and only imports $db,$conf,$langs,$user,
$canvas,$form,$formfile via 'global'. $objcanvas and $socid are never
brought into that scope, so they were undefined at runtime (the templates
already reconstruct the thirdparty object from $GLOBALS['objcanvas']).

- Derive $socid from the in-scope thirdparty object ($soc->id / $object->id),
  fixing the empty socid used for $filedir/$urlsource/showdocuments().
- Replace the bare $objcanvas->control->object with the already-derived $soc
  (company) / $object (individual).

For the company template $socid was previously masked from PHPStan by a
'@var int $socid' docblock; it is now actually defined.
2026-07-11 14:19:44 +02:00
MDW
d8f9286a25
Qual: Fix database typo (DoliDb -> DoliDB) (#39060)
# Qual: Fix database typo (DoliDb -> DoliDB)
The database handler type was updated from `DoliDb` to `DoliDB` in both `bookkeepingtemplate.class.php` and `bookkeepingtemplateline.class.php`.
2026-07-10 17:51:12 +02:00
MDW
1a1eafe74f
Qual: Update PHPDoc for setAsSelect method (#39061)
# Qual: Update PHPDoc for setAsSelect method

- Update the type definition of the $fieldOptions parameter in the setAsSelect method to make the color, picto, labelhtml, and note fields optional.
2026-07-10 17:50:47 +02:00
Nathan
95bcefbb9e
FIX: #39068 Ignore warning text in product search (#39071) 2026-07-10 17:46:28 +02:00
Francis Appels
0a3ba8e740
Revert "NEW: Show bom net needs treeview by line position. (#37459)" (#39083)
* Revert "NEW: Show bom net needs treeview by line position. (#37459)"

This reverts commit b02f1a4ebf.

* Update changelog and fix stan

* fix stan
2026-07-10 17:44:53 +02:00
Nathan
7612b0f74d
fix: correct import types phpdoc (#39096) 2026-07-10 17:28:02 +02:00
Laurent Destailleur
831c241c44 Debug v24 2026-07-10 14:39:11 +02:00
Laurent Destailleur
f3e3f55d6c Debug v24 2026-07-10 14:34:25 +02:00
Laurent Destailleur
d03101fae1 Doc and clean code (viewimage and document must follow same rules) 2026-07-10 14:22:08 +02:00
Laurent Destailleur
24b1b99c89 Sec possible injection during import - reported by Michael Holmquist
(Hasplabs)
2026-07-10 01:47:02 +02:00
Laurent Destailleur
a37aef26f7 Trans 2026-07-09 23:56:10 +02:00
Laurent Destailleur
52391ad574 Debug v24 2026-07-09 23:55:10 +02:00
Laurent Destailleur
eabfca88c5 Fix option to show statistics pages in menu. 2026-07-09 23:37:45 +02:00
Laurent Destailleur
9c45956003 Debug v24 2026-07-09 23:20:58 +02:00
Laurent Destailleur
09907cd37d Debug v24 2026-07-09 23:06:32 +02:00
Laurent Destailleur
83f566d5ac Fix: default color of subtotal lines in PDF 2026-07-09 16:59:35 +02:00
Laurent Destailleur
986b067ce5 css 2026-07-09 16:26:08 +02:00
Laurent Destailleur
e9caac12bb Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-07 15:43:41 +02:00