Commit graph

152390 commits

Author SHA1 Message Date
Laurent Destailleur
da442b67ce Fix missing include 2026-07-28 17:47:15 +02:00
Laurent Destailleur
1c705dc678 Automated merge from 22.0 to 23.0 by tool pullmerge.sh 2026-07-23 16:56:55 +02:00
Laurent Destailleur
45560ce69c Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-07-23 16:44:38 +02:00
Laurent Destailleur
ad7dd389ff Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-07-23 16:38:08 +02:00
Laurent Destailleur
0543dbf14d Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-07-23 16:36:43 +02:00
Laurent Destailleur
8851cba51a Cast 2026-07-23 16:36:22 +02:00
Laurent Destailleur
9cfefbeafa Automated merge from 19.0 to 20.0 by tool pullmerge.sh 2026-07-23 16:26:25 +02:00
Laurent Destailleur
9a99b4ddf0 Automated merge from 18.0 to 19.0 by tool pullmerge.sh 2026-07-23 16:23:08 +02:00
lvessiller-opendsi
1af18fca49
FIX #39258 Shipment: wrong backlog and component stock for a kit on several order lines (#39261) 2026-07-23 16:13:39 +02:00
lvessiller-opendsi
d12e6ec371
FIX #39259 Shipment: qty to ship prefilled 0 for 2nd+ order line of a same kit (#39262) 2026-07-23 16:12:33 +02:00
Sai Asish Y
2ce20a7b64
FIX #39252 Undefined array key warning building nested supplement lines in takepos invoice (#39263)
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
2026-07-23 16:10:42 +02:00
brice.l
5152e6f67e
FIX Documents generated/sent in fichinter card use wrong directory in multicompany mode (Change branch from develop to 22.0) (#39266)
* Update SQL queries to use getEntity for entity filtering

* Update file path handling for ficheinter module

* Refactor output directory handling in card.php
2026-07-23 16:10:18 +02:00
ThomasNgr-OpenDSI
9926334e78
Sec: sql injection via api in POST of thirdparties/id/banckaccount - (#39234)
reported by MDnyn

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-23 09:21:33 +02:00
Jam Balaya
f71bf6575e
FIX #32217 Fire BILL_CREATE with create-form extrafields on next situation invoice (#39254)
When creating the next situation invoice, the create-form extrafields were
saved AFTER createFromCurrent() had already fired BILL_CREATE, so triggers
listening to BILL_CREATE never saw them. Passing 'BILL_CREATE' to
insertExtraFields() (as first proposed) would fire the trigger a second time.

Instead, set the extrafields on $object before createFromCurrent() and let
create() insert them and fire BILL_CREATE once with the values present.
createFromCurrent() now skips its fetch_optionals() when array_options is
already set by the caller, so the form values are no longer overwritten by
the source invoice values. The two other createFromCurrent() callers do not
pre-set array_options, so their behaviour is unchanged.

Supersedes #32217.

Signed-off-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
2026-07-22 11:37:10 +02:00
Jam Balaya
ed47b61151
FIX mo_production: show very-short unit label instead of untranslated 'UnitPShort' (#39253)
The "Unit" column of the consume/produce tables used
measuringUnitString(..., 2), which translates a <Label>Short key. Those
keys do not exist for most units (e.g. a Piece -> 'UnitPShort', kg ->
'WeightUnitkgShort'), so the raw untranslated key was displayed. Use
param 1 (the very-short DB short_label: 'p', 'kg', ...) like every other
unit column in this file and across the codebase.

Supersedes #31706.

Signed-off-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
2026-07-22 03:35:51 +02:00
Jam Balaya
136be3c196
FIX #34667 checkUserAccessToObject: skip entity check for non-multientity objects (multicompany) (#39246)
When the multicompany module is enabled, checkUserAccessToObject() (used
by restrictedArea(), e.g. from an ajax tooltip) ran the entity check
unconditionally in its default/custom-object branch, building
"AND dbt.entity IN (...)". For a custom object whose table has no entity
column (ismultientitymanaged = 0), that SQL fails, nb comes back 0 and
access is wrongly denied.

Guard the branch so the entity test only runs when the object is actually
multi-entity managed. Keep the test for legacy classes that never define
ismultientitymanaged (null/unset) and for a non-object $object, and skip
it only when a class explicitly sets ismultientitymanaged = 0.

Supersedes the stale #34667 (by @jyhere) and applies the condition
requested by @eldy in its review.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 20:31:00 +02:00
Olivier ANDRADE SANCHEZ - Gérant Aplose
2b2b163fc5
FIX wrong backtopage after editing agenda event on product messaging page (#39240)
* Solve pb to manage cash control

* Finish cash control feature of v23

* Fix reopen button

* Fix default sort

* Debug v23

* Debug v23

* Debug v23

* Fix sql

* css

* Trans

* Debug v23

* Debug v23

* Fix warning

* Fix warnings

* Fix warning

* fix phpstan for v23 (#36774)

* fix phpstan

* Update functions.lib.php

* Update admin.lang

* Update errors.lang

* Update fournisseur.commande.class.php

* Update fournisseur.commande.class.php

* Update blockedlog_archives.php

* Update blockedlog_archives.php

* Update blockedlog_archives.php

* Update blockedlog_archives.php

* Debug v23 and migration

* Fix : presend on reception resulted in fatal error (#36794)

* Fix : wrong html end of fiche section (#36793)

* Fix : wrong html end of fiche section

* Update card.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Debug v23

* Debug v23

* Fix warning

* Debug v23

* Debug v23

* Fix warnings

* Fix warning

* Fix warning

* Fix warnings

* Fix merge on wrong branch

* Fix warning

* Fix warning

* Fix missing line number when bom card in sub bom mode (#36805)

* FIX: reception reopening lacks of message when an error occurs (#36752)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix warnings

* FIX API content-type assignment (#36771)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* css

* Debug v23

* CSS

* Add printFieldListWhere / printFieldListTitle  missing hooks in invoice template list (#36778)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix CI

* Make CommonObject::cloneCategories() generic (#36758)

It was working only for products

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* ActionComm clone also categories when cloning object (#36761)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix fill news & product on email template (#36756)

* Fix fill news & product on email template

* fix CI

* Update mailtemplate.php

---------

Co-authored-by: Lucas Marcouiller <lmarcouiller@dolicloud.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Missing translation (#36806)

* Missing link to language file

* Missing link to language file

* css

* css

* Debug v23

* FIX #GHSA-w5j3-8fcr-h87w

* Fix with accent like é are allowed in path

* More phpuint tests

* Fix #GHSA-px39-mwcr-hvxp

* Trans

* Fix #36709

* Clean files

* Fix warning

* Clean code

* Debug v23

* FIX: getCombination response is way too big (even db object is serialized) (#36830)

* Ajout d'une div responsive autour du formulaire pour améliorer la mise en page (#36825)

Co-authored-by: Anthony Berton <anthony.berton@bb2a.fr>

* css

* css

* Trans

* Doc

* Trans

* Trans

* Debug v23

* Debug v23

* Debug v23

* css

* Debug v23

* Debug

* Debug v23

* Debug v23

* Debug v23

* Trans

* Debug v23

* Debug v23

* Trans

* Fix case

* Fix CI

* CLOSE issue 36744 fix user can delete some actioncomm on which he has not the right (#36747)

* CLOSE issue 36744 fix user can delete some actioncomm on which he has not the right

* Fix whitespace

* Refactor delete confirmation logic for user access

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* FIX icon of mastodon social network

* Backport some fixes of #36851

* css

* CSS

* Debug v23

* CSS v23

* Fix CI

* Doc

* Debug v23

* Debug v23

* Debug v23

* Prepare 23.0

* Prepare 23.0

* Debug v23

* Debug v23

* Debug v23

* CSS

* Fix css

* Fix warning

* CSS

* Fix missing state

* Fix add missing message once token has been saved

* Fix warning oauth

* Fix name of Oauth entry must not have special chars

* Doc

* Fix generic password type

* FIX css

* Fix warning

* FIX Debug v23 - Pb in export accountancy. Var not defined. Missing
conditions for dol_dir_list. Pb cache not used when not found. Header
set at end.

* Init var

* Fix export for quadratus

* Trans

* Clean sql

* Debug v23

* Demo template

* Fix demo file

* css

* Fix CI

* CSS

* css

* Fix trans

* Debug v23

* Fix agenda search for holiday or birthday (#36878)

Co-authored-by: Lucas Marcouiller <lmarcouiller@dolicloud.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Fix css regression

* Fix description

* Debug v23

* Debug v23

* Debug v23

* Debug v23 - migrate_reload_modules was broken

* Debug v23 - PDF generation error if additional PDF name not set

* Debug v23

* Add PGK currency

* Missing PGK currency

* Debug v23

* Debug v23

* Doc

* Sync transifex

* Fix trans

* Debug v23 - Fix label of dispute status

* Fix color of status

* Fix no translate

* Fix label in list

* Fix status of dispute

* Disable remote access in test

* Trans

* Trans

* FIX #36902

* Debug v23

* Fix warning

* Fix #36896

* Ignore phan false positive

* Fix civility_code vs civility_id

* Fix CI

* Try to run phan and phpstan on modified files only

* Fix CI

* Fix CI

* Fix CI

* Fix shellcheck

* Fix CI

* Fix CI

* Fix ci

* Ci

* ci

* cs

* ci

* ci

* Ci

* Fix ci

* Fix id ci

* Fix ci

* Fix ci

* CI

* Try to fix ci

* Fix CI

* Fix CI

* Fix CI

* Close #36889 manually, too many conflict due to non atomic PR.

* Merge manually #36851 emailcollector phpimap in reply to oauth v22.

* Try to force phan version

* Fix CI

* Fix PROPAL_ENABLE_NEGATIVE_QTY and ORDER_ENABLE_NEGATIVE_QTY

* FIX Accountancy - Chart of account - Some problem on backtopage (#36910)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Debug v23

* Fix link

* CSS

* Fix css

* Fix trans

* Fix css and responsive pb

* Debug v23

* Debug v23

* Debug v23

* Fix ci

* Fix email layout selector for product (#36948)

Co-authored-by: Lucas Marcouiller <lmarcouiller@dolicloud.com>

* Fix ci

* FIX missmatch of permission check of button and action of cancel delivery note (expedition) (#36943)

In expedition/card.php there is the action "confirm_cancel" which checks for the right supprimer of expedition. The corresponding UI Button checks for creer of expedition. This means some people can see the button, but nothing happens when clicking on it (also no error message).

* Debug v23

* Add log

* Log

* Fix log

* Fix round in stripe amount

* Fix label

* Need a label for autorecord stripe payouts

* Label

* Fix message on button tooltip

* Fix label

* Fix CI

* Trans

* Fix CSS

* Debug v23

* Fix email collector ticket fetch (#36968)

* Fix email collector ticket fetch

* fix CI

---------

Co-authored-by: Lucas Marcouiller <lmarcouiller@dolicloud.com>

* Fix bad trans for member subscription on import (#36969)

* Fix bad trans for member subscription on import

* fix CI

---------

Co-authored-by: Lucas Marcouiller <lmarcouiller@dolicloud.com>

* fix: exclude special lines from supplier order dispatch count (#36964)

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

* Change resource selection index from 1 to 2 (#36955)

fix warning causing by returning array (1 to 2) and suppress search button (0 to 2)

* Fix select resource

* Fix count into badge

* Debug v23

* Debug v23 - Stock management on parent kit does not work yet (for example when creating/closing shipment). Edit interface to be more clear with that.

* Clean code

* Fix ci

* Fix code action

* Fix ci

* Fix CSS (#36977)

* Fix CSS

* Hide on smartphone

* Same on journal view

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Debug v23

* Fix ci

* Debug v23 - navigation into fiscal years

* FIX substitution of vars in donation templates

* Fix SMTP OAuth refresh scopes (#36950)

Recreate the OAuth service with its configured scopes when refreshing an access token (required by some providers like Microsoft v2).

Also keep the previous refresh token when the refreshed token does not include one (e.g. Google returns it only once).

Co-authored-by: caminotravelcenter <caminotravelcenter@localhost>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Debug v23 - Fix trans

* Debug v23

* Trans

* FIX wrong backtopage after editing agenda event on product messaging page

The $param variable used to build edit links in the agenda timeline was
copied from thirdparty/messaging.php and used socid instead of product id.
After saving an event, the redirect pointed to product/messaging.php?&socid=0
instead of product/messaging.php?id=XXXX.

Signed-off-by: Olivier ANDRADE SANCHEZ <oandrade@aplose.fr>
Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Signed-off-by: Olivier ANDRADE SANCHEZ <oandrade@aplose.fr>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
Co-authored-by: Maxime Kohlhaas <maxime@atm-consulting.fr>
Co-authored-by: Francis Appels <francis.appels@yahoo.com>
Co-authored-by: Jyhere <jyhere@gmail.com>
Co-authored-by: ptibogxiv <support@ptibogxiv.net>
Co-authored-by: spsolauv <stephane.pellier@solauv.fr>
Co-authored-by: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com>
Co-authored-by: Lucas Marcouiller <lmarcouiller@dolicloud.com>
Co-authored-by: Alexandre SPANGARO <alexandre.spangaro@gmail.com>
Co-authored-by: Laurent Destailleur <eldy@users.sourceforge.net>
Co-authored-by: Anthony Berton <34568357+BB2A-Anthony@users.noreply.github.com>
Co-authored-by: Anthony Berton <anthony.berton@bb2a.fr>
Co-authored-by: splohmer <113967431+splohmer@users.noreply.github.com>
Co-authored-by: Zakaria Boushaba <48571684+Boushabazakaria@users.noreply.github.com>
Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
Co-authored-by: Charlène Benke <1179011+defrance@users.noreply.github.com>
Co-authored-by: Braito <braito4@hotmail.com>
Co-authored-by: caminotravelcenter <caminotravelcenter@localhost>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 17:20:49 +02:00
Jam Balaya
797312579b
FIX isInt() does not detect sized integer types (tinyint, bigint) (#39236)
CommonObject::isInt() decides whether a list-page column gets numeric
search mode and is also used when resolving $this->id. The regex
/(^int|int$)/ missed sized integer types such as tinyint(4) and
bigint(20): they neither start nor end with "int".

These types are not exotic: tinyint(4) is used in several core $fields
definitions (societe, contact, entrepot, companypaymentmode, ...) and
ModuleBuilder-generated tables use bigint(20) for rowid, so isInt()
should recognise them rather than requiring callers to change the
column type.

The new regex /^(?:tiny|small|medium|big)?int|int$/ also handles
smallint/mediumint with a size. Anchoring is preserved on purpose so
that strings which merely contain "int" (e.g. sellist:Table:...) are
still NOT matched, while the Dolibarr foreign-key syntax
"integer:Class:path" keeps being detected.

Signed-off-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
2026-07-20 15:30:28 +02:00
ThomasNgr-OpenDSI
7ec003387a
22 report sec (#39235)
* Sec: sql injection via api in POST of thirdparties/id/banckaccount - reported by MDnyn

* Sec: sql injection via api in POST of thirdparties/id/banckaccount -
reported by MDnyn

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-20 15:29:30 +02:00
Jam Balaya
a270e0852b
FIX #39190 wrong unit price when invoicing time spent with one line per declaration (#39215)
* FIX #39190 wrong unit price when invoicing time spent with one line per declaration

In projet/tasks/time.php, the 'onelineperperiod' mode (invoice generation option
"One line for each time spent declaration") computed the unit price as

    $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU');

but totalvaluetodivideby3600 is timespent_duration (seconds) * timespent_thm
(hourly rate), so dividing by 3600 yields "hours * hourly rate", which is the line
total and not a unit price. The quantity passed to addline() is the number of hours,
so the line was billed hours * (hours * rate) instead of hours * rate: the time is
over-billed by a factor equal to the number of hours.

The sibling modes are already correct: 'onelineperuser' and 'onelinepertask' divide
by the recorded number of seconds. Up to 16.0 'onelineperuser' had the same /3600
expression; it was fixed there and 'onelineperperiod' was left behind. Align it with
that reference implementation, including the same guard against a zero duration.

Also reset $pu_ht for each generated line. $pu_ht is initialized once before the loops
(with the price of the selected product/service, or 0) and this mode only had an
"if (empty($pu_ht))" test, so once a price was computed for the first line every
following line reused it, and lines of users with a different hourly rate got the rate
of the first line. The base price is saved before the loop and restored on each
iteration, so the product/service price path is preserved.

* Rename variable for clarity in time.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-20 02:53:33 +02:00
atm-corentin
cfa6ec40e6
FIX : preserve supplier price permissions on upgrade to 23.0 (#39066)
23.0 introduced dedicated advanced permissions to read/write supplier prices
(product: read_supplier_prices / write_supplier_prices ; service:
read_supplier_prices). In Advanced permissions mode (MAIN_USE_ADVANCED_PERMS),
supplier price access is now gated by these new rights instead of the general
product/service read and create rights, but nothing grants them, so every user
and group silently loses access to supplier prices when upgrading.

Grant the new permissions to the users and groups that already hold the matching
product/service rights, from a migrate_supplier_prices_permissions() function in
upgrade2.php run right after the module reload, so permission ids are resolved by
name from rights_def instead of being hardcoded. Idempotent.
2026-07-19 17:50:29 +02:00
w3houde
ad73f9d879
Fix #39020 avoid duplicate MO when BOM has a sub-BOM (#39163)
* Fix #39020 avoid duplicate MO when BOM has a sub-BOM

When generating child MOs from a BOM with a sub-BOM line, the lookup of
the parent MO consume line used a substring filter
(origin_id LIKE '%id%') that was not scoped to the parent MO. It could
match an unrelated mrp_production row or none at all. When it matched
none, the child MO was still created from the leftover parent POST data,
producing a second MO identical to the parent instead of a real child.

Scope the lookup to the parent MO with an exact match on origin_id and
origin_type via customsql, and skip the iteration when no matching
consume line is found so no duplicate parent MO can be created.

Signed-off-by: Dolicraft <contact@dolicraft.com>

* Fix #39020 use exact-match filter keys instead of customsql per review

Add exact-match handling for fk_mo, origin_id and origin_type in
MoLine::fetchAll and call it with those keys instead of a customsql
clause, so the lookup stays valid on 18.0/19.0 where customsql would be
the only alternative to the buggy LIKE. The universal-search filter form
is handled separately on 20.0 and later.

Signed-off-by: Dolicraft <contact@dolicraft.com>

---------

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-07-19 17:31:25 +02:00
tcesar
a354e1239f
Fix: API createfromorder could invoice draft, canceled or already-billed orders (#39194) 2026-07-19 16:19:59 +02:00
atm-jonathan
720f5eff3e
FIX: wrong VAT amount on situation invoice PDF after conversion to delta lines (#39195)
pdf_crabe and pdf_sponge recompute the per-VAT-rate total for situation
invoice lines using a ratio based on (situation_percent - prev_progress),
assuming facturedet.total_ht/total_tva/situation_percent are still stored
as cumulative values (INVOICE_USE_SITUATION=1, the legacy behavior).

Once an instance is converted to store situation invoice lines as delta
values (INVOICE_USE_SITUATION=2), this ratio is applied a second time on
top of an amount that is already a delta, producing a wrong (sometimes
negative) VAT total on the generated PDF while Total HT/TTC stay correct.

CommonObject::update_price() already guards its equivalent cumulative-to-
delta computation with `getDolGlobalInt('INVOICE_USE_SITUATION') != 2`;
this adds the same guard to both PDF models so they skip the ratio and
use the stored (already delta) total_tva directly once INVOICE_USE_SITUATION=2.
2026-07-19 16:14:11 +02:00
atm-jonathan
b7d60cdd06
FIX : broken jquery selector prevents default model auto-select (#39196)
The selector $("[name='type'") was missing its closing bracket, so
the change handler that auto-selects the PDF model per invoice type
(INVOICE_USE_DEFAULT_DOCUMENT) never bound to the type radios.
Also trigger change on #model after .val() so the select2 widget
refreshes its displayed label, not just the underlying select value.
2026-07-19 16:10:04 +02:00
Joachim Kueter
118ae2e655
FIX #39210 Contact extrafields filters missing on advanced emailing target selection (#39211)
Typo $elementype vs $elementtype: extrafields were fetched for socpeople
but read under the stale key societe, so the contact extrafields section
rendered empty.
2026-07-19 15:52:40 +02:00
Jam Balaya
e9e526c032
FIX #35658 leading-zero account numbers dropped from personalized group totals (#39208)
In compta/resultat/result.php and clientfourn.php the account number was cast to
(int) before being passed to AccountancyCategory::getSumDebitCredit(), which
compares it as a string (t.numero_compte = '...'). (int) '0510' -> 510 -> '510'
never matches the stored '0510' (numero_compte and account_number are varchar(32),
so leading zeros are significant). Accounts whose code starts with 0 were therefore
silently excluded from the current-year and per-month totals of a personalized
account group, while the previous-year column was already correct because it passes
a string array.

The (int) cast had no functional purpose: it was added to silence a phan notice in
"Qual: Fix phan notices" (#33484). Remove it and pass the raw string, and widen the
getSumDebitCredit() @param to string|int|array<?string> so the string argument is
accepted by static analysis and the cast is not reintroduced. Numeric codes are
unaffected (the callee already casts the scalar with (string)).
2026-07-19 15:45:45 +02:00
Laurent Destailleur
b2723688a9 Automated merge from 22.0 to 23.0 by tool pullmerge.sh 2026-07-19 15:41:05 +02:00
Laurent Destailleur
6251488091 Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-07-19 15:41:02 +02:00
TowyTowy
b305e6a0cc
FIX getFirstDayOfEachWeek()/getLastDayOfEachWeek() use the wrong year for weeks overlapping 2 years (#39198)
In a January that starts with week 52 or 53 of the previous year (for
example January 2022), getFirstDayOfEachWeek() wrongly shifted week 01
to the next year, and the $year++ inside the loop then also corrupted
all the following weeks of the month: every first day returned was the
one of the next year (02, 09, 16, 23, 30 instead of 03, 10, 17, 24, 31
for January 2022). getLastDayOfEachWeek() had no year handling at all,
so the trailing/leading weeks of the other year were resolved in the
wrong year too.

This made the per-month time spent view (projet/activity/permonth.php)
display wrong week date ranges, link to the wrong week and compute the
weekly holiday overlap on wrong date ranges for such months.

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-18 19:40:57 +02:00
atm-jonathan
aea6a5fe99
FIX : situation invoice credit note wrong amount in progressive mode (#39197)
When creating a credit note "with same lines" from a situation invoice,
the code always subtracts the previous situation invoice's line values
before inverting the sign, assuming lines are stored cumulative
(INVOICE_USE_SITUATION = 1, legacy mode).

In progressive mode (INVOICE_USE_SITUATION = 2), each situation invoice
line already stores its own delta amount and percent, so this extra
subtraction credits the wrong amount and percent (e.g. 60% / 1272
instead of the correct 20% / 424 on a real cycle).

Skip the subtraction in progressive mode so the credit note reuses the
source line's own delta values, as expected.
2026-07-18 19:27:39 +02:00
Laurent Destailleur
b4e5998f2c Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 2026-07-18 02:49:17 +02:00
Laurent Destailleur
1057ad6c7e Sec: sql injection via api in POST of thirdparties/id/banckaccount -
reported by MDnyn
2026-07-18 02:49:05 +02:00
Laurent Destailleur
19991c8ffa Sec: sql injection via api in POST of thirdparties/id/banckaccount - reported by MDnyn 2026-07-18 02:48:07 +02:00
Régis Houssin
0194d44266
FIX BLOCKEDLOG_HMAC_KEY can not be the same by entity (#39067)
* FIX BLOCKEDLOG_HMAC_KEY can not be the same by entity

* FIX migrate for all entities
2026-07-16 14:06:54 +02:00
Laurent Destailleur
a727b8ecbb Automated merge from 22.0 to 23.0 by tool pullmerge.sh 2026-07-16 13:55:30 +02:00
Laurent Destailleur
647c404c53 Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-07-16 13:15:59 +02:00
Laurent Destailleur
f056d4fd1e Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-07-16 13:15:15 +02:00
Grégory Aliot
5f75ee865a
FIX #37540 DST distorts working day count in num_public_holiday (#39158)
The day loop of num_public_holiday() advanced with
dol_time_plus_duree($timestampStart, 1, 'd'). On 21.0 and 22.0 that
function only forces UTC when MAIN_DATE_IN_MEMORY_ARE_GMT is set, so by
default it adds a wall-clock day in the server timezone. When the range
crosses a DST boundary (last Sunday of March in Europe), the GMT
timestamp advances by only 23 hours, the same GMT day is evaluated
twice, one day is counted as holiday twice and the working day after
the boundary is never examined.

For a leave request from Sat 28/03/2026 to Mon 30/03/2026 with a server
in Europe/Paris: 3 days between, 3 holidays counted (Sunday twice),
0 working days instead of 1.

Advance by exactly 86400 seconds instead. Inputs of this function are
GMT dates (enforced by the modulo check at the top of the function), so
a GMT day is always exactly 86400 seconds, in every timezone and conf.
This matches the behaviour that 23.0 and develop get by default since
dol_time_plus_duree() switched to UTC by default there.

Signed-off-by: Gregory Aliot <greg.aliot@gmail.com>
Co-authored-by: Gregory Aliot <greg.aliot@gmail.com>
2026-07-16 13:14:59 +02:00
Laurent Destailleur
f70ccfa842 Add a TODO 2026-07-16 13:10:41 +02:00
Laurent Destailleur
0c2306c41f Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2026-07-16 13:06:22 +02:00
John BOTELLA
bd419519ff
Fix extrafield hidden field not ecaped value (#39148)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 13:06:00 +02:00
Laurent Destailleur
4c959a5ff6 Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-07-16 12:57:46 +02:00
HENRY Florian
9cc9367fc0
fix: if user cannot create suppluer invoice it cannot create payment (#39183)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 12:51:02 +02:00
MDW
8b7dab1c2d
Qual: Fix PHPStan for 23.0 + pre-commit backports (#39192) 2026-07-16 11:29:42 +02:00
nikube
3dd16ec3c2
FIX Mass action "Reverse movement" bypasses the MAIN_LIMIT_FOR_MASS_ACTIONS limit (#39091)
* FIX Mass reverse of stock movements bypasses the MAIN_LIMIT_FOR_MASS_ACTIONS limit

The confirm_reverse handler did not check the error raised by the
generic mass action limit control (TooManyRecordForMassAction), so
selecting more records than the limit still executed the reverse
after the error message was displayed. The reverse was also triggered
when relaunching a search while the confirmation form was open,
because the protection only reset $massaction, not $action.

* FIX phan: initialize $error at the start of the confirm_reverse handler

The new !$error guard lets phan narrow $error to falsy types inside
the block, so the $error++ in the query-error branch was reported as
PhanTypeInvalidUnaryOperandIncOrDec. Initialize $error to 0 at the
start of the handler (and drop the redundant init inside the loop
setup where present).

* FIX coding rule: comment on the $action test that only cancels the pending action

CodingPhpTest requires a permission check or an explicit comment on
every test of $action in the Actions section.

---------

Co-authored-by: Nicolas Zaou <nz@anatoleconseil.com>
2026-07-16 04:18:11 +02:00
HENRY Florian
34c78e21b6
fix: avoid Access refused to xxx.xxx.xxx.xxx by SQL or Script injection protection in main.inc.php:analyseVarsForSqlAndScriptsInjection type=1 (#39188)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 01:29:56 +02:00
Laurent Destailleur
e782608442 Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 2026-07-16 01:18:38 +02:00
John BOTELLA
063d0242b3
Fix extrafield hidden field not ecaped value (#39149)
* Fix extrafield hidden field not ecaped value

* Update commonobject.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 01:04:47 +02:00
ATM-NicolasV
da6ef26c8e
Fix empty SET clause in insertExtraFields UPDATE when no target column matches (#39184)
When an object is created from another element whose extrafields do not exist on
the target element (e.g. an invoice created from a shipment: the source line
extrafields are copied into array_options but none match facturedet), the
top-level empty($this->array_options) guard passes but the filtered column set is
empty. When an extrafields row already exists for the object, the UPDATE branch
then built "UPDATE llx_..._extrafields SET  WHERE fk_object = X" with an empty SET
clause, producing a MariaDB syntax error ("near 'WHERE fk_object = ...'") and
aborting the creation of the invoice.

Guard the UPDATE branch: when there is no column of the target element to update,
commit and return without running the query (the existing row is already
correct). This keeps the multicompany data-loss fix (UPDATE instead of
DELETE+INSERT, #34022) untouched.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 01:03:35 +02:00