Commit graph

155700 commits

Author SHA1 Message Date
Laurent Destailleur
ed57e239b8 Trans 2026-07-31 02:55:36 +02:00
Laurent Destailleur
8d1258490a Fix restore version 2026-07-31 02:49:52 +02:00
Laurent Destailleur
4f3b783e46 Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into 24.0 2026-07-31 01:04:59 +02:00
Laurent Destailleur
cdb7694041 Fix autocomplete 2026-07-31 01:04:47 +02:00
ThomasNgr-OpenDSI
78ab3a9aec
FIX : change mark rate on all lines would display an error if some lines are free lines. (#39305)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-30 21:28:29 +02:00
Vincent Maury
32f4a73903
Correct bug when merging clients having common products (#39334)
* Correct bug when merging clients having common products

If specific prices by customer are activated, when merging 2 thirdparties having common products, there is an errorr (with no details).

In dollibar.log :
2026-07-29 15:54:24 ERR     x.x.x.x   715490   1030  DoliDBMysqli::query SQL Error query: UPDATE llx_product_customer_price SET fk_soc= 4630 WHERE fk_soc = 1515
2026-07-29 15:54:24 ERR     x.x.x.x   715490   1030  DoliDBMysqli::query SQL Error message: DB_ERROR_RECORD_ALREADY_EXISTS Duplicate entry '165-4630' for key 'uk_customer_price_fk_product_fk_soc' From /my_pah/htdocs/core/class/commonobject.class.php:9337.

* Fix for pgsql compatibility

* Compat Postgresql
2026-07-30 19:45:42 +02:00
Pichinov-Jose
557d79d0bc
FIX supplier product combo does not preselect a product without supplier price ('idprod_ID' value) (#39300)
* FIX phpstan: Societe::$client (int<0,3>) does not accept -1 (#39244)

Societe::$client is annotated @var int<0,3> (domain 0=no customer,
1=customer, 2=prospect, 3=both) in societe.class.php, but the create
form in societe/card.php pre-set it to -1 as a transient "nothing
pre-selected" placeholder, tripping PHPStan level 10 on develop.

The value is never persisted (save paths compute 0..3) and the only
reader, the switch() building the form, treats -1 and 0 identically via
its default case. Use 0 (the property's own default) so the assignment
matches the declared type. No behavior change.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

* FIX supplier product combo does not preselect a product without supplier price ('idprod_ID' selected value)

Form::select_produits_fournisseurs() only fills the ajax search input when
the selected value is a supplier price id ((int) > 0). When the value is
'idprod_ID' (product without supplier price for this supplier — the format
documented for the $selected parameter and used by the backtopage of the
product creation popup), nothing was preselected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add copyright

* chore: retrigger CI (lock check setup canceled by GitHub infra)

---------

Co-authored-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-30 18:49:34 +02:00
Pichinov-Jose
fcf3006ddd
FIX Whole session loses its menus after a login done from inside a dialog popup (#39312)
* FIX phpstan: Societe::$client (int<0,3>) does not accept -1 (#39244)

Societe::$client is annotated @var int<0,3> (domain 0=no customer,
1=customer, 2=prospect, 3=both) in societe.class.php, but the create
form in societe/card.php pre-set it to -1 as a transient "nothing
pre-selected" placeholder, tripping PHPStan level 10 on develop.

The value is never persisted (save paths compute 0..3) and the only
reader, the switch() building the form, treats -1 and 0 identically via
its default case. Use 0 (the property's own default) so the assignment
matches the declared type. No behavior change.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

* FIX Whole session loses its menus after a login done from inside a dialog popup

The URLs opened by dolButtonToOpenUrlInDialogPopup() carry
dol_hide_topmenu=1 and dol_hide_leftmenu=1. If the session expires and
the user logs in again from inside the popup iframe, these flags were
stored into $_SESSION at login and applied to every following page: the
user 'loses' the top and left menus for the whole session, until logout.

Do not persist the two hide-menu flags when the login is done in a
dol_openinpopup context.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-30 18:48:21 +02:00
Frédéric FRANCE
174af16b66
FIX: Undefined array key "text" in dolGetButtonAction dropdown (#39311)
* FIX phpstan: Societe::$client (int<0,3>) does not accept -1 (#39244)

Societe::$client is annotated @var int<0,3> (domain 0=no customer,
1=customer, 2=prospect, 3=both) in societe.class.php, but the create
form in societe/card.php pre-set it to -1 as a transient "nothing
pre-selected" placeholder, tripping PHPStan level 10 on develop.

The value is never persisted (save paths compute 0..3) and the only
reader, the switch() building the form, treats -1 and 0 identically via
its default case. Use 0 (the property's own default) so the assignment
matches the declared type. No behavior change.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

* NEW Accountancy - FEC export - Add constant ACCOUNTING_EXPORT_FEC_ADD_TIMESTAMP to add a timestamp in export file name

* The test on dolibarr_main_restrict_os_commands was moved into
dumpDatabase()

* Fix missing extrafields propagation and object links when creating supplier credit note (#39285)

Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>

* NEW Filecheck can show diff of modified files (#39022)

* NEW: Show diff against original file in filecheck integrity report

* NEW: Compare against develop branch for alpha/beta versions in filecheck diff

* NEW: Improve filecheck diff granularity on large files with anchor-based split

* Update version.inc.php

* FIX: Undefined array key "text" in dolGetButtonAction dropdown

Button entries built without a 'text' key (e.g. the subtotals module's
"Add title line"/"Add subtotal line" dropdown) triggered a PHP warning on the multi-button branch, which already guarded every other optional key the same way.

---------

Co-authored-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: Alexandre SPANGARO <alexandre.spangaro@gmail.com>
Co-authored-by: Alexandre SPANGARO <aspangaro.dolibarr@gmail.com>
Co-authored-by: Zakaria Boushaba <48571684+Boushabazakaria@users.noreply.github.com>
Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
2026-07-30 18:47:32 +02:00
Lucky
3c02819090
Update expedition.class.php (#39314)
* Update expedition.class.php

In Expedition::addline_batch() (expedition.class.php:1284), the creation form submits all batch lines (even those with qty=0), because SHIPMENT_GETS_ALL_ORDER_PRODUCTS=1 forces their inclusion ($value['q'] == 0 && ...SHIPMENT_GETS_ALL_ORDER_PRODUCTS, line 1295). For each line included, the STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT control compared $prod_batch->qty < $linebatch->qty without verifying that $linebatch->qty (the actual quantity requested for this batch) is greater than 0.

Result: For the line in batch "azerty" (requested quantity = 0, stock = -10), the -10 < 0 test is true → the entire shipment is rejected with "insufficient stock," even though the batch actually chosen ("azerty123456789", requested quantity = 2, stock = 5) is more than sufficient.

* Update expedition.class.php

---------

Co-authored-by: Sylvain Legrand <sylvain.legrand@infras.fr>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-30 18:24:51 +02:00
Lucky
58c951afd6
Update fournisseur.commande.class.php (#39321)
In CommandeFournisseur::create(), the line insertion loop accepts lines provided as arrays, cast to stdClass on the fly (fournisseur.commande.class.php:1687-1689). When a cast line does not contain all the expected properties, the call to addline() reads 13 properties without guards, hence the repeated PHP Warning: Undefined property: stdClass::$...

Co-authored-by: Sylvain Legrand <sylvain.legrand@infras.fr>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-30 18:15:29 +02:00
Lucas Marcouiller
624d9c97e5
Fix member subscription with empty date valid (#39310)
* NEW : Add support of customer discount of the invoice in the sell journal

* Correction phpstan

* Correction phpstan

* Correction phpstan

* Correction phan

* Correction phan

* Correction phan

* Correction phan

* FIX #39146 : add SQL structure in llx_societe_perentity

* FIX phpstan: Societe::$client (int<0,3>) does not accept -1 (#39244)

Societe::$client is annotated @var int<0,3> (domain 0=no customer,
1=customer, 2=prospect, 3=both) in societe.class.php, but the create
form in societe/card.php pre-set it to -1 as a transient "nothing
pre-selected" placeholder, tripping PHPStan level 10 on develop.

The value is never persisted (save paths compute 0..3) and the only
reader, the switch() building the form, treats -1 and 0 identically via
its default case. Use 0 (the property's own default) so the assignment
matches the declared type. No behavior change.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

* NEW Accountancy - FEC export - Add constant ACCOUNTING_EXPORT_FEC_ADD_TIMESTAMP to add a timestamp in export file name

* The test on dolibarr_main_restrict_os_commands was moved into
dumpDatabase()

* Fix missing extrafields propagation and object links when creating supplier credit note (#39285)

Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>

* NEW Filecheck can show diff of modified files (#39022)

* NEW: Show diff against original file in filecheck integrity report

* NEW: Compare against develop branch for alpha/beta versions in filecheck diff

* NEW: Improve filecheck diff granularity on large files with anchor-based split

* Update version.inc.php

* Fix member subscription with empty date valid

* Create migration script 24.0.0-25.0.0.sql

* FIX #39146: Fos thirdparties, Manage fk_account, payment method and payment term per entity if MAIN_COMPANY_PERENTITY_SHARED is set.

* Missign migration file

* Update paymentok.php

---------

Co-authored-by: Kamel Khelifa <kkhelifa@open-dsi.fr>
Co-authored-by: tnegre <tnegre@open-dsi.fr>
Co-authored-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: Alexandre SPANGARO <alexandre.spangaro@gmail.com>
Co-authored-by: Alexandre SPANGARO <aspangaro.dolibarr@gmail.com>
Co-authored-by: Zakaria Boushaba <48571684+Boushabazakaria@users.noreply.github.com>
Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
2026-07-30 18:03:44 +02:00
Laurent Destailleur
689572a332 Fix trans 2026-07-30 17:50:18 +02:00
Sylvain Legrand
19c5b8f825
fix card when action=create (#39336)
some default values are not set
2026-07-30 17:37:46 +02:00
Laurent Destailleur
403e6b4640 Fix CI 2026-07-30 16:59:25 +02:00
Laurent Destailleur
e9c84e8926 Trans 2026-07-30 13:32:58 +02:00
Lucky
c7d2a661bf
fix PHP Warnings (#39316)
commonobject.class.php:9398 — Undefined array key "options_pos": direct access to $this->array_options[$ef_name] without checking its existence → added an isset() with fallback to an empty string.

commonobject.class.php:9767 (getRights() method) — Undefined property: stdClass::$shipping: $user->rights->$element accessed without checking that the module has registered this property (e.g., shipping module not active for this user) → added an isset(), returns null otherwise.

html.form.class.php:6088-6091 — Undefined array key "value": the $input array passed to formconfirm/multiSelect may not contain a value key for a checkbox field → added an isset($input['value']) on both conditions.

html.form.class.php:6752 (method form_modes_reglement()) — Undefined array key 2 / access on null: $selected corresponds to a payment method not in the cache cache_types_paiements → add an isset().

supplier_proposal/index.php:362 — Undefined property: stdClass::$dfv: the SQL query in the block (line 316) does not select the field fin_validite/dfv (unlike comm/propal/index.php which selects p.fin_validite as dfv) — this field does not even exist in llx_supplier_proposal. In addition to the warning, this bug systematically displayed the "Delay" icon (PHP8 comparison '' < number always true) → addition of an isset($obj->dfv) which properly neutralizes the test as long as this field is not returned by the request.

Co-authored-by: Sylvain Legrand <sylvain.legrand@infras.fr>
2026-07-30 12:59:04 +02:00
Laurent Destailleur
f8e5f7f4cc Trans 2026-07-30 11:56:51 +02:00
Laurent Destailleur
7011475563 Prepare release 2026-07-30 11:23:07 +02:00
Laurent Destailleur
9415c5c17b Doc 2026-07-30 11:20:44 +02:00
Laurent Destailleur
9f9bd02de8 Fix setup form 2026-07-29 19:41:58 +02:00
Laurent Destailleur
cbcd1cc14f Fix warning 2026-07-29 18:46:50 +02:00
Laurent Destailleur
3cd3753772 Debug v24 2026-07-29 13:39:19 +02:00
Laurent Destailleur
5811af49c1 Debug v24 2026-07-29 13:35:10 +02:00
Laurent Destailleur
9836f52c29 Add missing type 2026-07-29 13:27:35 +02:00
Laurent Destailleur
7e0f0c54f2 Fix deletion must not use the glob by default. 2026-07-29 13:20:28 +02:00
Laurent Destailleur
5c1cd43e1a Fix delete file function must not use glob. 2026-07-29 13:09:11 +02:00
Laurent Destailleur
b8ca29f832 Fix test that user is allowed on thirdparty on api to get categories -
reported by Sabuhi Mammadov
2026-07-29 12:55:43 +02:00
Laurent Destailleur
616784e85b Fix some users can update payments on not owned invoice - reported by
Sabuhi Mammadov
2026-07-29 12:30:59 +02:00
Laurent Destailleur
ca2c725bb1 Fix use of numeric hostname 2026-07-29 12:16:48 +02:00
Laurent Destailleur
29c85b5eed Adapt phpunit to the new sanitization of restricthtml 2026-07-29 01:14:59 +02:00
Laurent Destailleur
7bf7d71fda More complete list of js blacklist function - credit Jakub Kozub -
jakubk (HackerOne)
2026-07-29 00:51:57 +02:00
Laurent Destailleur
be67fb86ba Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 2026-07-28 20:50:18 +02:00
Laurent Destailleur
6e4ebb17be More complete list of js blacklist function 2026-07-28 20:49:43 +02:00
Laurent Destailleur
da442b67ce Fix missing include 2026-07-28 17:47:15 +02:00
Laurent Destailleur
bce5bd4229 Fix preselected user in edit of email sender profiles. 2026-07-28 16:14:31 +02:00
Laurent Destailleur
79b1ffeeff Add oncontentvisibility in list of forbidden keys 2026-07-28 15:25:14 +02:00
Laurent Destailleur
05b9704203 Debug v24 2026-07-27 23:59:46 +02:00
Pichinov-Jose
c32b5441df
FIX Accountancy: truncated doc ref not readable in ledger by account (#39242)
In accountancy/bookkeeping/listbyaccount.php, the "Piece" column cell uses
class tdoverflowmax250, which clips its content to a single line with an
ellipsis. For bank entries, the part of the label after the bank line ref
($bank_ref) is printed as a bare text node, with no title attribute and no
classfortooltip. As a result the truncated text cannot be read at all: no
tooltip appears on hover.

This is visible on bank entries whose label references many invoices, e.g.
"1234 - Supplier payment INV-0001 INV-0002 ... INV-0025": everything past
the first few refs is unreachable.

Before 19.0 the cell used class maxwidth400, which only sets a max-width:
the label simply wrapped onto several lines and stayed fully readable. The
switch to tdoverflowmax250 in 19.0 introduced the clipping without adding a
matching tooltip. The neighbouring "Label" column already does this
correctly (classfortooltip + title).

Wrap $bank_ref in a span carrying classfortooltip and the full doc_ref as
title, so hovering shows the complete label. Rendering is unchanged.
Also escape the output, which was previously printed unescaped.

Co-authored-by: Pichinov-Jose <225026364+Pichinov-Jose@users.noreply.github.com>
2026-07-27 14:15:21 +02:00
Zakaria Boushaba
0f583bdf5f
FIX: Fix variable collision in foreach loop causing 'Remove from cycle' button to be always disabled (#39243)
Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
2026-07-27 13:39:34 +02:00
Quentin-Seekness
88c9f5248b
Uniform truncate on order's totals (#39271)
Even if trunc is deprecated in pirce()'s function, we should truncate if it exceeds the MAIN_MAX_DECIMALS_SHOWN, as it is on the total_ttc

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-27 13:38:16 +02:00
MDW
c2943aade9
Fix CI: Better typing for TBomLineId (#39275) 2026-07-27 13:20:15 +02:00
Jam Balaya
4116c251da
FIX Buyer state/province VAT default (VATRULE 2) ignores active and entity filters (#39279)
get_default_tva() VATRULE 2 selects the VAT rate attached to the buyer
department (c_tva.fk_department_buyer) but filters only on the department id.
Unlike get_product_vat_for_country(), it omits t.active and t.entity, so a
disabled rate (or a rate from another entity) can be returned as the default,
and because of the taux DESC ordering an inactive higher rate wins over the
active one.

Add "AND t.active > 0" and "AND t.entity IN (getEntity('c_tva'))" to the query.
The ordering is unchanged, so the documented behaviour is preserved: the rate
flagged Default (use_default) wins, otherwise the highest active rate.

Add testGetDefaultTvaForBuyerState() covering VATRULE 2, which was previously
untested: it asserts the active department rate is selected and the inactive
one is ignored.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 13:04:30 +02:00
MDW
1d295abbef
Qual: Fix Phan notices (#39281)
# Qual: Fix Phan notices

Some phan notices are not reported in ci.

This fixes new ones that appeared:
- Update imap.phan_php to provide IMAP related typing info;
- Add typing info to variables;
- Decleare some variables global (htdocs/admin/dict.php) as reused in function;
- Cast potential null to string;
- Adjust param typing to correspond to default null value (getOnlineSignatureUrl);
- Check that parameter is object as expected by function all (dol_format_address);
2026-07-27 13:03:04 +02:00
MDW
3932cd5853
Qual: Update SQL query variables for situation mode in margin reports (#39282)
# Qual: Update SQL query variables for situation mode in margin reports

In the situation mode, the SQL queries for agentMargins, customerMargins, productMargins, and productMargins tab were updated to use new variable names ($sql_delta_pct and $sql_delta_ht) instead of the old ones ($delta_pct and $delta_ht).

This allows correct analysis by SqlInjection
2026-07-27 13:02:34 +02:00
MDW
f551727df9
Qual/Sec: Use db->sanitize instead of db->escape when not quoted, fix some quoting (#39286)
* FIX phpstan: Societe::$client (int<0,3>) does not accept -1 (#39244)

Societe::$client is annotated @var int<0,3> (domain 0=no customer,
1=customer, 2=prospect, 3=both) in societe.class.php, but the create
form in societe/card.php pre-set it to -1 as a transient "nothing
pre-selected" placeholder, tripping PHPStan level 10 on develop.

The value is never persisted (save paths compute 0..3) and the only
reader, the switch() building the form, treats -1 and 0 identically via
its default case. Use 0 (the property's own default) so the assignment
matches the declared type. No behavior change.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

* Qual: Fix entity handling in bonprelevement.class.php

The variable name 'entities' was changed to 'entity' to better reflect the singular nature of the value being retrieved.
It was also casted to an int instead of using an unquoted db->escape.

* Qual: Improve SQL query construction in company.lib.php

By escaping the concatenated string, injection verification does not identify a false positive.

* Qual: Avoid void positive, sanitize instead of escape

* Qual: Avoid false positive, sanitize instead of escape

* Sec: Fix potential injection with cast to int (timespent_duration)

* Qual: Avoid false positive, sanitize instead of escape

* Qual: Avoid false positive, sanitize instead of escape

* fix: Replace escape() with sanitize() in SQL queries

# FIX: Replace escape() with sanitize() in SQL queries

- Replace escape() with sanitize() in SQL queries to ensure proper SQL injection protection
- Update SQL queries in multiple files to use sanitize() instead of escape()
- Ensure consistent use of sanitize() across the codebase for better security

* fix(sql): Replace escape with sanitize in SQL queries

# FIX: Replace escape with sanitize in SQL queries

- Replace `escape` with `sanitize` in SQL queries to ensure proper SQL injection prevention

* Qual: Improve field escaping/quoting

# Qual: Qual: Improve field escaping/quoting

---------

Co-authored-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 13:00:33 +02:00
MDW
793abd010d
fix(project): Add quotes around date values in SQL query (#39287)
idate() call was missing quotes
2026-07-27 12:59:37 +02:00
MDW
cec87d9425
Qual: Remove unnecessary quotes around integer values in SQL queries (#39290)
* FIX: Do not quote NULL for fk_user_author & fk_element on insert

* Qual: Remove unnecessary quotes around integer values in SQL queries

# Qual: Remove unnecessary quotes around integer values in SQL queries

Removed unnecessary single quotes around integer values in SQL queries across multiple files.
2026-07-27 12:59:14 +02:00
MDW
a884cb1aec
FIX: Do not quote NULL for fk_user_author & fk_element on insert (#39291) 2026-07-27 12:58:22 +02:00
sonikf
a42aa4e124
Fix Standalone reception creation (#39299)
Fatal error: Uncaught Error: Call to a member function fetch_optionals() on null
2026-07-27 12:47:01 +02:00