* 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
* 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>
* 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>
* 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>
* 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>
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>
* 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>
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>
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>
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>
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>
# 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);
# 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
* 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>
* 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.