Commit graph

155700 commits

Author SHA1 Message Date
Laurent Destailleur
61ef9d017a Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-08-13 15:52:37 +02:00
w3houde
050a776b0e
Fix #39020 use universal-search filter for MoLine lookup on V21+ (#39489)
Follow-up to the 18.0 fix. On 21.0 and later, MoLine::fetchAll no longer
handles fk_mo/origin_id/origin_type as exact matches in the array-filter
path; every non-rowid key falls back to LIKE '%value%'. So the array
filter added for 18.0 turned into origin_id LIKE '%..%' here, which can
match an unrelated MO line and reintroduce the duplicate MO the fix was
meant to prevent.

Build the lookup with the universal-search string filter
(fk_mo:=:.. AND origin_id:=:.. AND origin_type:=:'bomline') so the class
turns it into exact equality, as requested during review of #39163.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-08-13 14:25:01 +02:00
Laurent Destailleur
4cea4f8c71 Automated merge from 19.0 to 20.0 by tool pullmerge.sh 2026-08-13 14:23:57 +02:00
Laurent Destailleur
7ea87bb303 Automated merge from 18.0 to 19.0 by tool pullmerge.sh 2026-08-13 14:23:54 +02:00
w3houde
53085395c2
Fix #39494 keep decimals on asset disposal amount (#39495)
The asset disposal amount was read with GETPOSTINT, casting it to int
and dropping the decimals, so a disposal at 1500.50 was stored as 1500.
disposal_amount_ht is a 'price' field, so use GETPOSTFLOAT to keep the
decimal amount, both when storing it and when re-displaying it in the
disposal confirmation form.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-08-13 14:22:04 +02:00
w3houde
7a82187acd
Fix #39245 set TRIGGER_PREFIX to BILL on Facture (#39497)
On 23.0 the generic CommonObject methods (setPaymentMethods,
setBankAccount, ...) build the trigger name from
$this->TRIGGER_PREFIX, falling back to get_class() when it is empty.
Facture does not declare it, so it fires FACTURE_MODIFY instead of the
BILL_* events the class uses everywhere else (BILL_CREATE, BILL_MODIFY,
...). Modules listening on BILL_MODIFY miss those changes.

