Commit graph

143306 commits

Author SHA1 Message Date
Laurent Destailleur
5bb3714ef7 Fix: use the same condition everywhere 2026-07-02 12:39:23 +02:00
reachsanjivbhagat-gif
dc2a01ff28
FIX #32909 Restrict salary/HR field edit to authorized users (#39033)
* FIX #32909 Restrict salary/HR field edit to authorized users

On the user card, a user with only "modify own info" (user->self->write)
could edit thm, tjm, salary, salaryextra and weeklyhours, even though the
display of these fields is gated on salaries->readall / hrm->employee->read.
Guard the write of these fields with the same permission used for display,
so self-service users can no longer change compensation data they are not
allowed to see.

Signed-off-by: Sanjiv Kumar Bhagat <reach.sanjiv.bhagat@gmail.com>

* Update card.php

* Update salary edit permissions logic

---------

Signed-off-by: Sanjiv Kumar Bhagat <reach.sanjiv.bhagat@gmail.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-02 12:25:04 +02:00
Laurent Destailleur
6e101143e0 Fix showunused option in sanity_check_trans_missing_unused.sh 2026-06-27 16:53:08 +02:00
Eric - CAP-REL
95a5391732
fix adherent table name (#38873)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-22 13:39:55 +02:00
Laurent Destailleur
47d72ce724 Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-06-22 13:22:24 +02:00
Laurent Destailleur
998967c93a Automated merge from 19.0 to 20.0 by tool pullmerge.sh 2026-06-22 13:22:21 +02:00
Laurent Destailleur
50151e3ad3 Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 19.0 2026-06-22 13:04:36 +02:00
Laurent Destailleur
d713e62c26 Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0 2026-06-22 13:04:11 +02:00
Laurent Destailleur
9f6306bfeb Fix whitespace 2026-06-22 12:18:56 +02:00
atm-jonathan
058c2341ce
FIX : fix duplicate contact names in messaging timeline (#38855)
Cache key was using legacy fk_contact field instead of the current
contact id ($cid), causing all contacts after the first to resolve
to the same cached entry in show_actions_messaging().
2026-06-22 03:46:41 +02:00
MDW
957f117d09
SEC: Fix SQL injection vulnerability in contract list (#38941)
# SEC: Fix SQL injection vulnerability in contract list

- Update the SQL query to properly escape the search_signed_status parameter
2026-06-21 19:18:18 +02:00
MDW
edcde65dfc
SEC: Correct SQL escaping for signed_status (#38943)
* SEC: Correct SQL escaping for signed_status

# SEC: Correct SQL escaping for signed_status

Escape signed_status using $db->escape instead of urlencode.

* Update list.php

* Update list.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-21 16:52:51 +02:00
MDW
b5a8a01eae
SEC: Sanitize SQL query parameters (#38942)
# SEC: Sanitize SQL query parameters

Sanitize SQL query parameters.
Replace urlencode with explicit type casting to int for fk_statut and signed_status parameters.
2026-06-21 15:27:28 +02:00
Laurent Destailleur
e42d6883e5 ci 2026-06-21 15:26:05 +02:00
Laurent Destailleur
46f8d4434d Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-06-19 04:01:49 +02:00
Eric - CAP-REL
d500b8ca62
fix adherent table name (#38872)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-19 04:00:36 +02:00
Laurent Destailleur
d0091363b8 Fix regression. It was not possible to create an intervention on a
partner not customer.
2026-06-19 03:40:50 +02:00
Laurent Destailleur
f553ff53af Automated merge from 19.0 to 20.0 by tool pullmerge.sh 2026-06-19 03:34:30 +02:00
Laurent Destailleur
d7e92bcd50 Automated merge from 18.0 to 19.0 by tool pullmerge.sh 2026-06-19 03:34:19 +02:00
Laurent Destailleur
594129161d Automated merge from 17.0 to 18.0 by tool pullmerge.sh 2026-06-19 03:34:05 +02:00
Laurent Destailleur
50ceefb2a4 Automated merge from 16.0 to 17.0 by tool pullmerge.sh 2026-06-19 03:28:40 +02:00
Laurent Destailleur
6993c665bf Automated merge from 15.0 to 16.0 by tool pullmerge.sh 2026-06-19 03:28:31 +02:00
Laurent Destailleur
4b22126e44 Automated merge from 14.0 to 15.0 by tool pullmerge.sh 2026-06-19 03:28:24 +02:00
Laurent Destailleur
c72af785c9 Fix ci 2026-06-19 03:22:18 +02:00
Eric - CAP-REL
1b4ece48e2
fix adherent table name (#38871) 2026-06-19 03:19:40 +02:00
Pichinov-Jose
2653b1707a
FIX Multicurrency amount columns were hidden on discount screens (wrong module test) (#38825)
On the third party discount tabs (htdocs/comm/remx.php), the multicurrency amount columns
(MulticurrencyAmountHT / MulticurrencyAmountTTC) and their colspan adjustments were guarded by
isModEnabled('multicompany') instead of isModEnabled('multicurrency'). As a result the foreign
currency amounts of available and consumed discounts/down payments were never shown when the
Multicurrency module is enabled (and the Multi-company module disabled).

The wrong test was introduced in commit 3bb1a2387b (2022, 'FIX php8 compatibility') which converted
!empty($conf->multicurrency->enabled) into isModEnabled('multicompany'). Restore the correct module
test. Present from v17 to develop; fixed here on the oldest maintained LTS branch (18.0).
2026-06-18 09:55:17 +02:00
lvessiller-opendsi
89d1696d61
Merge pull request #38830 from rycks/18.0_fix_adherent_migration
FIX: very old llx_adherent migration bug from 3.6-3.7
2026-06-18 09:45:23 +02:00
lvessiller-opendsi
50d61ed31c
Merge pull request #38833 from rycks/18.0_fix_stock_entrepot_table_name
name llx_product_stock_entrepot is now llx_product_warehouse_properties
2026-06-18 09:42:50 +02:00
Eric Seigne
1145c38080 fix table name thanks to lionel review 2026-06-18 09:29:12 +02:00
Eric Seigne
7338f2916b missing llx prefix 2026-06-18 09:22:21 +02:00
ThomasNgr-OpenDSI
4978cccc3b
Fix #38781 allow editing dictionary entries with rowid = 0 (ST_NEVER) (#38841) 2026-06-18 09:19:59 +02:00
Laurent Destailleur
77f9561b07 Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2026-06-16 04:12:47 +02:00
Laurent Destailleur
5901402ac1 CI 2026-06-16 04:12:10 +02:00
ThomasNgr-OpenDSI
5556626a92
Fix #38781 allow editing dictionary entries with rowid = 0 (ST_NEVER) (#38842) 2026-06-16 02:08:22 +02:00
Eric Seigne
a2623d8fc5 name llx_product_stock_entrepot is now llx_product_warehouse_properties 2026-06-15 11:38:22 +02:00
Eric Seigne
b302dfea2e fix very old llx_adherent migration bug from 3.6-3.7 2026-06-15 11:25:24 +02:00
Eric - CAP-REL
db6314ce9b
remove suppliers from list as fichinter is displayed only on customer… (#38657)
* remove suppliers from list as fichinter is displayed only on customer/prospect card

* add client = 2 as accepted values

* QUAL: switch to constants
2026-06-12 23:57:34 +02:00
lvessiller-opendsi
c278f65591
FIX set SOCIETE_FISCAL_MONTH_START default to 1 (#37662) (#38162) 2026-06-12 23:48:03 +02:00
Laurent Destailleur
2b3909aa85 Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-06-10 19:08:51 +02:00
w3houde
782d521978
Fix #36079 keep online signature URL from ending with a bcrypt trailing dot (#38526)
`getOnlineSignatureUrl()` ends each public signature URL with
`&securekey=` followed by the output of `dol_hash(..., '0')`. With the
default `MAIN_SECURITY_HASH_ALGO = password_hash`, that output is a
bcrypt string whose alphabet is `[./A-Za-z0-9]`, so a non-trivial share
of generated URLs legitimately end with `.` or `/`.

Gmail and several mobile mail clients autolink plain-text URLs but
drop trailing punctuation, so the recipient clicks on a URL with the
last character missing and gets a securekey mismatch error
(`Bad value for securitykey`). The user-facing symptom is exactly the
one in #31464.

When multicompany is enabled, the URL already ends with `&entity=N`,
which sidesteps the issue. For installations without multicompany,
append a stable trailing `&_=1` so the URL never ends with the hash.
The receiver in `public/onlinesign/newonlinesign.php` does not read
`_`, only `source`, `ref`, `securekey` and (when multicompany) `entity`,
so adding the parameter has no behavior impact and existing links keep
verifying as before. Only the real URL (mode 0) is affected, not the
mode 1 preview shown in the admin setup.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-10 19:08:26 +02:00
w3houde
21cea7627a
Fix #33042 divide by multicurrency_tx when checking minimum price (#38542)
The minimum-price guard on the customer invoice, customer order and
customer proposal forms compares the entered unit price to the
product's price_min. When the document is in a foreign currency the
unit price is provided in the foreign currency ($pu_ht_devise), so
it must first be converted back to the base (company) currency before
the comparison.

card.php was multiplying by $currency_tx:

    $pu_equivalent = (float) $pu_ht_devise * $currency_tx;

but multicurrency_tx is defined as 'units of foreign currency per
1 unit of base', exactly as price.lib.php uses it
(calcul_price_total at line 181):

    $pu = $pu_devise / $multicurrency_tx;

With the reporter's example (1 MXN = 0.055 USD, so tx = 0.055,
product min price = 1000 MXN, entered 55 USD), the wrong direction
gives 55 * 0.055 = 3.025 MXN < 1000 MXN and the form errors out with
'CantBeLessThanMinPrice', even though 55 USD is exactly 1000 MXN.
Dividing yields 55 / 0.055 = 1000 MXN and the check passes.

Mirror calcul_price_total's direction at all four invoice sites
(htdocs/compta/facture/card.php lines 2503/2506 and 2684/2687) plus
the corresponding sites in htdocs/commande/card.php and
htdocs/comm/propal/card.php. Documents in the base currency
($pu_ht_devise empty) are not affected because the conversion
branch is gated on $pu_ht_devise being non-empty.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-10 16:16:35 +02:00
Laurent Destailleur
836119732d Fix bug of sort -u on ubuntu 26.04. Use uniq instead. 2026-06-10 12:42:04 +02:00
Laurent Destailleur
c556d77185 Automated merge from 20.0 to 21.0 by tool pullmerge.sh 2026-06-10 12:13:33 +02:00
Laurent Destailleur
cd2b52b982 Automated merge from 19.0 to 20.0 by tool pullmerge.sh 2026-06-10 12:13:30 +02:00
Laurent Destailleur
6515c4feb1 Automated merge from 18.0 to 19.0 by tool pullmerge.sh 2026-06-10 12:13:28 +02:00
Laurent Destailleur
874422802e Automated merge from 17.0 to 18.0 by tool pullmerge.sh 2026-06-10 12:13:24 +02:00
w3houde
4cf54760b2
Fix #25107 honour FOR_ALL_STATUS in mass send action (#38532)
The per-card Send by email button on Propal, Commande and Facture
already honours the hidden constants
`PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS`,
`COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS` and
`FACTURE_SENDBYEMAIL_FOR_ALL_STATUS` to allow sending drafts. The
mass Send by email action in the corresponding lists silently dropped
draft objects regardless of those constants, so an administrator who
intentionally enabled the override saw inconsistent behaviour between
the card and the list.

Apply the same constant check on the three draft-skip guards in
`htdocs/core/actions_massactions.inc.php` so the mass action behaves
the same way as the single-object button. Default behaviour is
unchanged: with none of the constants set, drafts are still skipped
with the existing 'OnlyXxxNotDraftCanBeSentInMassAction' error
message.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-09 19:51:36 +02:00
w3houde
505c483484
Fix #38491 Name the field in the ticket too-long error message (#38507)
* Fix #38491 Name the field in the ticket too-long error message

When a ticket message exceeds 65000 characters, Ticket::verify() and
Ticket::update() appended the bare string "ErrorFieldTooLong" to
$this->errors. setEventMessages forwards that string and
dol_htmloutput_mesg applies $langs->trans() to it, which yields the
raw template "Field %s is too long." with the %s placeholder still
visible because no argument was passed.

Replace the bare key with a pre-translated message that names the
field ("Initial message"), the same pattern already used in
htdocs/barcode/printsheet.php for the same lang key. Two identical
sites in the file are updated (one in verify, called by create, and
one in update). The "errors" and "ticket" lang files are loaded
defensively before translation because both methods can run before
the page-level loadLangs.

Reported by @ocemag, expected field name confirmed by @aspangaro.

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

* Fix phan: declare $langs as global in ticket too-long branches

phan level 10 raised PhanUndeclaredVariable and PhanNonClassMethodCall
on the two branches that translate the new error message. The enclosing
Ticket::verify() and Ticket::update() do not declare global $langs;
add it where needed instead of opening the method scope further.

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

---------

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Alexandre SPANGARO <alexandre.spangaro@gmail.com>
2026-06-09 19:09:12 +02:00
w3houde
8d8debd441
Fix #38171 Allow underscore in extrafields old-syntax filter regex (#38506)
ExtraFields::showInputField normalises the legacy "(field=123)"
filter syntax of "List from a table" extrafields into the modern
USF "(field:=:123)" form. The compatibility regex
"/^\(?([a-z0-9]+)([=<>]+)(\d+)\)?$/i" only accepts alphanumeric
field names, so a filter like "fk_typent=2" does not match, the
filter is left as is, and forgeSQLFromUniversalSearchCriteria later
fails with "Filter error" because the raw expression is not valid
universal search syntax.

Accept the underscore character in the field name class, the rest
of the predicate is untouched. The two identical occurrences in
the file (one per branch of the dispatch) are updated.

Reported and root cause pinpointed by @stephanebourdon-cmyk.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-09 19:07:07 +02:00
w3houde
d17ae69331
Fix #38182 Backport oldcopy empty check to 21.0 (#38505)
Updating a product selling price via /product/price.php triggered a
fatal "Call to undefined method stdClass::isEmpty()" at
Product::update line 1457 of 21.0. In the update_price flow,
$this->oldcopy is a stdClass (not a Product instance), so isEmpty()
does not exist on it. The page returned HTTP 500 and the open
transaction was forcibly closed by DoliDBMysqli::close.

Replace the isEmpty() call with empty($this->oldcopy->id), which is
the form already shipped in 22.0, 23.0 and develop after upstream
commit ef94452f77. The accompanying comment from that commit is
also brought in.

Same root cause as issue 37792 (closed, fixed in 23.0.3 and
forward); the fix was never backported to 21.0 even though the bug
is still triggered on that branch.

Reported by @YOYOKMC.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-09 19:06:04 +02:00