Commit graph

154768 commits

Author SHA1 Message Date
Anthony Damhet
9cbb84c1ca
Fix: Using the Microphone (#38828) 2026-06-15 14:56:35 +02:00
Laurent Destailleur
5bcec58afb Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-06-15 14:32:59 +02:00
Laurent Destailleur
83174a5ba5 Prepare obfuscation key 2026-06-15 14:32:48 +02:00
Tanguy Chénier
17076a1e47
FIX Stock balance truncated to int for fractional qty (#38806)
calculateBalanceForProductBefore() cast the SUM of stock movement values
to (int), which truncated the fractional part. For products tracked in
fractional units (kg, liters, ...), the before/after period stock balance
displayed in the stock movement list (product/stock/movement_list.php) was
wrong (for example a real balance of 10.5 was shown as 10).

Cast the computed balance to (float) instead and update the method return
type accordingly.

Add a PHPUnit test (MouvementStockTest::testCalculateBalanceForProductBefore)
that records a fractional reception and checks the returned balance is not
truncated.
2026-06-15 14:18:44 +02:00
Laurent Destailleur
acfef04a06 Prepare obfuscation key 2026-06-15 13:51:52 +02:00
Laurent Destailleur
d66baa773d Prepare obfuscation key 2026-06-15 12:41:18 +02:00
Laurent Destailleur
40f571ebca Prepare obfuscation key 2026-06-15 12:33:55 +02:00
Laurent Destailleur
626c3cfe79 Debug v24 2026-06-15 11:10:51 +02:00
Laurent Destailleur
c339fc10a9 Show amount on tooltip 2026-06-15 10:52:59 +02:00
Laurent Destailleur
fe0cb1435e Look and feel 2026-06-15 10:51:17 +02:00
Laurent Destailleur
c13df1d46a Trans 2026-06-15 10:25:27 +02:00
Laurent Destailleur
0a67c9ffcf Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-06-15 10:24:11 +02:00
Laurent Destailleur
ad8cd7c0e1 Fix permission on paiment 2026-06-15 10:23:55 +02:00
Vincent de Grandpré
5b95397100
37423 DiscountAbsolute model refactor (#38808)
* opérations CRUD du modèle DiscountAbsolute

* taux de taxes locales et types ajoutés au modèle

* canvas et méthode paramétrées pour test unitaires

* test création et lecture OK

* #37423 - DiscountAbsolute model refactor to have localtaxes on a remise - unit tests completed

* phpcs

* remove comment

* phpcs local

* remove attributes in favor of parent

* phpstan -  type de données et correction tests unitaires

* typage des retours

* .

* exceptions Phan sur test unitaire

* commentaire de fonction bien formatté

* directives phan depuis CommonClassTest

* avertissements phan

* removing localtaxes from multicurrency attributes as not supported by data model

* interface testing from  ThirdParty comm/remx.php with added multicurrency ttc support

* phpcs OK

* phan typage

* merci phan

* buyer / seller roles of thirdparty integrity

* attribute typo in fetch

* setabsolutediscount and converttoreduc controller actions take into account localtaxes

* usage of localtaxes for discounts in objects

* phpcs

* stan typing

* integrity of multicurrency for generated credit note from supplier invoice
2026-06-15 04:16:42 +02:00
Laurent Destailleur
6de8ba5eff Fix mention on PDF 2026-06-15 02:47:12 +02:00
Laurent Destailleur
d0b67b3c49 Look and feel v24 2026-06-15 02:41:52 +02:00
Laurent Destailleur
57a2103557 Removed not used key 2026-06-15 02:37:40 +02:00
Laurent Destailleur
c47f95111a CSS 2026-06-15 02:26:58 +02:00
Laurent Destailleur
806974de5e CSS 2026-06-15 02:23:50 +02:00
Laurent Destailleur
4ed21499e2 Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-06-15 01:21:31 +02:00
Laurent Destailleur
648749d086 Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 2026-06-15 01:15:58 +02:00
Laurent Destailleur
8f5bbf3593 More clear doc 2026-06-15 01:15:46 +02:00
Laurent Destailleur
411ee58ca0 Fix migration 2026-06-14 20:59:02 +02:00
Laurent Destailleur
b9ebe7c2ec Debug v24 2026-06-14 20:49:44 +02:00
Laurent Destailleur
fa29fa6879 Debug v24 2026-06-14 20:42:42 +02:00
w3houde
f29d9b7a53
Fix #37365 add per-record transaction mode for mass validate (#38822)
htdocs/core/actions_massactions.inc.php:1060-1140 wrapped all selected
records in a single begin/commit so a mid-loop failure rolled back
records that had already validated. For modules that side-effect on
validate (VeriFactu / AEAT push, e-invoice gateways), the side effect
cannot be reverted alongside the local rollback, leaving the local DB
and the external system out of sync.

Add a hidden constant MAIN_MASSVALIDATE_<OBJECTCLASS>_NO_GLOBAL_TRANSACTION
that, when set to 1, moves the begin/commit pair inside the loop so each
record is its own atomic unit. The constant is per-objectclass per eldy's
review on the issue, so it can be enabled by the module on the page that
needs it (e.g. MAIN_MASSVALIDATE_FACTURE_NO_GLOBAL_TRANSACTION on the
customer invoice list) without affecting other mass-validate pages.

Default behavior is unchanged: with no constant set, the original
all-or-nothing transaction stays in place.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-14 13:06:52 +02:00
Maxime Kohlhaas
790b4076f5 Fix SQL migration error introduced in #38696 2026-06-14 11:08:31 +02:00
MDW
81368ad865
Qual: Update Phan baseline (#38805)
# Qual: Update Phan baseline
2026-06-14 01:54:50 +02:00
w3houde
4e462c5ca8
Fix #38786 datapolicy: restrict isObjectUsed() guard to deletion, not anonymization (#38798)
htdocs/datapolicy/class/datapolicycron.class.php:378 skipped the row as soon
as isObjectUsed() returned non-zero, regardless of whether the cron loop was
running the delete or anonymize action. isObjectUsed() on Societe is true as
soon as a quote, order, contract, intervention, shipment, etc. points at the
record - all things that are legitimately kept under accounting / commercial
retention while the personal data on the thirdparty itself must still be
erasable under GDPR.

Apply the guard only for action='delete' (where referential integrity is at
stake). Anonymization runs to completion regardless of attached commercial
documents.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-14 01:53:19 +02:00
William Mead
f472e1a564
Fixed extrafield type check (#38769) 2026-06-14 01:13:22 +02:00
Tanguy Chénier
544d8f9bbb
FIX Missing comma in ExpenseReportLine::fetch SQL (#38767)
The SELECT of ExpenseReportLine::fetch() was missing a comma after the
"tcheck_file" column. The concatenated SQL became
"... tcheck_file pjt.rowid as projet_id ..." which is a syntax error, so
the query always failed and fetch() returned -1.

This broke loading a single expense report line, both in the UI (confirm
delete line in expensereport/card.php) and in the REST API
(PUT /expensereports/{id}/lines/{lineid}).

The column is now also qualified with its table alias (fde.) for
consistency with the other columns of the SELECT.

Add a PHPUnit test (ExpenseReportTest::testExpenseReportLineFetch) that
creates an expense report with a line and reloads it: it fails before
the fix and passes after.
2026-06-14 01:12:13 +02:00
evarisk-kilyan
b22cbb9eed
Qual: Fix PHPStan warning (undefined variable $filter) in cron/list.php (#38771)
PHPStan level 9 (apstats config) reports at htdocs/cron/list.php:363:
"Variable $filter might not be defined."

$filter was only initialized inside the "if (empty($reshook))" Actions
block, but it is used unconditionally later to build the SQL WHERE clause.
When a hook intercepts the Actions section ($reshook not empty), $filter
stayed undefined. Initialize it with the other search criteria so it is
always defined.

As $filter is now always an array, the "is_array($filter)" guard becomes
redundant (it would raise a level 10 'always evaluate to true' warning),
so the condition is simplified to "count($filter) > 0". No behaviour change.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:11:22 +02:00
evarisk-kilyan
d0197ea460
Qual: Fix PHPStan warning (undefined variable $s) in bank.lib.php (#38770)
PHPStan level 9 (apstats config) reports at htdocs/core/lib/bank.lib.php:465:
"Variable $s might not be defined."

The variable $s was initialized inside the for() init expression
(for ($i = 0, $s = 0; ...)). As the apstats ruleset sets
polluteScopeWithLoopInitialAssignments: false, the assignment is not
seen as defined after the loop, where $s is used to compute the RIB key.
Moved the $s = 0 initialization just before the loop. No behaviour change.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:10:22 +02:00
Frédéric FRANCE
65b95df114
clean code (#38784)
* clean code

* clean code

* clean code

* clean code

* clean code
2026-06-14 01:09:51 +02:00
evarisk-kilyan
f4b659fffa
Qual: Fix PHPStan warning (undefined variable $maxlength) in recruitmentjobposition_note.php (#38775)
PHPStan level 9 (apstats config) reports at line 135:
"Variable $maxlength might not be defined."

$maxlength was never defined in this file and was passed as the 4th
argument (max label length) of FormProjets::select_projects(). An
undefined variable evaluates to null, and dol_trunc() returns the string
unchanged when its size argument is empty (null or 0). Passing 0
explicitly keeps the exact same behaviour (no truncation) and removes
the undefined-variable warning.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:09:18 +02:00
evarisk-kilyan
cabdee496b
Qual: Fix PHPStan warning (undefined variable $maxlength) in recruitmentcandidature_list.php (#38772)
PHPStan level 9 (apstats config) reports at line 444:
"Variable $maxlength might not be defined."

$maxlength was never defined in this file and was passed as the 4th
argument (max label length) of FormProjets::select_projects(). An
undefined variable evaluates to null, and dol_trunc() returns the string
unchanged when its size argument is empty (null or 0). Passing 0
explicitly keeps the exact same behaviour (no truncation) and removes
the undefined-variable warning.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:09:00 +02:00
evarisk-kilyan
7dd658bab6
Qual: Fix PHPStan warning (undefined variable $maxlength) in recruitmentjobposition_document.php (#38774)
PHPStan level 9 (apstats config) reports at line 159:
"Variable $maxlength might not be defined."

$maxlength was never defined in this file and was passed as the 4th
argument (max label length) of FormProjets::select_projects(). An
undefined variable evaluates to null, and dol_trunc() returns the string
unchanged when its size argument is empty (null or 0). Passing 0
explicitly keeps the exact same behaviour (no truncation) and removes
the undefined-variable warning.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:08:40 +02:00
evarisk-kilyan
bd67664569
Qual: Fix PHPStan warning (undefined variable $maxlength) in recruitmentjobposition_applications.php (#38773)
PHPStan level 9 (apstats config) reports at line 233:
"Variable $maxlength might not be defined."

$maxlength was never defined in this file and was passed as the 4th
argument (max label length) of FormProjets::select_projects(). An
undefined variable evaluates to null, and dol_trunc() returns the string
unchanged when its size argument is empty (null or 0). Passing 0
explicitly keeps the exact same behaviour (no truncation) and removes
the undefined-variable warning.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:08:20 +02:00
evarisk-kilyan
a5178b1832
Qual: Fix PHPStan warning (undefined variable $maxlength) in fichinter/card-rec.php (#38776)
PHPStan level 9 (apstats config) reports at line 544:
"Variable $maxlength might not be defined."

$maxlength was never defined in this standalone page and was passed as
the 4th argument (max label length) of FormProjets::select_projects().
An undefined variable evaluates to null, and dol_trunc() returns the
string unchanged when its size argument is empty (null or 0). Passing 0
explicitly keeps the exact same behaviour (no truncation) and removes
the undefined-variable warning.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:08:03 +02:00
evarisk-kilyan
fe50081c1a
Qual: Fix PHPStan warning (undefined variable $maxlength) in fourn/facture/card-rec.php (#38777)
PHPStan level 9 (apstats config) reports at line 1206:
"Variable $maxlength might not be defined."

$maxlength was never defined in this standalone page and was passed as
the 4th argument (max label length) of FormProjets::select_projects().
An undefined variable evaluates to null, and dol_trunc() returns the
string unchanged when its size argument is empty (null or 0). Passing 0
explicitly keeps the exact same behaviour (no truncation) and removes
the undefined-variable warning.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:07:47 +02:00
evarisk-kilyan
256e676068
Qual: Fix PHPStan warning (undefined variable $backtopageforcancel) in product/inventory/card.php (#38778)
PHPStan level 9 (apstats config) reports at line 244:
"Variable $backtopageforcancel might not be defined."

The page reads $backtopage from GETPOST and prints both a 'backtopage'
and a 'backtopageforcancel' hidden field, but $backtopageforcancel was
never read from the request, so it was always undefined.
Add the standard $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
line next to $backtopage, matching the canonical pattern used in
product/card.php and societe/card.php.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:07:28 +02:00
evarisk-kilyan
82d78234b5
Qual: Fix static analysis warnings in salaries/list.php (#38779)
PHPStan level 9 (apstats config) reports at line 836:
"Variable $selected might not be defined."
In the Kanban output, $selected was only defined inside the
"if ($massactionbutton || $massaction)" block, but it is always passed
to getKanbanView(). Initialize $selected = 0 before that block; 0 is the
exact value getKanbanView() falls back to when 'selected' is empty/absent
($selected = empty($arraydata['selected']) ? 0 : ...), so behaviour is
unchanged.

Phan reports at lines 808-809:
"Assigning $obj->status of type string to property but User->status/statut is int".
$obj->status comes from the SQL alias 'u.statut as status' (an int column
returned as a string by the DB layer) and is assigned to the int-typed
User::$status / User::$statut properties. Cast it to (int).

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:07:10 +02:00
github-actions[bot]
277a38eff7
PHPStan > Update baseline (#38780)
Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>
2026-06-14 01:06:22 +02:00
Anthony Damhet
4868f65bd8
UI|UX: AI design (#38789)
* WIP AI design

- Chat Interface
- French Translation

* AI Home Screen

Added a home page for the AI assistant, with pre-recorded prompts

* Fix missing user

* Add copyright

* Fix working tools and alignment
2026-06-14 01:05:01 +02:00
w3houde
14db36e848
Fix sql injection in sqlfilters API param - reported by sangkilp (#38794)
Switch four list endpoints that still used the legacy DolibarrApi::_checkFilters
+ bare preg_replace_callback path to the hardened forgeSQLFromUniversalSearchCriteria()
already used by the rest of the same files. The legacy path only validated
parenthesis balance and concatenated non-matching text verbatim into the WHERE
clause, while the hardened path applies the dummy-criteria syntax check first.

Endpoints touched:
- htdocs/api/class/api_setup.class.php getListOfRegions
- htdocs/api/class/api_setup.class.php getListOfIncoterms
- htdocs/api/class/api_setup.class.php getListOfVAT
- htdocs/multicurrency/class/api_multicurrencies.class.php index

See #38768 for the report.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-14 01:02:16 +02:00
w3houde
41a515d9fc
Fix #38783 enforce supplier qty_min on PRODUCT_USE_SUPPLIER_PACKAGING rounding (#38799)
CommandeFournisseur::addline rounds the line quantity to the next packaging
multiple but never enforces pfp.quantity (the supplier minimum purchase
quantity). A line with packaging=3 and qty_min=15 could therefore be saved
at qty=6 (only multiple of packaging) - the user-facing scenario from
#38783 with the table of expected vs actual values.

Two small changes:

1. htdocs/product/class/product.class.php get_buyprice() already maintains
   $prod_supplier->fourn_qty for the dynamic-price code path at lines 2622
   and 2691 but never propagates the same value to $this->fourn_qty (which
   is the public property documented as MOQ at line 738). Assign $this->fourn_qty
   in both branches of get_buyprice so callers can read it after the call.

2. htdocs/fourn/class/fournisseur.commande.class.php addline now applies a
   second rounding pass against $prod->fourn_qty after the packaging multiple
   step. If qty is still below qty_min, round qty_min up to the next packaging
   multiple - the smallest qty that satisfies both constraints simultaneously.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-14 00:57:56 +02:00
w3houde
718ad088a2
Fix #38782 harmonize packaging-rounding logic between supplier and customer order paths (#38800)
When PRODUCT_USE_CUSTOMER_PACKAGING / PRODUCT_USE_SUPPLIER_PACKAGING are
enabled, the four order line methods (Commande::addline, Commande::updateline,
CommandeFournisseur::addline, CommandeFournisseur::updateline) recompute the
quantity to the next packaging multiple. Reporter audited the four code paths
and listed six divergences between them; the customer addline at
htdocs/commande/class/commande.class.php:1720 is the reference and the rest
were re-aligned on it:

- Bug 1: supplier addline did not call setEventMessages() when qty < packaging,
  so the user was silently corrected (htdocs/fourn/class/fournisseur.commande.class.php:2153).
- Bug 2: supplier addline used a raw float multiplication; switch to price2num('MS').
- Bug 3: supplier updateline used 'fmod() > 0' which is vulnerable to float
  noise (fmod(3.0, 1.5) can yield 4.44e-16); switch to price2num((float) ..., 'MS').
- Bug 4: supplier updateline missed the qty < packaging notification.
- Bug 5: both updateline paths missed abs() in coeff = intval(qty / packaging) + 1,
  which broke rounding for negative qty; the addline paths already do abs().
- Bug 6: supplier path used setEventMessages('mesgs') (green/info); the user
  feedback is a corrected input, semantically a warning. Switch to 'warnings'
  to match the customer path.

No behavior change for callers passing positive, valid quantities; the diff
only affects edge cases (negative qty, qty just under packaging, float-fmod
noise) and the message channel.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-14 00:50:37 +02:00
w3houde
8f418f5b5e
Fix #34602 modulebuilder: preserve case of composite property types (#38803)
htdocs/modulebuilder/index.php:1859 ran strtolower() on the raw form value
$proptype before storing it back into the object's field definition. That
lower-cased composite types like
'integer:Societe:societe/class/societe.class.php:1:(...__SHARED_ENTITIES__...)'
into 'integer:societe:...:(...__shared_entities__...)'. Two breakages from
that single transform:

1. PHP class names are case-sensitive on case-sensitive filesystems; 'societe'
   then fails to instantiate where 'Societe' worked.
2. Substitution tokens such as __SHARED_ENTITIES__ are matched verbatim by
   the entity filter; once lower-cased they no longer match.

Only lowercase truly atomic types ('Integer' -> 'integer', 'TEXT' -> 'text').
For anything containing ':' or '_' (composite spec, substitution token) keep
the user-typed casing.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-14 00:49:05 +02:00
w3houde
2149bb6f0f
Fix #37773 align inventory pmp-perentity write condition with Product::fetch read (#38802)
htdocs/product/inventory/inventory.php:264 wrote into llx_product_perentity
under MAIN_PRODUCT_PERENTITY_SHARED, but Product::fetch at line 2995-2997
of htdocs/product/class/product.class.php only reads pmp from that table when
both MULTICOMPANY_PRODUCT_SHARING_ENABLED and MULTICOMPANY_PMP_PER_ENTITY_ENABLED
are set. MAIN_PRODUCT_PERENTITY_SHARED is the accountancy-codes flag; using
it to gate the pmp write meant inventory wrote a value that fetch would
silently ignore (and overwriting whatever was there before).

Align the inventory write with the fetch read so the two stay in sync.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-14 00:34:36 +02:00
w3houde
5acb9e3d77
Fix #34684 avoid double sign-flip on supplier orders driven by PROJECT_ELEMENTS_FOR_MINUS_MARGIN (#38791)
htdocs/projet/element.php:1075 unconditionally negates total_ht / total_ttc for
commande_fournisseur and supplier_proposal rows. A few lines below at 1095 the
margin block also negates when $margin === 'minus'.

The default 'order_supplier' entry in $listofreferent ships without a margin
key, so users opt it into the profit calculation via
PROJECT_ELEMENTS_FOR_MINUS_MARGIN=order_supplier. The PROJECT_ELEMENTS_FOR_MINUS_MARGIN
loop at line 819 then sets $margin='minus' for that key, and both negations
fire on the same value - the supplier total flows into balance_ht as a positive
amount instead of being subtracted, which matches the symptom in the screenshot.

Skip the line-level negation when the margin block will take care of it.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-14 00:18:11 +02:00