Declare public $TRIGGER_PREFIX = 'BILL', like the other objects do
(Holiday='HOLIDAY', Workstation='WORKSTATION', BOM='BOM').

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-08-13 14:21:43 +02:00
Jam Balaya
82bdf7a8ec
Qual: Fix phpstan notices on 24.0 (wrong case and always-false comparison) (#39487) 2026-08-13 04:17:26 +02:00
HENRY Florian
af6c24c0ce
fix: remove bug in last PR 39407 merged (JS allowoverconsumption not delcared) (#39414) 2026-08-13 04:00:48 +02:00
Laurent Destailleur
30bb613228 Clean code 2026-08-13 03:31:51 +02:00
support-accellier
bfbc4db36d
Fix currency rate lost (comes as 1) when creating Supplier Invoice from Supplier Order (#39424)
The origin multicurrency exchange rate was read with GETPOSTINT('originmulticurrency_tx'), which truncates any fractional rate (e.g. 0.83, 1.27) down to an integer. As a result, creating a Supplier Invoice from a Supplier Order (or other origin) always produced an exchange rate of 0 or 1 instead of the real rate, even when the multi-currency setting to keep the source object's original rate was enabled.

This was already fixed for one of the four occurrences in this file (the credit-note/replacement-invoice path) but the other three were never backported to this branch. This commit switches all three remaining occurrences from GETPOSTINT() to GETPOSTFLOAT(), matching develop/23.0.

Fixes #39423
2026-08-13 03:23:59 +02:00
Laurent Destailleur
be3fb14684 Prepare more generic definition of MCP server 2026-08-13 03:20:02 +02:00
Maxime Kohlhaas
cc31d40638
Fix : thirdparty birth was emptied on country change (#39440) 2026-08-13 03:05:13 +02:00
Laurent Destailleur
5e0c01fb1f Update file 2026-08-13 02:59:53 +02:00
Jam Balaya
99f0e545fa
FIX: Remove always-true error checks in mysql dump export (backport of #39339 to 24.0) (#39444) 2026-08-13 02:51:25 +02:00
Jam Balaya
21104e9204
FIX: REST API POST /tasks/{id}/addtimespent always returns 500 (#39442)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-08-13 02:48:35 +02:00
Pierre Grasswill
9decbcf53e
Allow positive lines on a supplier credit note, like on the customer side (#39456)
FactureFournisseur::addline() and updateline() force -abs() on every line of a
credit note, unconditionally. Facture (customer side) has the same forcing but
it can be relaxed since #33434 / #38730 when both FACTURE_ENABLE_NEGATIVE_LINES
and INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN are enabled. The supplier side has
no equivalent, so a supplier credit note can never hold a positive line.

Real case: a supplier withholds a fixed handling fee on every credit note it
issues. The fee reduces the credit, so on the document it is a positive amount
among negative ones. Dolibarr flips it to negative, the credit note comes out
3 EUR too large, and the only way to match the supplier document is to edit the
database by hand.

Use the same gate as Facture::updateline() in both methods, so the two classes
behave the same and default installs are untouched: with either constant unset,
-abs() still applies exactly as today.

The "credit note for the remaining amount to pay" option relied on the forcing
to sign its line: it now passes the amount already negative, which is a no-op
while the forcing applies and keeps the line correct once it is relaxed.

Tested on 23.0.3 and 24.0.0-beta: with a constant missing the fee line is still
stored at -3, with both set it stays at +3 and update_price() recomputes the
invoice totals correctly.

Co-authored-by: daGrumpf <pierre.grasswill@mediactivegroup.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-08-13 02:47:43 +02:00
VIAL-GOUTEYRON Quentin
3ad376dc01
FIX Holiday shown one day off in agenda for users in another timezone (#39465)
Columns llx_holiday.date_debut and date_fin are pure DATE columns: they hold a
calendar fact, not an absolute instant, so they carry no time and no timezone.

The agenda read them with jdate() defaulting to 'tzserver', then projected them
back with dol_print_date(..., 'tzuserrel') to pick the calendar day box. The
resulting shift equals TZ_user - TZ_server, so any user whose timezone differs
from the server got leaves rendered on the wrong day. Users aligned with the
server saw nothing wrong, which is why this went unnoticed. It also triggers with
no user timezone set at all, since 'tzuserrel' falls back to UTC when
$_SESSION['dol_tz_string'] is empty, shifting leaves on any server east of UTC.

Read and project those dates in GMT instead. This follows the documented core
convention for dates without time ("We suppose dates without time are always gmt
(storage of course + output)", commonobject.class.php; "For date without hour,
date is always GMT for storage and output", extrafields.class.php) and honors the
$daykey contract of $eventarray, which must be midnight GMT of the displayed
calendar day. It also makes the half-day comparison consistent, since
dol_get_first_hour() is already called with 'gmt' a few lines below and only
supports gmt/tzserver anyway.

Two further defects disappear as a side effect: the loop condition
"while ($daykey <= $event->date_end_in_calendar)" compared a user-shifted $daykey
against a server-anchored $datef and rendered one extra day box, and halfday=-1
happened to be correct while halfday=0/1 were not, because the +12h offset
accidentally compensated the timezone shift.

Regular events are untouched: llx_actioncomm.datep is a DATETIME holding a real
instant, and its block still uses 'tzuserrel', so a 9am meeting stays correctly
shifted for a viewer in another timezone. Every other render path already
excludes type_code 'HOLIDAY', so there is no display change elsewhere.

peruser.php carries a copy of the same block and is fixed identically, otherwise
the two views of the same page would contradict each other.

Tested with a real browser (Playwright) against a server running in UTC, driving
the month view as Europe/Paris, America/Cayenne and Pacific/Auckland users on
three existing leaves: 3 failures before, none after, with identical day boxes in
every timezone. A single-day leave of 2026-07-28 was rendered on both 2026-07-27
and 2026-07-28 for the America/Cayenne user before the fix.
2026-08-13 02:45:02 +02:00
Laurent Destailleur
4d5530d3d8 Debug v24 2026-08-13 02:16:24 +02:00
Laurent Destailleur
76f43ae9b1 Debug v24 2026-08-13 02:09:15 +02:00
Laurent Destailleur
c26483b012 Fix ci 2026-08-13 01:31:31 +02:00
Laurent Destailleur
26f33ecfaa Fix ci 2026-08-13 01:29:41 +02:00
Laurent Destailleur
defa8b2f2d Debug v24 2026-08-13 01:06:24 +02:00
Laurent Destailleur
491601af9b Typo 2026-08-13 00:32:09 +02:00
Laurent Destailleur
05b6b59853 css 2026-08-12 23:49:17 +02:00
w3houde
e7ab87886e
Fix #39395 remove duplicate fk_user_modif in chargesociales update (#39474)
ChargeSociales::update() set fk_user_modif twice in the same UPDATE
statement. PostgreSQL rejects this with "multiple assignments to the
same column", so editing a social contribution failed. Remove the
duplicate assignment. Backport of the develop fix #39389 to the 22.0
and 23.0 maintenance branches, where the duplicate is still present.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-08-12 23:37:36 +02:00
w3houde
79128945ff
Fix #39400 unaccent Hungarian double acute letters (#39476)
dol_string_unaccent() did not map the Hungarian letters o-double-acute
and u-double-acute (U+0150/U+0151/U+0170/U+0171), so they were left
untouched in sanitized filenames. Add the four missing entries so they
transliterate to O/o/U/u like the other accented variants.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-08-12 23:37:10 +02:00
HENRY Florian
a1bfd5d9fb
fix: module builder rebuild class mistype foreignkey so delete them (#39480)
* fix: module builder rebuild class mistype foreignkey so delete them

* fix: module builder rebuild class mistype foreignkey so delete them
2026-08-12 23:07:45 +02:00
Laurent Destailleur
0620be0601 Fix can use a non template ODT file as template to read it - reported by
tremor hunter
2026-08-12 22:55:31 +02:00
Laurent Destailleur
15c9ca58dc Automated merge from 19.0 to 20.0 by tool pullmerge.sh 2026-08-12 22:43:32 +02:00
Laurent Destailleur
736b11913d Debug v24 2026-08-12 22:40:57 +02:00
Laurent Destailleur
5028dae981 Fix file access with hasp parameter - reported by tremor hunter 2026-08-12 22:16:43 +02:00
Laurent Destailleur
6dbaef2fd4 Automated merge from 18.0 to 19.0 by tool pullmerge.sh 2026-08-12 22:13:16 +02:00
Laurent Destailleur
6c4cc72d72 Fix file access with hasp parameter - reported by tremor hunter 2026-08-12 22:10:23 +02:00
Laurent Destailleur
e9f6710db6 Prepare 24.0 release 2026-08-12 22:04:04 +02:00
Laurent Destailleur
55caca3c07 Close #39484 2026-08-12 21:43:53 +02:00
Laurent Destailleur
ad07059ae1 css 2026-08-12 21:37:26 +02:00
Pierre Grasswill
41c791a5a9
Fix #37599 make addline() honor the same credit note sign gate as updateline() (#39455)
Issue #37599 reported that PR #33434 relaxed the -abs() forcing on credit
note lines in updateline() only, and closed with #38730 tightening that gate
to require both FACTURE_ENABLE_NEGATIVE_LINES and
INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN. The second half of the report was
left open: addline() still forces -abs() unconditionally, so on a site that
enables both constants a line can only be made positive by adding it (stored
negative) and then editing it. Same form, same amount, two different results
depending on whether the line is new.

Apply the exact gate updateline() uses to addline(): subprice, totals,
localtaxes and their multicurrency counterparts. With either constant unset --
i.e. every default install -- nothing changes, addline() keeps forcing -abs().

One core caller relied on the forcing to sign its amount: the "credit note for
the remaining amount to pay" option passes abs($remain_to_pay). It now passes
the amount already negative, which is a no-op while the forcing applies and
keeps the line correct once it is relaxed.

Note that in the relaxed mode the sign becomes the caller's responsibility on
add as it already is on update, so an integration that feeds positive amounts
into a credit note (TakePOS credit notes, for instance) will store them as
given on a site that turns both constants on.

Co-authored-by: daGrumpf <pierre.grasswill@mediactivegroup.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-08-11 19:46:59 +02:00
Zakaria Boushaba
d0810e11e3
FIX: Fix mandatory field validation for select (empty '-1') and textarea (CKEDITOR not defined) (#39458)
Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
2026-08-11 19:46:22 +02:00
w3houde
6a647097bd
Fix #39355 load images.lib.php before image_format_supported in API (#39462)
The POST /documents endpoint with generateThumbs=1 called
image_format_supported() after requiring only files.lib.php, but that
function is defined in images.lib.php, which was never included on this
path. The call raised a fatal error and the request returned a bare
HTTP 500 with no JSON body. Add the missing require_once.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-08-11 19:41:49 +02:00
atm-lucas
eec0a49a87
Renaming a product's attached file fails when PRODUCT_USE_OLD_PATH_FOR_PHOTO is enabled (#39417) 2026-08-11 02:25:58 +02:00
Jam Balaya
c23ee40881
Qual: Remove unused use statement in api_users.class.php that breaks phan CI (#39443) 2026-08-11 02:22:55 +02:00
Frédéric FRANCE
7f39b0cced
fix CI in v23 (#39439)
* fix CI

* Update mod_holiday_madonna.php

* Update lettering.class.php

* Update modExpenseReport.class.php

* Update modFacture.class.php

* Update modFicheinter.class.php

* Update modFournisseur.class.php

* Update modHoliday.class.php

* Update modMailing.class.php

* Update modPrelevement.class.php

* Update modPropale.class.php

* Update modReception.class.php

* Update modSociete.class.php

* Update modStock.class.php

* Update modSupplierProposal.class.php

* Update myobject_agenda.php
2026-08-11 02:13:43 +02:00
Frédéric FRANCE
61b3bc52b8
fix stock_alerte may be empty (null) (#38484)
* fix stock_alerte may be empty (null)

* Update product.php
2026-08-11 02:00:55 +02:00
Frédéric FRANCE
c86264053e
avoid to delete directory if ref is empty (#38877)
* avoid to delete directory

* Update contrat.class.php

* Update expedition.class.php

* Update fournisseur.commande.class.php

* Update fournisseur.facture.class.php

* Update project.class.php
2026-08-11 01:25:46 +02:00
Laurent Destailleur
a80eadb356 Backport sanitization from v24 2026-08-10 11:40:49 +02:00
Laurent Destailleur
b66ed4338d Default ai cli setup 2026-08-09 23:58:19 +02:00
Laurent Destailleur
9c4eb94532 Fix must exclude some properties in post/put of expensereport api -
reportedby vulncheck
2026-08-09 19:59:33 +02:00
Laurent Destailleur
b1691356eb Fixed removed property pass_indatabase_crypted in api result - reported
by Vulncheck
2026-08-09 19:49:05 +02:00
Laurent Destailleur
e01a12ffea Fix CVE-2026-71506 - test on permission to delete payment in api. 2026-08-09 03:29:37 +02:00
Laurent Destailleur
12687f8370 Fix CVE-2026-71510 forgeSQLFromUniversalSearchCriteria must disallow
some search criteria
2026-08-09 03:21:39 +02:00