Commit graph

155399 commits

Author SHA1 Message Date
MDW
1dcd497c69
Qual: Fix 'SqlInjection' notices (#39219)
# Qual: Fix 'SqlInjection' notices

Batch of 25 files with changes to fix 'SqlInjection' Notices
2026-07-20 02:50:44 +02:00
Ushindi Gedeon
2fb564d438
FIX accounting export: enhance file metadata return and secure access checks (#39218)
Co-authored-by: gedeonts <gedeontshobowa1@gmail.com>
2026-07-20 02:50:31 +02:00
Camile
fa5fe7ebf8
FIX|Fix #34947 PDF top margin breaks layout in multiple templates (#35919)
* Fix pdf top margin break layout

* Fix others pdf theme's top margin
2026-07-20 00:09:32 +02:00
マルコメ
db8babd39c
FIX #35786 Allow situation credit notes regardless of payment (#39207)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-19 17:36:10 +02:00
MDW
679c6eaf29
Qual: Fix SqlInjection notices in scripts (#39214) 2026-07-19 17:32:57 +02:00
MDW
5db08a3151
Qual: Fix 'SqlInjection' notices (#39213)
# Qual: Fix 'SqlInjection' notices

Batch of 25 files with changes to fix 'SqlInjection' Notices
2026-07-19 17:32:14 +02:00
w3houde
cbe0335455
Fix #39143 store computed extrafields with object context (#39172)
When MAIN_STORE_COMPUTED_EXTRAFIELDS is enabled, insertExtraFields() and
updateExtraField() evaluated the computed formula without setting the global
$objectoffield to the current object, so formulas relying on
$objectoffield->array_options returned a wrong value (often 0) when stored,
unlike fetch_optionals() which already sets it.

The list template also always recomputed computed extrafields, but the raw
row available in a list has no object context, giving wrong display and wrong
totals. When MAIN_STORE_COMPUTED_EXTRAFIELDS is enabled the value stored in
database is now used instead.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-07-19 16:22:57 +02:00
github-actions[bot]
f495b92d1f
PHPStan > Update baseline (#39193)
Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>
2026-07-19 16:17:31 +02:00
bomuux
4c903ef62a
FIX #37381 Cancelling shipping shouldn't remove its linked objects association (#39212)
* FIX #37381

* Fix #37381

Cancelling shipping shouldn't remove its linked objects association #37381
2026-07-19 15:58:14 +02:00
MDW
6dac0c7263
Qual: Fix 'SqlInjection' notices (#39203)
# Qual: Fix 'SqlInjection' notices

Batch of 25 files with changes to fix 'SqlInjection' Notices
2026-07-19 15:53:14 +02:00
Pichinov-Jose
159802c08f
FIX Stripe payout: store payout reference (po_) in bank transfer (#39204)
The payout.paid IPN handler recorded the bank transfer line with an empty
num_chq (a "// TODO Store the po ref from $event->data" placeholder). The
Stripe payout id is available as $event->data->object->id, so store it as
the transfer reference. This makes auto-recorded payouts traceable and
reconcilable against Stripe.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 15:52:16 +02:00
Laurent Destailleur
281cbabf6c Automated merge from 23.0 to develop 2026-07-19 15:44: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
Laurent Destailleur
2693fd8c92 css 2026-07-19 15:26:01 +02:00
Laurent Destailleur
37017da5f5 css 2026-07-19 15:22:56 +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
f02aba5488 Clean code 2026-07-18 18:31:45 +02:00
Laurent Destailleur
e4c593e0f9 Fix use of & char inside of mysql backup 2026-07-18 18:31:26 +02:00
Laurent Destailleur
61916b9039 Sec: Fix wrong test on salary id - reported by Arpit Jain 2026-07-18 18:12:35 +02:00
Laurent Destailleur
0d414fcb51 Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-18 16:17:03 +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
Laurent Destailleur
2e65e0ea23 Clean code 2026-07-18 01:21:54 +02:00
Laurent Destailleur
07db77f071 Debug v24 2026-07-17 12:52:13 +02:00
Laurent Destailleur
1d5373325f Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-17 11:31:57 +02:00
Laurent Destailleur
fb4d379786 Debug 2026-07-17 11:28:00 +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
Jam Balaya
b2eae1b7d7
FIX #37826 country_code must be an ISO code, not a label (#39191)
* FIX #37826 country_code must be an ISO code, not a label

On a proposal/order, the 2nd+ line got VAT 0% with the error "no vat rates
defined for country 'France'/'Suisse'". Root cause: the seller country_code
held a translated country label instead of the ISO code, so the
"c.code IN (...)" lookup in Form::load_cache_vatrates() matched nothing.

- Societe::setMysoc(): the canonical MAIN_INFO_SOCIETE_COUNTRY is
  "id:code:label"; a legacy "id:label" value put the label into
  country_code. Only treat the full 3-token form as "id:code:label" and
  otherwise rebuild code/label from the authoritative country id.
- Form::load_tva(): defensively recover the seller ISO code from its
  country id when country_code is not a known c_country code, so a bad
  value can never silently force the VAT rate to 0%.

Signed-off-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>

* FIX #37826 avoid useless SQL per page: recover country ISO code from id only when code is not a 2-char ISO code

---------

Signed-off-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
2026-07-16 13:56:33 +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
Zakaria Boushaba
6d828c29fc
FIX accounting export: reexport date not updated and fiscal year filter incorrectly applied on reexport (#39186)
* fix: accounting export reexport date not updated and fiscal year filter incorrectly applied on reexport

* Update date_export only if it is empty or ACCOUNTING_REEXPORT is active

---------

Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 11:35:37 +02:00
MDW
8b7dab1c2d
Qual: Fix PHPStan for 23.0 + pre-commit backports (#39192) 2026-07-16 11:29:42 +02:00
Zakaria Boushaba
8a246db393
FIX Wrong margin calculation on situation invoices due to cumulative situation_percent (#39090)
* FIX: Margin calculation on situation invoices uses cumulative percent instead of delta, causing inflated amounts across all margin views

* Fix

* use the 'as' between table name and alias name

---------

Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 11:27:35 +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
Laurent Destailleur
989182d31b Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2026-07-16 04:11:16 +02:00
Laurent Destailleur
5e15653707 Fix default value system for checkbox "Show variant" on product list. 2026-07-16 04:11:02 +02:00
Jam Balaya
27d13fc880
FIX: supplier payment document.php runs restrictedArea() on unloaded object (#39117)
htdocs/fourn/paiement/document.php called
  restrictedArea($user, $object->element, $object->id, 'paiementfourn', '')
before $object was instantiated (the 'Load object' block sat after the
security check), so the permission check ran on an undefined $object (null
element / null id) and PHPStan level 10 flagged 'Variable $object might not
be defined'.

The sibling pages fourn/paiement/card.php and info.php instantiate the
PaiementFourn object before the same restrictedArea() call. Move the object
load ahead of the security check so the check runs against the real object.
2026-07-16 03:46:25 +02:00
Jam Balaya
591974e5d1
FIX: agenda day view passes usergroup filter as string instead of id array (#39157)
In htdocs/comm/action/index.php the month and week views call
print_actions_filter(..., $actioncode, $usergroupids, ...) with
$usergroupids (array<int>, built at the top from the comma-separated
$usergroup), but the day view passed the raw $usergroup string instead.
print_actions_filter() forwards this to select_dolgroups() which expects an
array, so a multi-group filter (e.g. '3,5') is not preselected in the day view.
Pass $usergroupids to match the two sibling calls.

PHPStan level 10 flagged: Parameter #16 $usergroupid of function
print_actions_filter expects array<int>, string given.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 03:08:11 +02:00
Jam Balaya
3058208201
FIX: PayPal API calls set CURLOPT_SSL_VERIFYHOST to a bool instead of 2 (#39155)
htdocs/paypal/lib/paypal.lib.php passed a boolean to CURLOPT_SSL_VERIFYHOST:
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($ssl_verifypeer ? true : false));
CURLOPT_SSL_VERIFYHOST expects 0, 1 or 2 (not a bool). 'true' is cast to int 1,
which only checks that a Common Name is present, not that it matches the host
(value 1 is also deprecated / a no-op on some libcurl builds) - weakening TLS
host verification on PayPal API calls. Use 2 (full host check) / 0.

PHPStan level 10 flagged: Parameter #3 $value of function curl_setopt expects
0|2, bool given.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 02:23:26 +02:00
Jam Balaya
4be9257efa
FIX: OpenID server discovery passes the whole HTTP response array as HTML (#39156)
htdocs/core/class/openid.class.php OpenId::GetOpenIDServer() calls:
	$response = getURLContent(...);            // array{http_code,content,...}
	list($servers, $delegates) = $this->HTML2OpenIDServer($response);
but HTML2OpenIDServer($content) runs preg_match_all(..., $content), i.e. it
expects the HTML string, not the whole getURLContent() array. On PHP 8 this
throws a TypeError (preg_match_all subject must be string), breaking OpenID
server discovery; on PHP 7 it silently matches nothing. Pass $response['content'].

PHPStan level 10 flagged: Parameter #1 $content of method
SimpleOpenID::HTML2OpenIDServer() expects string, array given.

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-16 02:07:23 +02:00